Utility API
- pyNDUS.utils.normalize_energy_unit(unit)[source]
Return the canonical label for an energy unit.
- Parameters:
unit (str) – Energy unit label. Supported values are
"eV"and"MeV", case-insensitively.- Returns:
Canonical unit label, either
"eV"or"MeV".- Return type:
- Raises:
ValueError – If the unit is not supported.
- class pyNDUS.utils.EnergyGrid(values, unit='eV')[source]
Energy group boundaries with explicit unit metadata.
- Parameters:
values (iterable) – One-dimensional energy group boundaries.
unit (str, optional) – Energy unit for
values. Supported values are"eV"and"MeV".
- to(unit)[source]
Return energy boundaries converted to the requested unit.
- Parameters:
unit (str) – Target energy unit. Supported values are
"eV"and"MeV".- Returns:
Converted energy boundaries.
- Return type:
- property ev
Energy group boundaries in eV.
- Returns:
Energy group boundaries converted to eV.
- Return type:
- property mev
Energy group boundaries in MeV.
- Returns:
Energy group boundaries converted to MeV.
- Return type:
- pyNDUS.utils.zais2zaid(zaid)[source]
Convert an isotope label to the integer ZAID format used by pyNDUS.
- pyNDUS.utils.AStoZ()[source]
Return a mapping from atomic symbol to atomic number.
- Returns:
periodictable – Keys are atomic symbols and values are atomic numbers.
- Return type:
- pyNDUS.utils.np2unp(v, rsd)[source]
Convert nominal values and relative standard deviations to uncertain values.
- Parameters:
v (numpy.ndarray) – Array of nominal values.
rsd (numpy.ndarray) – Array of relative standard deviations. The absolute standard deviation is computed as
rsd * abs(v).
- Returns:
Array of
uncertaintiesvalues with the same shape asv.- Return type:
- pyNDUS.utils.uncformat(data, std, fmtn=':.2u%S', fmts=None)[source]
Format nominal values and standard deviations for printing.
- Parameters:
data (array-like) – Nominal values, or uncertain values when
stdisNone.std (array-like or None) – Standard deviations associated with
data.fmtn (str, optional) – Format specification passed to
uncertainties.ufloat.fmts (str, optional) – Legacy argument retained for API compatibility. It is currently unused.
- Returns:
Formatted strings with nominal values and standard deviations.
- Return type: