Python API
Nucleide exposes a typed pure-Python package at python/nucleide/ that re-exports
a compiled PyO3 extension built from bindings/python/. The extension module is
named nucleide._internal; users import from the nucleide domain submodules,
which mirror the Rust workspace crates.
Module layout
import nucleide as nuc
The top level carries version(), nucleide.__version__, and the domain
submodules below (so nuc.nuclei.Nuclide(...) works directly). Each submodule
re-exports its symbols from nucleide._internal:
| Submodule | Backing crate | Contents |
|---|---|---|
nucleide.nuclei | nuclei | Nuclide/particle identifiers, nuclear data, reaction names |
nucleide.material | material | Compositions, compendium, activity, XML export |
nucleide.mcnp | mcnp-io | MCNP file readers and writers |
nucleide.serpent | serpent-io | Serpent output readers |
nucleide.fluka | fluka-io | FLUKA USRBIN readers |
nucleide.vr | vr-tools | MAGIC weight windows, source sampling |
nucleide.enrichment | enrichment | Enrichment cascades |
nucleide.depletion | depletion | Depletion chains and CRAM solves |
nucleide.data | — (pure Python) | Release-pinned data-file downloads |
nucleide.nuclei
Nuclide(name)— canonical nuclide identifier with cross-code name conversions.from_zaid(zaid)→Nuclidefrom an MCNP ZAID integer.Particle(spec)— particle species with MCNP/FLUKA/Geant4 translations.atomic_mass(key)— by nucid integer or name.natural_abundance(key)half_life(key)decay_constant(key)q_value_capture(key)q_value_alpha(key)rxname_id(name)→ reaction idrxname_name(id)→ namerxname_mt(id)→ ENDF MT number
nucleide.material
from_formula(formula)→ compositiondictMaterialsCompendium.load(path)→MaterialsCompendiumactivity(comp)→ activitydictto_xml(comp, name, density, units="g/cm3")→ materials XML string
nucleide.mcnp
read_xsdir(path)→Xsdirread_meshtal(path)→Meshtalread_wwinp(path)→Wwinpread_mctal(path)→Mctalread_ssw(path)→SurfSrcread_ptrac(path)→PtracFilewrite_ssw(ssw, path, tracks=None)read_inp(path)→ list of materialdictsmesh_to_geom(...)→ MCNP geometry deck string
nucleide.serpent
read_serpent(path, kind)→ structureddict
nucleide.fluka
read_usrbin(path)→ list ofUsrbinTally
nucleide.vr
magic(tally, per_group=False, tolerance=0.5)→MagicOutputAliasTable(pdf)— Walker alias table for discrete samplingMeshSourceSampler(tally, mode, user_pdf=None)— mesh source sampler
nucleide.enrichment
Cascade.default_uranium()→Cascadec.solve(tolerance=None, max_iterations=None)c.solve_multicomponent(tolerance=None, max_iterations=None)— M*-optimizing multicomponent solve
nucleide.depletion
read_chain(path)→Chainbuild_depletion_system(chain, rates)→DepletionSystemsystem.solve(n0, dt, order=48)→ resultdictsystem.solve_vec(n0, dt, order=48)→ resultlistin chain nuclide orderdeplete(chain, n0, dt, rates=None, order=48)→ resultdict
nucleide.data
Pure-Python helpers (no backing crate) for downloading repo data files that the wheel does not bundle, pinned to the installed release:
fetch(path, ref=None, dest=".")→ local pathstrof a repo-relative file (e.g."fixtures/depletion/chain_simple.xml")fetch_compendium(ref=None, dest=".")→ local pathstrof the Materials Compendium JSONdefault_ref()→ the installed version’s tag (e.g."v0.1.0"); passref="main"or a commit SHA to override
Version
version()→ workspace version stringnucleide.__version__— same value
For full type signatures, see python/nucleide/_internal.pyi.