Skip to main content

aci_rssa

CI PyPI License: EUPL-1.2

Fast, streaming reader for MCNP RSSA (surface source) files, with a Rust core and a Polars-based Python API.

RSSA files record every particle that crosses a given surface during an MCNP (or D1S-UNED) simulation, and can easily reach tens or hundreds of gigabytes. aci_rssa memory-maps the file and decodes track records in parallel (via rayon), handing the result to Python as a Polars DataFrame — either all at once, or as a lazy, batch-at-a-time stream for files too large to fit in memory.

Installation

pip install aci_rssa

Prebuilt wheels are published for Linux, macOS, and Windows (x86_64/arm64) on CPython ≥3.10 — no Rust toolchain needed to install.

Quickstart

from aci_rssa import RSSA

rssa = RSSA.read_from_file("surface_source.w")
print(rssa)  # summary: surfaces, track/history counts, source code

rssa.tracks          # polars.DataFrame: history, particle_type, weight, energy,
                      # time, x, y, z, u, v, w, surface_id
rssa.neutron_tracks   # tracks filtered to neutrons
rssa.photon_tracks    # tracks filtered to everything else (typically photons)

Reading only the header (fast, never touches the potentially huge track data):

from aci_rssa import FileParameters

parameters = FileParameters.read_from_file("surface_source.w")
parameters.nrss       # number of tracks recorded
parameters.surfaces   # surfaces tracks were recorded on

Very large files

For files too large to load eagerly, scan_tracks returns a Polars LazyFrame backed by a Rust reader that decodes the file batch by batch, driven by Polars' query engine — filters and column selection are pushed down so you only decode what you need:

from aci_rssa import scan_tracks
import polars as pl

(
    scan_tracks("surface_source.w")
    .filter(pl.col("energy") > 1.0)
    .select("x", "y", "z", "energy")
    .collect(engine="streaming")
)

RSSAPlot and RSSASpectraPlot accept a LazyFrame directly, so a scan_tracks() result can be plotted without ever loading the file eagerly — construct them by hand instead of going through RSSA.read_from_file()/.plot_cyl()/.plot_plane(), which require an in-memory RSSA:

from aci_rssa import FileParameters, RSSAPlot, scan_tracks

parameters = FileParameters.read_from_file("surface_source.w")  # header only
plot = RSSAPlot(scan_tracks("surface_source.w"), parameters, x_col="x", y_col="y")

(
    plot.set_particle("n")
    .calculate_bins(bin_width=10)
    .get_particle_current(1e17)
    .show()
)

Plotting

rssa.plot_cyl(axis="z").show()      # particle density on a cylindrical surface
rssa.plot_plane(x="x", y="y").show()  # particle density on a planar surface
rssa.plot_spectra().show()            # energy spectrum

Development

This is a Cargo workspace (rssa-core, the pure-Rust parsing/decoding library, and rssa-python, its PyO3 bindings) plus a Python package in python/, built together with maturin.

python -m venv .venv && source .venv/bin/activate
pip install "maturin>=1.9.4,<2.0"
maturin develop --extras test,dev   # builds the extension module, installs test/dev deps

cargo test                          # Rust tests (rssa-core)
pytest                              # Python tests
ty check python/aci_rssa            # type checking

License

Licensed under the European Union Public Licence v1.2 (EUPL-1.2).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aci_rssa-0.0.6.tar.gz (59.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aci_rssa-0.0.6-cp310-abi3-win_arm64.whl (4.5 MB view details)

Uploaded CPython 3.10+Windows ARM64

aci_rssa-0.0.6-cp310-abi3-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.10+Windows x86-64

aci_rssa-0.0.6-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

aci_rssa-0.0.6-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

aci_rssa-0.0.6-cp310-abi3-macosx_11_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

aci_rssa-0.0.6-cp310-abi3-macosx_10_12_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file aci_rssa-0.0.6.tar.gz.

File metadata

  • Download URL: aci_rssa-0.0.6.tar.gz
  • Upload date:
  • Size: 59.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for aci_rssa-0.0.6.tar.gz
Algorithm Hash digest
SHA256 a7f1031851b2eeea66a1193e6c6fae03901d0af2b62bfb9fdbe1dd10301e5ecf
MD5 1a422ad296b2f7c3928474fc1875d076
BLAKE2b-256 dda575bbf1b7d9f8b7ad6633a5a20879574dbbd9ff34ad80cec4e0f9521d97f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for aci_rssa-0.0.6.tar.gz:

Publisher: release.yml on AlvaroCubi/aci_rssa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aci_rssa-0.0.6-cp310-abi3-win_arm64.whl.

File metadata

  • Download URL: aci_rssa-0.0.6-cp310-abi3-win_arm64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 3.10+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for aci_rssa-0.0.6-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 a9d0a5a46ff70904ddc0b0cda1a830297fa98ac81a1ca0464dfc1964e03a816d
MD5 60f159add012e0bf7f410769a51f8b86
BLAKE2b-256 545935c5fa6cb0fa49e938b0227b35b8500c03a696f2be41000757b3917553fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for aci_rssa-0.0.6-cp310-abi3-win_arm64.whl:

Publisher: release.yml on AlvaroCubi/aci_rssa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aci_rssa-0.0.6-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: aci_rssa-0.0.6-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.0 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for aci_rssa-0.0.6-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 032b1532765808f463a26d9a33b46531745d91a93390688aa73754950d5259dc
MD5 7078e0c2138d335a7a35b83bf6f5fbbb
BLAKE2b-256 0494c1711193365e3f2963716121c6f8007e7dcdfb7d26a5db027a3f4743631a

See more details on using hashes here.

Provenance

The following attestation bundles were made for aci_rssa-0.0.6-cp310-abi3-win_amd64.whl:

Publisher: release.yml on AlvaroCubi/aci_rssa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aci_rssa-0.0.6-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for aci_rssa-0.0.6-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0136c22848d8610e9f760709604843fbb219a36444e56fce643b3b5b850641a5
MD5 d8fb9c344aa4e9af6b4deace83d431d5
BLAKE2b-256 5696049378ce3c275c5642eef918a7ac0603d8225e7a79131c10ec1f585dc303

See more details on using hashes here.

Provenance

The following attestation bundles were made for aci_rssa-0.0.6-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on AlvaroCubi/aci_rssa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aci_rssa-0.0.6-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for aci_rssa-0.0.6-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 553baf752d711d244f2c781a261970ab201107b36f63ad0c1f5b77c65f372b1f
MD5 69b27d5d0b358fa6dcad475fd325624c
BLAKE2b-256 d65f973eb1e7566506c6d2bfb605627abc9a797783c3058b7787270e1eb46ff3

See more details on using hashes here.

Provenance

The following attestation bundles were made for aci_rssa-0.0.6-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on AlvaroCubi/aci_rssa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aci_rssa-0.0.6-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aci_rssa-0.0.6-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 749a40ad1057b3a71370bcb08b7fdec2ba41972a8694d45178b2b0079d0bb8f7
MD5 b82854876fdccc5973cc2b4d4d664fc1
BLAKE2b-256 45b75cc091c899aa1957b4b9d61839619c0a546a2afb505c457f4be6632cc0fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for aci_rssa-0.0.6-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on AlvaroCubi/aci_rssa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aci_rssa-0.0.6-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for aci_rssa-0.0.6-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e2d1f75e69de0a7db3793cbb758ee50efa354c2f28de07b51d7e8440ca8273d3
MD5 615f9f0160c3a72af453790c66b2c56d
BLAKE2b-256 a7e9e4b62f340c120ec836313eece5653ef5589b7c9707629cccf46da4af9309

See more details on using hashes here.

Provenance

The following attestation bundles were made for aci_rssa-0.0.6-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on AlvaroCubi/aci_rssa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page