f4enix.output.meshinfo.DataMass#
- class f4enix.output.meshinfo.DataMass(dataframe: DataFrame)#
Bases:
objectThe dataframe contains the mass information present in the meshinfo file. It can be used either to know the masses of the desired Voxel-Cell combinations or to relate the material ids with the MCNP cell ids and vice-versa.
- Parameters:
dataframe (pd.DataFrame) – mass dataframe
- Variables:
dataframe (pd.DataFrame) – mass dataframe
Examples
Example of mass dataframe
>>> datamass.df Mass [g] Voxel Material Cell 1 0 327608 0.000000 327611 0.000000 ... 110 324893 4977.059766 324894 1332.655347 324896 8458.281897
Methods
__init__(dataframe)The dataframe contains the mass information present in the meshinfo file.
get_cells_from_materials(materials)Returns an array with all the cell ids that are filled with the materials given as argument.
get_filtered_dataframe([voxels, materials, ...])Returns a copy of the dataframe, if arguments are given, only the given values will appear.
load(path_to_folder)Returns an instance of the class that was saved with the
save_dataframe_to_hdf5()method.save_dataframe_to_hdf5(results_path)Saves the dataframe for later loading with the load class method.
Attributes
Returns the unique values of Material index
- get_cells_from_materials(materials: list[int] | None) DataFrame#
Returns an array with all the cell ids that are filled with the materials given as argument.
- Parameters:
materials (list[int] | None) – materials to be considered for the filter
- Returns:
data related to the requested materials
- Return type:
pd.DataFrame
- get_filtered_dataframe(voxels: list | None = None, materials: list | None = None, cells: list | None = None) DataFrame#
Returns a copy of the dataframe, if arguments are given, only the given values will appear.
- Parameters:
voxels (Optional[list], optional) – voxels to filter for, by default None
materials (Optional[list], optional) – materials to filter for, by default None
cells (Optional[list], optional) – cells to filter for, by default None
- Returns:
filtered dataframe
- Return type:
pd.DataFrame
- classmethod load(path_to_folder: PathLike) DataMass#
Returns an instance of the class that was saved with the
save_dataframe_to_hdf5()method.- Parameters:
path_to_folder (os.PathLike) – path to the folder where the hdf5 file was saved.
- Returns:
Loaded DataMass object
- Return type:
- property materials: ndarray#
Returns the unique values of Material index
- save_dataframe_to_hdf5(results_path: PathLike) None#
Saves the dataframe for later loading with the load class method.
- Parameters:
results_path (os.PathLike) – path to the output folder