Skip to main content

probixi - Self-Calibrating (PROB)ab(I)listic Peak Detection for Serial (X)-Ray Crystallograph(I)c Data

Probixi logo with link to website. Lifecycle: experimental PyPI version PyPI - Python Version PyTorch codecov CUDA Apple Silicon MPS Downloads License: MIT Documentation Status Code Style

probixi treats peakfinding as anomaly detection. Bragg signal is sparse, and the stream of frames is therefore mostly a sample of the detector's background. probixi learns that background at every pixel as frames arrive, whitens each frame against it, and reports the pixels the background does not explain. The peak contrast, peak prior, background blend, and detection threshold are calibrated on the data, and no parameter requires tuning. Each frame is then indexed, predicted, and integrated, with every peak weighted by its detection posterior.

image

Installation

pip install probixi

On Linux with CUDA, the gpu extra adds the Triton kernels and nvCOMP decompression. Without it, probixi runs its reference implementations on the same device.

pip install "probixi[gpu]"

The development version:

pip install git+https://github.com/ryan-odea/probixi.git

Usage

The command line goes from raw frames to integrated reflections in one call. The Python API returns lazy streams whose results stay on the GPU until collected, and any stage can feed further torch processing. probixi calibrates on a set of seed frames before detection, and --gif writes an animation of the noise model over the first frames of the run.

probixi -i files.lst -g myGeometry.geom -p myCell.cell -o stream.stream --device cuda --gif myNoiseModel.gif

The same run in Python:

import torch

from probixi import Probixi, DataOffloader

pipeline = Probixi(
    list_file="files.lst",
    geometry_file="myGeometry.geom",
    cell_file="myCell.cell",
    device=torch.device("cuda"),
)

pipeline.noise_diagnostics("myNoiseModel.gif", stop=32)
cal = pipeline.calibrate(n_seed=1636)
print(f"kappa={cal.kappa:.2f}  prior_peak={cal.prior_peak:.4f}  "
      f"threshold={pipeline.threshold_calibration.threshold:.2f}")

with DataOffloader(
    "stream.stream",
    geometry=pipeline.geometry,
    cell=pipeline.target_cell,
    geometry_file="myGeometry.geom",
    files=pipeline.metadata.files,
) as off:
    for result in pipeline.index_stream(pipeline.frames(), batch_size=8):
        off.write(result)  # or: pipeline.index_stream(...).to_stream(off)
        for crystal in result.crystals:
            print(f"frame {result.frame_index}: "
                  f"{crystal.n_indexed}/{crystal.n_peaks} indexed (rmsd {crystal.rmsd:.4f})")

DuckDB output

A .stream file suits partialator, but querying it means parsing a large text file. An output ending in .duckdb or .db is written as a DuckDB database instead, which may become the default.

probixi -i files.lst -g myGeometry.geom -p myCell.cell -o run.duckdb --device cuda
stream = pipeline.index_stream(pipeline.frames(), batch_size=8)
stream.to_db(
    "run.duckdb",
    geometry=pipeline.geometry,
    cell=pipeline.target_cell,
    geometry_file="myGeometry.geom",
    files=pipeline.metadata.files,
)

The database holds the run metadata (geometry, panels, cell, integration) and four result tables joined on frame_id: frames, crystals, reflections, and peaks. The schema lists their columns.

Indexing ambiguity

When the lattice symmetry is higher than the structure's point group, each crystal can be indexed in more than one way. probixi-resolve clusters the crystals in a database into the two choices and reindexes those on the wrong side. It is a torch and Triton implementation of CrystFEL's ambigator, by Thomas White.

probixi-resolve -i run.duckdb -y 3 -w 321 -o detwinned.duckdb

Without -o the database is rewritten in place. Reindexing transforms h k l in reflections together with the reciprocal axes and cell of each crystal in crystals, and records every assignment in an ambiguity table. In Python:

from probixi import Ambigator

amb = Ambigator("run.duckdb", symmetry="3", apparent="321")
result = amb.resolve()
print(f"{result.n_reindexed}/{len(result)} crystals reindexed")
amb.reindex(result, output="detwinned.duckdb")

Peak export for other indexers

To use another indexer, run probixi as a peakfinder with the CLI's --peaks-only flag or the Python API's peak_stream. The output directory receives one CXI file per input file, a peaks.lst, and a geometry for indexamajig --peaks=cxi. The exported peaks also improve conventional indexers on strong data (see the vignettes).

probixi -i files.lst -g myGeometry.geom -o peaks/ --peaks-only --device cuda
import torch

from probixi import Probixi, PeakOffloader

pipeline = Probixi(
    list_file="files.lst",
    geometry_file="myGeometry.geom",
    device=torch.device("cuda"),
)
pipeline.calibrate(n_seed=1636)

peaks = pipeline.peak_stream(pipeline.frames(), estimate_scale=False)
with PeakOffloader(
    "peaks/",
    geometry_file="myGeometry.geom",
    files=pipeline.metadata.files,
) as off:
    for result in peaks:
        if len(result):  # frames without peaks are not exported
            off.write(result)

Dependencies

  • python >= 3.10
    • click
    • deflate
    • duckdb
    • h5py
    • hdf5plugin
    • matplotlib
    • numpy
    • pillow
    • torch
  • optional (gpu): triton >= 3.5, nvidia-libnvcomp-cu12

Contributing

Report bugs and request features on the issue tracker. A pull request should meet the following conventions:

  1. Code is formatted with isort, then black, and passes ruff check. The same checks run on every PR.
  2. Only user-facing objects carry docstrings, in numpy style.
  3. Comments are single lines that state what the code does not show: a reason, a unit, a convention, or a source. The explanation of a bug fix belongs in the PR, not in the code.

Metadata

Release files for probixi 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for probixi 0.10.0
File Size Uploaded Provenance Actions
probixi-0.10.0.tar.gz 17.4 MB With provenance Details for probixi-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for probixi 0.10.0
File Interpreter ABI Platform Actions
probixi-0.10.0-py3-none-any.whl Python 3 none any Details for probixi-0.10.0-py3-none-any.whl

Total release size: 17.6 MB

Release files / probixi-0.10.0.tar.gz

Download URL probixi-0.10.0.tar.gz
Size 17.4 MB
Tags Source
SHA-256 checksum
How to use checksums
3fbbbc5d41d54bd5ca6ced0096233418741c7e2e02be047e91506d87c0e3d271
BLAKE2b-256 checksum
How to use checksums
07f32c9be99f5cc1540bc0931f8044d2e5be4d43b16049c3027c1845cd0bd52f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / probixi-0.10.0-py3-none-any.whl

Download URL probixi-0.10.0-py3-none-any.whl
Size 206.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d82f75b359a2dc781686dfaa62974e000d2547c2beeb1b24d6b1b4b7da71bea7
BLAKE2b-256 checksum
How to use checksums
598245b603c043f891069a7bfb22d3c50cd748f99179559445b6492f0bd9de50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for probixi 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for probixi-0.10.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page