Command Line Interface

The rustpix CLI provides batch processing capabilities for TPX3 files.

Installation

cargo install rustpix-cli

Or build from source:

cargo build --release -p rustpix-cli

Commands

CommandDescription
processProcess TPX3 files to extract neutron events
infoShow information about a TPX3 file
benchmarkBenchmark clustering algorithms

Quick Examples

# Process a file to CSV
rustpix process input.tpx3 -o output.csv

# Export to generic NeXus HDF5
rustpix process input.tpx3 -o output.h5

# Export to ORNL SNS NXsnsevent HDF5
rustpix process input.tpx3 -o output.nxs.h5 \
    --run-number 12345 --ipts IPTS-35004

# Export to TIFF stack with custom TOF binning
rustpix process input.tpx3 -o output.tiff \
    --tof-bins 500 --bit-depth 32

# Override auto-detected format
rustpix process input.tpx3 -o output.dat -f sns-hdf5

# Show file info
rustpix info input.tpx3

# Benchmark algorithms
rustpix benchmark input.tpx3

# Get help
rustpix --help
rustpix process --help

Output Formats

The output format is auto-detected from the file extension, or can be overridden with --format (-f):

ExtensionFormatDescription
.csvcsvComma-separated values with header
.h5, .hdf5, .nxshdf5Generic NeXus HDF5 (scipp-compatible)
.nxs.h5sns-hdf5ORNL SNS NXsnsevent HDF5 with run metadata
.tif, .tifftiffTIFF image stack with spectrum CSV sidecar
.bin, .dat, otherbinaryCompact binary format (default)

Format-Specific Flags

FlagFormatsDefaultDescription
--format (-f)AllAuto-detectOverride output format
--run-numbersns-hdf50SNS run number
--iptssns-hdf5""Experiment identifier (e.g., IPTS-35004)
--instrumentsns-hdf5venusInstrument preset
--tof-binstiff200Number of TOF bins
--tof-maxtiffAutoMaximum TOF in 25ns ticks
--bit-depthtiff16Bit depth (16 or 32)

See Commands Reference for detailed usage.