You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

This section details how to set up custom binning of the full detector images and save the output to an hdf5 file.

The main cube script is ./producers/letsCube.py, but this file should generally not be modified. The configuration is done through a hutch-specific file of the type ./producers/cube_config_<hutch>.py.

Config file

The configuration consists of the following main points (see example below too):

  • Custom bin definition. Using a run-based logic, one can define how to bin the data here. If no bins are given for a run, then the unique position of the corresponding scan motor will be used. The former is typically used for time or energy fly-scans and the latter is recommended for regular motor scans, such as phi or laser lens scans.
  • Filter definition. Default filter name is filter1. Any other filter name will lead to the creation of separate cube files ending with _filtername. This can be useful in case where an external field is applied on certain shots for example.
  • Laser on/off. If True will create a _on and _off cubed file.
  • Detectors. Area detectors dictionaries to be cubed are defined here. Pixel intensity threshold can be given and whether to return the image or the calib can be chosen with the image key. Full is meaningless for now. All the variable to add to the cubed file are then added to varList. The syntax for each non-area detector variable should follow the structure in the smalldata h5 file. Area detectors dictionaries must be passed here as well.
  • Histograms. At the end of the cube, a summary is posted to the elog. Variable histograms can be added here. The IPMs and timing tool are generally considered default. If a variable is also in the filter list, the filter boundaries will be shown in the histogram too. The pixel histograms for the area detector defined are also included in the summary. These plots can help you choose relevant filters and thresholds.

Example config file for XPP:

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 None


# 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'],
    ['ipm2/sum',3e2,6e4,'filter1'],
    ['evr/code_41',0.5,1.5,'custom']
]

# Laser on/off.
laser = True

# List detectors to be cubed. Area detector have additional options such as threshold
# For now only full image or calib works. TODO: Add photon maps. And then any detObjectFunc
# Detectors should then be added to varList
detDict = {'source':'jungfrau1M',
           'full':1,
           'image':0,
           'thresADU':6.5,
           'common_mode':0}

varList = ['ipm2/sum','ipm3/sum','diodeU/channels', detDict]


# 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 = {
    'ipm2/sum': [0, 5e4, 70],
    'ipm3/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 (ignore unless MEC)
save_tiff = False

Cube file output



  • No labels