Versions Compared

Key

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

...

https://github.com/slac-lcls/smalldata_tools/blob/master/examples/SmallDataProducer_userData.py
Each of the supported feature extraction/data reduction mechanism is described in their own subpages.
The common structure of adding user data is the addition of a "DetObject" for each detector you would like to extract information from to the producer python file. The relevant lines look like this: 

 

Code Block
have_cs140_0 = checkDet(env, 'cs140_0')
if have_cs140_0:
    cs140_0 = DetObject('cs140_0' ,ds.env(), int(run), common_mode=1, name='vonHamos')
    cs140_0.<feature extraction function>                                  
    dets.append(cs140_0)
'cs140_0' is a name given to the detector in the DAQ. You can get a list of detectors in your data by using the psana command "detnames exp=<expname>:run=<run#>" in a terminal.
The checkDet/if This structure allows detectors to be only processed when they appear. We loop over the list of DetObjects in the main event loop and for each detector, we get the data and attach it to the detector objectsobject. This is followed by a loop through the list of data extraction methods that have been added in the code block above. 

...

  • CsPad, cs140k: of all tiles of detector will exhibit a zero-photon peak, use common_mode=1, otherwise we recommend no correction (common_mode=0). It is also possible to request the use of the unbounded pixels by using common_mode=5
  • Opal, Zyla: no common-mode correction. Should a pedestal of the correct shape have been produced, then it will be subtracted. common_mode=-1 will return the raw data.
  • Jungfrau: no common_mode correction is the default.
  • Epix: we are using a method called "common_mode=46" which removed pixels with a lot of signal (10x noise) and the neighbors. Then, the common_mode is calculated for reach row & column and then subtracted. This is similar to method 7 and different will be tested hopefully soon.

The common mode corrections which are described <here> and DetObject simply wraps this.wrapped by DetObject are described on this page: Common mode correction algorithms.

When a DetObject has been declared, information used to extract the data will also be stored in the hdf5 file, among other things we store:

  • pedestal (measured in a dark run)
  • noise (measured in a dark run)
  • gain (if applicable)
  • geometry arrays (x/y/z positions for each pixel)

As mentioned above, to actually have event based data for your detector in the hdf5 file, you will need to add reduction/feature extraction methods to your detector. Several of them have been setup to allow for easy addition without any need to write own code.

If you have needs that are not met by this, you can add your own code in the event loop and use the <det>.evt.dat array that has been created as input. You can then add your results as python dict to smldata, which will save it to the hdf5 file. This also allows to combine information from two detectors for your feature extraction. Unless you need to deal with big data (full images,...) or have very computationally expensive algorithms, I would recommend store simpler data in the first level hdf5 file and run the second level processing outside as described in <link>

Children Display