Rust Backend for accessing CCD data in FITS files
This crate is a light wrapper over the astrors-fork crate. It provides a simple interface to access CCD data in FITS files and convert them to Polars DataFrames.
Features
- Read single FITS files into Polars DataFrames
- Process entire directories of FITS files
- Filter files using glob patterns
- Process specific selections of FITS files
- Automatic calculation of important derived values (Q, Lambda, etc.)
- Support for different experiment types (XRR, XRS)
- Automatic inclusion of DATE header for chronological sorting
- Simplified file name handling
Usage
Basic Usage
use *;
use Path;
Advanced Usage
use *;
use PathBuf;
Supported Experiment Types
ExperimentType::Xrr
- X-ray ReflectivityExperimentType::Xrs
- X-ray SpectroscopyExperimentType::Other
- Generic FITS files
Header Values
Each experiment type automatically extracts the relevant header values, plus standard headers:
// XRR headers
Xrr => vec!
// Standard headers always included for all experiment types
"DATE" // Date/time information from the FITS header
File Name Handling
The library now extracts only the base file name from the path without parsing frame numbers or scan IDs. This simplifies file handling and makes it more robust.
Calculated Values
The library automatically calculates:
- Wavelength (Lambda) in Angstroms
- Momentum transfer (Q) in inverse Angstroms
- Theta offset for calibration
Sorting
Output DataFrames are automatically sorted by:
- Date (from the DATE header)
- File name (as fallback sorting key)