Skip to main content

rustpix

CI Documentation Crates.io PyPI DOI License: MIT

High-performance pixel detector data processing for neutron imaging. Supports Timepix3 (TPX3) with 96M+ hits/sec throughput. Features multiple clustering algorithms, centroid extraction, and Python bindings.

Features

  • Fast TPX3 Processing: Parallel packet parsing with memory-mapped I/O
  • Multiple Clustering Algorithms:
    • ABS (Age-Based Spatial) - single-pass clustering of TOF-ordered hits
    • DBSCAN - Density-based with spatial indexing
    • Grid - Parallel grid-based clustering
  • Streaming Architecture: Process files larger than RAM
  • Python Bindings: Thin wrappers with NumPy integration
  • CLI Tool: Command-line interface for batch processing
  • GUI Application: Interactive analysis with real-time visualization
  • Multiple Output Formats: HDF5, Arrow, CSV

Installation

Python (pip)

pip install rustpix

macOS (Homebrew)

brew tap ornlneutronimaging/rustpix
brew install --cask rustpix  # GUI app

Rust (cargo)

# CLI tool
cargo install --locked rustpix-cli

# Library
cargo add rustpix-core rustpix-algorithms

From Source

# Using pixi (recommended)
git clone https://github.com/ornlneutronimaging/rustpix
cd rustpix
pixi install
pixi run build

# Or with cargo
cargo build --release --workspace

Quick Start

Python

import rustpix

# Process TPX3 file to neutron events
config = rustpix.ClusteringConfig(radius=5.0, temporal_window_ns=75.0)
neutrons = rustpix.process_tpx3_neutrons(
    "data.tpx3",
    clustering_config=config,
    algorithm="abs",
    collect=True,
)

# Convert to NumPy
data = neutrons.to_numpy()
print(f"Found {len(data['x'])} neutron events")

Command Line

# Process file
rustpix process input.tpx3 -o output.h5

# Show file info
rustpix info input.tpx3

# Benchmark algorithms
rustpix benchmark input.tpx3

GUI Application

Launch the GUI for interactive analysis:

# macOS (Homebrew)
open -a Rustpix

# From source
pixi run gui
cargo run -p rustpix-gui --release

Workspace Structure

Crate Description
rustpix-core Core traits and types
rustpix-tpx TPX3 packet parser and hit types
rustpix-algorithms Clustering algorithms (ABS, DBSCAN, Grid)
rustpix-io File I/O with memory-mapped reading
rustpix-python Python bindings (PyO3)
rustpix-cli Command-line interface
rustpix-gui GUI application (egui)

Python API

Read Hits

import rustpix

# Read all hits
hits = rustpix.read_tpx3_hits("input.tpx3")
hits_np = hits.to_numpy()

# Stream hits in batches
for batch in rustpix.stream_tpx3_hits("input.tpx3"):
    process(batch.to_numpy())

Process Neutrons

# Configure clustering
clustering = rustpix.ClusteringConfig(
    radius=5.0,
    temporal_window_ns=75.0,
    min_cluster_size=1
)

# Configure centroid extraction
extraction = rustpix.ExtractionConfig(
    super_resolution_factor=8.0,
    weighted_by_tot=True,
    min_tot_threshold=10
)

# Stream processing (low memory)
for batch in rustpix.process_tpx3_neutrons(
    "input.tpx3",
    clustering_config=clustering,
    extraction_config=extraction,
    algorithm="abs"
):
    save_batch(batch.to_numpy())

# Batch processing (collect all)
neutrons = rustpix.process_tpx3_neutrons(
    "input.tpx3",
    clustering_config=clustering,
    extraction_config=extraction,
    algorithm="abs",
    collect=True
)

CLI Usage

# Process with custom parameters
rustpix process input.tpx3 -o output.csv \
    --algorithm dbscan \
    --radius 2.0 \
    --temporal-window-ns 500

# Show file information
rustpix info input.tpx3

# Benchmark different algorithms
rustpix benchmark input.tpx3 --iterations 5

# Export neutrons to HDF5 (format from the extension)
rustpix process input.tpx3 -o output.h5

Performance

  • Throughput: 96M+ hits/sec on modern hardware
  • Memory: Streaming architecture processes files larger than RAM
  • Parallel: Multi-threaded clustering with rayon
  • Optimized: SIMD-friendly data layouts (SoA)

Development

# Install dependencies with pixi
pixi install

# Run tests
pixi run test

# Format and lint
pixi run lint

# Build documentation
pixi run docs

# Run GUI in debug mode
pixi run gui-debug

Documentation

Citation

If you use rustpix in your research, please cite:

@software{rustpix2026,
  title = {rustpix: High-performance pixel detector data processing},
  author = {{ORNL Neutron Imaging Team}},
  year = {2026},
  url = {https://github.com/ornlneutronimaging/rustpix},
  doi = {10.5281/zenodo.18496370}
}

License

MIT License - see LICENSE for details.

Contributing

Contributions welcome through GitHub issues and pull requests.

Acknowledgments

Developed by the Neutron Imaging Team at Oak Ridge National Laboratory.

Metadata

Release files for rustpix 1.4.2

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

Source distribution (sdist)

Source distribution for rustpix 1.4.2
File Size Uploaded Provenance Actions
rustpix-1.4.2.tar.gz 155.3 kB With provenance Details for rustpix-1.4.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rustpix 1.4.2
File Actions
rustpix-1.4.2-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for rustpix-1.4.2-cp311-abi3-win_amd64.whl
rustpix-1.4.2-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for rustpix-1.4.2-cp311-abi3-manylinux_2_28_x86_64.whl
rustpix-1.4.2-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for rustpix-1.4.2-cp311-abi3-macosx_11_0_arm64.whl
rustpix-1.4.2-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for rustpix-1.4.2-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 11.1 MB

Release files / rustpix-1.4.2.tar.gz

Download URL rustpix-1.4.2.tar.gz
Size 155.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cbb6d31bf00ea69f476281254601119cef2f77e991cf36ab44b4515a2c1c6379
BLAKE2b-256 checksum
How to use checksums
f871856ef410207601a118e6e02e69cfb2db26991fa9acf5f7fd09b65140db68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Nov 20, 2026.

Transparency log

Release files / rustpix-1.4.2-cp311-abi3-win_amd64.whl

Download URL rustpix-1.4.2-cp311-abi3-win_amd64.whl
Size 3.8 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f3741827c6c33173cf822da7c1377d076ebc08a2c9ca82b0903b85ba0a6524bd
BLAKE2b-256 checksum
How to use checksums
952687dffa66a6106b6b63f403c523d17b11d738ab2d5b0866d155f8b0737863
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Nov 20, 2026.

Transparency log

Release files / rustpix-1.4.2-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL rustpix-1.4.2-cp311-abi3-manylinux_2_28_x86_64.whl
Size 2.7 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
7a5822139ecfd9ced03335ae9c769d74b1f1a211e90ede7be223faaf2e6dc9ef
BLAKE2b-256 checksum
How to use checksums
c148e6216617894139c4f6b1611022995e6089c554692af1efabef3950eb5a7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Nov 20, 2026.

Transparency log

Release files / rustpix-1.4.2-cp311-abi3-macosx_11_0_arm64.whl

Download URL rustpix-1.4.2-cp311-abi3-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
47d85cbf36df8b3f8a5f2c68f50407f807ae303a429441f4df9eef40846221f2
BLAKE2b-256 checksum
How to use checksums
3b0849b9b1cbd7e5de806cd9ae9ea1e1758f10a4d5d5c26abe4d6be08a33b67e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Nov 20, 2026.

Transparency log

Release files / rustpix-1.4.2-cp311-abi3-macosx_10_12_x86_64.whl

Download URL rustpix-1.4.2-cp311-abi3-macosx_10_12_x86_64.whl
Size 2.3 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5c6ddfce6e7a5a5bacb04b84b118e11e37b8610de92bb38ca95e949f331a6711
BLAKE2b-256 checksum
How to use checksums
44c16e73bf511cb2e809514dc6f4cc3d2cef786eb93cc2473a41f1338abca1b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Nov 20, 2026.

Transparency log

Security for rustpix 1.4.2

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

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for rustpix-1.4.2.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 Nov 20, 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