openmc.arithmetic.AggregateFilter¶
- class openmc.arithmetic.AggregateFilter(aggregate_filter, bins=None, aggregate_op=None)[source]¶
A special-purpose tally filter used to encapsulate an aggregate of a subset or all of a tally filter’s bins for tally aggregation.
- Parameters
aggregate_filter (Filter or CrossFilter) – The filter included in the aggregation
bins (Iterable of tuple) – The filter bins included in the aggregation
aggregate_op (str) – The tally aggregation operator (e.g., ‘sum’, ‘avg’, etc.) used to aggregate across a tally filter’s bins with this AggregateFilter
- Variables
type (str) – The type of the aggregatefilter (e.g., ‘sum(energy)’, ‘sum(cell)’)
aggregate_filter (filter) – The filter included in the aggregation
aggregate_op (str) – The tally aggregation operator (e.g., ‘sum’, ‘avg’, etc.) used to aggregate across a tally filter’s bins with this AggregateFilter
bins (Iterable of tuple) – The filter bins included in the aggregation
num_bins (Integral) – The number of filter bins (always 1 if aggregate_filter is defined)
- can_merge(other)[source]¶
Determine if AggregateFilter can be merged with another.
- Parameters
other (AggregateFilter) – Filter to compare with
- Returns
Whether the filter can be merged
- Return type
- get_bin_index(filter_bin)[source]¶
Returns the index in the AggregateFilter for some bin.
- Parameters
filter_bin (Integral or tuple of Real) – A tuple of value(s) corresponding to the bin of interest in the aggregated filter. The bin is the integer ID for ‘material’, ‘surface’, ‘cell’, ‘cellborn’, and ‘universe’ Filters. The bin is the integer 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 a (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. For an AggregateTally the filter bin index is always unity.
- Return type
Integral
- Raises
ValueError – When the filter_bin is not part of the aggregated filter’s bins
- get_pandas_dataframe(data_size, stride, summary=None, **kwargs)[source]¶
Builds a Pandas DataFrame for the AggregateFilter’s bins.
This method constructs a Pandas DataFrame object for the AggregateFilter with columns annotated by filter bin information. This is a helper method for the Tally.get_pandas_dataframe(…) method.
- Parameters
data_size (int) – The total number of bins in the tally corresponding to this filter
stride (int) – Stride in memory for the filter
summary (None or Summary) – An optional Summary object to be used to construct columns for distribcell tally filters (default is None). NOTE: This parameter is not used by the AggregateFilter and simply mirrors the method signature for the CrossFilter.
- Returns
A Pandas DataFrame with columns of strings that characterize the aggregatefilter’s bins. Each entry in the DataFrame will include one or more aggregation operations used to construct the aggregatefilter’s bins. The number of rows in the DataFrame is the same as the total number of bins in the corresponding tally, with the filter bins appropriately tiled to map to the corresponding tally bins.
- Return type
See also
Tally.get_pandas_dataframe
,Filter.get_pandas_dataframe
,CrossFilter.get_pandas_dataframe
- merge(other)[source]¶
Merge this aggregatefilter with another.
- Parameters
other (AggregateFilter) – Filter to merge with
- Returns
merged_filter – Filter resulting from the merge
- Return type