Skip to content
ttrainor edited this page Jan 8, 2012 · 2 revisions

Important modules

  • modules/ana

    This package contains modules used for
    processing/analyzing x-ray data. More specifically
    the modules are geared towards processing surface
    diffraction, reflectivity and reflection
    standing wave (and other related) data.
    
  • modules/specfile

    This module is an interface to reading various types
    of x-ray scan data collected with spec
    

Examples

  • Read a spec file and the first scan, display it and plot some data

  • In the below example 'r' is a specfile.reader.Reader instance, and holds information about files and parameters

  • Note that the object returned from the r is a ScanData object.

    >>import specfile
    >>r = specfile.reader.Reader(spec='spec_file.spc')
    >>s1 = r.spec_scan(1)
    >>plot(s1['theta'],s1['I1'])
    

  • Read a spec file and list all the scans

  • Then read first scan including images

    >>import specfile
    >>r = specfile.reader.Reader(spec='caco3_feb09j.spc')
    >>r.list_spec()
    >>s = r.spec_scan(1,image=True)
    

  • Read a file on the defined path

  • Then get scan 42 (with images)

    >>spec_path='spec/'
    >>reader = specfile.reader.Reader(spec_path=spec_path)
    >>reader.read_spec('gt_6_apr07_c.spc')
    >>d = reader.spec_scan(42,image=True)
    

  • Read the file given the specific path.

  • Set the image parameters so the images are cached in a hdf file on the given path.

  • Then the first scan and images (they will be cached and not stored in memory)

    >>r = specfile.reader.Reader(spec = 'caco3_feb09j.spc',spec_path='spec/')
    >>r.image_params['archive'] = {'path':'d:\\tmp'}
    >>s = r.spec_scan(1, image = True)
    

  • Read spec scan with spectra. Note tau value corresponds to the deadtime value

  • This is a single element detector since there is a single tau value.

    >>reader = specfile.reader.Reader(spec='spec/bb405_0405.spc')
    >>reader.spectra_params['tau'] = 1.0e-8
    >>reader.spectra_params['lines'] = ['Ca ka','Ca kb','Ti ka','Ti kb','Mn ka','Mn kb', 'Fe ka', 'Fe kb']
    >>s6 = reader.spec_scan(6,med=True,xrf=True)
    

Clone this wiki locally