openmc.EnergyFunctionFilter

class openmc.EnergyFunctionFilter(energy, y)[source]

Multiplies tally scores by an arbitrary function of incident energy.

The arbitrary function is described by a piecewise linear-linear interpolation of energy and y values. Values outside of the given energy range will be evaluated as zero.

Parameters:
  • energy (Iterable of Real) – A grid of energy values in eV.
  • y (iterable of Real) – A grid of interpolant values in eV.
Variables:
  • energy (Iterable of Real) – A grid of energy values in eV.
  • y (iterable of Real) – A grid of interpolant values in eV.
  • num_bins (Integral) – The number of filter bins (always 1 for this filter)
  • stride (Integral) – The number of filter, nuclide and score bins within each of this filter’s 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.Mesh objects. Only used for openmc.MeshFilter objects.
classmethod from_tabulated1d(tab1d)[source]

Construct a filter from a Tabulated1D object.

Parameters:tab1d (openmc.data.Tabulated1D) – A linear-linear Tabulated1D object with only a single interpolation region.
Returns:
Return type:EnergyFunctionFilter
get_bin(bin_index)[source]

This function is invalid for EnergyFunctionFilters.

get_bin_index(filter_bin)[source]

Returns the index in the Filter for some bin.

Parameters:filter_bin (Integral 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:Integral

See also

Filter.get_bin()

get_pandas_dataframe(data_size, **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 (Integral) – The total number of bins in the tally corresponding to this filter
Returns:A Pandas DataFrame with a column that is filled with a hash of this filter. EnergyFunctionFilters have only 1 bin so the purpose of this DataFrame column is to differentiate the filter from other EnergyFunctionFilters. The number of rows in the DataFrame is the same as the total number of bins in the corresponding tally.
Return type:pandas.DataFrame
Raises:ImportError – When Pandas is not installed

See also

Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe()

is_subset(other)[source]

Determine if another filter is a subset of this filter.

If all of the bins in the other filter are included as bins in this filter, then it is a subset of this filter.

Parameters:other (openmc.Filter) – The filter to query as a subset of this filter
Returns:Whether or not the other filter is a subset of this filter
Return type:bool
to_xml_element()[source]

Return XML Element representing the Filter.

Returns:
Return type:ElementTree.Element