f4enix.input.libmanager.LibManager#
- class f4enix.input.libmanager.LibManager(xsdir_path: PathLike | DataFrame | None = None, defaultlib: str | None = None, activationfile: PathLike | None = None, isotopes_file: PathLike | None = None, dosimetry_lib: list[str] | None = None)#
Bases:
objectObject dealing with all complex operations that involves nuclear data.
- Parameters:
xsdir_path (pd.DataFrame) – table related to libraries variables.
defaultlib (str, optional) – lib suffix to be used as default in translation operations. If None, it reads from lib_df. If not provided, default is “81c”.
activationfile (str or path, optional) – path to the config file containing the reactions data for activation libraries. The default is None.
isotopes_file (str or path, optional) – path to the isotopes files. If None (default) the file is searched in the current directory.
dosimetry_lib (list[str], optional) – libraries to be used for dosimetry. The default is None. If a library is provided, this would be considered as dosimetry library and will be ignored during translation operations.
- Variables:
isotope_parser (IsotopeDataParser) – object dealing with the isotopes data.
isotopes (pd.DataFrame) – contains the isotopes data.
defaultlib (str) – lib suffix to be used as default in translation operations.
data (dict[str, dict[str, Union[Xsdir, OpenMCXsdir, SerpentXsdir]]]) – contains the libraries data. first level keys are the codes, second level keys are the library suffixes. ultimate value is the xsdir object.
codes (list) – list of codes available.
libraries (dict[str, list[str]]) – contains the libraries available for each code.
reactions (dict[str, pd.DataFrame]) – contains the reactions data for the different activation libraries.
dosimetry_lib (list[str]) – Libraries considered as dosimetry. These are ignored during translation operations.
- Return type:
None.
Methods
__init__([xsdir_path, defaultlib, ...])Object dealing with all complex operations that involves nuclear data.
check4zaid(zaid[, code])Check which libraries are available for the selected zaid and return it
convertZaid(zaid, lib[, code])This methods will convert a zaid into the requested library
expand_element(element)Given an element name (e.g. Li) returns all isotopes available with their isotopic data.
get_formulazaid(formula)get_libzaids(lib[, code])Given a library, returns all zaids available
get_reactions(lib, parent)get the reactions available for a specific zaid and parent nuclide
get_zaid_mass(zaid)Get the atomic mass of one zaid
get_zaidname(zaid)Given a zaid, its element name and formula are returned.
get_zaidnum(zaidformula)Given a zaid formula return the correct number
is_lib_available(lib[, codes])Check if a library is available in the xsdirs of the codes in the list
- check4zaid(zaid: str, code: str = 'mcnp') list[str]#
Check which libraries are available for the selected zaid and return it
- Parameters:
zaid (str) – zaid string (e.g. 1001).
code (str, optional) – Code to be looked up. Default is ‘mcnp’
- Returns:
libraries – list of libraries available for the zaid.
- Return type:
list[str]
- convertZaid(zaid: str, lib: str, code: str = 'mcnp') dict[str, tuple[str, float, float]]#
This methods will convert a zaid into the requested library
- modes:
1to1: there is one to one correspondence for the zaid
natural: the zaids will be expanded using the natural abundance
absent: the zaid is not available in the library, a default one will be used or the natural one if available.
- Parameters:
zaid (str) – zaid name (ex. 1001).
lib (str) – library suffix (ex. 21c).
code (str, optional) – code for which the translation is performed. default is MCNP
- Raises:
ValueError – if the library is not available in the xsdir file or if there is no valid translation for the zaid.
- Returns:
translation – {zaidname:(lib,nat_abundance,Atomic mass)}.
- Return type:
dict[str, tuple[str, float, float]]
- expand_element(element: str) DataFrame#
Given an element name (e.g. Li) returns all isotopes available with their isotopic data
- Parameters:
element (str) – element name (e.g. Li)
- Returns:
return the subset of the isotopes dataframe witth the isotpes available for the element.
- Return type:
pd.DataFrame
- get_libzaids(lib: str, code: str = 'mcnp') list[str]#
Given a library, returns all zaids available
- Parameters:
lib (str) – suffix of the library.
code (str, optional) – code for which the zaids are recovered. default is MCNP
- Returns:
zaids – list of zaid names available in the library.
- Return type:
list[str]
- get_reactions(lib: str, parent: str) list[tuple[str, str]]#
get the reactions available for a specific zaid and parent nuclide
- Parameters:
lib (str) – library suffix as in sheet name of the activation file.
parent (str) – zaid number of the parent (e.g. 1001).
- Returns:
reactions – contains tuple of (MT, daughter). If daughters are metastable, a ‘900’ is appended to their number.
- Return type:
list[tuple[str, str]]
- get_zaid_mass(zaid: str) float#
Get the atomic mass of one zaid
- Parameters:
zaid (matreader.Zaid) – Zaid to examinate.
- Returns:
m – atomic mass.
- Return type:
float
- get_zaidname(zaid: str) tuple[str, str]#
Given a zaid, its element name and formula are returned. E.g., hydrogen, H1
- Parameters:
zaid (str) – zaid number (e.g. 1001 for H1).
- Returns:
name (str) – element name (e.g. hydrogen).
formula (str) – isotope name (e.g. H1).
- get_zaidnum(zaidformula: str) str#
Given a zaid formula return the correct number
- Parameters:
zaidformula (str) – name of the zaid, e.g., H1. It also accepts only H, it will return the natural zaid 1000.
- Returns:
zaidnum – number of the zaid ZZZAA
- Return type:
str
- is_lib_available(lib: str, codes: list[str] = ['mcnp']) bool#
Check if a library is available in the xsdirs of the codes in the list
- Parameters:
lib (str) – Name of the library to check.
codes (list[str], optional) – list of the codes for which the presence of the library is checked in the xsdir, by default [“mcnp”]
- Returns:
True if library is present, False otherwise.
- Return type:
bool