Skip to main content

Nuclear data as Parquet — queryable with DuckDB

Project description

nucl-parquet

Nuclear data as Parquet files — cross-sections, stopping powers, decay data, and isotopic abundances from all major evaluated libraries. Queryable with DuckDB, Polars, Pandas, or any Arrow-compatible tool.

Installation

pip install nucl-parquet

The pip package is a thin loader (~50 KB). Data files are either cloned from the git repo or downloaded from GitHub Releases:

import nucl_parquet

# Download data to ~/.nucl-parquet/ (first time only)
nucl_parquet.download()

Or clone the repo directly for the full dataset:

git clone https://github.com/exoma-ch/nucl-parquet.git
export NUCL_PARQUET_DATA=/path/to/nucl-parquet

Usage

import nucl_parquet

db = nucl_parquet.connect()

# Cross-section query
db.sql("SELECT * FROM tendl_2024 WHERE target_A=63 AND residual_Z=30")

# Compare all libraries
db.sql("SELECT library, energy_MeV, xs_mb FROM xs WHERE target_A=63 AND residual_Z=30")

# Decay chain
db.sql(nucl_parquet.DECAY_CHAIN_SQL, params={"parent_z": 92, "parent_a": 238})

# Stopping power
nucl_parquet.elemental_dedx(db, "p", 29, 10.0)  # protons in Cu at 10 MeV
nucl_parquet.compound_dedx(db, "p", [(29, 0.5), (30, 0.5)], 10.0)

Data resolution

connect() finds data in this order:

  1. Explicit data_dir argument
  2. $NUCL_PARQUET_DATA environment variable
  3. Sibling repo checkout (when running from source)
  4. ~/.nucl-parquet/ (downloaded via nucl_parquet.download())

Why Parquet instead of ENDF-6?

The ENDF-6 format dates from the 1960s. It was designed for Fortran on punch cards: 80-character fixed-width records, implicit column positions, and a cryptic MF/MT numbering system.

ENDF-6 Parquet
Format Fixed-width Fortran text, 80-char cards Columnar binary, self-describing schema
Parsers needed Specialized (NJOY, PREPRO, FUDGE, endf pkg) Any language — Python, R, Julia, Rust, JS, SQL
Random access Sequential parse from start Predicate pushdown, skip irrelevant row groups
Compression None (or gzip'd text) zstd columnar compression (5-10x smaller)
Cross-library comparison Convert each library separately first SELECT * FROM '*/xs/p_Cu.parquet'
Browser/WASM Not feasible Works natively (DuckDB-WASM, Pyodide)

Size comparison for the same data:

Library ENDF-6 (zipped) Parquet (zstd) Reduction
TENDL-2025 neutron ~800 MB (2850 zip files) 25 MB 32x
ENDF/B-VIII.1 (all) ~120 MB 4.3 MB 28x
JENDL-5 (all) ~200 MB 8.6 MB 23x

Libraries included

Library Projectiles Source
TENDL-2024 n, p, d, t, ³He, α IAEA/PSI
TENDL-2025 n, p, d, t, ³He, α PSI
ENDF/B-VIII.1 n, p, d, t, ³He, α NNDC/BNL
JEFF-4.0 n, p NEA
JENDL-5 n, p, d, α JAEA
CENDL-3.2 n CIAE
BROND-3.1 n IPPE
FENDL-3.2 n IAEA
EAF-2010 n CCFE
IRDFF-II n IAEA
IAEA-Medical p, d IAEA
EXFOR n, p, d, t, ³He, α IAEA NDS (experimental)

Parquet schemas

Evaluated cross-sections ({library}/xs/*.parquet):

Column Type Description
target_A Int32 Target mass number
residual_Z Int32 Product atomic number
residual_A Int32 Product mass number
state Utf8 Isomer state: "", "g", "m"
energy_MeV Float64 Projectile energy in MeV
xs_mb Float64 Cross-section in millibarn

EXFOR experimental (exfor/*.parquet):

Column Type Description
exfor_entry Utf8 EXFOR accession number
target_Z Int32 Target atomic number
target_A Int32 Target mass number (0 = natural)
residual_Z Int32 Product atomic number
residual_A Int32 Product mass number
state Utf8 Isomer state
energy_MeV Float64 Projectile energy in MeV
energy_err_MeV Float64 Energy uncertainty (nullable)
xs_mb Float64 Cross-section in millibarn
xs_err_mb Float64 Cross-section uncertainty (nullable)
author Utf8 First author
year Int32 Publication year

Stopping powers (stopping/stopping.parquet):

Column Type Description
source Utf8 PSTAR, ASTAR, ICRU73, MSTAR
target_Z Int32 Target element
energy_MeV Float64 Projectile energy
dedx Float64 Stopping power (MeV cm²/g)

Development

# Install dev dependencies
uv sync --dev

# Run unit tests (no data needed)
uv run pytest tests/test_loader.py -v

# Run full test suite (requires data)
uv run pytest tests/ -v

License

MIT

Project details


Download files

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

Source Distribution

nucl_parquet-0.3.6.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

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

nucl_parquet-0.3.6-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file nucl_parquet-0.3.6.tar.gz.

File metadata

  • Download URL: nucl_parquet-0.3.6.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nucl_parquet-0.3.6.tar.gz
Algorithm Hash digest
SHA256 7fd71d18565e72033e0631c4e578ef712ab03b769a85178e0eadb66ca189eac8
MD5 84149696e4dee3ce4d92cfb462b9e468
BLAKE2b-256 816c6a6b225fe667e35e881574db58ee1abac0e18c83ba2b9d8752a519837566

See more details on using hashes here.

Provenance

The following attestation bundles were made for nucl_parquet-0.3.6.tar.gz:

Publisher: release.yml on exoma-ch/nucl-parquet

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

File details

Details for the file nucl_parquet-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: nucl_parquet-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nucl_parquet-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6f865de831fa9a6105ed6d1622b7fba3eca2f3ce0986456c2b25d0c8ae7a7b1a
MD5 2d57633c9b6072fbde26edb52d169c4f
BLAKE2b-256 831e023aadd537d8777941d9eb3372d74b12d959b98653fd2b7e5d7a42af0694

See more details on using hashes here.

Provenance

The following attestation bundles were made for nucl_parquet-0.3.6-py3-none-any.whl:

Publisher: release.yml on exoma-ch/nucl-parquet

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