openmc.MeshMaterialFilter

class openmc.MeshMaterialFilter(mesh: MeshBase, bins, filter_id=None)[source]

Filter events by combinations of mesh elements and materials.

Added in version 0.15.3.

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

  • bins (iterable of 2-tuples or numpy.ndarray) – Combinations of (mesh element, material) to tally, given as 2-tuples. The first value in the tuple represents the index of the mesh element, and the second value indicates the material (either a openmc.Material instance of the ID).

  • filter_id (int) – Unique identifier for the filter

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_volumes(mesh: MeshBase, volumes: MeshMaterialVolumes)[source]

Construct a MeshMaterialFilter from a MeshMaterialVolumes object.

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

  • volumes (openmc.MeshMaterialVolumes) – The mesh material volumes to use for the filter

Returns:

A new MeshMaterialFilter instance

Return type:

MeshMaterialFilter

classmethod from_xml_element(elem: Element, **kwargs) MeshMaterialFilter[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 a multi-index column for the cell instance. 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