gwinferno.interpolation.LogXLogYBSpline#

class LogXLogYBSpline(n_df, knots=None, interior_knots=None, xrange=(0.1, 1), normalize=True, **kwargs)[source]#

Bases: LogYBSpline

Methods

bases(xs)

bases form the basis spline design matrix evaluated at xs (in log space).

eval(xs, coefs)

eval Evaluate basis spline at xs given coefficients

get_coefficients(xs, ys)

computes the coefficients of the basis components given data 1-D data (xs, ys)

norm(coefs)

norm numerically normalizes the spline

project(bases, coefs)

project given a design matrix (or bases) and coefficients, project the coefficients onto the spline with normalization

__call__(xs, coefs)#

__call__ Evaluate basis spline at xs given coefficients

Args:

xs (array_like): input values to evaluate the basis spline at coefs (array_like): coefficients for the basis components

Returns:

array_like: The linear combination of the basis components evaluated at xs given the coefficients

__init__(n_df, knots=None, interior_knots=None, xrange=(0.1, 1), normalize=True, **kwargs)[source]#

Class to construct a basis spline (B-Spline) in the log-log space of the domain and range (X and Y)

Args:

n_df (int): number of degrees of freedom for the spline knots (array_like, optional): array of knots, if non-uniform knot placing is preferred.

Defaults to None.

interior_knots (array_like, optional): array of interior knots,

if non-uniform knot placing is preferred. Defaults to None.

xrange (tuple, optional): domain of spline. Defaults to (0.01, 1). k (int, optional): order of the spline +1, i.e. cubic splines->k=4. Defaults to 4 (cubic spline). normalize (bool, optional): flag whether or not to numerically normalize the spline. Defaults to True.

bases(xs)[source]#

bases form the basis spline design matrix evaluated at xs (in log space). -inf will be used for out-of-range values.

Args:

xs (array_like): input values to evaluate the basis spline at

Returns:

array_like: the design matrix evaluated at xs. shape (N, *xs.shape)

eval(xs, coefs)#

eval Evaluate basis spline at xs given coefficients

Args:

xs (array_like): input values to evaluate the basis spline at coefs (array_like): coefficients for the basis components

Returns:

array_like: The linear combination of the basis components evaluated at xs given the coefficients

get_coefficients(xs, ys)#

computes the coefficients of the basis components given data 1-D data (xs, ys)

Args:

xs (array_like): The x values of data ys (array_like): The y values of data

Returns:

the coefficients (array_like), interpolated y-values evaluated at xs (array_like), the design matrix evaluated at xs with shape (N, *xs.shape)

norm(coefs)#

norm numerically normalizes the spline

Args:

coefs (array_like): coefficients for the basis components

Returns:

float: the normalization factor given the coefficients

project(bases, coefs)#

project given a design matrix (or bases) and coefficients, project the coefficients onto the spline with normalization

Args:

bases (array_like): The set of basis components or design matrix to project onto coefs (array_like): coefficients for the basis components

Returns:

array_like: The linear combination of the basis components given the coefficients