Package: hextof-processor
hextof-processorThis code is used to analyze data measured at FLASH using the HEXTOF (high
energy X-ray time of flight) instrument. The HEXTOF uses a delay line detector
(DLD) to measure the position and arrival time of single electron events.The analysis of the data is based on "clean tables" of single events as dask dataframes.
There are two dataframes generated in the data readout process.
The main dataframeddcontains all detected electrons and can be binned according to the needs of the experiment.
The second dataframeddMicrobunchescontains the FEL pulses and is commonly used for normalization.The classDldProcessorcontains the dask dataframes as well as the methods to perform binning in a parallelized fashion.TheDldFlashDataframeCreatorExpressclass subclassesDldProcessorand is used for creating the dataframes from the hdf5 files generated by the DAQ system.InstallationIn this section we will walk you through all you need to get up and running with the hextof-processor.For using this package with the old FLASH data structure, please refer toREADME_DEPR.md.1. PythonIf you don't have python on your local machine yet we suggest to start withanacondaorminiconda.
Details about how to install can be foundhere.2. Install hextof-processorDownload the package by cloning to a local folder.$gitclonehttps://github.com/momentoscope/hextof-processor.git2.1 Virtual environmentCreate a clean new environment (Westronglysuggest you to always do so!)If you are using conda:$condaenvcreate-fenvironment.ymlnow, to activate your new environment (windows):$condaactivatehextof-expressif you are using linux:$sourceactivatehextof-express2.2 Virtual environment in Jupyter NotebooksTo add the newly created environment to theJupyter Notebookskernel list,
and install your new kernel:(hextof-express)$python-mipykernelinstall--user--name=hextof-express3. Local Setup3.1 Initialize settingsFinally, you need to initialize your local settings. This can be done by runningInitializeSettings.py, in the same repository folder(hextof-env)$pythonInitializeSettings.pyThis will create a file calledSETTINGS.iniin the local repository folder. This is used to store the local settings as well as calibration values (will change in future..) and other options.3.2 Setting up local pathsIn order to make sure your folders are in the right place, open this file and modify the paths in the[path]section.data_raw_dir- location where the raw h5 files from FLASH are storeddata_h5_dir- storage of binned hdf5 filesdata_parquet_dirwhere the apache parquet data files from the generated single event tables are stored (we suggest using an SSD for this folder, since would greatly improve the binning performance.)data_results_dirfolder where to save results (figures and binned arrays)if you are installing on Maxwell, we suggest setting the following paths:[paths]data_raw_dir=/asap3/flash/gpfs/pg2/YYYY/data/xxxxxxxx/raw/data_h5_dir=/asap3/flash/gpfs/pg2/YYYY/data/xxxxxxxx/processed/data_parquet_dir=/asap3/flash/gpfs/pg2/YYYY/data/xxxxxxxx/processed/parquet/data_results_dir=/asap3/flash/gpfs/pg2/YYYY/data/xxxxxxxx/processed/*USER_NAME*/binned/WhereYYYYis the current year andxxxxxxxxis the beamtime number.3.3 Calculating sector_correction listIf you like, in the settings, you can add the sector_correction list, which will shift any misalignment of the sectors.
At the very least, this should include the "bit stealing hack" correction, where the last bits of the dldTime
are set so they encode dldSectorId. This can be achieved by using the calibration.gen_sector_correction function
which will generate the list for you, given the energy shifts you want.3.4 Installing Doniach-Sunjic gaussian broadenedPlease refer toXPSdoniachs/README.mdfor compilation instructions.4. Test your installationIn order to test your local installation, we have provided a series of tutorial Jupyter Notebooks.
You can find all the relevant material in thetutorial folderin the main repository.
We suggest setting testingExpress data readout.ipynb.DocumentationThe documentation of the package can be foundhere.Examples are available asJupyter Notebooks.
Some example data is provided together with the examples. More compatible data is being collected and will soon be added to online open-access repositories.Citation and and acknowledgmentsIf you use this software, please consider citing these two papers:D. Kutnyakhovet al.Review of Scientific Instruments 91, 013109 (2020);R. P. Xianet al.Scientific Data 7, 442 (2020).