Fast open-source diffraction integration powered by Rust
Actively maintained. Last release 1 day ago, commits in 7 of the last 26 weeks. A safe choice.
pip install dioptrinREADME as published on PyPI with version 0.20.2.
Dioptrin
Dioptrin provides fast 1D and 2D diffraction integration using a compiled Rust engine. It supports pixel splitting, supersampling, detector corrections, Poisson uncertainties, azimuthal intensity spread, and batch integration.
See the user manual for API examples, HDF5 workflows and performance measurements.
Installation
python -m pip install dioptrin
Dioptrin is distributed as binary wheels for standard CPython 3.11–3.15 on Windows x86-64, macOS Intel and Apple silicon, and Linux x86-64 and ARM64. Free-threaded Python is not supported. If no compatible wheel is available, installation from the source distribution requires a Rust toolchain. The source is available on GitHub.
License
Dioptrin is open-source software under the MIT license. Starting with 0.7.0, both source builds and pre-built wheels work without activation, license keys, or expiration checks. Upgrade older installations:
python -m pip install --upgrade dioptrin
Use with Dioptas
Install Dioptrin in the same Python environment as Dioptas and restart Dioptas. The Use Dioptrin checkbox becomes available in its integration options. Dioptas continues to work with pyFAI without Dioptrin.
Multi-detector 2D integration (0.11.0)
MultiIntegrator.integrate2d combines detector images on a shared radial and
azimuthal grid. Detectors retain their individual calibrations, masks and
corrections. Fractional polygon splitting is the default for pixel_split,
with periodic seam handling and detector-plane sampling at the beam center.
# int1 and int2 have the same radial unit/range and their own geometry/mask.
multi = dioptrin.MultiIntegrator([int1, int2])
result = multi.integrate2d(
[img1, img2], 2000, 360, errors=True, normalization="absolute",
)
cake = np.asarray(result.intensity).reshape(360, 2000)
Import dioptrin and numpy as np in your application. Radial coordinates use
the configured unit; azimuthal coordinates and sector edges use radians. Raw
signal, normalization and Poisson variance are merged before final division.
Absolute scaling includes each detector's pixel area divided by distance
squared, matching pyFAI MultiGeometry's solid-angle scale. Applications must
call the new API to use it; upgrading the library alone does not switch an
existing Dioptas multi-detector workflow. See the
for complete setup, normalization, units, masks, uncertainties and benchmarks.