Page History
Warning |
---|
DO NOT MODIFY THE NOTEBOOKS IN THEIR NATIVE LOCATION Always clone the repo ( |
For many experiment, the analysis of the smalldata h5 files is not too computing intensive and the analysis team can benefit from the quick and iterative nature of the Jupyter notebooks framework over the more involved cube production.
These notebooks can be found in /sdf/data/lcls/ds/xpp/xpptut15/results/example_notebooks
.
It is highly recommended to be able to refer to the relevant example notebook while going through this part of the documentation.
In this section, a few template notebook for common experiments are discussed.
Common features
All templates will start with a section where the experiment and run can be defined:. Make sure to comment out the example file line when actual data are to be analyzed.
Define alias and filters
Sets of alias in the h5 files are defined in the following cell. This makes it convenient to change the target variable for the entire workflow, without having to change the variable name in each cell. The variables to be used for filtering (typically i0, timing tool fit, ...) are also defined here.
Code Block | ||||
---|---|---|---|---|
| ||||
run# helper =dict 21 expto = 'xppx47019' ffb = True # if 'drp' in socket.gethostname(): # p = Path('/cds/data/drpsrcf/{}/{}/scratch/hdf5/smalldata'.format(exp[:3], exp)) # else: #find data in file dataDict = {'alias': 'path/in/the/h5', ... p = Path('/cds/data/psdm/{}/{}/hdf5/smalldata/'.format(exp[:3], exp)) # # } filters = p{} filters['alias_filt1'] = Path('/cds/data/psdm/{}/{}/scratch/ffb/hdf5/smalldata/'.format(exp[:3], exp)) # print(p.exists()) # it = p.glob('{}_Run{:04d}*'.format(exp,run)) # try: f = next(it) # except: print('No files found at this path.') # print(f) # print('\n') f = Path('./example_ccm_2d_scan.h5') # only for example. Comment or delete later rr = [low,high] filters['alias_filt2'] = [low,high] ... print('Filter selection:') for key,value in filters.items(): print('\t{} : {}'.format(key, value)) hist_bins = {key: 35 for key in filters.keys()} |
Make sure to adapt the alias to the detectors names in your smalldata h5 file. The object rr
(created from rr = tables.File(f).root
...
The commented block should be uncommented whenever actual data are being analyzed.
...
) in the workspace allows for easy tab-exploration of the content of the h5 file to figure out variable names.
Example from trXRD.ipynb
While most value often remain the same for the entire experiment, the scanvar should be updated to match the axis being scanned for each run (delay, energy, azimuth, ...).
Code Block | ||||
---|---|---|---|---|
| ||||
# helper dict to find data in file dataDict = {'alias 'scanvar': 'enc/lasDelay', 'i0': 'path/in/the/h5', ... ipm2/sum', 'roi': 'jungfrau1M/ROI_0_area', 'xon': 'lightStatus/xray', 'lon': 'lightStatus/laser', 'tt_corr': 'tt/ttCorr', 'tt_fwhm': 'tt/FLTPOSFWHM', 'tt_amp': 'tt/AMPL' } filters = {} filters['i0'] = [200,10000] filters['aliastt_filt1amp'] = [0.0302,0.352] filters['aliastt_filt2fwhm'] = [4050,230240] ...damage = [dataDict['roi'].split('/')[0], dataDict['i0'].split('/')[0]] print('Filter selection:') for key,value in filters.items(): print('\t{} : {}'.format(key, value)) hist_bins = {key: 35 for key in filters.keys()} |
Check filter validity
The goodness of the filters be be evaluated in the next cell, where histograms of the variables are shown together with the selected boundaries..