openmc.data.Tabulated1D

class openmc.data.Tabulated1D(x, y, breakpoints=None, interpolation=None)[source]

A one-dimensional tabulated function.

This class mirrors the TAB1 type from the ENDF-6 format. A tabulated function is specified by tabulated (x,y) pairs along with interpolation rules that determine the values between tabulated pairs.

Once an object has been created, it can be used as though it were an actual function, e.g.:

>>> f = Tabulated1D([0, 10], [4, 5])
>>> [f(xi) for xi in numpy.linspace(0, 10, 5)]
[4.0, 4.25, 4.5, 4.75, 5.0]
Parameters:
  • x (Iterable of float) – Independent variable
  • y (Iterable of float) – Dependent variable
  • breakpoints (Iterable of int) – Breakpoints for interpolation regions
  • interpolation (Iterable of int) – Interpolation scheme identification number, e.g., 3 means y is linear in ln(x).
Variables:
  • x (Iterable of float) – Independent variable
  • y (Iterable of float) – Dependent variable
  • breakpoints (Iterable of int) – Breakpoints for interpolation regions
  • interpolation (Iterable of int) – Interpolation scheme identification number, e.g., 3 means y is linear in ln(x).
  • n_regions (int) – Number of interpolation regions
  • n_pairs (int) – Number of tabulated (x,y) pairs
classmethod from_ace(ace, idx=0, convert_units=True)[source]

Create a Tabulated1D object from an ACE table.

Parameters:
  • ace (openmc.data.ace.Table) – An ACE table
  • idx (int) – Offset to read from in XSS array (default of zero)
  • convert_units (bool) – If the abscissa represents energy, indicate whether to convert MeV to eV.
Returns:

Tabulated data object

Return type:

openmc.data.Tabulated1D

classmethod from_hdf5(dataset)[source]

Generate tabulated function from an HDF5 dataset

Parameters:dataset (h5py.Dataset) – Dataset to read from
Returns:Function read from dataset
Return type:openmc.data.Tabulated1D
integral()[source]

Integral of the tabulated function over its tabulated range.

Returns:Array of same length as the tabulated data that represents partial integrals from the bottom of the range to each tabulated point.
Return type:numpy.ndarray
to_hdf5(group, name='xy')[source]

Write tabulated function to an HDF5 group

Parameters:
  • group (h5py.Group) – HDF5 group to write to
  • name (str) – Name of the dataset to create