aci-tallies
Read MCNP tally files, however large, into NumPy arrays: meshtal files (FMESH
mesh tallies), MCTAL files (F tallies) and D1SUNED's cell-under-voxel
files (cuvmsh, meshinfo), in Rust, from Python or Rust.
Install as aci-tallies, import as aci_tallies.
import aci_tallies
f = aci_tallies.open("meshtal", input="model.i") # or an MCTAL file; input optional
f.ids # tally numbers; f.tallies describes each, no values read
t = f[14] # read one tally
t.result, t.rel_error # read-only NumPy views, no copy
f.read(14, energy="total") # read only MCNP's Total energy bin of it
Opening a file indexes it in one parallel pass; values are read when asked for, a tally or part of one at a time, straight from disk into the arrays returned. A 50 GB file opens in well under a second, and only what you read is ever in memory.
crates/tallies(aci-tallies): the readers.common(file sources, the parallel scan, Fortran number parsing, bins, error propagation),meshtal,mctal,cuv.crates/geom(aci-tallies-geom): mesh geometry (voxels, volumes, centres, point location, VTK,TR=), dependency-light, shared with other mesh tools.crates/pyandpython/aci_tallies: the Python package. It needs only NumPy;to_polars,to_xarrayandto_pyvistaneed their extras (pip install 'aci-tallies[polars,xarray,vtk]', or[all]).
The MCNP input (input=, a path or an aci_tallies.Input to reuse) is
optional and read with migjorn: it gives
what the files leave out (below).
meshtal files
aci_tallies.meshtal.open(path, input=None) → MeshtalFile, a mapping from
tally number to MeshTally.
- Every
out=layout (col,cf,ij,ik,jk), rectangular and cylindrical meshes, energy and time bins and their Total bins. result/rel_erroralways have five axes,(energy, time, i, j, k); a mesh withoutEMESH/TMESHhas length 1 there. When an axis has more than one bin, MCNP's Total bin is one more index at its end (t.energy.total,t.energy.total_index), never dropped.t.volume(out=cf) is(i, j, k).t.geometryis the mesh:kind,axis_names(x y zorr z theta),bounds,origin/axis/vec,transform(4x4,TR=),volumes(),centers(),locate(points).f.read(id, energy=, time=)reads only those bins (an index or"total"); in the columnar layouts a bin's rows are consecutive, in the matrix ones a run of blocks, so nothing else is read.- Operations run in Rust, in parallel, without copying their inputs: `+ -
- /
(errors propagated as for independent quantities;t + tis not2 * t),isel(energy=, time=, i=, j=, k=)with ints, slices or"total",integrate_energy()/integrate_time()(MCNP's Total bin when printed: its error comes from the histories, which summing can't reproduce),integrate_space()`.
- /
to_polars()/to_parquet()(one row per value; an axis with one bin gets no columns),to_xarray(),to_pyvista()(every field and bin attached),to_vtk(path)(written by Rust, no PyVista needed).
In Rust, aci_tallies_geom::mcnp_input reads the FMESH cards of an
input exactly (read_fmeshes) and writes them (FmeshCard::to_input, with
the TRn card of a TR=): a written card reads back the same, bounds to
the bit, and MCNP scores it as the card it came from.
What a meshtal file can't tell you
Found by running MCNP 6.2 and 6.3 on purpose-built inputs
(tests/fixtures/pencil_beam*.mcnp: one ray through void, so every voxel
scores exactly chord / volume). The input fixes the first two and the third:
- Bounds are rounded to 2 decimals (theta 3), origin and axes to 3 significant digits: geometry rebuilt from them is off by up to ~0.2% (~2% for an unround cylinder origin), and bins finer than 0.01 cm collapse (with a warning). Values are unaffected.
TR=leaves no trace.tally.geometry_from_inputsays which you got.*FMESHlooks likeFMESH; only the input says (energy_weighted).- Bounds around ±1e5–1e6 cm overflow MCNP's fixed-width fields: such a
section is listed in
f.failed.
MCTAL files
aci_tallies.mctal.open(path, input=None) → MctalFile, a mapping from
tally number to Tally.
result/rel_erroralways have MCNP's eight axes, in the order the file lists values:f d u s m c e t(cells or surfaces, direct, user, segments, multipliers, cosines, energies, times).t.axes["e"]has an axis's bins: MCTAL gives upper bounds only (Axis.upper), and flags a Total bin (total, last index) or cumulative bins (cumulative).f.read(id, f=slice(...))reads only those cells:fvaries slowest, so their values are a run of lines.f.read(id, perturbation=n)reads aPERTcard's values;f.kcodehas a KCODE run's estimates per cycle (a named column each);t.tfcthe fluctuation chart.- Detectors (point, ring, radiography grids),
*F/+F, user bins, legacy TMESH mesh tallies (their cells are thefbins, first axis fastest). isel(f=, e=, ...),integrate("e", "t"),+ - * /,to_polars(),to_xarray().
What an MCTAL file can't tell you
Found by running MCNP 6.2 and 6.3 on tests/fixtures/mctal/*.mcnp:
- The
fline names a bin only by its first level, and only when that is one cell or surface:(8 < 7[2 0 0] < 3)is listed as8, a group(1 2)as0, and the T bin as0unless every bin starts with the same cell.t.numbershas these. - With the input,
t.binshas what each bin is: every level, groups, lattice elements, the T bin, expanded the way MCNP expands the F card (str(bin)is the name MCNP's output gives it,"(8<7[1 0 0]<3)"). They are checked against the file, and left out with a warning if they don't match. In a chain a level of several cells or a lattice range makes one bin each, innermost level fastest, first lattice index fastest; a parenthesized level is one union. - Values below 1e-99 are printed without the
E(2.50000-113), in MCTAL and meshtal files alike: read exactly here (some other readers take them for 0).
CuV files (D1SUNED)
An FMESH with out=cuv (D1SUNED's cell-under-voxel mesh) is not written to
the meshtal file but to two files holding every CuV mesh of the run: the
meshinfo gives each (voxel, cell) pair's material, density and share of
the voxel's volume, the cuvmsh the same pairs with their flux spectra.
from aci_tallies import cuv
f = cuv.open("cuvmsh", input="model.i") # or a meshinfo; aci_tallies.open works too
p = f[14] # CuvPairs: every (voxel, cell) pair of mesh 14
p.voxel, p.cell, p.fraction, p.flux # flux: (pair, energy), per cm² and source particle
f.read(14, voxels=slice(0, 10_000)) # only those voxels' part of the file
both = cuv.open_mesh("cuvmsh", "meshinfo") # + material and density, pairs checked equal
f.to_mesh(14) # MeshTally of voxel fluxes: to_vtk, isel, ...
- Pairs come voxel by voxel in the mesh's flat order (
voxel, asGeometry.locatenumbers them); each voxel's printed centre is checked against the geometry, so a file in another order is refused. to_polars()(a row per pair;spectra=True: per pair and energy bin),to_xarray()(dimensionspair,energy).to_meshsums each voxel's cells, flux × volume share: what the same FMESH withoutout=cuvscores (to its 6 printed digits,tests/fixtures/d1suned). Its errors are combined as if the cells were independent: they aren't, and the estimate ran 2–18% low there.- The headers round the geometry like a meshtal header (and the energy
bounds to 3 digits) and leave out
TR=;input=gives the FMESH card's exact ones. D1SUNED's own keywords (sppts,spmode, ...) are known. - D1SUNED 3.x meshinfo files of cylinders (theta in radians, volumes 2π too
large) are corrected (
legacy_cylindrical). - D1SUNED 4.1.3.2 crashed writing a cylindrical CuV mesh with 2 energy bins ("output statement overflows record"); 20 bins ran.
Reliability
A damaged part of a file never stops the rest from being read: a bad row
or line leaves its values NaN with a ReadWarning (with its line number),
an unreadable section or tally is listed in f.failed, and every value is
where it belongs whatever is missing around it. A file changed since it was
opened is reported, never misread. Checked against MCNP 6.2 and 6.3 output
with exact expected values, property tests of the chunked parsing, and, for
MCTAL, F4Enix's reader (identical wherever it reads right).
Performance
On 96 cores, files in the OS cache:
| file | open | read all | peak memory |
|---|---|---|---|
| meshtal, 6.6 GB, 14 tallies | 0.06 s | 0.33 s | 1.6 GB (the arrays) |
| MCTAL, 2 GB, 104M values | 0.11 s | 0.22 s | 1.7 GB (the arrays) |
One bin of a 2.5M-voxel mesh tally: 0.01 s; ten cells of a 4M-cell MCTAL
tally: 1 ms. One core reads about 0.6–0.9 GB/s. The previous version read
the meshtal file in 3.3 s with 5.1 GB of memory (it held a section's text).
cargo run --release --example meshtal -- <file> --all (or mctal) times
a file and prints a checksum per tally.
Rust
use aci_tallies::{common::Input, mctal, meshtal};
let input = Input::read("model.i")?;
let mesh = meshtal::Reader::open_with_input("meshtal", &input)?;
let bin = mesh.read_bin(14, 0, 0)?; // one energy and time bin
let cells = mctal::Reader::open_with_input("mctal", &input)?;
let part = cells.read_f(4, 0..10)?; // ten cells of tally 4
aci_tallies::detect(head) tells the formats apart from a file's first
bytes.
Development
cargo test --workspace
python -m venv .venv && . .venv/bin/activate
pip install maturin && maturin develop --release # the extension, into the venv
pip install -e ".[dev]"
pytest tests/python && mypy python/aci_tallies tests/python && ruff check python tests
maturin develop without --release builds a debug extension, 10–30x
slower at parsing. The fixtures under tests/fixtures are MCNP output; each
.mcnp says how to regenerate it (tests/fixtures/d1suned: its README).
License
Metadata
Release files for aci-tallies 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aci_tallies-0.1.0.tar.gz | 162.9 kB | With provenance | Details for aci_tallies-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 7.6 MB
Release files / aci_tallies-0.1.0.tar.gz
| Download URL | aci_tallies-0.1.0.tar.gz |
|---|---|
| Size | 162.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ace463c59320bed69992e3a46dc6aaefc48b5663e18060ef624b6c41bee29796
|
|
BLAKE2b-256 checksum How to use checksums |
edf12bbd277c2f03621e41887dd590a2d6c2dd740b0c5a4bf53c753211f89e2c
|
| 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 Nov 13, 2026.
Transparency logRelease files / aci_tallies-0.1.0-cp310-abi3-win_amd64.whl
| Download URL | aci_tallies-0.1.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 930.5 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d1748ff6228ab03774da7bd0a8c2cda81dcd829ebb064c440e0e3ecbecf1c757
|
|
BLAKE2b-256 checksum How to use checksums |
c4242f37383c1923d2a8ea0fd6202c59d14bdcfd52d5585cc4bff4698d3b8ef0
|
| 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 Nov 13, 2026.
Transparency logRelease files / aci_tallies-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | aci_tallies-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
30689d403c6eab7846ed3ce83980bee4923ecdde1cacf28142e8fb7829bf6ba7
|
|
BLAKE2b-256 checksum How to use checksums |
d85b8b2dee4ca1ae1dbf47288ea91805488d70d6c2fcb39fe1f756e9e2c016a0
|
| 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 Nov 13, 2026.
Transparency logRelease files / aci_tallies-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | aci_tallies-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
4d34dac98234a2c1804e4d3d1b2cd2b858fccce6cdcddbc4f1861002a532346b
|
|
BLAKE2b-256 checksum How to use checksums |
d530e215ff3523297e04084a5c5cdfe21180cc3657685fd55e03069f088c60bc
|
| 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 Nov 13, 2026.
Transparency logRelease files / aci_tallies-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | aci_tallies-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fef8d1f0e2cb90ff39499ab3ca5cec77e67203c258f81916df8fd53633519b5e
|
|
BLAKE2b-256 checksum How to use checksums |
9b1d7fad25ea44d0dd4a6d2846888346e0696c278d0274ba37c86ab767c4cc85
|
| 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 Nov 13, 2026.
Transparency logRelease files / aci_tallies-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | aci_tallies-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3286975a377971d88b0b8a67de5773ea67fef2a5d6bee8318793b574e93c1557
|
|
BLAKE2b-256 checksum How to use checksums |
382506ddc3dfde175d24b6fa3d435c1aebaf9a99e76efae7b5f15b3f8fdf2107
|
| 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 Nov 13, 2026.
Transparency logRelease files / aci_tallies-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | aci_tallies-0.1.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 969.9 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
424071b9e73ec258336abb5791efb33e056e43ed1495f5f1a36b87ea230d9540
|
|
BLAKE2b-256 checksum How to use checksums |
857f51e610006da59e3b48f88547b437a16a2293061aaf7db382577e44cedf90
|
| 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 Nov 13, 2026.
Transparency logRelease files / aci_tallies-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | aci_tallies-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
e3735fe3e93b1e0d6b6d98417b15add5ef99e936a43ae2c18226987368c2058e
|
|
BLAKE2b-256 checksum How to use checksums |
3bcb4d807f94dd9ad543014f77c98a292fcc5829f16bb53609f50dda710431bb
|
| 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 Nov 13, 2026.
Transparency logSecurity for aci-tallies 0.1.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 8 files in this release have been uploaded with provenance metadata.
Attestation for aci_tallies-0.1.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 Nov 13, 2026.
Transparency logA 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.