API reference
The reference below is generated by mkdocstrings from the type stubs shipped
inside the installed yani wheel. Classes appear under their public names
(yani.Material, yani.PulseSchedule, ...) rather than the private yani._core
extension module they live in.
The members are grouped by what they are for. The get_*/set_* accessors
behind nuclear-data settings are documented as the settings themselves under
Nuclear data settings. Public submodules are
listed below under the names used in examples, such as
yani.sources.Histogram and yani.shapes.FoilLump.
Materials
yani.Material
Material(composition: dict[str | Nuclide, float | Enriched], density: float, *, density_units: str = 'g/cm3', name: Optional[str] = None, id: Optional[int] = None, fraction_type: str = 'atom', transmutable: bool = False, volume: Optional[float] = None, temperature: Optional[float] = None, s_alpha_beta: str | list[str] | dict[str, float] | None = None)
A homogeneous mixture of nuclides at a fixed density and temperature.
A Material is built from a composition dictionary whose keys may be
nuclide names ("Fe56"), element symbols ("Fe"), chemical formulas
("H2O"), or :class:Nuclide objects, and whose values are atom or
weight fractions (or :func:enriched specifications). Density is always a
float; density_units sets its meaning (g/cm3 by default, or
atom/barn-cm for a total atom density). For absolute per-nuclide atom
densities use :meth:Material.from_atom_densities.
Every Material has an id from construction: the one passed to the
constructor, or else a fresh one that no earlier material in the process
was given, so a yamc.Tally can filter on it before any geometry exists.
Materials may also carry a name, volume (cm³), temperature (K), and a
transmutable flag that marks them for depletion by
Model.simulate_transmutation (not needed for Material.transmute()).
Examples:
>>> import yani
>>> water = yani.Material(composition={"H2O": 1.0}, density=1.0)
>>> iron = yani.Material(
... composition={"Fe54": 0.0585, "Fe56": 0.9175,
... "Fe57": 0.0212, "Fe58": 0.0028},
... density=7.874, name="iron")
Create a new material with a declarative composition and density.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
composition
|
dict[str | Nuclide, float | Enriched]
|
Material composition.
Keys are element symbols ("Fe"), nuclide names ("Fe56"),
chemical formulas ("H2O"), or |
required |
density
|
float
|
Density value, interpreted per |
required |
density_units
|
str
|
Density units: "g/cm3", "g/cc", "kg/m3", or "atom/barn-cm" (total atom density; requires fraction_type="atom"). |
'g/cm3'
|
name
|
Optional[str]
|
Name for the material. |
None
|
id
|
Optional[int]
|
ID for the material. Defaults to a fresh one, which no earlier material was given. |
None
|
fraction_type
|
str
|
"atom" for atom fractions or "mass" for mass fractions. |
'atom'
|
transmutable
|
bool
|
Mark this material for depletion by
|
False
|
volume
|
Optional[float]
|
Material volume in cm³. |
None
|
temperature
|
Optional[float]
|
Temperature in Kelvin. If omitted, 294 K is used, or the only temperature the nuclear data carries when it carries just one. |
None
|
s_alpha_beta
|
str | list[str] | dict[str, float] | None
|
Thermal
scattering tables for bound nuclides, by name, such as
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Material |
Material
|
A new material. |
Source code in yani/_core/__init__.pyi
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | |
name
property
writable
name: Optional[str]
Get the name of the material
s_alpha_beta
property
writable
s_alpha_beta: dict[str, float]
The thermal scattering tables this material uses, as a dict of table name to the fraction of its nuclides that is bound.
thermal_bindings
property
thermal_bindings: dict[str, list[str]]
The nuclides each loaded thermal scattering table applies to, as a dict of table name to nuclide names. Empty until the nuclear data is read.
id
property
writable
id: int
The material's ID.
Assigned when the material is built: the id given to the
constructor, or else a fresh one that no earlier material in the
process was given. Copies keep it, as do the materials a transmutation
result returns, which keep their original's. Setting it replaces it,
but a tally keeps the IDs it was built with. Two different Material
objects with one ID are refused where they meet, in a yamc.Geometry
(its cells and their mesh fills) or a yamc.MeshGeometry, and a
yamc.Tally refuses one ID listed twice.
transmutable
property
writable
transmutable: bool
Whether this material is marked for depletion by Model.simulate_transmutation.
Only the coupled model driver reads this: in a geometry of many materials
it selects which ones to deplete. Material.transmute() ignores it, so
you do not need to set it for a standalone transmutation.
fraction_type
property
fraction_type: str
Get the percent type ("atom" or "mass") for this material's nuclide fractions.
nuclides
property
nuclides: list[tuple[str, float]]
Get the material nuclides as a tuple of (name, fraction) pairs.
When the Material was constructed via the Python API, the order matches the user's composition dict (with each input key's expanded nuclides sorted alphabetically). Nuclides added later (e.g. by transmutation) appear alphabetically at the end. When no input order is tracked, all nuclides are alphabetical.
volume
property
writable
volume: Optional[float]
Material volume in cm^3, if set.
density
property
density: float
Density value, in the material's density_units. Always a float: for
"atom/barn-cm" (and transmuted materials) it is the total atom
density, otherwise the mass density.
density_units
property
density_units: str
Density units string ("g/cm3", "kg/m3", or "atom/barn-cm").
temperature
property
writable
temperature: str
Temperature label in Kelvin (e.g. "293").
reaction_mts
property
reaction_mts: list[int]
Sorted list of all unique MT reaction numbers present.
from_atom_densities
staticmethod
from_atom_densities(atom_densities: dict, *, name: Optional[str] = None, id: Optional[int] = None, transmutable: bool = False, volume: Optional[float] = None, temperature: Optional[float] = None) -> Material
Build a material directly from absolute per-nuclide atom densities.
Stores the given atoms/barn-cm values verbatim (no normalize-then-recombine
round-trip), so callers that already hold raw number densities -- e.g. the
transmutation stepper -- keep full precision. density then reports the
sum of the values. This replaces the old Material(comp, density="sum").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atom_densities
|
dict[str, float]
|
nuclide name -> atoms/barn-cm. |
required |
name
|
Optional[str]
|
Name for the material. |
None
|
id
|
Optional[int]
|
ID for the material. Defaults to a fresh one, which no earlier material was given. |
None
|
transmutable
|
bool
|
Mark this material for depletion by
|
False
|
volume
|
Optional[float]
|
Material volume in cm³. |
None
|
temperature
|
Optional[float]
|
Temperature in Kelvin. If omitted, 294 K is used, or the only temperature the nuclear data carries when it carries just one. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Material |
Material
|
A material whose composition is absolute atom densities. |
Source code in yani/_core/__init__.pyi
1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 | |
get_nuclide_names
get_nuclide_names() -> list[str]
Return a list of nuclide names currently present in the material.
Source code in yani/_core/__init__.pyi
1352 1353 1354 1355 | |
read_nuclear_data
read_nuclear_data(nuclide_path_map: Optional[Any] = None, photon_data: Optional[Mapping[str, str]] = None) -> None
Bulk load nuclear data from a mapping of nuclide -> file path or a keyword string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nuclide_path_map
|
Optional[Dict[str, str] | str]
|
Mapping of nuclide names to file paths or a keyword string. |
None
|
photon_data
|
Optional[Dict[str, str]]
|
Mapping of element symbols to photon Arrow data paths. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If any file cannot be read / parsed. |
Source code in yani/_core/__init__.pyi
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 | |
calculate_microscopic_xs_neutron
calculate_microscopic_xs_neutron(mt_filter: Optional[Sequence[int]] = None) -> dict[str, dict[int, list[float]]]
Calculate microscopic neutron cross sections on the unified energy grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mt_filter
|
Optional[List[int]]
|
Restrict to these MT numbers. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, dict[int, list[float]]]
|
Dict[str, Dict[int, List[float]]]: nuclide -> MT -> xs array |
Source code in yani/_core/__init__.pyi
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 | |
get_atoms_per_barn_cm
get_atoms_per_barn_cm() -> dict[str, float]
Number density (atoms / barn-cm) per nuclide.
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Dict[str, float]: nuclide -> atoms / b-cm |
Source code in yani/_core/__init__.pyi
1390 1391 1392 1393 1394 1395 1396 | |
activity
activity(*, by_nuclide: bool = False, per: Optional[str] = None) -> Any
Calculate the radioactive activity of the current material inventory.
The material must have a volume in cm³. Atom densities are converted
to total atoms using atoms/barn-cm * 1e24 * volume. The decay data
(transmutation_decay_data, which has no default) provides
half-lives; each nuclide's activity is N * ln(2) / half_life.
Stable nuclides are omitted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
by_nuclide
|
bool
|
Return a |
False
|
per
|
str | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
Any
|
float | dict[str, float]: Activity, in Bq when |
Any
|
Bq/cm³ when it is |
Any
|
a |
Source code in yani/_core/__init__.pyi
1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | |
decay_heat
decay_heat(*, by_nuclide: bool = False, per: Optional[str] = None, component: Optional[str] = None) -> Any
Calculate decay heat from the current material inventory.
The material must have a volume in cm³. Atom densities are converted
to total atoms using atoms/barn-cm * 1e24 * volume. The decay data
(transmutation_decay_data, which has no default) provides
half-lives and mean decay energies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
by_nuclide
|
bool
|
Return a |
False
|
per
|
str | None
|
|
None
|
component
|
str | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
Any
|
float | dict[str, float]: Decay heat, in W when |
Any
|
W/cm³ when it is |
Any
|
|
Source code in yani/_core/__init__.pyi
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 | |
decay_photon_spectrum
decay_photon_spectrum(*, per: Optional[str] = None) -> tuple[list[float], list[float]]
The decay photon line spectrum of the current inventory.
The material must have a volume in cm³. Each nuclide's atom count
multiplies the line intensities the transmutation chain records for it,
which are per atom per second (the emission probability already times
the decay constant), so the values are photons per second rather than
probabilities. Lines at the same energy are summed and the result is
ascending in energy. Stable nuclides, nuclides the chain does not know
and non-photon sources contribute nothing.
Lines only. Part of some decay spectra is a continuum, a density per eV
rather than a set of lines, and decay_photon_continua() returns it.
The two lists are the (x, p) pair the source distributions take, so
the lines round-trip straight into a photon transport source:
>>> energies, rates = activated.decay_photon_spectrum()
>>> source = PhotonSource(energy=sources.Discrete(energies, rates))
Discrete normalizes the weights, so the shape is what transport
samples. sum(rates) is the line emission rate (photons/s) only,
the rate that scales tallies from this source. That source leaves out
every continuum, which for a continuum emitter can be most of its
photons (all of them for Sm158 in ENDF/B-VIII.1); the continua emit
sum(c.emission_rate for c in activated.decay_photon_continua())
more. No sources distribution yet holds a linear-linear continuum
exactly, so a transport source cannot yet carry every continuum.
Returns:
| Type | Description |
|---|---|
list[float]
|
tuple[list[float], list[float]]: Line energies (eV) and their |
list[float]
|
emission rates (photons/s). |
Source code in yani/_core/__init__.pyi
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 | |
decay_photon_continua
decay_photon_continua(*, per: Optional[str] = None) -> list[PhotonContinuum]
The decay photon continua of the current inventory, one per nuclide and continuum, in nuclide-name order.
The part of a decay spectrum ENDF gives as a density over energy rather
than as lines, which decay_photon_spectrum() does not include. Each
continuum keeps its own energy grid and interpolation law, and its
rates are photons/s/eV (or per cm³ or per g, following per), so
they are not line rates; emission_rate is the integral. A material
whose nuclides have no continuum returns an empty list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
per
|
str | None
|
None for the whole material, which needs a
|
None
|
Returns:
| Type | Description |
|---|---|
list[PhotonContinuum]
|
list[PhotonContinuum]: The continua, each with its nuclide, |
list[PhotonContinuum]
|
energies, rates, interpolation law and emission rate. |
Examples:
>>> for continuum in activated.decay_photon_continua():
... print(continuum.nuclide, continuum.emission_rate)
Source code in yani/_core/__init__.pyi
1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | |
contact_dose
contact_dose(*, dose_quantity: str = 'absorbed-air', build_up: float = 2.0, by_nuclide: bool = False) -> Any
Contact dose rate from the material's own decay photons.
The dose someone receives with a hand on the material. It is a slab
estimate rather than a transport result: the material is taken to be a
half-space, so half the photons emitted at any depth head for the
surface and the ones that arrive are the ones the material did not
attenuate itself. That leaves no distance and no volume in the answer --
unlike activity and decay_heat, this needs no material.volume
and a bigger lump of the same material reads the same.
Per photon line of energy E and per-atom emission rate S the
estimate is (build_up / 2) * (response(E) / mu_material(E)) * S * E
for the absorbed dose in air, and the same without the trailing E
for the effective dose. mu_material is the material's own linear
attenuation coefficient, built from the NIST XCOM mass attenuation
coefficients of the elements present; the response is the NIST-126
mass energy-absorption coefficient of air, or the ICRP-116 photon
effective-dose coefficient for anterior-posterior irradiation.
Follows the FISPACT-II manual (UKAEA-CCFE-RE(21)02, Appendix C.7.1) for
the absorbed-air quantity. For photon lines it agrees with OpenMC's
Material.get_photon_contact_dose_rate. A photon continuum is
integrated exactly under its evaluated interpolation law.
Bremsstrahlung from decay electrons is not modelled, and nuclides whose radiation the chain file does not describe contribute nothing. Photon lines outside the tabulated range (1 keV to 20 MeV for the absorbed-air quantity, 10 keV to 20 MeV for the effective dose) are dropped, and a continuum is integrated over its part of that range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dose_quantity
|
str
|
|
'absorbed-air'
|
build_up
|
float
|
Build-up factor standing in for the photons that scatter in the slab and still arrive. Default 2.0, as the FISPACT-II manual suggests. |
2.0
|
by_nuclide
|
bool
|
Return a |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
float | dict[str, float]: Contact dose rate in Gy/h |
Any
|
( |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a nuclide in the material has a photon continuum in the dose tables' range that this build cannot integrate: one whose data states no interpolation law, as transmutation data written before the law was stored does, one tabulated under a law other than histogram or linear-linear, or one whose energy and rate lists are unpaired, whose energies are not finite or descend, or whose rates are negative or not finite. Its integral is unknown, and leaving it out would understate the dose. |
Examples:
>>> activated.contact_dose()
380.088...
>>> activated.contact_dose(by_nuclide=True)
{'Co60': 380.088...}
>>> activated.contact_dose(dose_quantity='effective')
380.728...
Source code in yani/_core/__init__.pyi
1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 | |
clearance_index
clearance_index(limit_set: str, *, metal: bool = False, apply_default_limit: bool = True, exclude_daughters: bool = True) -> ClearanceResult
Clearance index of the current inventory against one regulatory limit set.
Each radionuclide's activity is divided by its limit in the set and the
ratios are summed; the material meets the limits when the sum is below
the set's threshold, normally 1. The limit sets cover UK, German, US, EU
and IAEA clearance, exemption and disposal tables, and come from the
radiological-material-clearance-finder crate, whose documentation
describes each one and where its numbers come from.
Half-lives come from the configured transmutation chain, the same ones
activity() and decay_heat() use, so a nuclide the chain calls
stable contributes nothing. Specific activities (Bq/g) need nothing
beyond the composition, and the volumetric US sets (Ci/m3) use the mass
density the atom densities imply. Only the total activity sets (Bq)
need material.volume.
Stable isotopes have to stay in the material: they are most of its mass, and so most of the Bq/g denominator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit_set
|
str
|
Name of the limit set, such as
|
required |
metal
|
bool
|
Whether the material is activated metal, which changes some NRC limits and adds others. |
False
|
apply_default_limit
|
bool
|
Whether to apply the set's catch-all limit to nuclides its table does not list. The UK regulations define one, so leaving this on is what they say. |
True
|
exclude_daughters
|
bool
|
Whether to leave out daughters whose parent's limit already covers them, as the regulation's own table directs. Turning it off double counts them. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
ClearanceResult |
ClearanceResult
|
The index, whether it clears, each nuclide's |
ClearanceResult
|
contribution, and any activity no limit in the set covers. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no limit set has that name. |
ValueError
|
If the set is in Bq and the material has no volume. |
Examples:
>>> result = material.clearance_index("UK_EPR16_out_of_scope")
>>> result.index
11.24...
>>> result.clearable
False
Source code in yani/_core/__init__.pyi
1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 | |
clearance_indices
clearance_indices(limit_sets: Optional[Sequence[str]] = None, *, metal: bool = False, apply_default_limit: bool = True, exclude_daughters: bool = True) -> dict[str, ClearanceResult]
Clearance indexes of the current inventory against many limit sets.
The same assessment as clearance_index(), once per set. Sets the
material cannot be assessed against are skipped rather than raising,
which in practice means the total activity sets (Bq) when the material
has no volume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit_sets
|
list[str] | None
|
Names of the limit sets. |
None
|
metal
|
bool
|
As for |
False
|
apply_default_limit
|
bool
|
As for |
True
|
exclude_daughters
|
bool
|
As for |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, ClearanceResult]
|
dict[str, ClearanceResult]: Results keyed by limit set name. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If a named limit set does not exist. |
Examples:
>>> results = material.clearance_indices()
>>> [name for name, r in results.items() if r.clearable]
['Fetter', 'NRC_long', ...]
Source code in yani/_core/__init__.pyi
1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 | |
macroscopic_cross_section
macroscopic_cross_section(reaction: int | str, temperature: Optional[str] = None) -> tuple[list[float], list[float]]
Calculate macroscopic cross section for a specific reaction.
This method accepts either an integer MT number or a string reaction name (like "(n,gamma)", "fission", etc.) and returns the macroscopic cross section for that reaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reaction
|
Union[int, str]
|
Either an MT number or reaction name. |
required |
temperature
|
Optional[str]
|
Temperature key (e.g., "294"). If not provided, uses material.temperature, else the only available temperature if there is just one, else 294 K. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[list[float], list[float]]
|
Tuple[List[float], List[float]]: (cross_section_values, energy_grid) |
Source code in yani/_core/__init__.pyi
1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 | |
transmute
transmute(schedule: Any, data_uncertainty: Optional[DataUncertainty] = None, self_shielding_chord: Optional[float] = None, self_shielding_shape: Optional[Any] = None, displacement_damage: bool = False, displacement_energies: Optional[Mapping[str, float]] = None, product_threshold: float = 1e-12) -> TransmutationResults
Transmute this material over an irradiation/cooling schedule, without re-running transport.
Each irradiation Pulse carries a NeutronSource whose energy is a
Histogram (the multigroup spectrum); the pulse rate is the total
flux magnitude [n/cm²/s]. The spectrum collapses cross sections into
one-group reaction rates, scaled by rate. A Cooldown is a
decay-only step. Different pulses may carry different spectra (e.g. a DD
and a DT campaign).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schedule
|
PulseSchedule
|
The irradiation/cooling timeline. Every
irradiation |
required |
The transmutation network is assembled from the configured per-subsection
sources (yani.transmutation_decay_data / _reactions /
_fission_yields); decay-only schedules need only the decay source.
There is no default library: a source the schedule reads that is unset
raises ValueError before any work, naming each such setting.
_reactions and _fission_yields can be set to False instead,
for a material with no reaction rates or one in which nothing fissions.
The material does not need transmutable=True. That flag exists so
Model.simulate_transmutation can pick which materials in a geometry to
deplete; here you have already named the one you mean.
The cross sections this needs are loaded into the material and kept,
so calling it again on the same material does no file reading at all.
Only the composition's and those of the products the schedule populates
are loaded (see product_threshold), not every nuclide the chain can
reach. The composition is not modified. A sweep over thousands of
distinct compositions should call release_nuclear_data() on each
material when it is done with it, since otherwise every one of them
holds its nuclides' data for as long as it lives.
Returns:
| Name | Type | Description |
|---|---|---|
TransmutationResults |
TransmutationResults
|
The same object |
data_uncertainty |
(DataUncertainty, optional)
|
Ask for nuclear-data
uncertainty on the result. Each source |
self_shielding_chord |
(float, optional)
|
Mean chord length The flux inside the lump comes from a slowing-down solve, which assumes nothing about resonances being narrow. The cheaper narrow-resonance approximation is deliberately not offered: it over-shields strong elastic scatterers badly enough to be worse than applying no correction at all (W186(n,gamma) in FNG-tung measures 1.29 b, where this gives C/E 0.80, no correction gives 0.86 and narrow resonance gives 0.46). |
self_shielding_shape |
(SphereLump | CubeLump | FoilLump | CylinderLump | WireLump, optional)
|
The lump's form, from A sphere has the least surface for its volume, so it has the longest chord and shields more than any other shape of the same size. It is an upper bound rather than a safe default, which is why there is no default here at all. |
displacement_damage |
bool
|
Also compute displacement damage over the
schedule: the damage energy deposited per atom (eV) and NRT
displacements per atom, per element and for the material, read
with |
displacement_energies |
(dict[str, float], optional)
|
Displacement
threshold energies |
product_threshold |
float
|
The atom fraction, or share of the
activity, decay heat or decay photon power, a transmutation
product must reach at some state of the schedule for its cross
sections to be downloaded and its own neutron reactions solved.
Default 1e-12. The schedule is solved with the composition's
cross sections, every product crossing this is loaded, and the
solve is repeated until nothing new crosses it, so a run fetches
the few dozen nuclides an irradiation populates rather than the
hundreds its chain can reach. A product below it is still
produced, decays and is reported; only its reactions are
dropped, which moves its own atom fraction and decay-quantity
shares by less than the threshold and what it would have made
by less than the summed peak fraction of the products left out.
What was loaded and left out is in
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If an irradiation pulse lacks a NeutronSource, its energy is not a Histogram, a transmutation source the schedule reads is unset, or on other invalid inputs. |
Examples:
>>> spectrum = yani.NeutronSource(energy=yani.sources.Histogram("CCFE-709", flux_709))
>>> sched = yani.PulseSchedule([
... yani.Pulse(rate=1e14, duration=(1, "h"), source=spectrum),
... yani.Cooldown(duration=(7, "d")),
... ])
>>> results = iron.transmute(schedule=sched)
>>> final = results.get_final_material(iron.id)
>>> # the isomeric split of the dominant channel, as two edges of one
>>> # reaction: the sum is sigma * phi * N and the ratio is f_m
>>> results.get_reaction_rates(iron.id, 0)["W186"]["(n,2n)"]
[('W185', 1.1e-08), ('W185_m1', 4.6e-07)]
Source code in yani/_core/__init__.pyi
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 | |
release_nuclear_data
release_nuclear_data() -> None
Drop the nuclear data this material has loaded.
transmute() loads the cross sections it needs into the material and
leaves them there, so calling it again on the same material does no file
reading at all. That is the composition and the products the
irradiation populates, a few dozen nuclides for a pure metal and up to a
couple of hundred for a steel, held for as long as the material is.
That is the right trade for a material you transmute more than once, and the wrong one for a sweep over thousands of distinct compositions -- so releasing is explicit rather than automatic. The material stays usable: the next call that needs the data loads it again.
Examples:
>>> for composition in many_compositions:
... mat = yani.Material(composition=composition, density=7.9)
... results = mat.transmute(schedule=sched)
... mat.release_nuclear_data()
Source code in yani/_core/__init__.pyi
1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | |
average_molar_mass
average_molar_mass() -> float
Return the average molar mass of this material (g/mol).
Source code in yani/_core/__init__.pyi
1834 1835 1836 1837 | |
get_mass_density
get_mass_density() -> float
Return the mass density in g/cm³ regardless of stored units.
Source code in yani/_core/__init__.pyi
1838 1839 1840 1841 | |
mix_materials
classmethod
mix_materials(materials: Sequence[Material], fractions: Sequence[float], fraction_type: str = 'atom', *, name: Optional[str] = None, id: Optional[int] = None) -> Material
Create a new material by mixing multiple materials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
materials
|
List[Material]
|
Materials to mix. |
required |
fractions
|
List[float]
|
Mixing fractions (one per material). |
required |
fraction_type
|
str
|
"atom", "mass", or "volume". |
'atom'
|
name
|
Optional[str]
|
Name for the new material. If omitted, one
is built from the components' names and fractions, such as
|
None
|
id
|
Optional[int]
|
ID for the new material. Defaults to a fresh one, which no earlier material was given. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Material |
Material
|
A new material with the mixed composition and density. |
Source code in yani/_core/__init__.pyi
1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 | |
yani.Enriched
Enriched(fraction: float, *, target: str, percent: float, fraction_type: str = 'atom')
Enrichment specification for use in Material composition dicts.
Build one with enriched() rather than by hand; the constructor is the
same either way.
Create an enrichment specification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fraction
|
float
|
Fraction of this component in the material. |
required |
target
|
str
|
Target nuclide for enrichment (e.g. "Li6"). |
required |
percent
|
float
|
Enrichment percentage of the target isotope. |
required |
fraction_type
|
str
|
"atom" for atom percent or "mass" for weight percent. |
'atom'
|
Returns:
| Name | Type | Description |
|---|---|---|
Enriched |
Enriched
|
An enrichment specification. |
Source code in yani/_core/__init__.pyi
843 844 845 846 847 848 849 850 851 852 853 854 855 | |
fraction
property
fraction: float
Fraction of this component in the material.
target
property
target: str
Target nuclide for enrichment (e.g. "Li6").
percent
property
percent: float
Enrichment percentage of the target isotope.
fraction_type
property
fraction_type: str
"atom" for atom percent or "mass" for weight percent.
yani.enriched
enriched(fraction: float, *, target: str, percent: float, fraction_type: str = 'atom') -> Enriched
Create an enrichment specification for a Material composition entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fraction
|
float
|
Fraction of this component in the material. |
required |
target
|
str
|
Target nuclide for enrichment (e.g. "Li6"). |
required |
percent
|
float
|
Enrichment percentage of the target isotope. |
required |
fraction_type
|
str
|
"atom" for atom percent or "mass" for weight percent. |
'atom'
|
Returns:
| Name | Type | Description |
|---|---|---|
Enriched |
Enriched
|
An enrichment specification. |
Source code in yani/_core/__init__.pyi
5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 | |
yani.transmute
transmute(materials: Sequence[Material], schedules: PulseSchedule | Sequence[PulseSchedule], data_uncertainty: Optional[DataUncertainty] = None, self_shielding_chord: Optional[float] = None, self_shielding_shape: SphereLump | CubeLump | FoilLump | CylinderLump | WireLump | None = None, displacement_damage: bool = False, displacement_energies: Optional[Mapping[str, float]] = None, product_threshold: float = 1e-12, processing: Optional[Processing] = None) -> TransmutationResults
Transmute several materials over one timeline in one call.
The plural of Material.transmute, for a mesh from a transport run, a
component broken into regions, or a sweep over compositions. The answer for
each material is exactly what material.transmute(schedule) gives it, and
the result is one TransmutationResults keyed by each material's id,
the same shape Model.simulate_transmutation returns.
What a Python loop would repeat is done once instead: the chain is read
once, each nuclide's cross sections are decoded once and shared by every
material that needs them, and a multigroup collapse runs once for every
distinct combination of spectrum, composition, temperature and shielding.
Cells of one steel that saw the same spectrum share a collapse, whatever
their flux magnitudes. results.collapse_reuse says how many collapses
were shared. The materials' solves then run in parallel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
materials
|
list[Material]
|
The materials, each with a distinct
|
required |
schedules
|
PulseSchedule | list[PulseSchedule]
|
One schedule for every material, or one per material in the same order. Each material's schedule carries its own spectra (the pulse sources) and flux magnitudes (the pulse rates), which is how each cell of a mesh gets its own flux. They must share one timeline, the same durations and irradiation on the same steps, because the result has one series of times. |
required |
data_uncertainty
|
DataUncertainty
|
Nuclear-data uncertainty,
applied to every material as |
None
|
self_shielding_chord
|
float
|
One chord length |
None
|
self_shielding_shape
|
SphereLump | CubeLump | FoilLump | CylinderLump | WireLump
|
One lump shape for every material, turned into a chord through each
material's own |
None
|
displacement_damage
|
bool
|
Also compute each material's displacement
damage, damage energy per atom and NRT dpa. See
|
False
|
displacement_energies
|
dict[str, float]
|
Displacement
threshold energies in eV by element symbol, replacing the defaults,
for every material. Needs |
None
|
product_threshold
|
float
|
The atom fraction, or share of a decay
quantity, a product must reach for its cross sections to be loaded
and its reactions solved, applied to each material's own schedule.
Default 1e-12. See |
1e-12
|
processing
|
Processing
|
Removals, transfers between
materials and feeds. The materials a transfer links are solved
together each step. A material it names that is not in
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
TransmutationResults |
TransmutationResults
|
Keyed by each material's |
Raises:
| Type | Description |
|---|---|
ValueError
|
If two materials share an id, the timelines differ, the
number of schedules does not match the number of materials, or
any single material would fail |
TypeError
|
If |
Examples:
>>> schedules = [
... yani.PulseSchedule([
... yani.Pulse(rate=flux[i], duration=(1, "y"), source=spectra[i]),
... yani.Cooldown(duration=(1, "d")),
... ])
... for i in range(len(cells))
... ]
>>> results = yani.transmute(cells, schedules)
>>> results.get_final_material(cells[3].id)
Source code in yani/_core/__init__.pyi
6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 | |
Irradiation schedules
yani.Pulse
Pulse(rate: float, duration: Any, source: Optional[Any] = None, flux_std_dev: Optional[Sequence[float]] = None, flux_covariance: Optional[Sequence[Sequence[float]]] = None, model: Optional[Any] = None, moves: Optional[Any] = None)
One irradiation campaign: a neutron source held at a constant rate (n/s)
for duration.
Create an irradiation pulse.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rate
|
float
|
For |
required |
duration
|
Any
|
A number of seconds, or a |
required |
source
|
Optional[Any]
|
The NeutronSource for this campaign. Defaults to |
None
|
flux_std_dev
|
Optional[Sequence[float]]
|
Per-bin standard deviation of the flux, in the same
units and the same order as the Used only by Treats the bins as independent. A spectrum from a Monte Carlo
tally is not: its bins are scored by the same histories and
move together, and a per-bin sigma then understates the error
of every rate that sums over a band. Give |
None
|
flux_covariance
|
Optional[Sequence[Sequence[float]]]
|
The full covariance of the |
None
|
model
|
Optional[Any]
|
The yani |
None
|
moves
|
Optional[Any]
|
Cells of |
None
|
Source code in yani/_core/__init__.pyi
2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 | |
model
property
model: Optional[Any]
The Model this pulse irradiates, or None.
moves
property
moves: dict[str, list[list[float]]]
The moved cells, {name: 4x4 matrix}.
source
property
source: Optional[Any]
The neutron source active during this pulse, or None if sourceless.
flux_std_dev
property
flux_std_dev: Optional[list[float]]
The per-bin flux standard deviation, or None if none was given.
flux_covariance
property
flux_covariance: Optional[list[list[float]]]
The flux covariance, or None if none was given.
rate
property
rate: float
Source emission rate in particles/second.
duration
property
duration: float
Pulse duration in seconds.
yani.Cooldown
Cooldown(duration: Any, model: Optional[Any] = None, moves: Optional[Any] = None)
A cooling step: no source, the materials just decay for duration.
Create a cooling step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
Any
|
A number of seconds, or a |
required |
model
|
Optional[Any]
|
The yani |
None
|
moves
|
Optional[Any]
|
Cells of |
None
|
Source code in yani/_core/__init__.pyi
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
model
property
model: Optional[Any]
The Model the machine cools in, or None.
moves
property
moves: dict[str, list[list[float]]]
The moved cells, {name: 4x4 matrix}.
duration
property
duration: float
Cooldown duration in seconds.
yani.cooldown_steps
cooldown_steps(start: Any, stop: Any, n: int, spacing: str = 'log') -> list[Cooldown]
Build a run of cooling steps at log-spaced cumulative times.
Cooldown takes the duration OF THAT STEP, which is the right primitive and
the wrong thing to type. Anyone plotting a decay curve wants points at
cumulative times, and would otherwise have to difference them by hand:
HOUR, YEAR = 3600.0, 365.25 * 86400.0
cum = [HOUR * (10 * YEAR / HOUR) ** (k / (n - 1)) for k in range(n)]
gaps = [cum[0]] + [cum[k] - cum[k - 1] for k in range(1, n)]
Log spacing is the default because decay is exponential, so a linear sweep is wrong twice over: it wastes steps in the flat tail and misses the early fall entirely. Activity and decay heat are plotted on log-log axes, so evenly spaced PLOTTED points means log-spaced times.
Source code in yani/_core/__init__.pyi
5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 | |
yani.PulseSchedule
PulseSchedule(steps: Any)
An irradiation/cooling timeline built from Pulse and Cooldown steps.
time_correct_tally post-processes a decay-photon tally into shutdown dose
rates over the schedule.
Build a schedule from a list of Pulse / Cooldown steps.
Source code in yani/_core/__init__.pyi
2804 2805 2806 2807 | |
sources
property
sources: list[Any]
The distinct neutron sources used by the pulses, in first-appearance
order. For a mixed-spectrum schedule, pass time_correct_tally a dict
mapping each of these to its transport run's tally result.
yani.NeutronSource
NeutronSource(*, position: Optional[Any] = None, energy: Optional[Any] = None, direction: Optional[Any] = None, strength: Optional[float] = None)
A neutron particle source with spatial, energy, and angular distributions.
Create a neutron source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
Optional[Any]
|
Birth location. Pass a tuple/list |
None
|
energy
|
Optional[Any]
|
Birth energy. Pass a float in eV for a single energy (recommended), or an energy distribution (yamc.Discrete, yamc.Uniform, yamc.Normal) for a spectrum. Defaults to 14.06 MeV (D-T fusion). |
None
|
direction
|
Optional[Any]
|
Angular distribution (e.g., yamc.Isotropic()). Defaults to Isotropic. |
None
|
strength
|
Optional[float]
|
Source strength for multi-source weighting. Defaults to 1.0. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
NeutronSource |
NeutronSource
|
A neutron source. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in yani/_core/__init__.pyi
2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 | |
position
property
writable
position: Any
Spatial distribution describing where particles are sampled.
Returns an (x, y, z) list for a fixed point, or the spatial
distribution object.
energy
property
writable
energy: Any
Energy distribution describing source particle energies in eV.
Returns a Discrete, Uniform, or Normal distribution.
direction
property
writable
direction: Any
Angular distribution describing source particle directions.
Returns an Isotropic or Monodirectional distribution.
strength
property
writable
strength: float
Relative strength of this source for multi-source weighting. Default is 1.0; only meaningful when multiple sources are passed to a Model.
Continuous processing
Feeds, extraction and transfers are configured on one Processing and passed
to the batch solver; see Continuous processing.
yani.Processing
Processing()
Removals, transfers between materials and feeds, for a transmutation run.
Each term adds to the Bateman equations of the materials it names, and every one is solved exactly: a first-order removal is a loss rate, a transfer is that loss arriving in the destination scaled by the ratio of volumes, and a feed is a source held constant over each interval. Materials a transfer links are solved together each step.
A destination need not be irradiated. One that transmute or
simulate_transmutation is not otherwise given (a storage tank outside
the geometry, say) is carried unirradiated and reported in the results
under its own id, so its activity and contact dose read like any other
material's.
A rate is a number, or a table (times, rates): piecewise constant, each
rate holding from its time (seconds from the start of the schedule, or
(value, unit)) to the next, and zero before the first. Steps are split
where a table changes, so a table is solved exactly. steps restricts a
term to the listed schedule steps (0-based).
Examples:
>>> loop = yani.Processing()
>>> # tritium out of the breeder with a 2 h half-time, into a tank
>>> loop.add_transfer(pbli, "H3", rate=(2, "h"), rate_units="half-time",
... destination=tank)
>>> loop.add_transfer(pbli, "He", rate=6, rate_units="1/h") # vented
>>> loop.add_feed(pbli, {"Li6": 1.0}, rate=0.05, rate_units="kg/d", steps=[0, 2])
>>> # a whole liquid circulating between a core and a pool
>>> loop.add_transfer(water, rate=flow / water.volume, destination=pool)
>>> loop.add_transfer(pool, rate=flow / pool.volume, destination=water)
>>> results = yani.transmute([pbli, water], schedules, processing=loop)
Source code in yani/_core/__init__.pyi
2657 | |
material_ids
property
material_ids: list[int]
The ids of every material a term names.
add_transfer
add_transfer(material: Material, component: Optional[str] = None, *, rate: Any, rate_units: str = '1/s', destination: Optional[Material] = None, steps: Optional[Sequence[int]] = None) -> None
Remove component from material continuously, at a first-order
rate, into destination when given and out of the system otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Material
|
Where it is removed from. |
required |
component
|
str
|
An element ( |
None
|
rate
|
float | tuple
|
The rate, or a |
required |
rate_units
|
str
|
|
'1/s'
|
destination
|
Material
|
Where it goes. Both materials need a volume: what leaves is diluted by their ratio. |
None
|
steps
|
list[int]
|
The schedule steps it acts on; every step by default. |
None
|
Source code in yani/_core/__init__.pyi
2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 | |
add_feed
add_feed(material: Material, composition: Mapping[str, float], *, rate: Any, rate_units: str = 'g/s', proportional_to: Optional[str] = None, steps: Optional[Sequence[int]] = None) -> None
Feed composition into material continuously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Material
|
What it is fed into. |
required |
composition
|
dict[str, float]
|
Nuclides or natural elements, by atom fraction (normalized). |
required |
rate
|
float | tuple
|
The rate, or a |
required |
rate_units
|
str
|
An amount per time, |
'g/s'
|
proportional_to
|
str
|
A nuclide of |
None
|
steps
|
list[int]
|
The schedule steps it acts on; every step by default. |
None
|
Source code in yani/_core/__init__.pyi
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 | |
Results
yani.TransmutationResults
Results from a transmutation calculation.
Contains material compositions at each timestep for all transmuted materials. Index 0 is the initial composition, index i is after timestep[i-1].
data_gaps
property
data_gaps: dict
What the result rests on that the nuclear data does not give, per material ID.
A product whose decay the decay library has no record for is never
booked onto another nuclide: its fate is unknown, so it is counted as
produced and kept out of the inventory (get_material does not hold
it). Fission in a nuclide the library gives no yields for has unknown
products. Each material's entry is a dict:
decay_library: the decay data the run read, as configured;volume: the material's volume in cm^3, orNone;fate_unknown: per nuclide,atoms_per_barn_cmat each state (index 0 is the initial composition),production_rateover each step andactivity_boundat each state, both per barn-cm per second, andproduced_by("<parent> <reaction>","<parent> decay"or"<parent> fission"). The bound holds whatever the half-life: activity is never more than the largest production rate so far, taken here over each step's average;fission_without_yields: per nuclide, itsfission_ratein each step, per barn-cm per second;unknown_fission_share: per step, the share of the whole fission rate whose products are unknown.
Every entry names a gap of the library the run read, which is what its
evaluators would need to fill it. A material whose answer rests on
nothing missing has empty fate_unknown atoms and no
fission_without_yields.
times
property
times: list[float]
Cumulative times [s] including t=0.
timesteps
property
timesteps: list[float]
Timesteps used [s].
collapse_reuse
property
collapse_reuse: Optional[dict]
How much of the multigroup collapse work was shared, or None for a
transport-coupled solve, which does none.
A dict with performed, the collapses actually run, and
requested, one per distinct spectrum per material. Materials with
the same spectrum, composition, temperature and shielding collapse to
the same rates and share one, so performed below requested is
the saving transmute made over solving them one at a time.
data_releases
property
data_releases: dict
The nuclear-data release each library keyword came from, and the
release of each local release folder data was read from, as a dict
keyed by keyword or by the folder's absolute path. Each value is a dict
with release (the release identifier), manifest_sha256 (the
hash of that release's manifest, which pins every file in it),
format_version, offline (True when the data origin was
unreachable and the newest complete cached release was used, always
False for a local folder), converters (every build that
wrote the release's files, as its manifest lists them, such as
"yani-python 0.22.1 (core 250c439e...)"; empty for a release
published before releases listed them), locally_processed and
library. A transmutation subsection read from a local directory
that is not a release folder (one convert_transmutation wrote) is
keyed by that directory's absolute path, with locally_processed
True, library and release the library and data_version its
converter recorded, and manifest_sha256 the sha256 of its files.
For a release locally_processed is False and library empty.
num_steps
property
num_steps: int
Number of transmutation steps.
material_ids
property
material_ids: list[int]
List of material IDs that were transmuted.
get_source_rates
get_source_rates(material_id: int) -> Optional[list[float]]
The rate each step drove a material at, one per timestep, zero for a cooldown.
A spectrum solve (Material.transmute, transmute) gives each
material's own flux magnitude in n/cm^2/s, which differs between
materials given their own schedules. Model.simulate_transmutation
gives the source strength in n/s, the same for every material.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
Returns:
| Type | Description |
|---|---|
Optional[list[float]]
|
List of rates, or None if the material is not in the results. |
Source code in yani/_core/__init__.pyi
3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 | |
get_uncertainty_breakdown
get_uncertainty_breakdown(material_id: int, nuclide: str, step: int) -> Optional[dict]
Where a nuclide's uncertainty at one step comes from.
Present when the run was asked for it with
DataUncertainty(attribution=True), and None otherwise. A dict:
variance: the total, resampled, the square ofget_nuclide_uncertainty;by_source: each source alone, resampled the same way, so this says how much is statistical and how much is each kind of nuclear data. The sources are independent and these sum to the total;unattributed: what that sum leaves, interaction and sampling noise, small when the attribution holds;contributors: first order, a list of(source, nuclide, reaction, variance), largest reach first. Within the cross sections a nuclide's whole evaluation hasreactionofNoneand each channel alone names it; a half-life hasNone. A decay branching contributor is a two-mode parent's one degree of freedom, withreactionofNone. It says which evaluation to look at; the total is the resampled one.linearity: how well that first order explains the replicas, per source and as"all"for every source together. Each replica's first-order prediction is the nominal plus every sensitivity times that replica's own change in its input, so no extra solve is made. Per entry:r2(squared correlation between replicas and predictions),residual_share(the share of the variance first order does not account for),by_contributor({source: {nuclide: r2}}, each contributor's term alone),ranking_agrees(whether the first-order top contributor is also the best correlated), andflagged(residual_shareabove 0.1, or the ranking disagrees: read the contributors with care). First order has terms only forcross_sections,half_lifeanddecay_branching.Nonefor every other source (flux_spectrum,statistical,decay_energy,decay_photon_lines,fission_yield), and for"all"when any applied source is one of those; absent for a nuclide with no spread. The default source set applies several of them, so with the defaults"all"isNone: restrictDataUncertainty(sources=...)tocross_sections,half_lifeanddecay_branching(or a subset) for an"all"entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
nuclide
|
str
|
Nuclide name. |
required |
step
|
int
|
As in |
required |
Source code in yani/_core/__init__.pyi
3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 | |
get_reaction_rate_uncertainty
get_reaction_rate_uncertainty(material_id: int, step: int) -> Optional[list[tuple[str, str, Optional[str], float, float]]]
The statistical uncertainty of each transport-tallied reaction rate at one step.
Present for Model.simulate_transmutation run with
data_uncertainty including the "statistical" source, and
None otherwise. Each entry is (nuclide, reaction, target, rate,
std_dev) in 1/s per atom: a reaction total has target of None,
an isomeric partial names its final state. The rates are the tally's,
scaled by the step's source rate, exactly as the step's solve used them
before the branching fold.
The rates are correlated, having been scored by the same histories, and the inventory sigmas are computed with those correlations. These standard deviations alone do not carry them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Schedule step index, as in |
required |
Source code in yani/_core/__init__.pyi
3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 | |
get_nuclide_evolution
get_nuclide_evolution(material_id: int, nuclide: str) -> Optional[list[float]]
Get the evolution of a specific nuclide over all timesteps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
nuclide
|
str
|
Nuclide name (e.g., "Co60"). |
required |
Returns:
| Type | Description |
|---|---|
Optional[list[float]]
|
List of atom densities [atoms/barn-cm] at each time point |
Optional[list[float]]
|
(index 0 = initial, index i = after step i). |
Optional[list[float]]
|
Returns None if material_id not found. |
Source code in yani/_core/__init__.pyi
3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 | |
get_nuclide_density
get_nuclide_density(material_id: int, nuclide: str, step: int) -> Optional[float]
Get nuclide density at a specific timestep.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
nuclide
|
str
|
Nuclide name (e.g., "U235"). |
required |
step
|
int
|
Timestep index (0 = initial). |
required |
Returns:
| Type | Description |
|---|---|
Optional[float]
|
Atom density [atoms/barn-cm] or None if not found. |
Source code in yani/_core/__init__.pyi
3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 | |
get_nuclide_uncertainty
get_nuclide_uncertainty(material_id: int, nuclide: str, step: int) -> Optional[float]
Get the nuclear-data standard deviation on a nuclide density.
The spread over an ensemble of solves with the activation cross sections
resampled from their MF=33 covariance. In the same units as
get_nuclide_density, so the pair reads as mean ± sigma. With
transport replica weights the Monte Carlo noise of the replicas'
tallies is removed from it (see get_nuclide_uncertainty_noise).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
nuclide
|
str
|
Nuclide name (e.g., "Mn56"). |
required |
step
|
int
|
Timestep index (0 = initial). |
required |
Returns:
| Type | Description |
|---|---|
Optional[float]
|
Standard deviation [atoms/barn-cm], or None if the transmutation was |
Optional[float]
|
run without |
Optional[float]
|
and always reports 0.0: it is an input, and perturbing cross sections |
Optional[float]
|
does not move it. |
Optional[float]
|
A nuclide whose evaluation carries no covariance also reports 0.0. |
Optional[float]
|
That is not a claim of certainty -- check |
Optional[float]
|
|
Optional[float]
|
which lists exactly |
Optional[float]
|
those nuclides. |
Source code in yani/_core/__init__.pyi
3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 | |
get_nuclide_uncertainty_standard_error
get_nuclide_uncertainty_standard_error(material_id: int, nuclide: str, step: int) -> Optional[float]
Get the standard error of get_nuclide_uncertainty: how far another
ensemble of the same size could put that sigma.
It allows for a heavy tail, through the replicas' sample kurtosis, so a lognormal-tailed density reads as less settled than a Gaussian one at the same replica count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
nuclide
|
str
|
Nuclide name. |
required |
step
|
int
|
As in |
required |
Returns:
| Type | Description |
|---|---|
Optional[float]
|
The standard error [atoms/barn-cm], or None if the transmutation was |
Optional[float]
|
run without |
Optional[float]
|
Step 0 reports 0.0. |
Source code in yani/_core/__init__.pyi
3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 | |
get_nuclide_uncertainty_noise
get_nuclide_uncertainty_noise(material_id: int, nuclide: str, step: int) -> Optional[tuple[float, float]]
Get what get_nuclide_uncertainty is made of: the replicas' spread
as solved, and the Monte Carlo noise removed from it.
With transport replica weights, each replica's tallied shift from the
nominal carries Monte Carlo noise, which inflates the replicas' spread
at low history counts. Each replica is then solved a second time from
the even half of the transport's histories, and the spread of the
difference between the two solves measures that noise, independent of
every data draw. get_nuclide_uncertainty is
sqrt(replica_spread**2 - noise**2), zero where the noise is the
larger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
nuclide
|
str
|
Nuclide name. |
required |
step
|
int
|
As in |
required |
Returns:
| Type | Description |
|---|---|
Optional[tuple[float, float]]
|
|
Optional[tuple[float, float]]
|
not measured, or None if the transmutation was run without |
Optional[tuple[float, float]]
|
|
Source code in yani/_core/__init__.pyi
3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 | |
get_nuclide_uncertainty_evolution
get_nuclide_uncertainty_evolution(material_id: int, nuclide: str) -> Optional[list[float]]
Get the standard deviation of a nuclide's density at every timestep.
Parallel to get_nuclide_evolution, leading zero included, so the two
can be zipped without an index correction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
nuclide
|
str
|
Nuclide name. |
required |
Returns:
| Type | Description |
|---|---|
Optional[list[float]]
|
List of standard deviations [atoms/barn-cm], or None if the |
Optional[list[float]]
|
transmutation was run without |
Source code in yani/_core/__init__.pyi
3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 | |
get_uncertainty_inventories
get_uncertainty_inventories(material_id: int, step: int) -> Optional[list[dict[str, float]]]
Every replica's inventory at one timestep.
For a quantity that has to be evaluated per sample rather than from the mean. Activity, decay heat and the decay-photon spectrum are all functions of a whole inventory, so evaluating one of them once per entry here and taking the spread keeps the correlations between nuclides. Taking the mean inventory and evaluating once throws them away, and summing per-nuclide sigmas in quadrature assumes an independence that the resampling exists precisely to avoid assuming.
These are the replicas as solved. With transport replica weights their
spread still holds the Monte Carlo noise that the sigmas this class
reports have removed (see get_nuclide_uncertainty_noise).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial, which has no ensemble). |
required |
Returns:
| Type | Description |
|---|---|
Optional[list[dict[str, float]]]
|
List of |
Optional[list[dict[str, float]]]
|
transmutation was run without |
Source code in yani/_core/__init__.pyi
3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 | |
get_activity_uncertainty
get_activity_uncertainty(material_id: int, step: int, *, by_nuclide: bool = False) -> Any
Activity at one timestep [Bq], with the nuclear-data spread on it.
Evaluated once per replica and summed within each, so the correlations between nuclides survive. Doing it any other way gives a plausible number that is wrong in a specific direction: evaluating from the mean inventory gives no spread at all, and adding the per-nuclide sigmas in quadrature double-counts a variance that partly cancels, since every Mn56 atom in an irradiated iron foil came out of an Fe56 atom.
The volume is taken from the stored step material, so the nominal value and every replica are scaled by the same one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial composition). The composition at
step 0 is an input, but each replica evaluates it with its own
sampled half-lives, so the activity at step 0 has a spread
whenever the |
required |
by_nuclide
|
bool
|
Return a |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
Estimate | dict[str, Estimate] | None: None if the transmutation |
Any
|
was run without |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the material has no |
Source code in yani/_core/__init__.pyi
3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 | |
get_decay_heat_uncertainty
get_decay_heat_uncertainty(material_id: int, step: int, *, by_nuclide: bool = False) -> Any
Decay heat at one timestep [W], with the nuclear-data spread on it.
See get_activity_uncertainty: same ensemble, same rule, and the
quantity the FNS decay-heat benchmarks are written against. A calculated
band beside the measured one is what turns a C/E into a statement about
whether the disagreement is larger than the data uncertainty allows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
With the "decay_photon_lines" source on, each replica's gamma decay
energy E_EM follows its drawn photon lines and continua rather than an
independent "decay_energy" draw, so its gamma heat and its contact
dose come from the same draw of one evaluation. E_EM moves by the drawn
change in the photon energy per decay (each line's energy times its
intensity, plus each continuum's energy integral), and the part of E_EM
the tabulated spectra do not carry is held at nominal. The beta and
alpha parts keep their "decay_energy" draws. The heat then has a
range, Estimate.std_dev to Estimate.std_dev_correlated, from the
photon intensities' unstated correlations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial composition). As in
|
required |
by_nuclide
|
bool
|
Return a |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
Estimate | dict[str, Estimate] | None: None if the transmutation |
Any
|
was run without |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the material has no |
Source code in yani/_core/__init__.pyi
3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 | |
get_contact_dose_uncertainty
get_contact_dose_uncertainty(material_id: int, step: int, *, dose_quantity: str = 'absorbed-air', build_up: float = 2.0, by_nuclide: bool = False) -> Any
Contact dose rate at one timestep, with the nuclear-data spread on it.
The one derived quantity here that is not linear in the atom densities. The material attenuates its own decay photons, so the emitters sit in the numerator and the whole inventory in the denominator: a replica that makes more of an emitter also absorbs more of it. Scaling the nominal dose by the density spread would report the activity's uncertainty, which is wrong by the whole value; evaluating per replica gets the cancellation for free.
Needs no volume, unlike the other three, because the estimate takes
the material for a half-space.
The band is the spread of the replicas' inventories (each with its own
half-lives when the "half_life" source is on), and of their decay
photon line intensities and energies and continuum normalisations when
the "decay_photon_lines" source is on. The photon attenuation
(XCOM), air energy absorption (NIST SRD 126), ICRP-116 dose
coefficients and the build-up factor are held at their nominal values
and contribute nothing to it.
With the "decay_photon_lines" source on, the band is a range:
Estimate.std_dev takes each nuclide's photon intensities as
independent where the decay data state no correlation, and
Estimate.std_dev_correlated as fully correlated (the lines of a
spectrum, its normalisation and lines, and its gamma and x-ray
spectra). ENDF/B-VIII.1 folds each spectrum's normalisation sigma into
every line's, so a multi-line emitter's range there is wide;
get_data_uncertainty_info names those spectra under
decay_photon_spectra_folded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial composition). As in
|
required |
dose_quantity
|
str
|
|
'absorbed-air'
|
build_up
|
float
|
Build-up factor, a plain multiplier on the answer. |
2.0
|
by_nuclide
|
bool
|
Return a |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
Estimate | dict[str, Estimate] | None: None if the transmutation |
Any
|
was run without |
Source code in yani/_core/__init__.pyi
3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 | |
get_decay_photon_spectrum_uncertainty
get_decay_photon_spectrum_uncertainty(material_id: int, step: int) -> Optional[list[LineEstimate]]
The decay-photon spectrum at one timestep, line by line, with the nuclear-data spread on each emission rate.
Ascending in energy and coincident lines summed, exactly as
Material.decay_photon_spectrum returns them, and over the union of
the lines the nominal run and every replica emit. A line a replica does
not emit counts as a zero in it -- the same rule the densities follow,
and the only one under which two lines' spreads are taken over the same
sample -- and LineEstimate.emitting reports how many replicas
emitted it, which is what the zero-fill would otherwise hide. Lines
only, as there: a photon continuum is not a line and is not reported
here.
The band is the spread of the replicas' inventories (each with its own
half-lives when the "half_life" source is on), and of each line's
intensity per decay when the "decay_photon_lines" source is on.
That source draws each line's energy too, so lines are matched across
replicas on their nominal energy, and LineEstimate.energy_std_dev
gives the spread of the energy drawn. A line's rate spread is a range,
LineEstimate.std_dev to LineEstimate.std_dev_correlated, for the
reason get_contact_dose_uncertainty gives.
>>> lines = results.get_decay_photon_spectrum_uncertainty(mid, step)
>>> [(l.energy, l.nominal, l.std_dev) for l in lines[:2]]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial composition). As in
|
required |
Returns:
| Type | Description |
|---|---|
Optional[list[LineEstimate]]
|
list[LineEstimate] | None: None if the transmutation was run without |
Optional[list[LineEstimate]]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
if the material has no |
Source code in yani/_core/__init__.pyi
3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 | |
get_gas_production
get_gas_production(material_id: int, *, produced: bool = True) -> Optional[dict[str, list[float]]]
Hydrogen and helium gas production in appm, at every time point.
appm is gas atoms per million initial atoms of the material, so the denominator stays fixed as the material transmutes. The gas is what the inventory already holds: H1, H2, H3, He3 and He4 emitted by reactions and by decays, so tritium decaying to He3 during a cooldown shows up as He3 there.
>>> gas = results.get_gas_production(material_id=mid)
>>> gas["He4"][-1], gas["H"][-1]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
produced
|
bool
|
Subtract the gas the material started with (water,
polymers, lithium compounds), the default, so index 0 is zero
and each value is what the schedule made by then. A nuclide
consumed faster than it is made reads negative, as H1 in water
can through H1(n,gamma)H2. |
True
|
Returns:
| Type | Description |
|---|---|
Optional[dict[str, list[float]]]
|
dict[str, list[float]] | None: appm keyed |
Optional[dict[str, list[float]]]
|
|
Optional[dict[str, list[float]]]
|
and |
Optional[dict[str, list[float]]]
|
|
Optional[dict[str, list[float]]]
|
index i is after step i. None if the material is not in the results. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the chain the solve used has no entry for one of the five gas nuclides. The solve follows an emitted particle only when the chain has it, so that gas was dropped and a zero would be wrong rather than measured. The message names the missing nuclides. |
Source code in yani/_core/__init__.pyi
3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 | |
get_gas_production_uncertainty
get_gas_production_uncertainty(material_id: int, step: int, *, produced: bool = True) -> Optional[dict[str, Estimate]]
Gas production in appm at one timestep, with the nuclear-data spread on it.
See get_gas_production for the quantity. Evaluated on every
replica's inventory against the one initial inventory, which is an
input and the same in each, and the totals "H" and "He" are
summed within a replica before the spread is taken, as
get_activity_uncertainty does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial composition, which has no spread). |
required |
produced
|
bool
|
As in |
True
|
Returns:
| Type | Description |
|---|---|
Optional[dict[str, Estimate]]
|
dict[str, Estimate] | None: keyed as |
Optional[dict[str, Estimate]]
|
the transmutation was run without |
Raises:
| Type | Description |
|---|---|
ValueError
|
as |
Source code in yani/_core/__init__.pyi
3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 | |
get_data_uncertainty_info
get_data_uncertainty_info(material_id: int) -> Optional[dict]
What the nuclear-data uncertainty covered for one material, and what it did not.
None when the transmutation was run without data_uncertainty, or
the material is not in the results.
Otherwise a dict whose job is to make gaps visible rather than let them
read as confidence:
perturbed/no_covariance_data: which nuclides had usable MF=33 covariance and which had none.rate_fraction_covered_total: the per-channel shares below, averaged with each channel weighted by the production it drove (the rate this run used times parent density): the share of the production driven from energies where a covariance states a nonzero variance.Noneon a decay-only schedule; on a transport run, where the shares are of the dilute rate over the tally spectrum and the covered share of the tallied production is not computed; and under the1/Ewithin-group weight (Rust API only), whose shares are not exact where a covariance edge cuts a group.Nonetoo when a channel is listed inpartials_above_rateorpartials_below_rate, whose rate is not the one its share is of: the(n,n')of a nuclide with a metastable, whose rate is the MF=10 production of the metastables while its covariance is MT 4's. Read this before any sigma here. It is a different and much sharper question than how many nuclides carry MF=33: an evaluation can state covariance for every isotope in the material and none for the channel making the product of interest, and the count then reads as full coverage while the ensemble perturbs almost nothing.rate_fraction_covered: per nuclide and channel, the share of the reaction rate from energies where the evaluation states a nonzero variance for it, the rate being the dilute one on a dilute run and the shielded one on a self-shielded run. Below one means part of the rate carries no stated uncertainty and dilutes the sigma; on a transport run it is a share of the dilute rate over the tally spectrum, and the dilution applied differs from it. An interval the covariance grid spans with a variance of zero counts as uncovered: ENDF/B-VIII.1 W186(n,gamma)states zero from 1e-5 eV to 10 keV, where nearly all of its capture rate is. Every consumed self-covariance block counts where it states a nonzero variance, relative (LB=1 to 6), absolute (LB=0) and short-range (LB=8) alike. Exact under the default flat within-group weight; under the1/Eweight (Rust API only) the rate of a group a covariance edge cuts is split by energy width, not lethargy, so the share is off there.partials_above_rate: per nuclide and channel, where the partial rates the covariance was weighted with, zero variance intervals included, add up to more than the rate it was divided by, their ratio to it. Each entry is a channel whose sigma is overstated. Three known causes: a tallied rate on a transport run, which the transport can self-shield within its bins, against partials weighted flat within each bin; a grafted(n,n'), whose rate is the metastables' MF=10 production while the partials are MT 4's; and the1/Ewithin-group weight (Rust API only) with a covariance edge inside a group. The share inrate_fraction_coveredis of the fold's own rate, not of the listed rate, and under the1/Eweight it is off as well wherever an edge cuts a group. On a channel derived through an NC block, the partials of the reactions the block names are checked the same way, and the check is also that they add up to the one it derives over the block's range; a sum above it lands here.partials_below_rate: keyed the same way, where a covariance grid spans the whole flux range and its partial rates add up to less than the rate, their ratio to it: a channel whose sigma is understated. The1/Eweight gives one for a reaction falling with energy when a covariance edge cuts a group. A grid that stops short of the flux range cannot be checked from below, since rate from outside it rightly leaves its partials short. A derived channel whose NC block names reactions adding up to less than the one it derives lands here too: ENDF/B-VIII.1 O16(n,d)above 20 MeV, whose cross section holds MT 660 to 669 while the block names 650 to 659.derived_opposing_uncorrelated: keyed the same way, for a channel derived through an NC block whose terms name two reactions with opposite signs, each with a variance of its own, and no covariance between them: the[a, b]pairs. The absent block is read as zero, since ENDF-102 33.3.2 a.1 lets a tape leave a zero covariance unstated, and with opposing signs that reading sets the sigma. FENDL-3.2d and TENDL-2017 H2(n,2n)isσ_1 - σ_2 - σ_102and folds to about 22% at 14 MeV and thousands of percent near threshold, the tape's literal statement. Counted inhas_gaps.lumped_covariance_not_assignable: keyed"Nuclide MT852", a lumped reaction (MT 851-870) with several components, to their kinds ("MT91"for one that is not a channel). ENDF-102 33.2.3 states its covariance for the sum of the components and for none of them. A lump with one component is that component, and its covariance is folded as the component's. A lump an LTY=0 block names is folded through that derivation, with its cross section the sum of its components': ENDF/B-VIII.1 and TENDL-2017 U235 and U238 MT 4 is MT 51 plus MT 851. A component with no covariance of its own takes the lump's relative perturbation, so the components of one lump move together and their sum moves as the lump's covariance states, as NJOY's ERRORR leaves a lump and SANDY applies it: ENDF/B-VIII.1, FENDL-3.2d and JEFF-4.0 W180 to W186 give(n,2n)only as MT 852, the sum of MT 16 and 41. A level sum with no covariance of its own is derived from its levels, each reading its own blocks or its lump's, so W186(n,p)reads MT 855, the sum of MT 600 and 649. Listed here is only a lump with a block that is not relative, absolute or short-range, which states the sum's spread in barns and nothing of how it splits, where the fold reaches a component; no library yani reads has one. Counted inhas_gaps.unsupported_layouts: covariance blocks that were present but not consumed, counted once per spectrum, so a run over several spectra counts the same block once for each.skipped_nc: per nuclide, NC blocks (a covariance derived from other reactions) that could not be derived. An LTY=0 block is derived from the NI covariances of the reactions it names, cross blocks included, over its own energy range: ENDF/B-VIII.1 O16(n,p)is stated only that way. Left here are LTY 1 to 4 (a covariance from a measurement's ratio to another evaluation's standard, which no library yani reads states), a block in a cross-reaction subsection, one whose list of reactions is empty or does not match its coefficients, one whose own energy range is empty, one naming a reaction with no cross section, and one met only circularly.skipped_cross_material: per nuclide, blocks on a reaction the fold reaches (a channel, or one a channel is derived from) that correlate it with another evaluation, not applied: the evaluation they name is not in the run (or carries no covariance, so its MAT is not known), or one of the two reactions has no relative covariance to correlate. A block naming the nuclide's own MAT is its own evaluation and is folded.applied_cross_material: the same count for the blocks applied, whose two nuclides are drawn jointly, one draw per replica shared by every material of the run.skipped_other_file: blocks whose partner is not a cross section, which no library yani reads states.mirrored_disagree: keyed"Nuclide (n,a) (n,b)", where a pair stored in both orientations has copies that are not each other's transpose, the largest difference relative to the largest entry. The copy in the lower MT's section is the one folded.malformed_blocks: covariance blocks not consumed because they break ENDF-102's rules for their layout: arrays that disagree with their declared sizes, an LB=0 to 2 block carrying a second energy table, an LB=3 or 4 block without one or whose tables share no energy range, or an LB=8 variance stated between two reactions.covariance_source: where each perturbed nuclide's covariance came from,"<library>, MAT <n>", the library being the one its data folder records ("unknown"when none is recorded).covariance_warnings: perturbed nuclides whose library documents a problem with this covariance, each with what it says and where: every FENDL-3.2 covariance, which its own paper says should not be used, and the ENDF/B-VIII.1 evaluations its release paper names (Fe, Cr covariances reused from VIII.0; Cu with no fast-range covariance; Ta, W, Pb resolved-resonance covariance flagged as too low; the Ta181 unresolved covariance overwritten). The evaluation is still sampled as it is; any warning makeshas_gapstrue.covariance_repaired: nuclides the material can populate (bounded at or above the solver's density floor over the schedule at nominal rates; a replica's rates can sit above them) whose evaluated cell covariance was not positive semi-definite past round-off, with a channel a draw can move (a positive rate on a spectrum the schedule irradiates with). Past round-off means the correlation matrix of the cells has an eigenvalue below-m * 1e-12(mthe number of cells with a positive stated variance), or a cell is stated with a negative variance, or a zero one and a covariance to another cell. The correlation matrix is replaced by the nearest correlation matrix and rescaled by the evaluated sigmas, so every cell keeps its evaluated sigma and only correlations move (a cell stated at zero or negative variance is held at nominal); a channel folding several cells can still be sampled at a sigma other than its evaluation's, either way, and any makeshas_gapstrue.covariance_repairsgives one dict per repaired populated nuclide and spectrum, including repairs no draw can move, withlambda_min(the most negative eigenvalue of the cells' correlation matrix before the repair),largest_correlation_changeandcorrelation_frobenius_change(the largest and the Frobenius change of that correlation matrix),cells(in the coupled blocks repaired),held_cells,convergedand, per channel keyed by kind,evaluated_variance(the folded diagonal as stated, which can be negative),evaluated_sigma(Nonewhen that variance is negative) andsampled_sigma. A repair of a nuclide outside the populated bound has no dict;covariance_repaired_outside_boundnames those with a channel a draw can move. The bound holds at nominal rates only and a replica's rates can populate them, so any also makeshas_gapstrue.worst_sigma_change: the largest|sampled / evaluated sigma - 1|over the repaired channels of populated nuclides with a positive rate on a spectrum the schedule irradiates with,float('inf')when a repair gave a spread to a channel whose stated variance is zero or negative.rate_weighted_sigma_changeis the weighted mean of|sampled / evaluated sigma - 1|over every sampled channel of a populated nuclide, each weighted by its unit-flux rate times its spectrum's fluence in the schedule times its parent's initial density, so it covers first-generation reactions only (a produced nuclide carries no weight), shows the decomposition's round-off on matrices that needed no repair, and isNonewhen no weighted channel has an evaluated sigma. Both can befloat('inf'), which strict JSON does not accept.sigma_at_least_one/sigma_at_least_ten: sampled channels of populated nuclides with a positive rate on a spectrum the schedule irradiates with, keyed"Nuclide (n,x)", whose folded relative sigma as evaluated, before any repair, is at least one or ten. At that width the answer depends on the lognormal chosen to carry the evaluation's two moments, not on the evaluation alone.sigma_at_least_one_outside_boundis the same for nuclides outside the populated bound, whose wide channels a replica's draw can take past it; the ten-or-more subset reads off its values.lognormal_not_carried: nuclides whose evaluated relative covariance is not a lognormal's, keyed by nuclide, each withcells(cells whose sampled sigma or correlation differs from the evaluated one),largest_sigma_change(the largest|sampled / evaluated sigma - 1|),largest_correlation_changeandlog_space_repair(None, or a dict with the keys of a repair above, of the log-space correlation matrix). Two fully correlated cells with different sigmas, or an anticorrelation with1 + C <= 0, are not, and the nearest lognormal is sampled: where the log-space covariance is not PSD its correlation matrix is replaced by the nearest correlation matrix, which keeps every sigma. A property of the distribution rather than a defect of the data, so not a gap.flux_lognormal_not_carriedis the same for a stated flux covariance, keyed by spectrum index, whoselog_space_repairis alwaysNone: a flux covariance's log-space negative eigenvalues are clipped.cross_material_adjusted: keyed by a group of nuclides drawn jointly through cross-material covariance, their names joined by+("U235+U238"), where the covariance stated between their interval averages is not admissible beside each one's own and the closest admissible one was drawn instead, each own covariance kept exactly and the correlations between the averages fitted to the stated ones (each clipped to one first) in the Frobenius norm:relative_change(||X' - X|| / ||X||of the drawn against the stated log-space covariance between the averages),least_relative_change(the same with each stated entry only clipped to a correlation of one: no admissible draw goes below it),largest_stated_correlation(past one where an entry alone is inadmissible),largest_correlation_change(the largest move of a correlation from its stated value clipped to one),iterationsandconverged(the fit's; its result is admissible either way). ENDF/B-VIII.1 U235 and U238 fission read about 0.31. Counted inhas_gaps.rates_sampled: cross-section rate draws made, each read off one draw of the nuclide's cross sections.rates_flooredcounts those that came out negative and were floored at zero, which only a channel subtracting reactions or reading an additive (absolute or short-range) covariance can.cross_section_points_floored: withmethod="coupled", the cross-section grid values a replica's draw took below zero and that were floored at zero, over every replica.half_lives_perturbed/no_half_life_uncertainty: with the"half_life"source, which reachable unstable nuclides had their half-life sampled and which state no sigma to sample from.half_life_uncertainty_not_carriednames those whose stated sigma no draw can carry (not finite, or not finite relative to the half-life), held at nominal and counted as a gap.half_lives_sampledcounts the draws made. Each is a lognormal matched to the evaluation's mean and sigma, so none can go non-positive and none is floored.decay_energies_perturbed/no_decay_energy_uncertainty: the same for the"decay_energy"source, drawn per nuclide as a lognormal with the stated mean and sigma, per component where the data splits it.decay_energy_uncertainty_not_carriednames those with a sigma stated on a zero energy, or not finite, which no draw can carry; that energy is held at nominal and counted as a gap.decay_photon_lines_perturbed/no_decay_photon_line_uncertainty: the same for the"decay_photon_lines"source, over the reachable unstable nuclides with decay photon data.decay_photon_line_uncertainty_not_carriednames those with a sigma stated on a zero value, or not finite, which no draw can carry; that value is held at nominal and counted as a gap.decay_photon_spectra_foldedmaps each perturbed nuclide with a spectrum written the ENDF/B way (a normalisation of 1 with no sigma, its sigma folded into every line's dRI) to the radiation of each such spectrum ("gamma","xray"). How much of those dRI the lines share is not stated, so they are where most of the range between a photon output'sstd_devandstd_dev_correlatedcomes from.fission_yields_perturbed/no_fission_yield_uncertainty: the same for the"fission_yield"source, over the reachable parents the run gives a fission rate (one that never fissions is not drawn).fission_yield_uncertainty_not_carriednames those with a DY on a zero yield, or not finite, which is held while the parent's other yields are drawn.fission_yields_mapping_mismatchnames those whose tape yields, named and summed by the converter's rule, do not give back the yields the solver reads; they are held rather than drawn through a mapping their yields were not built with. Each is counted as a gap.decay_branchings_perturbed: with the"decay_branching"source, the reachable multi-mode parents whose split was sampled. Held at their evaluated ratios, each a gap:no_decay_branching_uncertainty(no mode states a sigma, or one does beside two or more that do not) anddecay_branchings_too_wide(every mode that could move states a sigma no ratio with its mean can have). Sampled but short of the stated sigmas, each a gap too:decay_branchings_partly_held(one or more modes held at their ratios, for such a sigma or for stating none) anddecay_branchings_sigma_adjusted(a mode drawn more than 0.1% from its stated sigma: the largest exceeds the sum of the others', or the complement's needs a correlation non-negative ratios cannot carry).decay_branchings_floored/decay_branchings_sampledcount draws whose complement was pulled back above zero and draws made.isomer_branchings_perturbed: with the"isomer_branching"source, the reachable reactions, as"Parent reaction", whose isomeric split was drawn from the MF=40 covariance of at least one of their final states.no_isomer_branching_uncertaintylists those whose split can move but whose evaluation states no MF=40 on any state the run folds, held at their nominal shares, a gap.isomer_branching_blocks_not_usedgives, per parent, the MF=40 blocks not used, counted by why, a gap.isomer_branching_covariance_repairedandisomer_branching_lognormal_not_carriedare the MF=40 matrices repaired to the nearest correlation matrix (a gap) and those not a lognormal's (not a gap), with the same entries ascovariance_repairsandlognormal_not_carried.isomer_production_sigmagives, as"Parent reaction Product", the relative sigma MF=40 states for the product's production, folded against the spectrum (the largest over the run's spectra).isomer_branchings_sampledcounts the draws, one per drawn parent per replica.isomer_branchings_clippedgives, as"Parent reaction Product", how many list draws (one per replica per spectrum) scaled the product's drawn production back to the drawn reaction total, the stated productions of its list having come out above it; a product never clipped is absent.damage_energy: withdisplacement_damage=Trueand the"cross_sections"source, per nuclide of the starting composition{"explained": ..., "sigma": ...}: the share of its stored MT=444 rate its reactions' deposits reproduce, the part a draw moves (the rest, fission's share above all, is held, a gap), and the relative sigma of its drawn damage-energy rate, each weighted over the spectra by fluence.statistical_rates: with the"statistical"source on a transport run, how many tallied rates were sampled from their covariance;statistical_floored/statistical_sampledcount draws that came out negative and were floored.resonance_parameters: per nuclide with resonance parameters (MF=2 and MF=32) and a rate in this run, how its resonance-range uncertainty was sampled.methodis"parameters sampled"(drawn per replica and the cross sections rebuilt from them, on a transport run against the flux it tallied through the resonances) or"first-order rows"(the MF=32 rows ofcovariance.arrow),reasonwhy the parameters were not sampled (Nonewhere they were), andrangesone sampler report per sampled range:isotopeandrangeindices, thegaussian,lognormalandheldparameter counts,zero_mean_widths(widths stated with a zero mean and a nonzero sigma, held at zero) andnegative_mean_widths(drawn as signed), each withindex,location,quantity,valueandsigma,zero_variance_with_covariance,unattainable_pairs, andstated_repair/transformed_repair(the nearest-correlation repair of the stated and of the log-space matrix, each withlambda_min,frobenius_change,max_change,parameters,iterationsandconverged,Nonewhere none was needed). How far the draws' parameter correlations are from the evaluated ones, in the parameters themselves after both repairs and the lognormal transform, reads offlargest_correlation_change(the largest change of one correlation) andcorrelation_frobenius_change, per range and per nuclide over its ranges; every drawn parameter keeps its evaluated mean and sigma, so that is the whole of the difference in the first two moments. Widths stay lognormal, so a pair no lognormal carries (unattainable_pairs) is where it is largest. Empty on a transport run, which keeps the rows.not_perturbed: every input this run held at its nominal value, such as any MF=32 resonance-parameter covariance neither sampled nor in the library'scovariance.arrow, the photon and dose data, the material composition, any source switched off, and, where they applied, the self-shielding correction, the flux's response to a perturbed cross section on a transport run, and the per-branch decay emission of a parent whose branching was drawn.samples/converged/convergence/hit_cap/unconverged: how many replicas ran; whether every tracked sigma reached the target,convergence, for the standard error of a sigma relative to it; whether the 1024-replica cap stopped the run first; and, worst first, every sigma that missed, as dicts ofoutput("density","activity","decay_heat"or"decay_photon_rate"),nuclide(Nonefor a total),stepand therelative_standard_errorit reached. Listed with a fixedsamplestoo, wherehit_capis never set.noise_removed/noisy: whether the Monte Carlo noise in the replicas' spread was measured and removed from every sigma (with transport replica weights, each replica is solved a second time from the even half of the transport's histories, seeget_nuclide_uncertainty_noise), and, the largest share first, every tracked sigma whose removed noise variance exceeded a quarter of the variance left, as dicts ofoutput,nuclide,step,replica_spread,noiseandstd_dev(the sigma reported). Those sigmas would sharpen most with more transport histories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
Source code in yani/_core/__init__.pyi
3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 | |
get_self_shielding_info
get_self_shielding_info(material_id: int) -> Optional[dict]
What the self-shielding did for one material.
Present for every material of a spectrum solve, shielded or not, and
None for a transport-coupled solve or a material not in the
results. chord_cm of None means the run was dilute and
nothing was corrected; otherwise it says how: the method and
chord_cm used, which nuclides were shielded, which were
not_shielded and why, and strongest_factor, the smallest factor
any group average was multiplied by. A run reporting 1.0 there
shielded nothing in practice, which is a different statement from not
having tried.
would_shield is the other direction, and is filled only on a dilute
run: nuclides whose own resonances are structured enough to have
suppressed a reaction, each mapped to how strongly.
It is an indicator, not a correction and not a bound. There is no
geometry in it: the weight is 1 / (1 + N * sigma_x) on that one
reaction and that nuclide's own density, which fixes the background at
1/cm, while the correction proper uses 1 / chord_cm against the
material's total. So the number scales with how strongly a nuclide's own
resonances could bite without predicting what a given lump would see,
and it can sit either side of the real factor: a lump thinner than a
centimetre of chord shields less, and a material whose other nuclides
dominate the total at the resonance dips the flux further than this one
reaction can express.
On the FNS tungsten foil, would_shield reads 0.634 for W186 while
the slowing-down correction on the same foil and spectrum saturates at
0.730 from a millimetre of chord upward. Read it as "this answer may be
high, and this is a resonance absorber", which is the warning a dilute
run should carry rather than silence. Read the size of the effect off a
shielded run, by asking for one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
Source code in yani/_core/__init__.pyi
4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 | |
get_product_screening_info
get_product_screening_info(material_id: int) -> Optional[dict]
Which transmutation products had their cross sections loaded, and
which were left out below product_threshold.
A product is loaded once its atom fraction, or its share of the activity, decay heat or decay photon power, reaches the threshold at any state of the schedule; one left out is still produced, decays and is reported, and only its own neutron reactions are dropped.
Keys: threshold; rounds, the screening solves run;
closure, how many nuclides with neutron reactions the chain
reaches from the composition, which is what loading without screening
fetched; loaded, the sorted nuclides whose cross sections drive
the solve; unavailable, products that crossed the threshold but
the library has no data for; below_threshold, each product left
out mapped to its largest atom fraction over the schedule; and
dropped_fraction, the sum of those, which bounds the share of the
material's atoms the left-out reactions could have moved before
multiplying by the share of them that react.
None for a material not in the results, and for one a
transport-coupled solve did not irradiate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
Source code in yani/_core/__init__.pyi
4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 | |
get_material_nuclides
get_material_nuclides(material_id: int, step: int) -> Optional[dict[str, float]]
Get material composition at a specific timestep as a dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial). |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict[str, float]]
|
Dict of nuclide -> density [atoms/barn-cm], or None if not found. |
Source code in yani/_core/__init__.pyi
4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 | |
get_material
get_material(material_id: int, step: int) -> Optional[Material]
Get material composition at a specific timestep.
The material keeps material_id, so it can stand in for the
original in a model. Placed beside the original it needs an id of its
own, since a geometry refuses two different materials with one id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial). |
required |
Returns:
| Type | Description |
|---|---|
Optional[Material]
|
Material object with composition at that timestep, or None if not found. |
Source code in yani/_core/__init__.pyi
4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 | |
step_materials
step_materials(material_id: int) -> list[Material]
Composition at the end of each schedule step, without the initial one.
Indexed as timesteps, so entry i is the state at the end of step
i and pairs with get_reaction_rates(material_id, i). This is the
list Material.transmute used to return on its own. Each keeps
material_id, as get_material says.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
Returns:
| Type | Description |
|---|---|
list[Material]
|
List[Material]: One material per step; empty if the material is |
list[Material]
|
unknown or was never stepped. |
Source code in yani/_core/__init__.pyi
4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 | |
get_final_material
get_final_material(material_id: int) -> Optional[Material]
Final composition for a material, after the last step. It keeps
material_id, as get_material says.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Material]
|
Material at the end of the schedule, or None if the material is |
Optional[Material]
|
unknown. |
Source code in yani/_core/__init__.pyi
4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 | |
get_dpa
get_dpa(material_id: int, element: Optional[str] = None) -> Optional[list[float]]
Cumulative NRT displacements per atom (dpa) over the schedule.
Present when the transmute call was given
displacement_damage=True, and None otherwise. One value per
state, aligned with times: entry 0 is the initial composition and
is zero, and entry i is the total after schedule step i - 1.
Cooldowns add nothing.
For an element X it is the damage energy deposited per atom of
X, from X's own nuclides, converted with X's displacement
threshold energy as 0.8 * E_damage / (2 * E_d) (the NRT model,
ASTM E521). The material total, with element omitted, is the
atom-fraction-weighted sum over elements: each element's recoils are
treated as slowing down among atoms of their own kind, which reduces to
the elemental value for a pure element and leaves out energy transfer
between elements in a cascade. MT=444 is already integrated over the
recoil spectrum, so the per-recoil threshold steps of the NRT model
(no displacement below E_d, one up to 2 * E_d / 0.8) are not
applied, which is the standard practice for a damage-energy cross
section. The E_d used and its source are in
get_displacement_damage_info, and the nuclear-data spread, when
data_uncertainty was given too, in get_dpa_uncertainty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
element
|
Optional[str]
|
Element symbol, e.g. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[list[float]]
|
List of cumulative dpa, one per state, or None if damage was not |
Optional[list[float]]
|
asked for or the material is not in the results. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in yani/_core/__init__.pyi
4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 | |
get_damage_energy
get_damage_energy(material_id: int, element: Optional[str] = None) -> Optional[list[float]]
Cumulative damage energy deposited per atom [eV] over the schedule.
The quantity dpa is computed from, kept separate so the displacement
model can be changed without the data: each nuclide's MT=444
damage-energy cross section [eV barn] folded against the pulse
spectrum by the same collapse as the reaction rates, times the flux
magnitude and the step duration, at each step's composition. Indexed
as get_dpa. For an element it is per atom of that element; the
material total weights the elements by atom fraction, so it is per atom
of the material.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
element
|
Optional[str]
|
Element symbol for that element's damage energy; omit it for the material total. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[list[float]]
|
List of cumulative damage energy [eV per atom], one per state, or |
Optional[list[float]]
|
None if damage was not asked for or the material is not in the |
Optional[list[float]]
|
results. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in yani/_core/__init__.pyi
4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 | |
get_dpa_uncertainty
get_dpa_uncertainty(material_id: int, step: int, element: Optional[str] = None) -> Optional[Estimate]
NRT dpa at one timestep, with the nuclear-data spread on it.
Present when the transmute call was given both
displacement_damage=True and data_uncertainty. Each replica's
dpa is accumulated over its own inventory, with each starting nuclide's
damage-energy rate moved by the replica's draw:
"cross_sections": MT=444 has no covariance of its own, but it is the sum over reactions of each cross section times the damage energy that reaction deposits, so a draw moves it by each reaction's deposit times its drawn change. The elastic and inelastic reactions, which carry most of it, are drawn with the activation channels as one evaluation. What no reaction's deposit reproduces (fission's share) is held;get_data_uncertainty_info(...)["damage_energy"]says how much that is per nuclide."flux_spectrum": the damage energy's own per-group terms under the replica's flux draw, where the spectrum has a sigma.
Transmutation products' damage energy, short-range (LB=8) covariance and the displacement threshold energies are held at nominal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial composition, which has no dpa). |
required |
element
|
Optional[str]
|
Element symbol for that element's dpa; omit it for the material total. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[Estimate]
|
Estimate | None: None if damage or uncertainty was not asked for, |
Optional[Estimate]
|
or the material is not in the results. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in yani/_core/__init__.pyi
4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 | |
get_damage_energy_uncertainty
get_damage_energy_uncertainty(material_id: int, step: int, element: Optional[str] = None) -> Optional[Estimate]
Damage energy per atom [eV] at one timestep, with the nuclear-data spread on it.
The same replicas as get_dpa_uncertainty, before the NRT
conversion, so its relative spread is the dpa's for a pure element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Timestep index (0 = initial composition). |
required |
element
|
Optional[str]
|
Element symbol for that element's damage energy; omit it for the material total. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[Estimate]
|
Estimate | None: None if damage or uncertainty was not asked for, |
Optional[Estimate]
|
or the material is not in the results. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in yani/_core/__init__.pyi
4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 | |
get_displacement_damage_info
get_displacement_damage_info(material_id: int) -> Optional[dict]
What the displacement damage was computed with, and what it could not count.
None unless the transmute call was given
displacement_damage=True. A dict:
model:"NRT", andefficiency:0.8.displacement_energies: per element with dpa,{"energy": E_d in eV, "source": ...}, wheresourceis"ASTM E521","OECD-NEA 2015"(Table 2.4 of NEA/NSC/DOC(2015)9, for an element ASTM E521 does not cover) or"user".without_damage_energy: nuclides present on an irradiated step whose data has no MT=444, each with the largest atom fraction it reached there. Their damage energy is not counted, so a large entry here means the totals are low by about that share. Only transmutation products can appear: a nuclide of the starting composition without MT=444 is refused.without_displacement_energy: transmutation-product elements with no displacement threshold energy (hydrogen and helium, typically), each with the largest atom fraction reached. Their damage energy is counted inget_damage_energy; they add nothing toget_dpa. Passdisplacement_energiesto include them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
Source code in yani/_core/__init__.pyi
4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 | |
get_reaction_rates
get_reaction_rates(material_id: int, step: int) -> Optional[Any]
Per-edge reaction rates the solve drove one step with.
The rate of each individual production edge, which the solve computes to build the burnup matrix and used to throw away. Without it a consumer can enumerate the routes into a product but not weight them, so a route carrying 99.9% and one carrying 0.1% look alike.
Both methods report the same quantity in the same shape.
method="coupled" takes the rates from that step's transport tallies
and method="independent" from the single transport's multigroup fold
scaled by the step's source rate; either way the edge rate is that rate
times the branching of the chain the step was solved with, isomeric
overlay included.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Schedule step index, the same index as |
required |
Returns:
| Type | Description |
|---|---|
Optional[Any]
|
dict[str, dict[str, list[tuple[str | None, float]]]] | None: parent |
Optional[Any]
|
nuclide -> reaction kind -> [(target, rate [1/s])]. A |
Optional[Any]
|
|
Optional[Any]
|
means fission, whose products come from the yields rather than from |
Optional[Any]
|
an edge. Empty for a decay-only step, and |
Optional[Any]
|
or the step is unknown. |
Examples:
>>> rates = results.get_reaction_rates(material_id=1, step=0)
>>> rates["Fe56"]["(n,gamma)"]
[('Fe57', 1.7e-09)]
>>> # share of Mn56 production arriving down each route
>>> into_mn56 = [
... (parent, kind, rate)
... for parent, kinds in rates.items()
... for kind, edges in kinds.items()
... for target, rate in edges
... if target == "Mn56"
... ]
Source code in yani/_core/__init__.pyi
4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 | |
get_reaction_rate_spectrum
get_reaction_rate_spectrum(material_id: int, nuclide: str, kind: str, step: int) -> Optional[Any]
One channel's reaction rate over one step, resolved onto the groups of the spectrum that drove it.
get_reaction_rates answers with one number per edge, already
collapsed against the whole spectrum. That number cannot say which part
of the spectrum made it, and where a cross section spans decades the two
readings are different physics: an effective W186(n,gamma) of 57 mb
against a spectrum 89% of which sits in 12-16 MeV and 0.7% of which is
below 100 keV is either a fast-capture rate or a resonance-region rate,
and only the breakdown says which. A disagreement can then be pinned on
resonance processing rather than guessed at, and a covariance grid that
stops short of the spectrum can be checked against where the rate
actually is.
The per-group entries sum to the collapsed rate for the same channel, to floating-point rounding, because both come from the same walk of the same cross sections with the same self-shielding weighting.
Nothing is stored for this. The breakdown is re-derived from the spectrum when asked for, which is one reaction over the group structure; keeping it for every channel would be tens of megabytes on a 709-group structure, and a run that never asks should not pay that.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
nuclide
|
str
|
The parent the reaction happens on, e.g. |
required |
kind
|
str
|
The reaction, spelled as the chain spells it, e.g.
|
required |
step
|
int
|
Schedule step index, as |
required |
Returns:
| Type | Description |
|---|---|
Optional[Any]
|
dict | None: |
Optional[Any]
|
one longer than the rates, and |
Optional[Any]
|
to the rate [1/s]. None when the material, the step, the nuclide or |
Optional[Any]
|
the channel is unknown; for a step that drove no flux, whether by |
Optional[Any]
|
being a cooldown or by carrying a zero rate; for |
Optional[Any]
|
rate comes from the branching overlay's partials rather than from a |
Optional[Any]
|
group average; and for a transport-coupled solve, which scores its |
Optional[Any]
|
rates at the collision energy and keeps no group structure to |
Optional[Any]
|
resolve them onto. |
Examples:
>>> spectrum = results.get_reaction_rate_spectrum(
... material_id=1, nuclide="W186", kind="(n,gamma)", step=0
... )
>>> sum(spectrum["rates"]) # the collapsed rate
1.9e-09
>>> # where in energy that rate came from
>>> below_100_keV = sum(
... r
... for lo, r in zip(spectrum["boundaries"], spectrum["rates"])
... if lo < 1.0e5
... )
Source code in yani/_core/__init__.pyi
4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 | |
get_isomeric_branching
get_isomeric_branching(material_id: int, step: int) -> Optional[Any]
Flux-weighted isomeric branching at one step.
Which state a reaction leaves its product in is energy dependent, so the
single number describing a spectrum is the branching collapsed against
it, and that number exists only inside a solve. The chain file carries
the unweighted ratios, and where the branching overlay supplies the
split it carries a placeholder instead: on TENDL-2025 the dominant
tungsten channel reads W186 (n,2n) -> W185 1.000000 and
W186 (n,2n) -> W185_m1 0.000000 in the file, and the overlay
replaces both at solve time with roughly the 54/46 that spectrum gives.
On a foil whose decay heat comes from an isomer, that difference is the
whole answer.
Only channels landing in more than one final state appear. A channel
with one product has no branching to report, and listing it at 1.0
buries the ones that do; get_reaction_rates has the unnormalised
edges if the rest is wanted.
This is the number that says whether a disagreement belongs to a cross section or to a branching ratio, which are different data and different fixes.
Channels come back ordered by production, the channel's rate times its
parent's atom density at the start of the step. A rate on its own is per
atom of the parent, so ordering on it promotes whatever sits on a trace
isotope: on an FNS tungsten foil W180(n,2n) has the highest per-atom
rate of any channel in the foil, and W180 is 0.12% of it, so by what it
made the channel falls to fifth, two orders of magnitude below the
W186(n,2n) carrying most of that foil's decay heat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Schedule step index, the same index |
required |
Returns:
| Type | Description |
|---|---|
Optional[Any]
|
list[dict] | None: one entry per splitting channel, most produced |
Optional[Any]
|
first, each with |
Optional[Any]
|
|
Optional[Any]
|
ordered with the largest share first. Empty for a decay-only step, |
Optional[Any]
|
and None if the material or the step is unknown. A parent absent |
Optional[Any]
|
from the step's starting composition has production 0.0 and sorts |
Optional[Any]
|
last rather than being dropped. |
Examples:
>>> results.get_isomeric_branching(material_id=1, step=0)[0]
{'parent': 'W186', 'reaction': '(n,2n)', 'production': 9.35e-14,
'split': [('W185_m1', 0.535), ('W185', 0.465)]}
Source code in yani/_core/__init__.pyi
4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 | |
get_branching_report
get_branching_report(material_id: int, step: int) -> Optional[dict]
What the isomeric-branching rule did over one step's spectrum.
The branching evaluation gives the split and the cross-section library
the total. How a list's values are read is decided by how the
evaluation gives them, which the converter records: a complete MF=10
list (its ground state listed) and every MF=9 list are shares of the
transport total, applied at each energy; an MF=10 list of isomers only,
and every (n,n') list, are absolute productions, the ground state
taking the rest. This says, per channel, which of those applied and how
much of the parent's removal rate rests on anything the evaluation
does not give.
It also says where each split came from. With several branching
sources (transmutation_branch_ratios = ["irdff-ii", "endf-b8.1"])
each channel takes its split from the first source that evaluates it,
and its source names that one. mixed is True when the splits
come from more than one library, or a split from a library other than
its reaction's total, so a mixed run reads as one at the top of the
report.
MT=5, (n,anything), is the (n,X) reaction: its residuals, read
from the reaction library's MF=6 MT=5, are shares of the MT=5 total
at each energy (file 6, representation "share"), and its
light particles H1 to He4 are their multiplicities times that total
(representation "multiplicity", each state's share the
multiplicity folded over the spectrum, which can exceed one).
A run refuses when the clipped or held production of its channels,
each parent weighted by its density, is more than 0.1% of the
material's neutron removal rate; each channel's clipped_share and
extrapolated_share are of its own parent's removal. A multiplicity above what the target's nucleons allow is
clipped like any other impossible value. unmodelled_mt5 lists the
parents whose MT=5 residuals the chain does not model, with the reason;
on a reactions subsection that carries MT=5, a run warns when those
of the material's own nuclides carry more than 0.1% of the material's
removal rate (one written before MT=5 was carried is reported only).
The solve continues with an incomplete inventory: absent residuals are
not invented, and the missing removal fraction does not bound activity
or decay-heat error. The clipped/held production refusals are unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
step
|
int
|
Schedule step index, as |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
dict | None: |
Optional[dict]
|
|
Optional[dict]
|
None if the material or the step is unknown. Each channel has |
Optional[dict]
|
|
Optional[dict]
|
|
Optional[dict]
|
|
Optional[dict]
|
|
Optional[dict]
|
|
Optional[dict]
|
and |
Optional[dict]
|
reaction's share of the parent's removal rate), |
Optional[dict]
|
and |
Optional[dict]
|
|
Optional[dict]
|
most exceed the evaluation's own total, or None), |
Optional[dict]
|
|
Optional[dict]
|
from, as named in |
Optional[dict]
|
|
Optional[dict]
|
subsection) and |
Optional[dict]
|
total came from, or None where that is not known). |
Optional[dict]
|
the branching sources the channels used, in the configured order, |
Optional[dict]
|
and |
Optional[dict]
|
dropped channel has |
Optional[dict]
|
|
Optional[dict]
|
where it cannot be folded). |
Optional[dict]
|
|
Optional[dict]
|
of each parent whose MT=5 residuals are not modelled, largest |
Optional[dict]
|
first. Empty for a decay-only step. |
Examples:
>>> report = results.get_branching_report(material_id=1, step=0)
>>> report["channels"][0]["representation"]
'absolute'
>>> # A Nb93 foil, transmutation_branch_ratios = ["irdff-ii", "endf-b8.1"]
>>> [(c["reaction"], c["source"]) for c in report["channels"] if c["parent"] == "Nb93"]
[('(n,2n)', 'irdff-ii'), ('(n,gamma)', 'irdff-ii'), ("(n,n')", 'irdff-ii')]
>>> report["mixed"]
True
Source code in yani/_core/__init__.pyi
4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 | |
get_production_routes
get_production_routes(material_id: int, product: str, step: int, reaction_depth: int = 1, decay_depth: int = 3) -> Optional[Any]
Every way a product was made over one step, weighted by how much of it arrived down each.
Enumerating routes is easy and weighting them is not. Asked what makes
W187, a chain answers Os190(n,a) and Ir192(n,npa) as readily as
W186(n,gamma), and nothing in a tungsten foil is osmium. So the walk
starts from the nuclides the material actually began with, and each
route is weighted by what its own reactions drove rather than by
anything read off the chain.
A route is reaction_depth neutron reactions followed by up to
decay_depth decays. Its weight is the atoms it starts from, times
each reaction step's per-atom production over the step, times the
branching of every decay it passes through: a route through a 1% branch
delivers 1% of what the reaction made. Reaction steps carry the step
duration, so a two-reaction route is in the same units as a one-reaction
route and comes out smaller by roughly a factor of the fluence, which is
the honest answer for an irradiation short enough that products barely
burn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_id
|
int
|
Material ID number. |
required |
product
|
str
|
The nuclide whose production is being explained. |
required |
step
|
int
|
Schedule step index, as |
required |
reaction_depth
|
int
|
Neutron reactions a route may use. 1 is what the published pathway tables carry. |
1
|
decay_depth
|
int
|
Decays a route may follow after them. |
3
|
Returns:
| Type | Description |
|---|---|
Optional[Any]
|
list[dict] | None: one entry per route, largest share first, each |
Optional[Any]
|
with |
Optional[Any]
|
|
Optional[Any]
|
|
Optional[Any]
|
production, summing to one) and |
Optional[Any]
|
before normalising, so that 100% of almost nothing is |
Optional[Any]
|
distinguishable from 100% of the inventory). Empty when nothing in |
Optional[Any]
|
this material makes the product, which is an answer. None if the |
Optional[Any]
|
material, the step, or the chain is unknown. |
Examples:
>>> for r in results.get_production_routes(1, "W185", 0):
... print(f"{r['route']:<32} {r['share']:.1%}")
W186(n,2n)W185_m1(IT)W185 53.0%
W186(n,2n)W185 46.8%
Source code in yani/_core/__init__.pyi
4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 | |
to_arrow
to_arrow(path: Optional[str | PathLike | Path] = None) -> Optional[bytes]
Save the result as an Arrow IPC file.
One file holds one result. Every file has the same schema, so the
files of a run split into parts read back as one table with
polars.scan_ipc("parts/*.arrow") or pyarrow.dataset: one row
per stored number, with columns material_id, material_name,
step, quantity ("density", "reaction_rate" or
"source_rate"), nuclide, reaction, product and
value. Everything else the result holds is in the schema metadata,
so TransmutationResults.from_arrow gives back the same result.
The file pins, rather than stores, the transmutation chain and the
nuclear data the run read; see from_arrow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | PathLike | None
|
Where to write. None returns the file's bytes instead, for a browser or Pyodide session with no file system to write to. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[bytes]
|
bytes | None: The file's bytes when |
Examples:
>>> results.to_arrow("part_1.arrow")
>>> data = results.to_arrow()
Source code in yani/_core/__init__.pyi
4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 | |
from_arrow
staticmethod
from_arrow(source: Any) -> TransmutationResults
Load a result that to_arrow saved.
Every getter answers as it did on the saved result, but three of them
re-derive from data the run read rather than from what it computed:
get_production_routes and get_isomeric_branching walk the
transmutation chain, and get_reaction_rate_spectrum reads the
initial composition's cross sections. The file pins both: the chain by
a sha256 of its contents, and each nuclide by the file it was read
from (for a library keyword, a folder of the release the run used).
On load the chain is assembled from the configured
yamc.transmutation_* sources and kept only if it is the same data,
and each nuclide is read again from its file. Whatever cannot be
reattached is reported in one UserWarning, and the getters that
need it raise RuntimeError rather than answer from other data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | PathLike | bytes
|
A file path, or the bytes
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
TransmutationResults |
TransmutationResults
|
The saved result. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> results = yani.TransmutationResults.from_arrow("part_1.arrow")
Source code in yani/_core/__init__.pyi
4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 | |
yani.DoseCoefficients
Fluence-to-dose conversion coefficients (effective dose or ambient dose
equivalent H*(10)), returned by :func:yani.data.dose_coefficients.
Carries the energy grid, the coefficients, and their units, and can
repackage itself for a tally via :meth:as_energy_function.
energy
property
energy: list[float]
Incident energies in eV.
coefficients
property
coefficients: list[float]
Fluence-to-dose coefficients, one per energy.
units
property
units: str
Units of the coefficients ("pSv cm2").
as_energy_function
as_energy_function() -> tuple[list[float], list[float], str, str]
Repackage as the (energy, coefficients, units, interpolation) tuple
accepted by Tally(energy_function=...). The interpolation is
"log-log", how the tabulation is read everywhere else.
Source code in yani/_core/__init__.pyi
689 690 691 692 693 694 | |
yani.ClearanceResult
The outcome of assessing a material against one clearance limit set.
Every regulation here uses the same arithmetic: each radionuclide's
activity divided by its tabulated limit, summed. The material meets the
limits when that sum, index, is below threshold. The per-nuclide
dicts are ordered largest first.
Examples:
>>> result = material.clearance_index("UK_EPR16_out_of_scope")
>>> result.clearable
False
>>> result.dominant(2)
[('Co60', 11.2...), ('Cs137', 0.029...)]
>>> print(result)
limit_set
property
limit_set: str
Name of the limit set assessed against.
index
property
index: float
The sum of activity-to-limit ratios.
threshold
property
threshold: float
The value the index must stay below, normally 1.
units
property
units: str
Activity units the comparison was made in: "Bq/g", "Ci/m3" or
"Bq".
clearable
property
clearable: bool
Whether the material meets this set's limits.
out_of_scope
property
out_of_scope: bool
Whether the regulation excludes this material outright, which for the UK sets means every radionuclide present is shorter lived than 100 s.
by_nuclide
property
by_nuclide: dict[str, float]
Each nuclide's contribution to the index, largest first.
activities
property
activities: dict[str, float]
Each nuclide's activity in units, largest first.
limits_used
property
limits_used: dict[str, float]
The limit applied to each nuclide, after any metal, per-gram, dynamic or secular equilibrium adjustment.
defaulted
property
defaulted: list[str]
Nuclides that took the set's catch-all limit because the table does not list them.
excluded
property
excluded: dict[str, str]
Nuclide to the reason its activity was left out, which is always that a parent's limit already accounts for it in full.
credited
property
credited: dict[str, float]
Nuclide to the activity a parent accounted for, where the parent could only support part of it. The remainder was assessed against the nuclide's own limit.
uncovered
property
uncovered: dict[str, float]
Activity present with no limit and no catch-all, so absent from the index entirely. The number to check before trusting a comfortable index.
unlimited
property
unlimited: list[str]
Nuclides present that the source explicitly places no limit on.
uncovered_activity
property
uncovered_activity: float
Total activity with no limit, in units.
uncovered_fraction
property
uncovered_fraction: float
Share of total activity that falls outside the sum, from 0 to 1.
material_name
property
material_name: str
The material's name, carried through for reporting.
assessed_activity
assessed_activity(nuclide: str) -> float
The activity actually charged against the limit for one nuclide: its total activity, less any part a parent accounted for.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nuclide
|
str
|
Nuclide name, such as |
required |
Source code in yani/_core/__init__.pyi
202 203 204 205 206 207 208 209 | |
dominant
dominant(count: int = 10) -> list[tuple[str, float]]
The nuclides contributing most to the index, largest first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
How many to return. |
10
|
Source code in yani/_core/__init__.pyi
210 211 212 213 214 215 216 | |
to_json
to_json(path: Optional[str | PathLike | Path] = None) -> Optional[bytes]
Save the result as JSON: the limit set, material, index, threshold and units, whether it is clearable or out of scope, and per nuclide the index contributions, activities and limits used, with the defaulted, excluded, credited, uncovered and unlimited nuclides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | PathLike | None
|
Where to write. None returns the JSON as bytes instead, for a browser or Pyodide session. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[bytes]
|
bytes | None: The JSON when |
Examples:
>>> result.to_json("clearance.json")
>>> json.loads(result.to_json())["clearable"]
True
Source code in yani/_core/__init__.pyi
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
yani.PhotonCoefficients
A photon coefficient tabulated against energy, returned by
:func:yani.data.mass_attenuation_coefficient and
:func:yani.data.mass_energy_absorption_coefficient.
Carries the energy grid and the coefficients, and evaluates itself between the tabulated points with the log-log interpolation NIST publishes these for.
energy
property
energy: list[float]
Tabulated energies in eV. An absorption edge appears as two energies one ulp apart, carrying the value below and above the edge.
coefficients
property
coefficients: list[float]
The coefficient at each tabulated energy, in cm²/g.
units
property
units: str
Units of the coefficients ("cm2/g").
interpolate
interpolate(energy: float) -> float
The coefficient at energy (eV), log-log interpolated.
Energies outside the tabulated range return the nearest end value rather than extrapolating: the tabulation stops where the data does.
Source code in yani/_core/__init__.pyi
2444 2445 2446 2447 2448 2449 2450 | |
as_energy_function
as_energy_function() -> tuple[list[float], list[float], str, str]
Repackage as the (energy, coefficients, units, interpolation) tuple
accepted by Tally(energy_function=...). The interpolation is
"log-log", matching :meth:interpolate, so a tally weights by the
same values; its absorption edges are steps rather than the ringing a
cubic spline gives across them.
Source code in yani/_core/__init__.pyi
2451 2452 2453 2454 2455 2456 2457 2458 | |
yani.PhotonContinuum
One nuclide's decay photon continuum within a material's inventory.
ENDF gives part of some decay spectra as a density over energy rather than
as lines: the spontaneous-fission photons of an actinide, or the whole
photon emission of a nuclide far from stability, whose lines were never
measured. The values are a rate per eV, so they are not line rates and
cannot be added to decay_photon_spectrum()'s. Their rate is the
integral, which emission_rate gives. Both follow the per argument
of decay_photon_continua(): for the whole material, or per cm³ or per g.
nuclide
property
nuclide: str
The emitting nuclide.
energies
property
energies: list[float]
Tabulated energies [eV], ascending.
rates
property
rates: list[float]
The emission-rate density at each energy: photons/s/eV for the whole
material, or per cm³ or per g following the per argument the
continuum was requested with.
interpolation
property
interpolation: Optional[str]
How rates is read between the energies: the ENDF law by name
("histogram", "linear-linear", ...), or None where the data
states no law, which data written before the law was stored does.
emission_rate
property
emission_rate: float
The emission rate over the whole continuum, its integral read under its
law: photons/s for the whole material, or per cm³ or per g following
the per argument the continuum was requested with.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the law is not stated, or is one this build does not integrate, or if the energy and rate lists are unpaired, the energies are not finite or descend, or the rates are negative or not finite. The integral is then unknown, and no number is returned in its place. |
Nuclear-data uncertainty
DataUncertainty is passed to Material.transmute(), not read from it; the
sigmas and the coverage report it produces come back on TransmutationResults
above. Estimate and LineEstimate are what the derived quantities come back
as, a nominal value with the ensemble's spread beside it, from
get_activity_uncertainty and the three getters like it. What the uncertainty
covers, and what a sigma of zero does and does not mean, is in
Nuclear-data uncertainty.
yani.DataUncertainty
DataUncertainty(seed: int = 1, samples: Optional[int] = None, sources: Optional[Sequence[str]] = None, attribution: bool = False, convergence: Optional[float] = None)
Request nuclear-data uncertainty on a transmutation.
Pass one to :meth:Material.transmute and the result carries a standard
deviation on every nuclide density alongside the mean.
What it can cover, by source (DataUncertainty.available_sources()):
"cross_sections": the activation cross sections, sampled from the ENDF MF=33 covariance folded against this material's own spectrum, and where the library folder carries the evaluation's resonance parameters (MF=2 and MF=32,resonance_parameters.arrow), the parameters themselves: each replica draws them from their covariance, rebuilds the resonance range's cross sections from the draw and Doppler broadens the change to the temperature in use, so the resonance range's uncertainty is exact in the parameters rather than first order. On a transport-coupled run the change is folded against the flux the transport tallied on the nuclide's own energy grid through its resonances, so a self-shielded resonance is weighted with its own flux dip. A nuclide whose parameters cannot be sampled keeps the first-order MF=32 rows ofcovariance.arrow, and the report says which and why;"flux_spectrum": the spectrum itself, from the per-binflux_std_devgiven on aPulse;"half_life": every reachable nuclide's half-life, from the decay data's own standard deviation. A replica's half-lives are used in its solve AND in the activity, decay heat and dose evaluated from it, so a saturated activity (lambda N = R) is correctly insensitive to its own half-life rather than inheriting the density's spread;"decay_branching": the decay branching ratios of every reachable parent with several modes and a stated sigma, drawn so the parent's total is kept and every ratio stays between zero and it: each mode but one from a logit-normal with the evaluated ratio as its mean and the stated sigma as its standard deviation, the last their complement, coupled so the modes carry the zero-sum covariance of largest entropy that realises every stated sigma (for two or three modes the only one). A small branch with a large relative sigma is drawn skewed, never below zero. A largest sigma above the sum of the others' is drawn as that sum; a single mode stating no sigma is the complement of the rest when it is the largest or the only way to trade; a mode whose sigma no ratio with its mean can have (sigma**2 >= b * (T - b)), and a mode stating none otherwise, are held at their ratios and the rest share what is left. The report names every parent short of its stated sigmas by why;"statistical": the Monte Carlo uncertainty of transport-tallied reaction rates, from their per-history covariance, drawn independently for each material since their tallies are separate estimates. It applies toModel.simulate_transmutation, as"flux_spectrum"applies only toMaterial.transmute; each call ignores the other's, and the report'ssourceslists what actually applied;"decay_energy": each nuclide's mean decay energy, from the sigma the decay data gives each recoverable-heat component (beta, gamma, alpha), or the total's where it gives no split. It moves decay heat only: a decay energy never enters the solve, so the inventory and activity are untouched;"decay_photon_lines": each decay photon spectrum's normalisation (FD for lines, FC for a continuum), one draw per spectrum common to all its lines, and each line's own intensity (dRI) and energy (dER), from the decay data's MT=457 sigmas. It moves the decay photon spectrum, the contact dose and, through the gamma decay energy E_EM, which follows each replica's drawn lines in place of a"decay_energy"draw, the decay heat; no photon enters the solve. The decay data do not state how a nuclide's photon intensities are correlated beyond the normalisation (between the lines' dRI, between a normalisation and its lines, between gamma and x-ray spectra), so each output is evaluated at both ends:Estimate.std_devtakes them independent andEstimate.std_dev_correlatedfully correlated. A D1S dose (PulseSchedule.time_correct_tally) draws the normalisations alone;"fission_yield": each fissioning parent's independent yields (MT=454), from the DY the evaluation states on each, drawn on the tape's own products and summed onto the chain's the way the converter summed the nominal yields. No evaluation states a correlation between yields, so each is drawn independently and the yields of a draw are not renormalised. An actinide that borrows another's yields shares its draw. Needs a chain that carries the evaluated yields (fission_yields/evaluated_yields.arrow); without one every parent is listed underno_fission_yield_uncertainty;"isomer_branching": the isomeric split of every reachable reaction whose evaluation states the MF=40 covariance of its final states' production cross sections (the MF=10 partials of the branching subsection, from itsbranching_covariance.arrow). Each stated state's production is drawn on the covariance's own energy grid, folded against the same spectrum and weight as the nominal split, and the split re-made from the draw by the nominal branching rule. Where the list names its ground state only the shares move, and they still sum to one, while the reaction's total stays the cross sections' (MF=33), so the uncertainty of the total is not counted twice. An isomer listed alone, and every(n,n')isomer, is an absolute production: it is made at its drawn value, the ground state taking the rest of the total, so its own MF=40 sigma replaces the MF=33 sigma of its reaction that it carries with"cross_sections"alone, and can be the smaller. Applies toMaterial.transmute; a transport run's split comes from tallied partials and is held.
Each cross-section draw is a lognormal multiplier with the covariance's own mean and variance, so a sampled rate is never negative and nothing is floored. The correlated Gaussian deviates are kept (a Gaussian copula), so the ordering between channels is preserved, but the Pearson correlations come out weaker than evaluated as the sigmas grow. Half-lives and decay energies are drawn the same way, one nuclide at a time: the decay data states a mean and a sigma for each and no correlation, so the draws carry exactly what the evaluation states and are never negative. So are the decay photon normalisations, intensities and energies, with the one correlation the data does state, a spectrum's normalisation common to its lines, and the ones it does not state bounded rather than assumed.
Held at their nominal values, with uncertainties of their own that this does not propagate:
- the decay branching ratios
"decay_branching"does not sample (a sigma wider than the ratio allows, or no sigma to draw), and the per-decay photon lines and decay energy of a drawn parent, which follow its nominal branching; - the isomeric split of a reaction whose evaluation states no MF=40
covariance on any of its states, listed in
no_isomer_branching_uncertainty, and MF=40 blocks"isomer_branching"cannot use (another evaluation's partner, a partner that is not an MF=10 production, NC, absolute and short-range layouts, a state the branching rule folds no curve for), counted inisomer_branching_blocks_not_used; - covariance correlating an evaluation with one the run does not hold
(MAT1 naming a material not in the run, counted in
skipped_cross_material), covariance with a quantity that is not a cross section (XMF1 not 0 or 3), covariance derived from other sections by an NC block that cannot be derived (LTY 1-4, or an LTY=0 block counted inskipped_nc), the covariance of a lumped reaction (MT=851-870) stated in barns, listed inlumped_covariance_not_assignable, and the resonance-parameter covariance (MF=32) of a range neither sampled nor incovariance.arrow: a library converted before the converter wrote either, or a resonance range whose formalismendfdoes not reconstruct. No library yani reads states an XMF1 other than 0 or 3, an NC block with LTY 1-4, or a lump in barns. What is sampled is each reaction's explicit MF=33 blocks, the resonance parameters where the folder carries them and otherwise the resonance-range blocks the converter derives from MF=32 and writes beside them, the blocks of a lumped reaction for each of its components (one component is the lump; several each take the lump's relative perturbation, moving together), for a level sum with no covariance of its own its levels' (W186(n,p)as the lumped MT 855 of MT 600 and 649), and for a reaction an LTY=0 NC block states as a sum of others (ENDF/B-VIII.1 O16 (n,p) as MT 600 to 603, U235 MT 4 as MT 51 plus the lumped MT 851), the covariance derived from the named reactions' own blocks and the cross blocks between them. A block correlating two evaluations the run both holds (the neutron standards: ENDF/B-VIII.1 U235 fission with U238 fission and capture, Pu239 fission, Au197 capture and Li6 (n,t)) is applied, counted inapplied_cross_material: the two nuclides are drawn jointly, one draw per replica shared by every material; - the self-shielding correction, when
self_shielding_chordorself_shielding_shapeis given: the shielded flux is built once from the nominal cross sections and reused by every replica, sampled resonance parameters included; - on a transport run, the flux's response to a perturbed cross section:
there is one transport, not one per replica. The tallied values
themselves are still drawn by the
"statistical"source; - the decay photon spectrum covariance and continuum shape (MF=8 MT=457 LCOV, which no library states), photon attenuation (XCOM), air energy absorption (NIST SRD 126), the ICRP-116 fluence-to-dose coefficients and the contact-dose build-up factor;
- the material's composition, density, natural isotopic abundances and the AME2020 atomic masses used to convert mass fractions;
- any source switched off with
sources, or with nothing to act on (a spectrum given withoutflux_std_dev). When only some of a material's spectra have one, the entry is"flux spectrum (spectra without a sigma only)"andspectra_without_flux_sigmagives the count. A rate under a spectrum with a sigma that the flux draw cannot move is named influx_rates_without_terms.
TransmutationResults.get_data_uncertainty_info lists every one of these
that applied to a material under not_perturbed, along with any nuclide
whose evaluation carries no covariance, any unstable nuclide whose
half-life or decay energy has no stated sigma, and any whose stated
half-life or decay-energy sigma no draw can carry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
int
|
Base seed. A given nuclide's perturbation in a given replica
is a pure function of |
1
|
samples
|
int
|
Fixed replica count. Leave as |
None
|
sources
|
list[str]
|
Which inputs to perturb. Naming a source this build cannot perturb raises, rather than
being ignored. A source that has not landed yet must not look like
one that contributed nothing. |
None
|
attribution
|
bool
|
Also say where the uncertainty comes from, read
with |
False
|
convergence
|
float
|
How well each standard deviation must
be known before the run stops: the standard error of the sample
standard deviation, relative to it, |
None
|
Examples:
>>> results = iron.transmute(
... schedule=sched,
... data_uncertainty=yani.DataUncertainty(seed=42),
... )
>>> results.get_nuclide_density(iron.id, "Mn56", 1)
1.234e-08
>>> results.get_nuclide_uncertainty(iron.id, "Mn56", 1)
8.7e-10
Source code in yani/_core/__init__.pyi
597 | |
attribution
property
attribution: bool
Whether the run also says where the uncertainty comes from.
convergence
property
convergence: float
The target for each standard deviation's standard error, relative to it, that an adaptive run stops on.
available_sources
staticmethod
available_sources() -> list[str]
The uncertainty sources this build can perturb.
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: Names accepted by the |
Source code in yani/_core/__init__.pyi
598 599 600 601 602 603 604 605 | |
yani.Estimate
A quantity's value, and the spread the nuclear-data ensemble puts on it.
nominal is the unperturbed run, and is present whether or not
uncertainty was asked for. mean and std_dev are None below two
replicas: a spread over fewer than two samples is unmeasured, not zero, and
reporting it as zero would read as a quantity known exactly.
A quantity a decay photon intensity enters (contact dose, the photon
spectrum, and the decay heat through its gamma part) has a range rather
than one spread when the "decay_photon_lines" source is on, because
the decay data do not state how a nuclide's photon intensities are
correlated. std_dev is the lower end, every unstated correlation taken
as zero, and std_dev_correlated the upper end, every one taken as one;
std_dev_range gives both. For any other quantity, or with the source
off, the two are equal.
nominal
property
nominal: float
The quantity from the unperturbed inventory.
mean
property
mean: Optional[float]
The ensemble mean, or None below two replicas.
Worth comparing against nominal: activity and decay heat are linear
in the atom densities, so the two agree to within the sampling error,
and a gap between them says the perturbation is biased rather than
merely wide.
std_dev
property
std_dev: Optional[float]
The ensemble's sample standard deviation, or None below two replicas.
The lower end of std_dev_range: where the "decay_photon_lines"
source is drawn, the correlations the decay data leave unstated
between a nuclide's photon intensities are taken as zero, which is the
evaluation read literally.
std_dev_correlated
property
std_dev_correlated: Optional[float]
The ensemble's sample standard deviation with those correlations taken
as one, or None below two replicas: within each nuclide the lines of a
spectrum, the spectrum's normalisation and its lines, and its gamma and
x-ray spectra all move together. The upper end of std_dev_range.
Evaluated on the same inventories as std_dev, so the two differ by
the line data alone. Equal to std_dev for activity, or when the
"decay_photon_lines" source is not drawn.
std_dev_range
property
std_dev_range: Optional[tuple[float, float]]
(std_dev, std_dev_correlated), the range every non-negative
correlation between a nuclide's photon intensities gives, or None below
two replicas.
Negative correlations are not considered: what the intensities leave unstated is a shared normalisation, which moves every line it scales the same way and cannot anticorrelate them.
relative_std_dev
property
relative_std_dev: Optional[float]
std_dev as a fraction of nominal, or None if either is absent.
relative_std_dev_correlated
property
relative_std_dev_correlated: Optional[float]
std_dev_correlated as a fraction of nominal, or None if either
is absent.
std_dev_standard_error
property
std_dev_standard_error: Optional[float]
The standard error of std_dev: how far another ensemble of the
same size could put it, or None below four replicas.
It allows for a heavy tail, Var(s^2) = s^4 (2/(n-1) + kappa/n) with
kappa the sample excess kurtosis, so a lognormal-tailed quantity
reads as less settled than a Gaussian one at the same replica count.
replicas
property
replicas: int
How many replicas the ensemble held.
replica_spread
property
replica_spread: Optional[float]
The replicas' standard deviation as they were solved, before any Monte
Carlo noise was removed, or None below two replicas. Equal to
std_dev where no noise was measured.
noise
property
noise: Optional[float]
The standard deviation of the Monte Carlo noise removed from
replica_spread, so std_dev**2 = replica_spread**2 - noise**2
(floored at zero), or None where it was not measured.
With transport replica weights each replica's tallied shift from the nominal is resolved only to the transport's history count. Each replica is solved a second time from the even half of the histories, and the spread of the difference measures that noise.
noise_dominated
property
noise_dominated: bool
Whether the noise removed exceeded a quarter of the variance left: the sigma is then mostly what more transport histories would sharpen.
yani.LineEstimate
One decay-photon line, with the ensemble's spread on its emission rate and on the energy it is emitted at.
The set of lines is not the same in every replica: a nuclide that falls
below the density floor in one draw takes its lines out of that draw. The
spectrum is reported over the union, a line missing from a replica counts as
a zero in it, and emitting says how many replicas emitted it at all --
which is the difference between a line that is dim and a line that is
sometimes not there.
energy
property
energy: float
Nominal line energy [eV], the one the evaluation states. Lines are matched across replicas on it.
energy_mean
property
energy_mean: Optional[float]
The mean energy the emitting replicas drew for this line [eV], or None
below two of them. Equal to energy unless the
"decay_photon_lines" source drew line energies.
energy_std_dev
property
energy_std_dev: Optional[float]
The sample standard deviation of the drawn energy over the emitting
replicas [eV], or None below two of them. Zero unless the
"decay_photon_lines" source drew line energies.
nominal
property
nominal: float
Emission rate from the unperturbed inventory [photons/s].
mean
property
mean: Optional[float]
The ensemble mean [photons/s], or None below two replicas.
std_dev
property
std_dev: Optional[float]
The ensemble's sample standard deviation [photons/s], or None below two replicas.
The lower end of std_dev_range: where the "decay_photon_lines"
source is drawn, the correlations the decay data leave unstated
between a nuclide's photon intensities are taken as zero, which is the
evaluation read literally.
std_dev_correlated
property
std_dev_correlated: Optional[float]
The ensemble's sample standard deviation with those correlations taken
as one, or None below two replicas: within each nuclide the lines of a
spectrum, the spectrum's normalisation and its lines, and its gamma and
x-ray spectra all move together. The upper end of std_dev_range.
Evaluated on the same inventories as std_dev, so the two differ by
the line data alone. Equal to std_dev when the
"decay_photon_lines" source is not drawn.
std_dev_range
property
std_dev_range: Optional[tuple[float, float]]
(std_dev, std_dev_correlated), the range every non-negative
correlation between a nuclide's photon intensities gives, or None below
two replicas.
Negative correlations are not considered: what the intensities leave unstated is a shared normalisation, which moves every line it scales the same way and cannot anticorrelate them.
relative_std_dev
property
relative_std_dev: Optional[float]
std_dev as a fraction of nominal, or None if either is absent.
relative_std_dev_correlated
property
relative_std_dev_correlated: Optional[float]
std_dev_correlated as a fraction of nominal, or None if either
is absent.
std_dev_standard_error
property
std_dev_standard_error: Optional[float]
The standard error of std_dev, or None below four replicas (see
Estimate.std_dev_standard_error).
replicas
property
replicas: int
How many replicas the ensemble held.
emitting
property
emitting: int
Replicas that emitted this line at a positive rate.
Below replicas when the emitter dropped out of some draws. A line
with emitting far below replicas has a mean that is mostly
zeros, and its spread says more about whether the line is there than
about how bright it is.
Nuclear data
yani.Nuclide
Nuclide(name: Optional[str] = None)
Nuclide data container exposed to Python.
Create a new (optionally named) nuclide instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Optional nuclide identifier (e.g. "Li6", "Fe56"). If not
supplied you must pass |
None
|
Notes
Individual fields (e.g. name, atomic_number, available_temperatures,
loaded_temperatures) are exposed as read-only attributes via PyO3 getters.
Detailed descriptions appear once each in the generated documentation--this
summary omits a full per-attribute list to avoid duplication.
Create a new (optionally named) nuclide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Optional nuclide identifier (e.g. "Li6", "Fe56"). If not
supplied you must pass |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Nuclide |
Nuclide
|
A nuclide object with no data loaded yet. |
Source code in yani/_core/__init__.pyi
2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 | |
name
property
name: Optional[str]
Name / identifier for the nuclide (e.g. "Li6", "Fe56").
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: Nuclide name or None if not yet set. |
element
property
element: Optional[str]
Chemical element symbol (e.g. "Fe").
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: Element symbol or None if data not loaded. |
atomic_symbol
property
atomic_symbol: Optional[str]
Atomic symbol (currently same as element symbol).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: Atomic symbol string. |
atomic_number
property
atomic_number: Optional[int]
Proton number Z.
Returns:
| Type | Description |
|---|---|
Optional[int]
|
Optional[int]: Atomic number. |
neutron_number
property
neutron_number: Optional[int]
Neutron number N.
Returns:
| Type | Description |
|---|---|
Optional[int]
|
Optional[int]: Neutron count. |
mass_number
property
mass_number: Optional[int]
Mass number A = Z + N.
Returns:
| Type | Description |
|---|---|
Optional[int]
|
Optional[int]: Mass number. |
atomic_weight_ratio
property
atomic_weight_ratio: Optional[float]
Atomic weight ratio (target mass / neutron mass) from nuclear data file.
Returns:
| Type | Description |
|---|---|
Optional[float]
|
Optional[float]: Atomic weight ratio. |
library
property
library: Optional[str]
Originating nuclear data library identifier.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: Library name/code. |
fissionable
property
fissionable: bool
Whether the nuclide is fissionable.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if fissionable. |
available_temperatures
property
available_temperatures: list[str]
All temperatures present in the source data file.
Returns:
| Type | Description |
|---|---|
list[str]
|
List[str]: Temperature labels in Kelvin (e.g. ["293"]). |
loaded_temperatures
property
loaded_temperatures: list[str]
Temperatures actually loaded into memory (subset of available_temperatures).
Returns:
| Type | Description |
|---|---|
list[str]
|
List[str]: Loaded temperatures. |
data_path
property
data_path: Optional[str]
Path to the data file used to populate this nuclide (if known).
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: Filesystem path or None. |
reactions
property
reactions: Any
Mapping of temperature -> MT number -> reaction data.
Returns:
| Type | Description |
|---|---|
Any
|
Dict[str, Dict[int, Dict[str, Any]]]: Nested dictionary. The innermost |
Any
|
dictionary has these keys:
|
reaction_mts
property
reaction_mts: Optional[list[int]]
List of MT numbers available for the (first) loaded temperature.
Returns:
| Type | Description |
|---|---|
Optional[list[int]]
|
Optional[List[int]]: List of MT identifiers or None if no data. |
energy
property
energy: Optional[Any]
Energy grids by temperature.
Returns:
| Type | Description |
|---|---|
Optional[Any]
|
Optional[Dict[str, List[float]]]: Map of temperature key to energy grid |
Optional[Any]
|
or None if no energy data loaded. |
read_nuclear_data
read_nuclear_data(path: Optional[str] = None, temperatures: Optional[Sequence[str]] = None) -> None
Read nuclear data from a file, keyword, or directory.
You can either provide a source explicitly via path or rely on
the name given at construction and the global configuration to resolve it.
Providing an explicit path will override any global configuration.
The path argument accepts:
- A file path (e.g. "tests/Li6.arrow")
- A keyword (e.g. "tendl-2025", "fendl-3.2d", "endf-b8.1")
- A directory path (e.g. "/path/to/neutron/") -- resolves to <dir>/<name>.arrow
- None -- looks up the path from yani.neutron_cross_section_data
When temperatures is provided only those temperatures are loaded while
available_temperatures always lists every temperature present in the
file. The subset actually loaded is stored in loaded_temperatures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Optional[str]
|
Optional path to the nuclide data file, keyword,
or directory. If omitted, the constructor |
None
|
temperatures
|
Optional[List[str]]
|
Temperature strings in Kelvin (e.g. ["293"]). If given only these temperatures are loaded. |
None
|
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither |
Examples:
Compare the same nuclide from different data sources:
>>> # Set global default
>>> yani.neutron_cross_section_data = "tendl-2025"
>>>
>>> # Load from global config (will use TENDL)
>>> li6_tendl = yani.Nuclide("Li6")
>>> li6_tendl.read_nuclear_data()
>>>
>>> # Override to use FENDL for comparison
>>> li6_fendl = yani.Nuclide("Li6")
>>> li6_fendl.read_nuclear_data("fendl-3.2d")
>>>
>>> # Use a directory
>>> li6_dir = yani.Nuclide("Li6")
>>> li6_dir.read_nuclear_data("/path/to/neutron/")
>>>
>>> # Use custom local file
>>> li6_custom = yani.Nuclide("Li6")
>>> li6_custom.read_nuclear_data("path/to/custom_Li6.arrow")
Source code in yani/_core/__init__.pyi
2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 | |
energy_grid
energy_grid(temperature: str) -> Optional[list[float]]
Get the energy grid for a specific temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temperature
|
str
|
Temperature key in Kelvin (e.g. "293"). |
required |
Returns:
| Type | Description |
|---|---|
Optional[list[float]]
|
Optional[List[float]]: The energy grid or None if not present. |
Source code in yani/_core/__init__.pyi
2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 | |
get_reaction_energy_grid
get_reaction_energy_grid(temperature: str, mt: int) -> Optional[list[float]]
Get energy grid for a specific temperature and MT number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temperature
|
str
|
Temperature to use for reaction data. |
required |
mt
|
int
|
ENDF/MT number for the reaction channel. |
required |
Returns:
| Type | Description |
|---|---|
Optional[list[float]]
|
Optional[List[float]]: Reaction energy grid if present. |
Source code in yani/_core/__init__.pyi
2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 | |
microscopic_cross_section
microscopic_cross_section(reaction: int | str, temperature: Optional[str] = None) -> tuple[list[float], list[float]]
Get microscopic cross section data for a specific reaction and temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reaction
|
Union[int, str]
|
Either an ENDF/MT number (int) or reaction name (str) like "(n,gamma)", "(n,elastic)", "fission", etc. |
required |
temperature
|
Optional[str]
|
Temperature to use. If None, uses the single loaded temperature if only one is available. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[list[float], list[float]]
|
Tuple[List[float], List[float]]: A tuple of (cross_section_values, energy_grid). |
Raises:
| Type | Description |
|---|---|
Exception
|
If temperature not found, reaction not found, multiple temperatures loaded without specifying one, or no data available. |
Source code in yani/_core/__init__.pyi
2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 | |
yani.Element
Element(name: str)
Chemical element container providing isotope helper methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Element symbol (e.g. "Fe", "U", "H"). |
required |
Create a new Element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Element symbol (e.g. "Fe", "U", "H"). |
required |
Source code in yani/_core/__init__.pyi
798 799 800 801 802 803 804 | |
name
property
name: str
Element symbol.
get_nuclides
get_nuclides() -> list[str]
Return list of isotope (nuclide) identifiers for this element.
Returns:
| Type | Description |
|---|---|
list[str]
|
List[str]: Isotope names sorted by mass number (e.g. ["Fe54", "Fe56"]). |
Source code in yani/_core/__init__.pyi
806 807 808 809 810 811 812 | |
yani.Reaction
Reaction(products: Sequence[ReactionProduct], cross_section: Sequence[float], threshold_idx: int, mt_number: int, q_value: float, energy_grid: Sequence[float], scatter_in_cm: bool)
Lightweight reaction summary exposed to Python.
Represents a single nuclear reaction channel with its products and cross section data.
Source code in yani/_core/__init__.pyi
2856 | |
products
property
products: list[ReactionProduct]
List of outgoing particles with their yield and secondary distributions.
cross_section
property
cross_section: list[float]
Cross section values in barns at each energy point.
threshold_idx
property
threshold_idx: int
Index into parent energy grid where this reaction becomes active (threshold).
mt_number
property
mt_number: int
ENDF MT number identifying the reaction type (e.g., 2 for elastic, 16 for (n,2n)).
q_value
property
q_value: float
Q-value of the reaction in eV (energy released if positive, absorbed if negative).
energy_grid
property
energy_grid: list[float]
Reaction-specific energy grid in eV (subset of parent nuclide energy grid).
scatter_in_cm
property
scatter_in_cm: bool
Whether scattering is in center-of-mass frame (requires CM to LAB conversion).
yani.TransmutationChain
A parsed transmutation chain.
Wraps the parsed chain data so it can be reused without re-parsing it.
Examples:
>>> chain = yani.TransmutationChain.from_arrow("transmutation-endf-b8.1-sfr.arrow")
>>> reduced = chain.reduce(["Fe56"])
>>> reduced.nuclide_names
nuclide_names
property
nuclide_names: list[str]
List of nuclide names in the chain.
half_lives
property
half_lives: Any
Half-lives of the unstable nuclides in the chain.
Returns:
| Type | Description |
|---|---|
Any
|
dict[str, float]: nuclide name -> half-life in seconds. Stable |
Any
|
nuclides (no half-life) are omitted. |
decay_energies
property
decay_energies: Any
Mean decay energies of nuclides in the chain.
Returns:
| Type | Description |
|---|---|
Any
|
dict[str, float]: nuclide name -> mean decay energy in eV. Nuclides |
Any
|
with zero decay energy are omitted. |
reactions
property
reactions: Any
Neutron-induced reactions of each nuclide in the chain.
Every nuclide in the chain is a key, including those with no reactions.
For the decay half of a production route see :attr:decays.
Returns:
| Type | Description |
|---|---|
Any
|
dict[str, list[tuple[str, str | None, float]]]: nuclide name -> |
Any
|
list of (reaction_type, target, branching_ratio). |
Any
|
|
Any
|
practice means fission. |
Any
|
where the evaluation's product has no decay data and the chain |
Any
|
builder stepped from it to a nuclide that has: ENDF/B-VIII.1's |
Any
|
Pu245 |
Any
|
from it lands back on Pu245. Such a channel leaves the parent's |
Any
|
count unchanged and makes no product, so a production-route walk |
Any
|
should skip it, as :meth: |
Any
|
does. |
decays
property
decays: Any
Decay modes of each unstable nuclide in the chain.
The other half of a production route. :attr:reactions gives the
neutron-induced edge, and a walk with only that stops at the first
product: it reaches the Hf183 in W186(n,a)Hf183 and not the
beta- step that carries it on to Ta183, or the IT step that
turns an isomer into its own ground state. Multi-step routes are what a
decay heat pathway analysis is made of.
Same tuple shape as :attr:reactions, and the same underlying
ChainReaction, so a walk can concatenate the two into one edge list.
Returns:
| Name | Type | Description |
|---|---|---|
Any
|
dict[str, list[tuple[str, str | None, float]]]: nuclide name -> |
|
Any
|
list of (decay_mode, daughter, branching_ratio), the branchings for |
|
Any
|
one parent summing to 1. Modes carry the evaluation's own |
|
spellings |
Any
|
|
Any
|
|
|
Any
|
|
|
product |
Any
|
on any mode involving spontaneous fission ( |
Any
|
|
|
Any
|
carry, on a mode whose stored daughter is the parent itself, and where |
|
Any
|
the mode's product is outside the chain. The branching is kept, so a |
|
Any
|
parent still decays at its full half-life and that share of it |
|
Any
|
leaves the chain. Stable nuclides have no decay modes and are |
|
Any
|
omitted, as they are from :attr: |
photon_sources
property
photon_sources: Any
Decay photon sources of each nuclide that has them (D1S data).
A source is lines or a continuum, and the two are in different units,
so each one says which it is. Each ENDF spectrum is its own source, so
a nuclide emitting gammas and x-rays has one line source for each.
Each has its own normalisation in the data file, which this tuple does
not expose, and the tuple does not say which radiation a source is,
so the gamma and x-ray sources cannot be told apart from Python. In
data that keeps the spectra apart (decay/sources.arrow with a
radiation column), lines are listed as the evaluation writes them:
an energy can appear in both sources, and can repeat within one. Older
data holds one merged line source per nuclide, sorted by energy with
coincident energies summed.
Material.decay_photon_spectrum() sums the lines by energy.
Returns:
| Type | Description |
|---|---|
Any
|
dict[str, list[tuple[str, list[float], list[float], str | None]]]: |
Any
|
nuclide name -> one |
Any
|
per photon source. A |
Any
|
intensity its emission rate per atom [1/s], and its interpolation is |
Any
|
None. A |
Any
|
emission-rate density per atom [1/s/eV] at that energy, read between |
Any
|
energies by |
Any
|
|
Any
|
data states no law. |
from_arrow
staticmethod
from_arrow(path: str) -> TransmutationChain
Parse a transmutation chain from a split (v2) chain directory that
holds a decay/ subsection subdir, and the reactions/ and
fission_yields/ ones where the chain has them.
A chain is a directory of files, so it is read from a path only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the chain root directory. |
required |
Examples:
>>> chain = yani.TransmutationChain.from_arrow("chain_dir")
Source code in yani/_core/__init__.pyi
3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 | |
reduce
reduce(nuclides: Sequence[str], level: Optional[int] = None) -> TransmutationChain
Reduce the chain to nuclides reachable from seed nuclides.
By default this walks until the reachable set stops growing, so the
result holds every nuclide the seeds can ever produce, no matter how
long they are irradiated. Pass level only to build a deliberately
truncated chain (a small test fixture, say); a truncated chain will
miss inventory at high fluence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nuclides
|
list[str]
|
Seed nuclide names. |
required |
level
|
int | None
|
Cap on the number of reaction/decay steps to walk. Default None, meaning walk to saturation. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
TransmutationChain |
TransmutationChain
|
Reduced chain containing only reachable nuclides. |
Source code in yani/_core/__init__.pyi
3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 | |
to_arrow
to_arrow(path: str) -> None
Write the chain to a split (v2) chain directory with decay/,
reactions/ and fission_yields/ subsection subdirs, which
:meth:from_arrow reads back. A directory, so a path is required.
Decay modes the chain models no product for (any mode involving
spontaneous fission, and a mode whose stored daughter is the parent
itself) are written with no target, as :attr:decays reports them.
Loading the export gives the same chain, but for those rows the file
does not repeat the target the source file stored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Output directory path. |
required |
Source code in yani/_core/__init__.pyi
3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 | |
yani.cache_dir
cache_dir() -> str
The directory downloaded nuclear data is cached in.
A folder in the platform's per-user cache directory (under ~/.cache on
Linux, or $XDG_CACHE_HOME when that is set; ~/Library/Caches on
macOS; %LOCALAPPDATA% on Windows), shared by both wheels. Inside it
each library keeps one folder per published release,
<keyword>/<release>/, holding that release's manifest.json and the
files downloaded from it, each verified against the manifest. Read only:
to use data from somewhere else, point the data source at a local
directory instead.
Returns:
| Type | Description |
|---|---|
str
|
The cache directory as a string, whether or not it exists yet. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the platform resolves no home directory. |
Source code in yani/_core/__init__.pyi
5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 | |
yani.available_nuclear_data_libraries
available_nuclear_data_libraries() -> dict
What each hosted nuclear data library provides, keyed by library keyword.
Read from each library's release manifest, which lists every file the release publishes, so this downloads no data: only the small release pointer and the manifest, which are cached after the first call. The release is the one a calculation would read now, or, with the data origin unreachable, the newest cached one.
Every list is complete, so an empty list means the library has none of
that: "photon": [] says it publishes no photo-atomic data, not that it
was not looked at. A library that could not be resolved at all has
None for every entry and its reason under "error".
Each library's entry is a dict:
release: the release identifier, andoffline: whether it is the newest cached release because the origin could not be reached;neutron: nuclides with neutron cross sections;neutron_covariances: per kind, the nuclides that carry it:cross_section(MF=33),resonance_parameters(MF=32),angular_distribution(MF=34),nubar(MF=31) andfission_spectrum(MF=35);thermal_scattering: thermal scattering tables;photon: elements with photo-atomic data, what photon transport reads;photonuclear: targets with photonuclear data, a different thing fromphoton;decay,reactions,fission_yields,isomeric_branching: whether the library publishes that transmutation subsection;sources: the upstream files the release was built from, each a dict withname,bytesandsha256.
Returns:
| Type | Description |
|---|---|
dict
|
dict[str, dict]: Per library keyword, what it provides. |
Examples:
>>> libraries = yani.available_nuclear_data_libraries()
>>> list(libraries)
['tendl-2025', 'tendl-2017', 'fendl-3.2d', 'endf-b8.1', 'jeff-4.0', 'jendl-5.0', 'irdff-ii']
>>> libraries["jeff-4.0"]["photon"]
[]
>>> "Fe56" in libraries["endf-b8.1"]["neutron_covariances"]["cross_section"]
True
Source code in yani/_core/__init__.pyi
4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 | |
yani.verify_library
verify_library(path: str) -> dict
Check a nuclear-data library folder against its manifest.json.
Re-hashes every file the manifest lists and compares its size and sha256 with the manifest, then looks for files the manifest does not list. Loading data from a library folder only checks the sizes of the files it reads; this is the full check, for a library kept for offline use or built locally.
Parameters
path : str
A library folder: manifest.json beside the neutron/,
photon/, photonuclear/ and transmutation/ folders it
describes, laid out as each release in :func:cache_dir is. A release
folder in the cache holds only the files runs have downloaded, so the
rest are reported missing.
Returns
dict
keyword, release, format_version and manifest_sha256
identify the release the manifest describes, and file_count and
total_bytes count what it lists. missing (listed but absent),
changed (listed, with another size or sha256) and unlisted
(in the release's <Name>.arrow/ folders, or a particle's
index.json, but not listed) are sorted paths relative to the
folder. ok is True when all three are empty.
An unlisted file fails the check: results record the manifest's sha256
as the identity of the library a run read, and a file the manifest
does not list is data that identity does not cover. Files outside the
release's folders, such as a local build's ``.build/`` folder, are not
looked at.
Raises
RuntimeError
If path is not a folder or holds no manifest.json, if the
manifest is not a version 1 release manifest or is in a
format_version this build does not read, or if a listed file
cannot be read.
Source code in yani/_core/__init__.pyi
6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 | |
yani.lookup_neutron_cross_section_data
lookup_neutron_cross_section_data(nuclide: str) -> Optional[str]
Look up the cross-section data path for a single nuclide, applying the global default if no per-nuclide entry is set.
Source code in yani/_core/__init__.pyi
5570 5571 5572 5573 5574 | |
yani.set_neutron_cross_section_data_entry
set_neutron_cross_section_data_entry(nuclide_or_keyword: str, path: Optional[str] = None) -> None
Set the cross-section data path for a single nuclide, or set the global default
if path is omitted and nuclide_or_keyword is a library keyword /
directory.
Source code in yani/_core/__init__.pyi
5770 5771 5772 5773 5774 5775 | |
yani.lookup_photon_cross_section_data
lookup_photon_cross_section_data(element: str) -> Optional[str]
Resolve one photon element from the explicit photon selection only.
Source code in yani/_core/__init__.pyi
5576 5577 5578 5579 | |
yani.group_structure
group_structure(name: str) -> list[float]
Energy boundaries of a built-in group structure, in eV.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the group structure, case-sensitive, one of the names
:func: |
required |
Returns:
| Type | Description |
|---|---|
list[float]
|
list[float]: The bin edges in eV, ascending. One more than the number |
list[float]
|
of groups, so |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the name is not a built-in group structure. The message lists the ones that are. |
Examples:
>>> import yani
>>> edges = yani.group_structure("UKAEA-1102")
>>> len(edges), edges[0], edges[-1]
(1103, 1e-05, 1000000000.0)
>>> # the energies a 1102-group spectrum belongs to
>>> midpoints = [(lo + hi) / 2 for lo, hi in zip(edges, edges[1:])]
Source code in yani/_core/__init__.pyi
5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 | |
yani.group_structure_names
group_structure_names() -> list[str]
Names of the built-in group structures.
Neutron structures first by increasing group count, then photon. Every name
except "CCFE-24-PHOTON" carries the same boundaries as OpenMC's
openmc.mgxs.GROUP_STRUCTURES entry of that name.
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: The names accepted by :func: |
list[str]
|
else a group structure can be named. |
Examples:
>>> import yani
>>> names = yani.group_structure_names()
>>> "CCFE-709" in names
True
>>> {n: len(yani.group_structure(n)) - 1 for n in names[:2]}
{'XMAS-172': 172, 'VITAMIN-J-175': 175}
Source code in yani/_core/__init__.pyi
5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 | |
Making data
yani.generate_library
generate_library(keyword: str, path: str, *, parts: Optional[Sequence[str]] = None, nuclides: Optional[Sequence[str]] = None, temperatures: Optional[Sequence[float]] = None, njoy_exec: Optional[str] = None, downloads: Optional[str] = None) -> dict
Build a whole nuclear-data library from its evaluated sources into a folder.
Downloads the library's source archives (each checked against the size and
sha256 it is pinned to), unpacks them, converts every evaluation, builds the
transmutation chain, checks the result and writes manifest.json last. The
folder is laid out as a published release, so it serves every setting:
.. code-block:: python
generate_library("endf-b8.1", "/data/endf-b8.1")
neutron_cross_section_data = "/data/endf-b8.1"
transmutation_decay_data = "/data/endf-b8.1"
Running it again resumes: finished folders are kept and only the rest are converted. A folder holds one library built by one build of this package: the same version compiled from the same core commit.
The build is recorded in the release. manifest.json carries
provenance.builder ("yani-python <version>"),
provenance.builder_commit (the core commit this extension was compiled
from, :data:__commit__) and provenance.builder_dirty
(:data:__commit_dirty__), both null when it was built outside a git
checkout, beside provenance.njoy. Every version.json and
provenance.json carries the same as one converter stamp, such as
"yani-python 0.22.1 (core 250c439e...)", and the manifest lists each
distinct stamp as converters.
An extension compiled from a tree with uncommitted changes
(__commit_dirty__ is True) writes data no commit describes, so it
builds only a partial library (parts, nuclides or temperatures
given), which is never published. Commit the changes and rebuild to build
a whole library.
Some hosts serve their archives only to a web browser (the IAEA's FENDL and
IRDFF-II files, JAEA's JENDL-5 files). The error then lists each file with
its link; download them with a browser and run again. They are found in the
Downloads folder, in downloads, or in <path>/.build/downloads/.
Parameters
keyword : str
The library: "endf-b8.1", "jeff-4.0", "jendl-5.0",
"tendl-2025", "tendl-2017", "fendl-3.2d" or "irdff-ii".
path : str
The folder to build in, created if absent. It must be new, empty or an
earlier build of the same library, and not inside :func:cache_dir.
parts : list of str, optional
What to build, of "neutron", "photon", "photonuclear",
"thermal", "decay", "reactions", "fission_yields" and
"branching". The default is every part the library's published
release carries. Only "neutron" and "thermal" run NJOY, so a
chain alone builds in minutes. "thermal" is the thermal scattering
tables (thermal/c_H_in_H2O.arrow/ and so on), which only
"endf-b8.1", "jeff-4.0" and "jendl-5.0" publish.
nuclides : list of str, optional
Only these nuclides ("Fe56", "Am242_m1") and elements ("Fe",
meaning every Fe evaluation and the Fe photon data), and thermal tables
by name ("c_H_in_H2O") or by what they bind to ("H" is every
table binding hydrogen). The transmutation chain is always built whole.
A name the library does not have is refused.
temperatures : list of float, optional
Neutron temperatures in Kelvin. The default is 250, 293.6, 600, 900, 1200
and 2500 K. The 0 K grid is always kept.
njoy_exec : str, optional
The NJOY executable. The default is the njoy installed beside this
Python (pip install njoy2016), then the one on PATH. FENDL needs the
IAEA-NDS fork of NJOY, and a refusal says how to build it.
downloads : str, optional
A folder of source archives fetched by hand, searched first.
Returns
dict
keyword, release (the date the build started, the folder's
release stamp), path, parts, converted and reused (sorted
"<particle>/<Name>" keys), not_converted (the evaluations the
library's recipe declares NJOY cannot process, with the reason each
failed), stale_declarations (declared ones that converted after all),
njoy (the NJOY version used, or None), chain_nuclides,
manifest_sha256, file_count and total_bytes.
Raises
ValueError
An unknown keyword or part, or bad temperatures.
RuntimeError
The build cannot start (an extension compiled from uncommitted changes
asked for a whole library, the folder or another build in it, the NJOY,
the disk space, or source files that need a browser), or did not
finish: evaluations that failed and are not declared, a gate that
failed, or Ctrl-C. Nothing finished is lost, and running again retries
only what is left. Each failed evaluation's reason is in
<path>/.build/failed/.
Source code in yani/_core/__init__.pyi
5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 | |
yani.convert_neutron_xs
convert_neutron_xs(input_path: str, output_dir: str, source_format: str = 'endf', njoy_exec: str = 'njoy', temperatures: Optional[Sequence[float]] = None, library: str = '', data_version: str = '', created_utc: Optional[str] = None, covariance: bool = False) -> str
Convert an evaluation into the cross-section data an activation calculation reads.
Writes a {nuclide}.arrow/ directory holding nuclide.arrow,
energy.arrow, reactions.arrow and version.json, which is exactly
what a transport-free reaction-rate collapse reads. The secondary distributions and
lookup tables a transport run needs are deliberately not written: an
activation calculation never touches them, and building them from an ACE
table would cost heating data it does not carry.
Parameters
input_path : str
An ENDF evaluation, or an ACE table when source_format="ace".
output_dir : str
Directory to write {nuclide}.arrow/ into. With
source_format="endf", NJOY also works in a hidden directory here,
so this disk needs room for its tapes; the directory is removed when
the conversion ends.
source_format : {"endf", "ace"}
"endf" runs NJOY to reconstruct resonances and Doppler broaden,
which is the documented route and the only one that can reach an
arbitrary temperature. "ace" reads a table you already have and
needs no NJOY, at the cost of being stuck with the temperature it was
processed at.
njoy_exec : str, optional
The NJOY executable, for source_format="endf". Note that FENDL is
processed with the IAEA-NDS fork and upstream NJOY does not reproduce
the official release; both builds succeed, so the wrong choice is quiet.
temperatures : list[float], optional
Temperatures in Kelvin. Defaults to NJOY's own default. Ignored for
source_format="ace".
library, data_version, created_utc
Recorded in version.json. data_version identifies the published
release and is what a consumer compares a cached copy against.
covariance : bool
Also write covariance.arrow, the MF=33 cross-section covariance,
and the evaluation's other covariance sections where it has them:
angular_covariance.arrow (MF=34), nubar_covariance.arrow
(MF=31), spectrum_covariance.arrow (MF=35) and
resonance_parameters.arrow (the MF=2 resonance parameters with
their MF=32 covariance). Off by default: the matrices are large and
only an uncertainty
calculation reads them. Requires source_format="endf" -- MF=33 is
not carried through ACER, so asking for it from an ACE table raises.
Returns
str Path to the directory written.
Source code in yani/_core/__init__.pyi
5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 | |
yani.convert_transmutation
convert_transmutation(decay_files: Sequence[str], fpy_files: Sequence[str], neutron_files: Sequence[str], output_path: str, library: str = '', decay_library: str = '', data_version: str = '', created_utc: Optional[str] = None, reactions: Optional[Sequence[str]] = None, branch_ratios: Optional[str] = None, subsections: Optional[Sequence[str]] = None, decay_fill_files: Sequence[str] = [], decay_fill_library: str = '') -> int
Convert ENDF decay, fission product yield and neutron evaluations into a transmutation Arrow directory.
Parameters
decay_files, fpy_files, neutron_files : list[str]
ENDF inputs. All three are needed to build a network: the decay data
says what decays into what, the neutron data what transmutes into what,
and the fission yields what fission produces. A file may hold one
evaluation or a whole tape of them, such as JEFF-4.0's decay and
fission yield tapes; every material in it is read.
output_path : str
Directory to write. Created if absent, merged into if it already holds
other subsections of the same library.
library : str
Library name recorded in the provenance, e.g. "endf-b8.1".
data_version : str
Identifier of the published release. This is what a consumer compares a
cached copy against, so a rebuild that changes values must change this.
It is not the converter version: two rebuilds from one converter are
different data.
created_utc : str, optional
Timestamp recorded in the provenance. Supply one for a reproducible
directory; left unset, the current time is used.
branch_ratios : str, optional
Path to a JSON branching table in openmc_data shape,
{reaction: {parent: {target: fraction}}}. Splits a reaction between
a ground state and its metastable partners. Without it every
(n,gamma) gives its whole rate to the ground state and the
metastable product is absent from the network entirely.
subsections : list[str], optional
Which of decay, reactions and fission_yields to write.
Defaults to all three. A caller assembling a chain from more than one
library writes each subsection from the library that has it, and the
manifest merges rather than being overwritten.
reactions : list[str], optional
Reaction names to follow. Defaults to every reaction the chain builder
knows, not the six-name short set, so nothing is silently left out.
decay_fill_files : list[str], optional
Decay evaluations from a second library, read only to replace the
placeholder average decay energies in decay_files. Some libraries
write a stand-in for nuclides nobody has evaluated: a third of each
beta or electron-capture branch's Q to the light particles and a third
to the photons, which for an electron-capture emitter can be several
times the recoverable energy (Sn111 in ENDF/B-VIII.1 is 1.63 MeV per
decay against 0.69 MeV from its decay scheme). A placeholder is
replaced only where the second library has an evaluated decay scheme
for the same nuclide with a half-life within 25% of the first's.
Half-lives and decay modes are never touched. The decay subsection's
provenance.json lists every placeholder and every replacement,
with or without a fill. A tape is read whole, as for decay_files.
decay_fill_library : str, optional
The library decay_fill_files came from, e.g. "jendl-5.0".
Required with decay_fill_files.
Returns
int The number of nuclides in the network written.
Source code in yani/_core/__init__.pyi
5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 | |
yani.convert_branching
convert_branching(neutron_files: Sequence[str], decay_files: Sequence[str], output_path: str, library: str = '', decay_library: str = '', data_version: str = '', created_utc: Optional[str] = None, tol_ev: float = 3000.0, linearize_tol: float = 0.001) -> dict
Extract isomeric branching from neutron evaluations and write the
branching/ subsection.
Separate from :func:convert_transmutation because the branching curves and
the decay data routinely come from different libraries: TENDL branching
beside ENDF/B decay is the usual combination. Both calls merge into the same
manifest.json.
Parameters
neutron_files : list[str]
Neutron evaluations of the parent nuclides. MF=8/9/10 radionuclide
production is what carries the branching. A file may hold many
materials, such as IRDFF-II's tape of 70, and every one is read.
decay_files : list[str]
Decay evaluations, read only to build the isomer table, so the
metastable ones suffice. A tape is read whole, as for the neutron files.
output_path : str
The transmutation directory to write branching/ into.
library, data_version, created_utc
As for :func:convert_transmutation. The library here is the branching
source, which need not match the chain's.
tol_ev : float, optional
Energy tolerance when matching a nuclear level to an isomeric state.
linearize_tol : float, optional
Relative tolerance for resampling a non-lin-lin region onto the lin-lin
pairs the format stores.
Returns
dict
Coverage: parents read, parents with data, curves linearized, duplicate
groups merged, the metastable targets found, level_routes (how many
excited production levels were matched to an isomer by energy, by
energy within a tenth, by level index, as the only isomer, or not at
all) and flagged_levels (one line per level that was unresolved,
taken as ground because the decay data has no isomer for its product,
matched only by the looser energy pass, matched by energy while its
level index pointed at another isomer, or taken as its product's only
isomer while further from it than either energy pass accepts; every
excited level that ends up at ground is listed), partial_sum_mismatches
(one line per reaction whose MF=10 partial cross sections do not sum to
its MF=3 total, or whose MF=9 yields do not sum to one, within two
percent below 20 MeV), and skipped_states (one line per production
state that names no single product nuclide, and so gives no row:
fission, an IZAP of zero that no single MF=8 subsection resolves, or
any other ZAP whose Z or A is not positive), list_facts (one line
per production list, a parent's MT in MF=9 or MF=10: whether the ground
state is listed, whether the file has an MF=3 section for the MT, each
state's LFS, LMF, target, route and level energy difference, and the
MF=1 normalisation lines naming the MT) and list_counts (how many
lists are complete or isomers only in each file, have no MF=3 section
for their MT, or are normalised). The same facts are stored per row in
branching.arrow; they change no rate.
The MF=40 production
covariance, written as the tape gives it to
branching/branching_covariance.arrow, is counted by
mf40_sections (sections read, whatever the MT), mf40_blocks
(blocks written), mf40_blocks_by_lb (the NI blocks by layout),
mf40_nc_blocks, mf40_unmatched_states (one line per product
state that matches no MF=9 or MF=10 state, matches several within the
tolerance, or is excited with no stated excitation to confirm a level
by, written with no target), mf40_states_without_chain_kind
(states of an MT with no chain reaction, such as MT 18, written with
no reaction),
mf40_on_yield_channels (states matched to a level whose production
MF=9 gives as a yield rather than an MF=10 cross section; where that
yield is merged with another state's, the row carries the state's own
yield with quantity "yield"),
mf40_mat1_naming_itself (sub-subsections whose MAT1 is the
evaluation's own MAT, written as given), mf40_cross_state_blocks
(blocks other than a state's covariance with itself; key them on MT,
LFS, MT1 and XLFS1, since both states can resolve to one target),
mf40_blocks_outside_mf10 (blocks whose partner is in another
material or has XMF1 other than 10), mf40_without_blocks (one line
per section, state or sub-subsection holding no block, with its tape
values, the only part of MF=40 the file cannot show),
mf40_partner_unresolved (one line per sub-subsection written
with no partner target because the tape does not pin the partner to
one state, among them a partner whose level XLFS1 MF=10 numbers
differently from MF=40), and mf40_states_placed_by_excitation (one
line per product state whose target was matched by excitation because
MF=9 and MF=10 give its IZAP and LFS no state or one at another
excitation; its self blocks name it by MF=40's own LFS). The four line
lists are also written to branching/provenance.json. An evaluation
set without MF=40 writes no covariance file, and removes one an
earlier conversion left there.
Source code in yani/_core/__init__.pyi
5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 | |
yani.radionuclide_production
radionuclide_production(neutron_files: Sequence[str]) -> list
List the final states each reaction of an evaluation can leave its product in.
A reaction that can leave its product in a metastable state says so in
MF=8, one subsection per final state. An evaluation that lists only the
ground state is not merely less accurate: the isomer is absent from any
network built from it, so no code can make it, and a measurement that sees
its decay heat cannot be reproduced by any means. TENDL-2017 omits the
1706 keV state from Os190(n,n'), which is why the FNS osmium foil comes
out at a third of the measured heat with that library, in yani and in
FISPACT-II alike. Nothing about the reaction looks wrong from outside: it
is present, its cross section is reasonable, and only the state list is
short. So comparing the state lists of several libraries is how such a gap
is found, and this is the read that makes the comparison possible.
A read, not a conversion. Nothing is written, no decay data is involved, and the answer is what the files say rather than what a network built from them would hold.
Parameters
neutron_files : list[str] Neutron evaluations, one or many materials per file. Read one file at a time rather than held, so a whole sublibrary is a valid argument.
Returns
list[dict]
One entry per (parent, reaction) carrying MF=9 or MF=10, in file order
and then tape order, each with parent, mt, reaction (the
transmutation reaction name, or None for an MT no chain reaction
covers) and states.
Each state has excitation_energy_eV, level_index, product
and source. excitation_energy_eV is None for an excited
state whose evaluation gives neither a positive MF=8 ELFS nor a
positive QM - QI.
``product`` is the product's **ground-state** name even for an excited
state, because naming the isomer needs decay data to say which
isomeric ordinal a level is; pair it with ``excitation_energy_eV``.
It is ``None`` for a state naming no single nuclide: fission, a
subsection whose IZAP is zero with no single MF=8 subsection to name
it, or any other ZAP whose Z or A is not positive.
``level_index`` is the evaluation's own LFS and is not comparable
between libraries: Ir190's 377 keV isomer is level 3 in ENDF/B-VIII.1
and level 37 in JEFF-4.0. ``source`` is ``"cross_section"`` for MF=10
or ``"yield"`` for MF=9.
Examples
>>> [c for c in yani.radionuclide_production(["n-Os190.tendl"])
... if c["mt"] == 4][0]["states"]
[{'excitation_energy_eV': 0.0, 'level_index': 0, 'product': 'Os190',
'source': 'cross_section'}]
Source code in yani/_core/__init__.pyi
5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 | |
The two below write sections only transport reads, so nothing here consumes
their output. They are on this wheel so that a data-generation script works
against either wheel, which the bindings repository pins with a parity test.
convert_photon carries its auxiliary tabulations, the same ones yamc's does.
yani.convert_neutron_transport
convert_neutron_transport(input_path: str, output_dir: str, njoy_exec: str = 'njoy', temperatures: Optional[Sequence[float]] = None, library: str = '', data_version: str = '', created_utc: Optional[str] = None, covariance: bool = False) -> str
Convert an ENDF evaluation into the full neutron transport data set.
Everything :func:convert_neutron_xs writes, plus the reaction products,
their secondary angle and energy distributions, the lookup accelerator the
transport hot path reads, and the two fissile-only sections.
ENDF only, deliberately. An ACE table holds one temperature, carries no MT 901 heating and no fission energy release, so a transport conversion from one would be missing the local KERMA and the fission photon scaling with nothing on disk to say so.
Parameters
input_path : str
Path to the ENDF evaluation.
output_dir : str
Directory to write {Nuclide}.arrow/ into. NJOY also works in a
hidden directory here, so this disk needs room for its tapes; the
directory is removed when the conversion ends.
njoy_exec : str
The NJOY executable. FENDL needs the IAEA-NDS fork; upstream NJOY does
not reproduce the official release, and both builds succeed, so the
wrong choice is quiet.
temperatures : list[float], optional
Temperatures in Kelvin. Defaults to NJOY's own default.
library, data_version, created_utc
Recorded in version.json.
covariance : bool
Also write covariance.arrow, the MF=33 cross-section covariance,
and the evaluation's other covariance sections where it has them:
angular_covariance.arrow (MF=34), nubar_covariance.arrow
(MF=31), spectrum_covariance.arrow (MF=35) and
resonance_parameters.arrow (the MF=2 resonance parameters with
their MF=32 covariance). Off by default: the matrices are large and
only an uncertainty
calculation reads them.
Returns
str Path to the directory written.
Source code in yani/_core/__init__.pyi
5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 | |
yani.convert_photon
convert_photon(photoatomic_path: str | PathLike | Path, output_dir: str | PathLike | Path, relaxation_path: Optional[str | PathLike | Path] = None, compton_profiles: Optional[str | PathLike | Path] = None, density_effect: Optional[str | PathLike | Path] = None, bremsstrahlung: Optional[str | PathLike | Path] = None, library: str = '', data_version: str = '', created_utc: Optional[str] = None) -> list[str]
Convert a photoatomic evaluation into the per-element photon sections.
Writes element.arrow always, and subshells.arrow, compton.arrow
and bremsstrahlung.arrow where there is data for them. No NJOY: a
photoatomic evaluation is already pointwise.
Parameters
photoatomic_path : str
The photoatomic evaluation. One file may hold several elements, and
each is written to its own directory.
output_dir : str
Directory to write {Element}.arrow/ into.
relaxation_path : str, optional
The atomic relaxation evaluation for the same element, carrying binding
energies, occupancies and the transition cascade. Without it the
subshells are written with zero binding energy and no transitions,
which is a fluorescence-free atom rather than an error.
compton_profiles, density_effect, bremsstrahlung : str or path, optional
Other copies of the auxiliary tabulations, which no evaluation carries
(Compton profiles, the density effect and bremsstrahlung). The default
is the copies compiled into this package, the same in yani and yani.
Give all three or none.
library, data_version, created_utc
Recorded in version.json.
Returns
list[str] One path per element written.
Source code in yani/_core/__init__.pyi
5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 | |
The photonuclear converter preserves evaluated MF=3 cross sections and the original ENDF sections. It does not enable photon-induced transmutation or photon transport; see TENDL photonuclear data.
yani.convert_photonuclear
convert_photonuclear(input_path: str, output_dir: str, library: str = '', data_version: str = '', created_utc: Optional[str] = None) -> str
Preserve a photonuclear ENDF evaluation as lossless Arrow tables.
Writes native-grid MF=3 cross sections with their ENDF interpolation and
every original section, including outgoing-particle data. Requires NSUB=0.
No neutron Doppler broadening or photoatomic relaxation is applied. This
processes evaluated data; it does not enable photonuclear transport.
library, data_version and created_utc are recorded in version.json.
Source code in yani/_core/__init__.pyi
5245 5246 5247 5248 5249 5250 5251 5252 5253 | |
Reading data back
Both of these read a converted Arrow directory through the same loader transport uses and return a description of what is in it, which is how a conversion is checked without standing up a transport run. Neither goes through the process-wide stores, and the photon one publishes none of the process-wide photon grids, so inspecting two builds of the same nuclide or element in one interpreter reports on each of them rather than handing back the first.
yani.read_nuclide_from_arrow
read_nuclide_from_arrow(path: str, scope: str = 'full') -> Any
Read a nuclide Arrow directory through yani's own loader and describe it.
Parameters
path : str
A {Nuclide}.arrow/ section directory. Taken verbatim: no keyword
expansion, no directory search and no download, so a validation run
cannot silently check a different file from the one it named.
scope : str, optional
"full" (default) reads every section, which is what transport
needs. "xs" reads nuclide.arrow, energy.arrow and
reactions.arrow only, which is what a transport-free reaction-rate
collapse touches.
Returns
dict
name, atomic_number, mass_number, atomic_weight_ratio,
fissionable, urr_present, available_temperatures,
loaded_temperatures, mts, energy_points,
angular_covariance, nubar_covariance, spectrum_covariance,
resonance_parameters and scope_loaded.
``energy_points`` is a dict of temperature to grid length, over the
loaded temperatures. Not one number: the reader also keeps the 0 K union
grid, which is longer than any of them and belongs to no temperature the
other two lists mention, so a single maximum would report a grid nothing
reads and hide a per-temperature grid that had been truncated.
There is no ``library`` key. The Arrow loader does not populate that
field, so it would report ``None`` for every directory, correct or not.
Read ``version.json`` for it.
``angular_covariance`` is the folder's MF=34 (``angular_covariance.arrow``),
summarised as ``{mt: [(l, l1), ...]}``: per reaction, the sorted (L, L1)
pairs of Legendre orders a covariance block correlates. ``None`` when
the folder has none. It is read whatever ``scope`` says, since it is a
separate optional section.
``nubar_covariance`` is the folder's MF=31 (``nubar_covariance.arrow``),
summarised as the sorted fission multiplicity MTs (of 452, 455 and 456)
it carries covariance for, and ``spectrum_covariance`` its MF=35
(``spectrum_covariance.arrow``), as ``{mt: [(e1, e2), ...]}``: per
reaction, the incident energy range of each covariance block, in tape
order. Each is ``None`` when the folder has none, and both are read
whatever ``scope`` says, as ``angular_covariance`` is.
``resonance_parameters`` is the folder's MF=2 and MF=32
(``resonance_parameters.arrow``), both parsed, summarised as the
``(lru, lrf)`` of each MF=2 energy range, isotope by isotope in tape
order: LRU 1 resolved or 2 unresolved, LRF the formalism. ``None`` when
the folder has none, and read whatever ``scope`` says.
``scope_loaded`` is the one to assert on, and it is not always the
``scope`` asked for: a directory holding no transport sections narrows a
``"full"`` request to ``"xs"`` rather than failing it, on the theory
that it is a cross-sections-only conversion. A gate that asks for
``"full"`` and does not check what it got will pass a directory with no
distributions and no products.
Raises
ValueError
scope is neither "full" nor "xs".
RuntimeError
The directory is absent, is not the Arrow format version this build
reads, or any section fails to parse, the stored MF=2 and MF=32 text
included.
Source code in yani/_core/__init__.pyi
5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 | |
yani.read_element_from_arrow
read_element_from_arrow(path: str) -> Any
Read a photoatomic Arrow directory through yani's own loader and describe it.
Parameters
path : str
An {Element}.arrow/ directory. Taken verbatim, and read straight
rather than through the process-global element store: that store is
keyed by element name, so validating two builds of Fe.arrow in one
process would get the first one back for the second call and report a
false pass.
Publishes none of the process-wide photon grids either. An ordinary
read installs the Compton momentum grid and the two TTB grids on first
use, so inspecting a candidate directory in an interpreter that also
runs transport would hand that candidate's grids to every later element
load and every photon collision. The sampler reads the profile tables
against whichever grid is installed, so a different grid changes every
Doppler sample and says nothing about it.
Returns
dict
name, atomic_number, n_energy_points, n_subshells,
has_atomic_relaxation, has_compton_profiles and
has_bremsstrahlung.
The last three are the auxiliary tabulations that are not in any
evaluation, so a directory converted without them reads back fine and
is still not what transport wants. There is no ``scope`` here: the
photon reader has one mode.
Raises
RuntimeError The directory is absent, or any section fails to parse.
Source code in yani/_core/__init__.pyi
5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 | |
The photonuclear readback validates its cross-section tables against the preserved MF=3 source rather than invoking either transport loader.
yani.read_photonuclear_from_arrow
read_photonuclear_from_arrow(path: str) -> Any
Validate evaluated photonuclear Arrow tables against their preserved ENDF. Returns the nuclide identity, MTs, per-MT energy-point counts and preserved (MF, MT) section keys. Does not invoke neutron or photoatomic transport.
Source code in yani/_core/__init__.pyi
5750 5751 5752 5753 5754 5755 | |
Data helpers
Cross-section inspection, dose and attenuation coefficients, available element
and reaction names, and the nuclide cache are accessed through yani.data.
yani.data
dose_coefficients
dose_coefficients(particle: str, geometry: Optional[str] = None, data_source: Optional[str] = None, dose_quantity: str = 'effective') -> DoseCoefficients
Return fluence-to-dose conversion coefficients.
dose_quantity='effective' (the default) returns fluence-to-effective-dose
coefficients from ICRP Publication 74 or 116 for an irradiation geometry.
dose_quantity='ambient' returns fluence-to-ambient-dose-equivalent
H(10) coefficients from ICRP Publication 74 (Table A.21 for photons, Table
A.42 for neutrons), the ICRU-57 definition most regulations still reference.
H(10) is defined at 10 mm depth in the ICRU sphere in an aligned and
expanded field, so it takes no geometry, and ICRP-116 does not tabulate
it. It is designed to over-estimate effective dose for area monitoring, but
for high-energy neutrons it under-reads it. The tables cover 1 meV to 20 MeV
for neutrons and 10 keV to 10 MeV for photons, and are not extrapolated: a
tally folded with them scores nothing for particles outside that range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particle
|
str
|
'neutron' or 'photon'. |
required |
geometry
|
str
|
Irradiation geometry for effective dose. One of:
'AP' (Anterior-Posterior), 'PA' (Posterior-Anterior),
'LLAT' (Left Lateral), 'RLAT' (Right Lateral),
'ROT' (Rotational), 'ISO' (Isotropic). Defaults to 'AP'. Must not be
given for |
None
|
data_source
|
str
|
'icrp74' or 'icrp116'. Defaults to 'icrp116' for effective dose and 'icrp74' for ambient dose equivalent, which only ICRP-74 tabulates. |
None
|
dose_quantity
|
str
|
'effective' (default) for effective dose or 'ambient' for ambient dose equivalent H*(10). |
'effective'
|
Returns:
| Name | Type | Description |
|---|---|---|
DoseCoefficients |
DoseCoefficients
|
an object with |
DoseCoefficients
|
(pSv cm2), |
Examples:
import yani
Get ICRP-116 AP geometry dose coefficients
dc = yani.data.dose_coefficients('neutron', 'AP') dc.energy # incident energies in eV dc.coefficients # fluence-to-dose coefficients dc.units # 'pSv cm2'
ICRP-74 ambient dose equivalent H*(10)
h10 = yani.data.dose_coefficients('neutron', dose_quantity='ambient')
Fold them into a flux tally via the energy_function= argument
dose_tally = yamc.Tally(scores=['flux'], energy_function=dc.as_energy_function())
Or let the tally fetch the same coefficients itself:
dose_tally = yamc.Tally(scores=['flux'], dose_coefficients=('neutron', 'AP'))
References
- ICRP Publication 74: https://doi.org/10.1016/S0146-6453(96)90010-X
- ICRP Publication 116: https://doi.org/10.1016/j.icrp.2011.10.001
Source code in yani/_core/data.pyi
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
mass_attenuation_coefficient
mass_attenuation_coefficient(element: Any) -> PhotonCoefficients
Return the photon mass attenuation coefficient mu/rho of an element.
Total attenuation with coherent scattering, from the NIST XCOM database,
tabulated from 1 keV to 20 MeV for Z = 1 to 100. Dividing a material's dose
or fluence by sum(density_i * mu_over_rho_i(E)) is what a self-shielding
estimate like :meth:Material.contact_dose does with it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
element
|
str | int
|
Element symbol ( |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PhotonCoefficients |
PhotonCoefficients
|
mu/rho in cm²/g against energy in eV. |
Examples:
import yani
iron = yani.data.mass_attenuation_coefficient('Fe') iron.interpolate(1.0e6) # 0.05995 cm2/g at 1 MeV iron.energy, iron.coefficients
References
- NIST Standard Reference Database 8 (XCOM): https://doi.org/10.18434/T48G6X
Source code in yani/_core/data.pyi
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
mass_energy_absorption_coefficient
mass_energy_absorption_coefficient(material: str = 'air') -> PhotonCoefficients
Return the mass energy-absorption coefficient mu_en/rho of a material.
The fraction of incident photon energy actually absorbed per unit mass, less what scattered photons carry away, from NIST SRD 126. This is the response an absorbed dose in air folds against, and it is a different quantity from the attenuation coefficient: attenuation counts photons removed from the beam, this counts energy deposited.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
str
|
Currently only |
'air'
|
Returns:
| Name | Type | Description |
|---|---|---|
PhotonCoefficients |
PhotonCoefficients
|
mu_en/rho in cm²/g against energy in eV. |
Examples:
import yani
air = yani.data.mass_energy_absorption_coefficient('air') air.interpolate(1.0e6) # 0.02789 cm2/g at 1 MeV
References
- NIST Standard Reference Database 126: https://doi.org/10.18434/T4D01F
Source code in yani/_core/data.pyi
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
natural_abundance
natural_abundance() -> Any
Return a dict of natural isotopic abundances by nuclide name.
Returns:
| Type | Description |
|---|---|
Any
|
dict[str, float]: e.g. |
Source code in yani/_core/data.pyi
138 139 140 141 142 143 144 | |
natural_abundance_records
natural_abundance_records() -> Any
Return the TICE 2013 record behind each natural abundance, by nuclide name.
Table 1 of Meija et al., "Isotopic compositions of the elements 2013
(IUPAC Technical Report)", Pure Appl. Chem. 88(3), 293-306 (2016),
doi:10.1515/pac-2015-0503 (© IUPAC, De Gruyter 2016), columns 4, 5, 6
and 9.
:func:natural_abundance gives column 9 where it is a value and the
column 6 best measurement where column 9 is an interval.
Each value is a dict with keys:
representative_value,representative_uncertainty: column 9. TICE gives no coverage factor for this uncertainty.representative_interval: column 9 as(low, high)for the 12 elements given an interval instead of a value (H, Li, B, C, N, O, Mg, Si, S, Cl, Br, Tl).observed_interval: column 4,(low, high)of natural variation.best_measurement,best_measurement_uncertainty: column 6.best_measurement_coverage: column 6 coverage, e.g."2s".best_measurement_calibration:"C","F"or"N". TICE prints this and the coverage once per element; they apply to every isotope of it.annotations: column 5, e.g."g,r".
None means the table leaves that field empty ("not stated", never
zero). These uncertainties are reference data only: no calculation
samples or propagates them.
Returns:
| Type | Description |
|---|---|
Any
|
dict[str, dict[str, Any]]: e.g. |
Source code in yani/_core/data.pyi
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
element_nuclides
element_nuclides() -> Any
Return a dict mapping element symbol to its naturally occurring nuclides.
Each value is a sorted list of nuclide names for that element.
Returns:
| Type | Description |
|---|---|
Any
|
dict[str, list[str]]: e.g. |
Source code in yani/_core/data.pyi
180 181 182 183 184 185 186 187 188 | |
element_names
element_names() -> Any
Return a dict mapping element symbol to full element name.
Returns:
| Type | Description |
|---|---|
Any
|
dict[str, str]: e.g. |
Source code in yani/_core/data.pyi
190 191 192 193 194 195 196 | |
reaction_names
reaction_names() -> Any
Return a dict mapping MT numbers (int) to ENDF reaction notation strings. e.g. {2: "(n,elastic)", 18: "(n,fission)", 102: "(n,gamma)", ...}
Each MT's own name, not an inversion of REACTION_MT. Several names map to
one MT ("fission" and "(n,fission)" are both MT 18), so inverting a
HashMap picked whichever the iteration order reached last: the same build
could return {18: "fission"} on one run and {18: "(n,fission)"} on the
next.
Source code in yani/_core/data.pyi
198 199 200 201 202 203 204 205 206 207 208 | |
clear_nuclide_cache
clear_nuclide_cache() -> None
Clear any internally cached nuclide data.
This forces subsequent reads to re-parse JSON files.
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in yani/_core/data.pyi
210 211 212 213 214 215 216 217 218 | |
split_nuclide
split_nuclide(name: str) -> tuple[str, int, int]
Split a nuclide name into its element symbol, mass number and isomeric state.
The one place downstream code should ask, because the obvious way of doing
it by hand is wrong for exactly the entry that is easiest to forget:
stripping the trailing digits off "Ta180_m1" leaves "Ta180_m" and a
mass number of 1, and natural tantalum really does contain Ta180m, so a
composition built from :func:natural_abundance will hand you that name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
A nuclide name, e.g. |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, int, int]
|
tuple[str, int, int]: Element symbol, mass number, and isomeric state (0 for a ground state, 1 for the first metastable, and so on). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the name is not a nuclide name. |
Examples:
>>> yani.data.split_nuclide("Fe56")
('Fe', 56, 0)
>>> yani.data.split_nuclide("Ta180_m1")
('Ta', 180, 1)
Source code in yani/_core/data.pyi
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
atomic_symbol
atomic_symbol(z: int) -> str
Return the chemical symbol of an atomic number.
Bound so that a caller naming files or directories from ENDF data does not have to carry its own copy of the periodic table, or install a second nuclear-data package to borrow one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
int
|
Atomic number, 0 to 118. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The chemical symbol, e.g. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If there is no element with that atomic number. |
Examples:
>>> yani.data.atomic_symbol(26)
'Fe'
>>> yani.data.atomic_symbol(0)
'n'
Note
Z = 0 is the neutron, "n", and is not an error. ENDF libraries
really do ship a neutron material (JENDL is one), so a caller walking a
sublibrary will meet it.
Source code in yani/_core/data.pyi
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
atomic_number
atomic_number(symbol: str) -> int
Return the atomic number of a chemical symbol.
The inverse of :func:atomic_symbol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
A chemical symbol, e.g. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The atomic number. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the symbol names no element. |
Examples:
>>> yani.data.atomic_number("Fe")
26
Source code in yani/_core/data.pyi
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
Material collections
The bundled PNNL collection is available as yani.materials.pnnl; see
Materials for selecting a composition.
yani.materials
pnnl
module-attribute
pnnl: MaterialCollection
The PNNL Compendium of Material Composition Data for Radiation Transport Modeling (PNNL-15870, Rev. 2): 410 materials keyed by the report's own names.
MaterialCollection
A read-only, name-keyed table of published material compositions.
Indexing returns an ordinary :class:Material, freshly built each time,
so it can be renamed and mutated without affecting the collection or any
other lookup of the same name.
Examples:
>>> import yani
>>> steel = yani.materials.pnnl["Steel, Stainless 304"]
>>> steel.name = "firstwall_material"
>>> yani.materials.pnnl.search("concrete")[:2]
['Concrete, Barite (Type BA)', 'Concrete, Barytes-Limonite']
citation
property
citation: str
Short citation for the source document, e.g. "PNNL-15870, Rev. 2".
url
property
url: str
URL of the source document.
names
names() -> list[str]
Every material name, in source-document order.
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: All names in the collection. |
Source code in yani/_core/materials.pyi
74 75 76 77 78 79 80 | |
search
search(query: str) -> list[str]
Names containing query, compared case-insensitively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Substring to look for, e.g. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: Matching names, ready to pass straight back to |
Source code in yani/_core/materials.pyi
81 82 83 84 85 86 87 88 89 90 | |
material
material(key: str, *, name: Optional[str] = None, density: Optional[float] = None, density_units: str = 'g/cm3', temperature: Optional[float] = None, volume: Optional[float] = None, transmutable: bool = False, id: Optional[int] = None) -> Material
Build the named material, overriding fields the collection does not set.
Equivalent to collection[key] followed by attribute assignment,
except for density, which :class:Material does not allow to be
reassigned after construction. Use it for a material used at other
than its reference density, e.g. a concrete at a different porosity
or a steel diluted by a coolant void fraction.
Examples:
>>> steel = yani.materials.pnnl.material("Steel, Stainless 316", temperature=600)
>>> porous = yani.materials.pnnl.material(
... "Steel, Stainless 316", density=7000, density_units="kg/m3"
... )
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The source document's name, verbatim. |
required |
name
|
Optional[str]
|
Rename the material, e.g. to match a mesh geometry's material name. |
None
|
density
|
Optional[float]
|
Density in |
None
|
density_units
|
str
|
Units of |
'g/cm3'
|
temperature
|
Optional[float]
|
Temperature in Kelvin. If omitted, 294 K is used, or the only temperature the nuclear data carries when it carries just one. |
None
|
volume
|
Optional[float]
|
Volume in cm³. |
None
|
transmutable
|
bool
|
Mark for depletion by
|
False
|
id
|
Optional[int]
|
Material ID. Defaults to a fresh one, which no earlier material was given. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Material |
Material
|
The material with the overrides applied. |
Source code in yani/_core/materials.pyi
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
entry
entry(name: str) -> dict
The source document's own record for a material, for citation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The source document's name, verbatim. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
|
dict
|
document), |
|
dict
|
|
|
dict
|
fraction), |
Source code in yani/_core/materials.pyi
129 130 131 132 133 134 135 136 137 138 139 140 141 | |
NameIter
Iterator over a collection's material names.
collections
collections() -> list[str]
Names of the available material collections.
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: Collection names, each an attribute of |
Source code in yani/_core/materials.pyi
151 152 153 154 155 156 157 | |
Source distributions
The energy distributions used by irradiation spectra live in yani.sources.
See Spectra for setting a pulse's shape and flux magnitude.
yani.sources
Histogram
Histogram(boundaries: Any, probabilities: Sequence[float])
Histogram (piecewise-constant) energy distribution over energy bins.
Create a histogram (piecewise-constant) energy distribution.
Each bin i spans boundaries[i] to boundaries[i + 1] and holds
probability mass probabilities[i]; an energy is sampled by choosing a
bin in proportion to its mass and then drawing uniformly within it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
boundaries
|
Any
|
Either explicit energy bin edges in eV (length |
required |
probabilities
|
Sequence[float]
|
Relative probability mass for each of the |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Histogram |
Histogram
|
A histogram energy distribution. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a named group structure is unknown, if |
Examples:
>>> import yani
>>> # 30% of source neutrons in [0, 1] MeV, 70% in [1, 20] MeV
>>> energy_dist = yani.sources.Histogram([0.0, 1e6, 20e6], [0.3, 0.7])
>>> # or from a named group structure (709 per-group weights)
>>> energy_dist = yani.sources.Histogram("CCFE-709", flux_709)
Source code in yani/_core/sources.pyi
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
boundaries
property
boundaries: list[float]
Get the bin boundaries.
Returns:
| Type | Description |
|---|---|
list[float]
|
List[float]: Energy bin edges in eV, length |
probabilities
property
probabilities: list[float]
Get the per-bin probabilities, as supplied.
Returns:
| Type | Description |
|---|---|
list[float]
|
List[float]: Relative probability mass for each bin. |
sample
sample() -> float
Sample an energy value from the distribution.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sampled energy in eV. |
Source code in yani/_core/sources.pyi
70 71 72 73 74 75 76 | |
Self-shielding shapes
The lump shapes passed to Material.transmute() control its resonance
self-shielding correction; see Self-shielding.
yani.shapes
SphereLump
SphereLump()
A sphere, sized by the material's volume.
The extreme case: a sphere has the least surface for its volume, so it has the longest mean chord and shields more than any other shape of the same volume. Convenient, but an upper bound rather than a neutral choice.
A sphere. Its radius follows from Material(volume=...).
Source code in yani/_core/shapes.pyi
30 31 32 33 | |
CubeLump
CubeLump()
A cube, sized by the material's volume.
A cube. Its side follows from Material(volume=...).
Source code in yani/_core/shapes.pyi
41 42 43 44 | |
FoilLump
FoilLump(thickness: float)
A flat slab of a stated thickness.
The chord is twice the thickness whatever the area, so a foil's shielding
does not depend on the volume at all -- the volume is still what makes
activity and decay_heat available, but it plays no part here.
Args: thickness (float): Foil thickness in cm.
Source code in yani/_core/shapes.pyi
58 59 60 61 62 | |
CylinderLump
CylinderLump(radius: float)
A cylinder of a stated radius; its height follows from the volume.
Args: radius (float): Cylinder radius in cm.
Source code in yani/_core/shapes.pyi
72 73 74 75 76 | |
WireLump
WireLump(radius: float)
A cylinder long enough that its ends do not matter. Chord 2r.
Args: radius (float): Wire radius in cm.
Source code in yani/_core/shapes.pyi
86 87 88 89 90 | |