A comprehensive Python toolkit for X-ray scattering data analysis, providing both GUI and CLI interfaces for SPEC file conversion, data processing, and integration analysis.
-
Prerequisites: Ensure Anaconda/Miniconda is installed
-
Create Environment:
conda create -n pdsENV python=3.13 conda activate pdsENV conda config --add channels conda-forge conda install -c conda-forge h5py matplotlib numpy pillow pytest scipy tables wxpython pip install pyshortcuts
-
Install PDS:
pip install -e . -
Verify Installation:
pds --help
After installation, PDS provides a unified pds command with multiple modes:
# Show all available commands
pds --help
# Show detailed convert options
pds --convert helppds --integrator
# or short form:
pds -ipds --filter
# or short form:
pds -fPDS can convert SPEC files to HDF5 format with full metadata and image data preservation:
# Convert single SPEC file
pds --convert data.spec
# Convert with custom output name
pds --convert data.spec output.mh5
# Overwrite existing file
pds --convert data.spec -w
# Specify custom image directory
pds --convert data.spec -i /path/to/images# Convert all SPEC files in directory once and exit
pds --convert /path/to/spec/files --once
# Monitor directory for new/modified files (continuous)
pds --convert /path/to/spec/files
# Monitor with custom interval
pds --convert /path/to/spec/files -i 30
# Process existing files first, then monitor
pds --convert /path/to/spec/files --process-existing# Run all tests
pds --test
# or short form:
pds -t# Create desktop shortcuts for GUIs
pds --make_icon
# or short form:
pds -m-
Setup Environment:
conda activate pdsENV cd /path/to/your/experiment -
Convert Data:
# For completed experiments pds --convert . --once # For live experiments pds --convert . --process-existing
-
Launch Analysis GUI:
pds --integrator
Based on our testing with real scientific data:
# Convert a single experimental run
pds --convert uo2-29a_1d_O2_1.spec
# Processed 43 scans with image data → 89 MB HDF5 file
# Batch convert entire experimental directory
pds --convert /path/to/experiment/ --once
# Processed 243+ scans → 490+ MB total data
# Monitor live experiment data
pds --convert /beamline/data --process-existing -i 10
# Process existing data, then monitor every 10 secondsTypical conversion performance:
- 43 scans → 89 MB HDF5 (0.17 minutes)
- 70 scans → 134 MB HDF5 (0.24 minutes)
- 86 scans → 164 MB HDF5 (0.31 minutes)
-w- Overwrite existing output file-a- Append to existing output file (default)-q- Quiet mode (suppress verbose output)-i <image_dir>- Custom image directory path
-i <seconds>- Monitoring interval (default: 20 seconds)-q- Quiet mode--process-existing- Process existing files before monitoring--once- Process existing files once and exit
# Run all tests
python -m pytest
# Run specific test categories
python -m pytest -m "not slow" # Skip slow tests
python -m pytest -m "unit" # Unit tests only
python -m pytest -m "integration" # Integration tests
python -m pytest -m "cli" # CLI tests# Install development dependencies
pip install -e ".[dev]"
# Run linting
ruff check .
# Run formatting
ruff format .
# Pre-commit hooks
pre-commit installEnvironment Setup Issues:
# Ensure correct Python version
python --version # Should show 3.13.x
# Verify conda environment
conda list | grep h5py # Should show h5py ≥3.14.0Conversion Issues:
# Check file permissions
ls -la your_spec_file.spec
# Verify SPEC file format
head -20 your_spec_file.spec | grep "#S"
# Use verbose mode for debugging
pds --convert your_file.spec -vGUI Issues:
# Test wxPython installation
python -c "import wx; print('wxPython OK')"
# Try command line mode if GUI fails
pds --convert your_data --once# General help
pds --help
# Detailed convert help
pds --convert help
# Test installation
pds --testThis project is licensed under the MIT License - see the LICENSE file for details.
For additional support, please open an issue on the GitHub repository.