openmc.DistribcellFilter

class openmc.DistribcellFilter(cell, filter_id=None)[source]

Bins tally event locations on instances of repeated cells.

This filter provides a separate score for each unique instance of a repeated cell in a geometry. Note that only one cell can be specified in this filter. The related CellInstanceFilter allows one to obtain scores for particular cell instances as well as instances from different cells.

Parameters:
  • cell (openmc.Cell or Integral) – The distributed cell to tally. Either an openmc.Cell or an Integral cell ID number can be used.
  • filter_id (int) – Unique identifier for the filter
Variables:
  • bins (Iterable of Integral) – An iterable with one element—the ID of the distributed Cell.
  • id (int) – Unique identifier for the filter
  • num_bins (int) – The number of filter bins
  • paths (list of str) – The paths traversed through the CSG tree to reach each distribcell instance (for ‘distribcell’ filters only)
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.
get_bin_index(filter_bin)[source]

Returns the index in the Filter for some bin.

Parameters:filter_bin (int 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:int
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
Keyword Arguments:
 

paths (bool) – If True (default), expand distribcell indices into multi-index columns describing the path to that distribcell through the CSG tree. NOTE: This option assumes that all distribcell paths are of the same length and do not have the same universes and cells but different lattice cell indices.

Returns:

A Pandas DataFrame with columns describing distributed cells. The dataframe will have either:

  1. a single column with the cell instance IDs (without summary info)
  2. separate columns for the cell IDs, universe IDs, and lattice IDs and x,y,z cell indices corresponding to each (distribcell paths).

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