f4enix.output.meshtal.fmesh.Fmesh#

class f4enix.output.meshtal.fmesh.Fmesh(mesh: MeshData, meshLabel: str, trsf: None | tuple = None, binlabels: tuple[str] | None = None)#

Bases: MeshData

Methods

__init__(mesh, meshLabel[, trsf, binlabels])

apply_transformation(tr)

Apply a transformation to the mesh object

convert2tally()

In case the mesh is 1D (only one spatial binning is higher than 1), convert the tally data into a pandas DataFrame.

get_etbin_data([ebin, tbin])

Return a sub mesh with only data of selected energy and time bins

print_info()

Print mesh information in a dictionary format.

sameMesh(other_mesh)

Check if two meshes are the same based on their geometry and bins.

write(outpath[, list_array_names, ...])

Export the mesh to a file.

Attributes

comments

Mesh comments

cooling_time

Mesh cooling time (e.g. for CDGS mesh).

data

array with mesh values and statistical error

ebin

mcnp energy bin (or user bin assingned to mcnp energy bin)

geom

Mesh geometry ('rec', 'cyl')

ne

number of energy intervals (or energy values if discrete) on energy grid (or defined user bin)

nt

number of time intervals (or time values if discrete) on time grid (or defined user bin)

nx1

number of intervals on X/R axis

nx2

number of intervals on Y/Z axis

nx3

number of intervals on Z/T axis

particle

Transported particle

strength

Mesh strength (e.g. for CDGS mesh).

tally

Mesh label

tbin

mcnp timebin (or user bin assingned to mcnp time bin)

trsf

Mesh transformation

type

Mesh type (meshtal, CDGS, CUV, ...)

x1bin

X/R bins data (rec or cyl geometry)

x2bin

Y/Z bins data (rec or cyl geometry)

x3bin

Z/T bins data (rec or cyl geometry)

apply_transformation(tr: Card) None#

Apply a transformation to the mesh object

Parameters:

tr (parser.Card) – transformation card to be applied to the fmesh

Raises:
  • ValueError – If a non-transformation card is passed

  • ValueError – If the transformation card has not 4 (translation) or 13 (affine transformation) values

property comments: str | None#

Mesh comments

convert2tally() tuple[int, DataFrame, str]#

In case the mesh is 1D (only one spatial binning is higher than 1), convert the tally data into a pandas DataFrame.

Returns:

A tuple containing the tally number, a pandas DataFrame with the converted data, and a comment string.

Return type:

tuple[int, pd.DataFrame, str]

property cooling_time: float | None#

Mesh cooling time (e.g. for CDGS mesh)

property data: ndarray#

array with mesh values and statistical error

property ebin: ExtraBin#

mcnp energy bin (or user bin assingned to mcnp energy bin)

property geom: str#

Mesh geometry (‘rec’, ‘cyl’)

get_etbin_data(ebin: int | None = None, tbin: int | None = None) MeshData#

Return a sub mesh with only data of selected energy and time bins

property ne: int#

number of energy intervals (or energy values if discrete) on energy grid (or defined user bin)

property nt: int#

number of time intervals (or time values if discrete) on time grid (or defined user bin)

property nx1: int#

number of intervals on X/R axis

property nx2: int#

number of intervals on Y/Z axis

property nx3: int#

number of intervals on Z/T axis

property particle: str | None#

Transported particle

print_info() dict#

Print mesh information in a dictionary format.

Returns:

fmesh infos

Return type:

dict

sameMesh(other_mesh: MeshData) bool#

Check if two meshes are the same based on their geometry and bins.

Parameters:

other_mesh (MeshData) – The other mesh to compare with.

Returns:

True if the meshes are the same, False otherwise.

Return type:

bool

property strength: float | None#

Mesh strength (e.g. for CDGS mesh)

property tally: str#

Mesh label

property tbin: ExtraBin#

mcnp timebin (or user bin assingned to mcnp time bin)

property trsf#

Mesh transformation

property type: str | None#

Mesh type (meshtal, CDGS, CUV, …)

write(outpath: Path | str | PathLike, list_array_names: list[str] | None = None, out_format: str = 'vtk', outfile: str | None = None) None#

Export the mesh to a file. vtk, csv, fluent (txt) and point cloud (txt) formats can be selected.

Parameters:
  • outpath (os.PathLike | str) – path to the output folder.

  • list_array_names (list[str], optional) – arrays to be exported. The default is None, meaning that all the available arrays will be used.

  • out_format (str, optional) – output format. The allowed ones are [‘point_cloud’, ‘ip_fluent’, ‘csv’, ‘vtk’]. Default is .vtk

  • outfile (str, optional) – name of the output file. If specified, overrides the default one. Do not include the extension of the file here. Default is None.

Raises:

KeyError – raises KeyError if the output format is not allowed.

property x1bin: ndarray#

X/R bins data (rec or cyl geometry)

property x2bin: ndarray#

Y/Z bins data (rec or cyl geometry)

property x3bin: ndarray#

Z/T bins data (rec or cyl geometry)