How weijini777/dataacceleratorchemrixs works
Purpose and Entry Points
ChemRIXS is a Python analysis/reduction library for chemistry resonant inelastic X-ray scattering (RIXS) data. Its practical entry points are importable modules under src/chemrixs/ and exploratory reduction/calibration notebooks under jupyter_notebook/. Reduction behavior is driven by YAML ROI and calibration inputs such as roi_input.yml, conf.yml, and mono_calib.yml.
Package Layout and Core API
The package is source-layout Python, rooted at src/chemrixs/__init__.py. Its architecture separates event-level detector handling, per-shot extraction, scan/run processing, aggregation, and persisted “small data” access:
• src/chemrixs/detector.py
• src/chemrixs/singleshot.py
• src/chemrixs/process.py
• src/chemrixs/integrating.py
• src/chemrixs/smalldata.py
Detector and ROI Interpretation
Detector-specific operations and region-of-interest selection are centralized in src/chemrixs/detector.py, with reusable transformations in src/chemrixs/utils.py. YAML files define detector regions and reduction parameters; examples include roi_input.yml, roi_inputTT.yml, and BGroi_input.yml. This creates a boundary between experiment-specific geometry/configuration and general reduction code.
Single-Shot Reduction
src/chemrixs/singleshot.py represents the event-level analysis stage: raw detector frames and associated per-shot metadata are converted into extracted spectral/intensity measurements. It depends on detector/ROI semantics rather than embedding experiment configuration. Timing-tool exploration and calibration workflows supporting this stage are represented in jupyter_notebook/TT_test.ipynb, jupyter_notebook/calibration.ipynb, and jupyter_notebook/tt_funcs.py.
Run and Scan Processing
src/chemrixs/process.py orchestrates reduction across shots or runs, applying configured extraction to build scan-level outputs. It is the likely control-flow boundary between raw/small-data input and analysis products. Supported experimental scan forms are reflected by representative HDF5 fixtures:
• tests/data/mono_scan_testfile_Run0000.h5
• tests/data/mono_fly_testfile_Run0000.h5
• tests/data/delay_scan_testfile_Run0000.h5
Integration and Aggregation
src/chemrixs/integrating.py performs integration-oriented reduction, while src/chemrixs/average.py provides aggregation/averaging of reduced measurements. The expected flow is detector frame → single-shot extraction → process orchestration → integration/averaging into run- or scan-level spectra. jupyter_notebook/correlations.ipynb and jupyter_notebook/eaxmple_run.ipynb are user-facing examples of downstream analysis.
Small-Data and Storage Boundary
src/chemrixs/smalldata.py abstracts access to compact run data, with HDF5 as the material persisted-data format evidenced by files in tests/data/ and jupyter_notebook/Run0023.h5. This module forms the external data boundary: the core reduction pipeline operates on data retrieved from HDF5/small-data structures rather than requiring a web service or application server.
Runtime, Dependencies, and Validation
The project uses Python packaging via pyproject.toml; environment setup is additionally described through conf.yml. It has no indicated deployed service infrastructure. Core behavior is validated around processing, integration, and small-data handling in tests/test_process.py, tests/test_integrating.py, and tests/test_smalldata.py. An older implementation path, src/chemrixs/old/reduce_funcs.py, should be treated as legacy rather than a primary extension point.
Main entry points: process.py Run and scan processing · smalldata.py Small-data access · detector.py Detector and ROI · __init__.py chemrixs package
Components 16
Experiment configuration
Experiment-specific ROI and calibration inputs.
- ROI YAML inputs · Defines detector regions and reduction parameters.
roi_input.yml - Calibration YAML inputs · Provides reduction and monochromator calibration settings.
mono_calib.yml
Reduction library
Importable Python reduction pipeline.
- chemrixs package · Source-layout public library root.
src/chemrixs/__init__.py - Small-data access · Reads compact persisted run data.
src/chemrixs/smalldata.py - Detector and ROI · Centralizes detector operations and ROI interpretation.
src/chemrixs/detector.py - Reduction utilities · Reusable detector transformations.
src/chemrixs/utils.py - Single-shot extraction · Converts frames and shot metadata into measurements.
src/chemrixs/singleshot.py - Run and scan processing · Applies configured extraction across shots or runs.
src/chemrixs/process.py - Integration · Performs integration-oriented reduction.
src/chemrixs/integrating.py - Averaging · Aggregates reduced measurements into spectra.
src/chemrixs/average.py
Interactive workflows
Notebook-based calibration and downstream analysis.
- Timing and calibration · Explores timing-tool and calibration workflows.
jupyter_notebook/calibration.ipynb - Timing-tool exploration · Interactive timing-tool analysis.
jupyter_notebook/TT_test.ipynb - Correlation analysis · Downstream reduced-data analysis example.
jupyter_notebook/correlations.ipynb
Other components
- HDF5 run data · Compact input and scan data format.
jupyter_notebook/Run0023.h5 - Scan forms · Representative mono, fly, and delay scan inputs.
tests/data/mono_scan_testfile_Run0000.h5 - Legacy reduction functions · Older implementation path, not a primary extension point.
src/chemrixs/old/reduce_funcs.py
Connections 17
- chemrixs package → Detector and ROI: exposes
- chemrixs package → Run and scan processing: exposes
- chemrixs package → Small-data access: exposes
- ROI YAML inputs → Detector and ROI: defines ROIs
- Calibration YAML inputs → Run and scan processing: configures
- Reduction utilities → Detector and ROI: supports
- Detector and ROI → Single-shot extraction: provides ROI semantics
- HDF5 run data → Small-data access: read by
- Scan forms → Small-data access: represent scan inputs
- Small-data access → Run and scan processing: supplies run data
- Single-shot extraction → Run and scan processing: extracts per-shot measurements
- Run and scan processing → Integration: feeds reduced data
- Integration → Averaging: feeds
- Timing and calibration → Calibration YAML inputs: develops calibration
- Timing-tool exploration → Single-shot extraction: supports timing workflow
- Run and scan processing → Correlation analysis: produces analysis inputs
- Legacy reduction functions → Run and scan processing: superseded by