Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Common

The additional analysis function are passed to the cube workflow by adding a det_proc keys to the detector definition dictionary. The content of this key must be another dictionary with the following sctructureConfig file example for MFX with azimuthal integration of the Rayonix:

Code Block
languagepy
themeRDark
{
	name: '<function_name>' # must be the exact DetObjectFunc name,
	'func_kwargs1': <...>,
 	'func_kwargs2': <...>,
	...
}

The function <function_name> will then be applied to the summed binned detector data and its output will be saved under <detector name>_variable in the binned hdf5 file, in addition to the full detector data.

Azimuthal integration

pyFAI

Detector definition section with azimuthal integration of the Rayonix:

Code Block
languagepy
themeRDark
# import numpy as np

# Custom bins
def binBoundaries(run):
    if isinstance(run,str):
        run=int(run)
    if run>0:
        # return np.arange(-5.,50.,0.2)
        return np.arange(-5.,10.,1)
    return None


# ##### FILTERS ##########################################################################
# filters to apply to the data
# format: list of [det (field), low, high, name]
# 'filter1' is the standard name and will not be added to the h5 file name.
filters = [
    ['lightStatus/xray',0.5,1.5,'filter1'],
    ['ipm_dg1/sum',1e3,4.5e4,'filter1'],
    # ['ipm3/sum',200,3e3,'filter1'],
    # ['tt/FLTPOSFWHM',60,230,'filter1'],
    # ['tt/AMPL',0.005,0.19,'filter1']
    # ['evr/code_41',0.5,1.5,'custom']
]

# Laser on/off
laser = False

# ##### DETECTORS ########################################################################
# List detectors to be cubed. Area detector have additional options such as threshold
# Full images will always be saved. 
# More area detector can be defined following the same syntax, and adding them to varList
detDict = {'source':'Rayonix', 
           'full':1, 
           'image':1, 
           'thresADU':-1e5, 
           'common_mode':0}

pix_size = 176e-6
func_kwargs = {
    'name': 'azav_pyfai', # must be the name of the smalldata_tools ana_funcDetObjectFunc
    'ai_kwargs': {'dist':1, 'poni1':960*pix_size, 'poni2':960*pix_size},
    'npts': 512,
    'int_units' : '2th_deg',
    'return2d' : False
}
det_proc = [func_kwargs]
detDict['det_proc'] = det_proc

# make list of all variables to be added to the cube
varList = ['ipm_dg1/sum','ipm_dg2/sum', detDict]

The h5 resulting from this detector definition then contains:

  • Rayonix_azav (Array)
  • Rayonix_data (Array)
  • Rayonix_nEntries (Array)
  • Rayonix_q (Array)

The available keyword arguments to pass to the azav_pyfai function are

Code Block
languagepy
themeRDark
titleazav_pyfai documentation
	"""
    Parameters
    ----------
    name: str
        Function name

# ##### LOGBOOK SUMMARIES #################################################################
# histogram configuration. Usually does not need to be changed
# field: destination in smd, list: [low,high,n] or None (then default to some percentile)
hist_list = {
    'ipm_dg1/sum': [0, 5e4, 70],
    'ipm_dg2/sum': [0, 5e3, 70],
    # 'tt/FLTPOS_PS': [-0.5, 0.5, 70],
    # 'tt/AMPL': [0, 0.2, 70],
    # 'tt/FLTPOSFWHM': [0, 300, 70]
}


# save as tiff file (ingore unless MEC)
save_tiff = False    
    mask: array, optional
        User defined mask. 1 for valid pixels.
    
    return2d: bool, optional
        Return a 2d (q,phi). Default: False
    
    poni_file: str, Path object, optional
        Path to a pyFAI calibration file
    
    ai_kwargs: dict, optional
        Arguments to pyFAI.AzimuthalIntegrator. Either this parameter or a calib file is necessary
        For arguments see: https://pyfai.readthedocs.io/en/master/api/pyFAI.html#module-pyFAI.azimuthalIntegrator
    
    pol_factor: float, optional
        Polarization factor. Default 1. Passed to integrate1d or integrate2d.
        
    npts_radial: int, optional
        Number of points for the radial binning. Default 256.
    
    npts_az: int, optional
        Number of points for the azimuthal binning. Default 360. Only used for the 2d integration.
        
    azav_kwargs: dict, optional
        Additonal arguments to pass to integrate1d or integrate2d.
        See https://pyfai.readthedocs.io/en/master/api/pyFAI.html#pyFAI.azimuthalIntegrator.AzimuthalIntegrator.integrate1d
    """

Fourier transform

TBD

Autocorrelation

TBD