XPCS correlation calculations for synchrotron experiments
Project description
xpcs-correlator
Table of contents
- About
- Documentation
- Features
- Requirements
- Installation
- Quickstart
- Configuration / Logging
- Tests
- Contributing
- License
- Contact
About
This package consolidates ongoing development of correlators for XPCS data analysis at ESRF, with a focus on the ID02 and ID10-coh beamlines.
Documentation
The documentation is hosted online: https://mj.gitlab-pages.esrf.fr/xpcs_developments/xpcscorr/
Features
- Dense frames data reference and chunked correlator implementations.
- Calculates g2, g2 errors, and ttcf (2-time correlation function).
- The ttcf calculations support linear binning for t1,t2 format and hybrid linear log binning for age,lag format.
- Designed to handle large frame stacks via chunked (partitioned) processing.
- Supports Dask for both cluster (SLURM) and local parallel execution
Requirements
- Python 3.10+ (recommended: 3.10, 3.11, 3.12)
- numpy
- dask
- dask_jobqueue
- h5py
- hdf5plugin
- threadpoolctl
Installation
Install in editable/develop mode (recommended during development):
pip install -e .
Install with development extras (for running tests and linters):
pip install -e .[dev]
When published to PyPI the package can be installed with:
pip install xpcs-correlator
Quickstart
For a step-by-step walkthrough with examples and runnable code, see the Tutorial in the online documentation: Quickstart tutorial.
Basic usage example — adapt to your data shape and correlator options:
import numpy as np
from xpcscorr import correlator_dense_reference, correlator_dense_chunked
# Replace with your frames array; shape here is (n_frames, nx_pixels, ny_pixels)
frames = np.random.random((100,512, 512))
roimask= np.ones((512,512), dtype=bool)
# Run reference correlator
result_ref = correlator_dense_reference(frames, roimask)
# Run chunked correlator (handles large data in chunks)
extra_options = {'chunks_N': 3}
result_chunked = correlator_dense_chunked(frames, roimask, extra_options=extra_options)
print(type(result_ref), type(result_chunked))
Notes:
- Replace the synthetic
frameswith your real dataset (HDF5 dataset or numpy array). - Check correlator function docstrings for exact argument names and options.
Configuration / Logging
Control logging with environment variables used by the package (see src/xpcscorr/__init__.py):
XPCSCORR_LOG_TO_CLI— set to1to enable logging to stdout (default in development)XPCSCORR_LOG_TO_FILE— set to1to enable logging to a file namedxpcscorr.log
Example:
export XPCSCORR_LOG_TO_CLI=1
export XPCSCORR_LOG_TO_FILE=0
Tests
Run tests with pytest:
pip install -e .[dev]
pytest -q
There are unit tests under tests/ that exercise correlator behavior and core utilities.
Contributing
- Open issues for bugs or feature requests.
- Fork the repo, create a feature branch, add tests, and submit a pull request.
- Keep changes small, document API changes, and add tests for new behavior.
License
This project is licensed under the MIT License — see the LICENSE file for details.
Contact
Maintainer: Maciej Jankowski — maciej.jankowski@esrf.fr
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xpcs_correlator-0.1.1.tar.gz.
File metadata
- Download URL: xpcs_correlator-0.1.1.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbb738f4498d9aaee4e95da7a2e82d3196a56b1bdbe787a4db84e26720f5fdf3
|
|
| MD5 |
2a5049c86cabddffc6d1fa66a58cd919
|
|
| BLAKE2b-256 |
bcc5c2976abfa136dc64aeb239fada4f00ee70cc9717c48fdeee4361988d8332
|
File details
Details for the file xpcs_correlator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: xpcs_correlator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
531384532661579dab9b907ced4f72bc9b644cd8ea76e0f27ce580819019e4ec
|
|
| MD5 |
9045eddb52342ee701c2b3cf36b6d9b9
|
|
| BLAKE2b-256 |
5ac8fe7713adbd6522fdef9403f6a1f8bdd83fc641ca8718e2fd1245114f0298
|