custom_spline

halotools.empirical_models.custom_spline(table_abscissa, table_ordinates, **kwargs)[source]

Convenience wrapper around InterpolatedUnivariateSpline, written specifically to handle the edge case of a spline table being built from a single point.

Parameters:
table_abscissaarray_like

abscissa values defining the interpolation

table_ordinatesarray_like

ordinate values defining the interpolation

kint, optional

Degree of the desired spline interpolation. Default is 1.

Returns:
outputobject

Function object to use to evaluate the interpolation of the input table_abscissa & table_ordinates

Notes

Only differs from UnivariateSpline in two respects. First, the degree of the spline interpolation is automatically chosen to be the maximum allowable degree permitted by the number of abscissa points. Second, the behavior differs for the case where the input tables have only a single element. In this case, the default behavior of the scipy function is to raise an exception. The custom_spline instead returns a constant-valued function where the returned value is simply the scalar value of the input ordinates.