class openmc.CellInstanceFilter(bins, filter_id=None)[source]

Bins tally events based on which cell instance a particle is in.

This filter is similar to DistribcellFilter but allows one to select particular instances to be tallied (instead of obtaining all instances by default) and allows instances from different cells to be specified in a single filter.

New in version 0.12.

  • bins (iterable of 2-tuples or numpy.ndarray) – The cell instances to tally, given as 2-tuples. For the first value in the tuple, either openmc.Cell objects or their integral ID numbers can be used. The second value indicates the cell instance.

  • filter_id (int) – Unique identifier for the filter

  • bins (numpy.ndarray) – 2D numpy array of cell IDs and instances

  • id (int) – Unique identifier for the filter

  • num_bins (Integral) – The number of filter bins

classmethod from_xml_element(elem, **kwargs)[source]

Generate a filter from an XML element

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

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


Filter object

Return type


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().

  • data_size (int) – The total number of bins in the tally corresponding to this filter

  • stride (int) – Stride in memory for the filter


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


See also

Tally.get_pandas_dataframe, CrossFilter.get_pandas_dataframe


Return XML Element representing the Filter.


element – XML element containing filter data

Return type