Page History
...
Code Block |
---|
ana.addCut('lightStatus/xray',0.5,1.5,'on')
ana.addCut('lightStatus/laser',0.5,1.5,'on')
ana.addCube('cube','delay',np.arange(13.,15.,0.05),'on')
cs140Dict = {'source':'cs140_rob','full':1}
ana.addToCube('cube',['ipm2/sum','ipm3/sum','diodeU/channels',cs140Dict])
anaps.makeCubeData('cube', onoff=2) |
Cubing - Step-by-step
ana.addCut('lightStatus/xray',0.5,1.5,'on')
ana.addCut('lightStatus/laser',0.5,1.5,'on')
ana.addCube('cube','delay',np.arange(13.,15.,0.05),'on')
cs140Dict = {'source':'cs140_rob','full':1}
ana.addToCube('cube',['ipm2/sum','ipm3/sum','diodeU/channels',cs140Dict])
anaps.makeCubeData('cube')
Binning variables
Add variables from the smalldata hdf5 (ana)
Add variables from the xtc (images)
OnOff parameter in makeCubeData
makeCubeData takes an optional parameter onoff=[0/1/2]. It is two by default which makes that the filter will be applied as given. onoff=1 means select laser-on events. The requirement that the optical laser is on is added, nothing else is changed. The outputfile will end on <…>_on.h5 onoff=0 selected laser-off events. If present, the laser-on requirement is flipped and criteria involving the timetool will be dropped. All other criteria remain. The outputfiles will not end in <…>_on.h5
Production script
...
-s <size>: rebin image to size x size pixels
-m <common mode parmaeter>: apply common mode
-t <thres in ADU>: hitfinder
-T <thres in Rms>: hitfinder
-R store raw cspad data (NOT image)
...
Cube data format
By default, the data gets saved in an hdf5 file in /reg/d/psdm/<instrument>/<expname>/hdf5/smalldata
and the files have names like Cube_<expname>_Run<runnumber>_<cubename><optional _on/off>.h5
h5ls -r on an example file looks like this:
Code Block |
---|
/Cfg__epix10ka2m__calib_mask Dataset {16, 352, 384}
/Cfg__epix10ka2m__gain Dataset {7, 16, 352, 384}
/Cfg__epix10ka2m__ix Dataset {16, 352, 384}/
Cfg__epix10ka2m__iy Dataset {16, 352, 384}
/Cfg__epix10ka2m__mask Dataset {16, 352, 384}
/Cfg__epix10ka2m__ped Dataset {7, 16, 352, 384}
/Cfg__epix10ka2m__rms Dataset {7, 16, 352, 384}
/Cfg__epix10ka2m__x Dataset {16, 352, 384}
/Cfg__epix10ka2m__y Dataset {16, 352, 384}
/binVar Dataset {13}
/binVar_bins Dataset {13}
/cubeSelection Dataset {1}
/epix10ka2m Dataset {13, 16, 352, 384}
/ipm5__sum Dataset {13}
/nEntries Dataset {13}
/std_binVar_bins Dataset {13}
/std_delay Dataset {13}
/std_ipm5__sum Dataset {13} |
/Cfg__<detnames>__<parametername>
are calibration parameters for a detector. This will be added whenever detector data from the big xtc file is added.
/nEntries is somewhat self-explanatory
/binVar_bins are the bin boundaries for the binning variable.
/std__<varname> are the std calculated from all data points in the bin.
/ipm5__sum and /epix10ka2m are the main data: ipm5__sum is from the smalldata and in this case can be used for normalization of the incoming beam intensity. epix10ka2m is the full data for the epix10ka2m detector.
cubeSelection is a dataset stored for its attribute which is the text of the selection criteria used for the creating of this cube.
Advanced options (in progress)
Multi-dimensional binning
You can add more dimensions to bin the data in by using <cube>.add_BinVar:
Code Block |
---|
def add_BinVar(self, addBinVars):
"""
add extra dimensions to bin the data in
parameters: addBinVars: dict or list
list: only 1 extra variable [varname, bin1, bin2, ....]
dict: {varname: bins}
""" |
Indices for the events in all dimensions will be created and turned into one big flat index after which xarray binning is used. Finally, the data is reshaped into the expected formIt is possible to do this.
Returning event-by-event data (from smallData
...
ONLY when using SmallDataAna.makeCubeData)
Code Block |
---|
ana.addToCube(<cubename>, targetVar, isIdxVar=True) |
When variables are added to the cube is isIdxVars=True (default is False), in additional to the cube-dictionary, a second dictionary with list of values for each bin of the cube are returned. This only works for the SmallDataAna method, NOT the SmallDataAna_psana one. You can then treat the returned data further, e.g. by pic,ing one event for each bin out of the list and write out the data for those events. This is demonstrated in PickedEventsCube.pyIt is possible to do this.
Getting data from laser-off images closest in time for each cube slice
...