Skip to main content

Hextof Offline Analyzer

Project description

DOI Documentation Status

hextof-processor

This 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 dataframe dd contains all detected electrons and can be binned according to the needs of the experiment. The second dataframe ddMicrobunches contains the FEL pulses and is commonly used for normalization.

The class DldProcessor contains the dask dataframes as well as the methods to perform binning in a parallelized fashion.

The DldFlashDataframeCreatorExpress class subclasses DldProcessor and is used for creating the dataframes from the hdf5 files generated by the DAQ system.

Installation

In 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 to README_DEPR.md.

1. Python

If you don't have python on your local machine yet we suggest to start with anaconda or miniconda. Details about how to install can be found here.

2. Install hextof-processor

Download the package by cloning to a local folder.

$ git clone https://github.com/momentoscope/hextof-processor.git

2.1 Virtual environment

Create a clean new environment (We strongly suggest you to always do so!)

If you are using conda:

$ conda env create -f environment.yml

now, to activate your new environment (windows):

$ conda activate hextof-express

if you are using linux:

$ source activate hextof-express

2.2 Virtual environment in Jupyter Notebooks

To add the newly created environment to the Jupyter Notebooks kernel list, and install your new kernel:

(hextof-express)$ python -m ipykernel install --user --name=hextof-express

3. Local Setup

3.1 Initialize settings

Finally, you need to initialize your local settings. This can be done by running InitializeSettings.py, in the same repository folder

(hextof-env)$ python InitializeSettings.py

This will create a file called SETTINGS.ini in 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 paths

In 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 stored
  • data_h5_dir - storage of binned hdf5 files
  • data_parquet_dir where 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_dir folder 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/

Where YYYY is the current year and xxxxxxxx is the beamtime number.

3.3 Calculating sector_correction list

If 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 broadened

Please refer to XPSdoniachs/README.md for compilation instructions.

4. Test your installation

In order to test your local installation, we have provided a series of tutorial Jupyter Notebooks. You can find all the relevant material in the tutorial folder in the main repository. We suggest setting testing Express data readout.ipynb.

Documentation

The documentation of the package can be found here.

Examples are available as Jupyter 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 acknowledgments

If you use this software, please consider citing these two papers:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hextof-processor-1.1.0.tar.gz (97.6 kB view details)

Uploaded Source

Built Distribution

hextof_processor-1.1.0-py3-none-any.whl (99.2 kB view details)

Uploaded Python 3

File details

Details for the file hextof-processor-1.1.0.tar.gz.

File metadata

  • Download URL: hextof-processor-1.1.0.tar.gz
  • Upload date:
  • Size: 97.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for hextof-processor-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7a597b7e95b02679ff8b23dee6ee6b7c8bb1e1c7cb648ab6b2a22b4c73d5d208
MD5 3df75e1fde32615357bb774cc2bb765f
BLAKE2b-256 3a399d86091682c82d0c7cb8eac330ee0b17f3d318a18e5c6cf1deedc128a263

See more details on using hashes here.

File details

Details for the file hextof_processor-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: hextof_processor-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 99.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for hextof_processor-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02ed988b46b9c228002355a1328ce9fb6014a793a1564bcb2f1fdaa5c134f580
MD5 f25d266c7d02dbfceaa8ef377d9bf8b6
BLAKE2b-256 59ffed51c9f5610e843e49c3ba2014b126a57170d0b2de6e1f43be0a974beade

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page