openmc.MeshFilter

class openmc.MeshFilter(mesh, filter_id=None)[source]

Bins tally event locations onto a regular, rectangular mesh.

Parameters:
  • mesh (openmc.Mesh) – The Mesh object that events will be tallied onto
  • filter_id (int) – Unique identifier for the filter
Variables:
  • bins (Integral) – The Mesh ID
  • mesh (openmc.Mesh) – The Mesh object that events will be tallied onto
  • id (int) – Unique identifier for the filter
  • num_bins (Integral) – The number of filter bins
can_merge(other)[source]

Determine if filter can be merged with another.

Parameters:other (openmc.Filter) – Filter to compare with
Returns:Whether the filter can be merged
Return type:bool
check_bins(bins)[source]

Make sure given bins are valid for this filter.

Raises:
classmethod from_hdf5(group, **kwargs)[source]

Construct a new Filter instance from HDF5 data.

Parameters:group (h5py.Group) – HDF5 group to read from
Keyword Arguments:
 meshes (dict) – Dictionary mapping integer IDs to openmc.Mesh objects. Only used for openmc.MeshFilter objects.
get_bin(bin_index)[source]

Returns the filter bin for some filter bin index.

Parameters:bin_index (Integral) – The zero-based index into the filter’s array of bins. The bin index for ‘material’, ‘surface’, ‘cell’, ‘cellborn’, and ‘universe’ filters corresponds to the ID in the filter’s list of bins. For ‘distribcell’ tallies the bin index necessarily can only be zero since only one cell can be tracked per tally. The bin index for ‘energy’ and ‘energyout’ filters corresponds to the energy range of interest in the filter bins of energies. The bin index for ‘mesh’ filters is the index into the flattened array of (x,y) or (x,y,z) mesh cell bins.
Returns:bin – The bin in the Tally data array. The bin for ‘material’, surface’, ‘cell’, ‘cellborn’, ‘universe’ and ‘distribcell’ filters is a 1-tuple of the ID corresponding to the appropriate filter bin. The bin for ‘energy’ and ‘energyout’ filters is a 2-tuple of the lower and upper energies bounding the energy interval for the filter bin. The bin for ‘mesh’ tallies is a 2-tuple or 3-tuple of the x,y or x,y,z mesh cell indices corresponding to the bin in a 2D/3D mesh.
Return type:1-, 2-, or 3-tuple of Real
get_bin_index(filter_bin)[source]

Returns the index in the Filter for some bin.

Parameters:filter_bin (Integral or tuple) – The bin is the integer ID for ‘material’, ‘surface’, ‘cell’, ‘cellborn’, and ‘universe’ Filters. The bin is an integer for the cell instance ID for ‘distribcell’ Filters. The bin is a 2-tuple of floats for ‘energy’ and ‘energyout’ filters corresponding to the energy boundaries of the bin of interest. The bin is an (x,y,z) 3-tuple for ‘mesh’ filters corresponding to the mesh cell of interest.
Returns:filter_index – The index in the Tally data array for this filter bin.
Return type:Integral

See also

Filter.get_bin()

get_pandas_dataframe(data_size, stride, **kwargs)[source]

Builds a Pandas DataFrame for the Filter’s bins.

This method constructs a Pandas DataFrame object for the filter with columns annotated by filter bin information. This is a helper method for Tally.get_pandas_dataframe().

Parameters:
  • data_size (int) – The total number of bins in the tally corresponding to this filter
  • stride (int) – Stride in memory for the filter
Returns:

A Pandas DataFrame with three columns describing the x,y,z mesh cell indices corresponding to each filter bin. The number of rows in the DataFrame is the same as the total number of bins in the corresponding tally, with the filter bin appropriately tiled to map to the corresponding tally bins.

Return type:

pandas.DataFrame

See also

Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()