gwinferno.interpolation.RectBivariateBasisSpline#

class RectBivariateBasisSpline(xdf, ydf, xrange=(0, 1), yrange=(0, 1), kx=4, ky=4, xbasis=<class 'gwinferno.interpolation.BSpline'>, ybasis=<class 'gwinferno.interpolation.BSpline'>, normalize=True)[source]#

Bases: object

Methods

bases(xs, ys)

bases form the basis spline design matrix evaluated at xs and ys

norm_2d(coefs)

norm_2d numerically normalizes the 2D spline

project(bases, coefs)

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

__init__(xdf, ydf, xrange=(0, 1), yrange=(0, 1), kx=4, ky=4, xbasis=<class 'gwinferno.interpolation.BSpline'>, ybasis=<class 'gwinferno.interpolation.BSpline'>, normalize=True)[source]#

Class to construct a 2D (bivariate) rectangular basis spline

Args:

xdf (int): number of degrees of freedom for the spline in the X direction ydf (int): number of degrees of freedom for the spline in the Y direction xrange (tuple, optional): domain of X spline. Defaults to (0, 1). yrange (tuple, optional): domain of Y spline. Defaults to (0, 1). kx (int, optional): order of the X spline +1, i.e. cubic splines->k=4. Defaults to 4 (cubic spline). ky (int, optional): order of the Y spline +1, i.e. cubic splines->k=4. Defaults to 4 (cubic spline). xbasis (object, optional): Choice of basis to use for the X spline. Defaults to BSpline. ybasis (object, optional): Choice of basis to use for the Y spline. Defaults to BSpline. normalize (bool, optional): flag whether or not to numerically normalize the spline. Defaults to True.

bases(xs, ys)[source]#

bases form the basis spline design matrix evaluated at xs and ys

Args:

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

Returns:

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

norm_2d(coefs)[source]#

norm_2d numerically normalizes the 2D spline

Args:

coefs (array_like): coefficients for the basis components

Returns:

float: the normalization factor given the coefficients

project(bases, coefs)[source]#

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