openmc.MeshFilter

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

Bins tally event locations by mesh elements.

Parameters:
  • mesh (openmc.MeshBase) – The mesh object that events will be tallied onto

  • filter_id (int) – Unique identifier for the filter

Variables:
  • mesh (openmc.MeshBase) – The mesh object that events will be tallied onto

  • id (int) – Unique identifier for the filter

  • translation (Iterable of float) – This array specifies a vector that is used to translate (shift) the mesh for this filter

  • bins (list of tuple) – A list of mesh indices for each filter bin, e.g. [(1, 1, 1), (2, 1, 1), …]

  • 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

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.MeshBase objects. Only used for openmc.MeshFilter objects.

classmethod from_xml_element(elem: Element, **kwargs) MeshFilter[source]

Generate a filter from an XML element

Parameters:
  • elem (lxml.etree._Element) – XML element

  • **kwargs – Keyword arguments (e.g., mesh information)

Returns:

Filter object

Return type:

openmc.Filter

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

to_xml_element()[source]

Return XML Element representing the Filter.

Returns:

element – XML element containing filter data

Return type:

lxml.etree._Element