sandy.pert module

class sandy.pert.Pert(series, **kwargs)

Bases: object

Container for tabulated multigroup perturbation coefficients.

Attributes:
datapandas.Series

Series of groupwise perturbation coefficients.

leftpandas.Series

Pertrubations with left-bounds of the energy intervals as index.

midpandas.Series

Pertrubations with mid-values of the energy intervals as index.

rightpandas.Series

Pertrubations with right-bounds of the energy intervals as index.

Methods

from_bin(elow, ehigh, coeff)

Generate a Pert object from a pair of energy bins (elow, ehigh].

reshape(eg[, inplace])

Interpolate perturbation over new energy grid structure using bfill method.

property data

Series of groupwise perturbation coefficients.

Returns:
pandas.Series

multigroup perturbation coefficients

Raises:
sandy.Error

if data is not a pandas.Series

sandy.Error

if energy grid is not monotonically increasing

Attributes:
indexpandas.IntervalIndex

energy bins (in eV) over which the perturbations are defined

valuesnumpy.array

perturation coeffcients as ratio values

classmethod from_bin(elow, ehigh, coeff)

Generate a Pert object from a pair of energy bins (elow, ehigh].

Parameters:
elowTYPE

lower energy boundary in eV.

ehighfloat

upper energy boundary in eV.

coefffloat

perturbation coefficient.

Returns:
pertsandy.Pert

perturbation object.

Examples

>>> Pert.from_bin(1e-5, 1e-4, 0.05)
ENERGY
(0.0, 1e-05]      1.00000e+00
(1e-05, 0.0001]   1.05000e+00
dtype: float64
classmethod from_file(file, sep=None, **kwargs)

Initialize Pert object reading perturbations from file.

Parameters:
filestr

file name (absolute or relative path)

sepstr, optional, default “s+”

column separator. By default it takes blankspaces as separators. .. note:: for csv files use “,”

**kwargspandas.read_csv properties, optional
Returns:
Pert

Container for binned perturbations

property left

Pertrubations with left-bounds of the energy intervals as index. .. note:: the index of the series is a pandas.Index instance, not a

pandas.IntervalIndex instance.

Returns:
pandas.Series

perturbations

property mid

Pertrubations with mid-values of the energy intervals as index. .. note:: the index of the series is a pandas.Index instance, not a

pandas.IntervalIndex instance.

Returns:
pandas.Series

perturbations

recenter(low=0.0, high=2.0, value=1.0)

Truncate perturbation values when they exceed a defined lower or upper value. Every value outside the boundary is replaced with the cental perturbation vaule, i.e. 1, or with a value of choice.

Parameters:
lowfloat, optional

lower limit for truncation. The default is 0.0.

highfloat, optional

upper limit for truncation. The default is 2.0.

valuefloat, optional

value used to replace any perturbation exceeding the limiting domain. The default is 1.0.

Returns:
sandy.Pert

perturbation instance with truncated values.

reshape(eg, inplace=False)

Interpolate perturbation over new energy grid structure using bfill method.

Note

value 1 is given to extrapolated energies

Parameters:
egarray-like object

monotonic energy grid with non-negative values

inplacebool, optional, default is False

apply changes inplace and return None

Returns:
sandy.Pert

perturbation coefficients reshaped over a union of the original and new energy grids

Raises:
aleph.Error

if the given energy grid is not monotonic

value.Error

if negative values are found in the given energy grid

property right

Pertrubations with right-bounds of the energy intervals as index. .. note:: the index of the series is a pandas.Index instance, not a

pandas.IntervalIndex instance.

Returns:
pandas.Series

perturbations

truncate(low=0.0, high=2.0)

Truncate perturbation values when they exceed a defined lower or upper value. Every value outside the boundary is replaced with the boundary value that was exceeded.

Parameters:
lowfloat, optional

lower limit for truncation. The default is 0.0.

highfloat, optional

upper limit for truncation. The default is 2.0.

Returns:
sandy.Pert

perturbation instance with truncated values.