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 (Adjacency-Based Search) - 8-connectivity clustering
    • DBSCAN - Density-based with spatial indexing
    • Graph - Union-find connected components
    • 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 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"
)

# 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, Graph, 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 \
    --spatial-epsilon 2.0 \
    --temporal-epsilon 500

# Show file information
rustpix info input.tpx3

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

# Convert formats
rustpix convert input.tpx3 -f hdf5 -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! See CONTRIBUTING.md for guidelines.

Acknowledgments

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

Metadata

Release files for rustpix 1.3.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 rustpix 1.3.0
File Size Uploaded Provenance Actions
rustpix-1.3.0.tar.gz 140.1 kB With provenance Details for rustpix-1.3.0.tar.gz

Built distributions (wheels)

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

Total release size: 11.0 MB

Release files / rustpix-1.3.0.tar.gz

Download URL rustpix-1.3.0.tar.gz
Size 140.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f00dee9a3bba91a1266f003155115276e5b011b853eb7975a64a8ff98b6834ea
BLAKE2b-256 checksum
How to use checksums
c8ede179ff75c2fed23e516cb338caf72cd4ba60245e05773ab6d6eae9fe088b
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 Oct 2, 2026.

Transparency log

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

Download URL rustpix-1.3.0-cp311-abi3-win_amd64.whl
Size 3.8 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
57144f24181543351a49c14ac35c4c71dc527a6f4698c847e42219d4f0e4f7dc
BLAKE2b-256 checksum
How to use checksums
51d56b8ab26d89ae26ac4a32856e549fd2e21636a3a907e95f86808e2d6184a4
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 Oct 2, 2026.

Transparency log

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

Download URL rustpix-1.3.0-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
adf6198df13c1c80fd4492d3822e2692da46b162b8b0c833d51f920c73f61ba1
BLAKE2b-256 checksum
How to use checksums
d696d5ee66b1d2aca272d47f26947a6e001fde3018a43323328c4ac2912a3cd2
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 Oct 2, 2026.

Transparency log

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

Download URL rustpix-1.3.0-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
3912b2e6ffffc4347431ec5203921cc98a6bd1e4a4da61adfd1f15936d32ce13
BLAKE2b-256 checksum
How to use checksums
6a3775b65151719527a4240daffc5bc9ad304ccf40411918bac10fc418933e83
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 Oct 2, 2026.

Transparency log

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

Download URL rustpix-1.3.0-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
3abb6356d985e0d0f0227540b12a4f825b6504732fb1115ea28e5bf57951481d
BLAKE2b-256 checksum
How to use checksums
569713bef65e77fb455b749a82374c5cca0b73f073cb752eaf1e65770ea5cd31
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 Oct 2, 2026.

Transparency log

Security for rustpix 1.3.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

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

Select from 5 files

Attestation for rustpix-1.3.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 2, 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