bspline¶
-
class
pydl.pydlutils.bspline.
bspline
(x, nord=4, npoly=1, bkpt=None, bkspread=1.0, verbose=False, **kwargs)[source]¶ Bases:
object
Bspline class.
Functions in the bspline library are implemented as methods on this class.
Parameters: x :
numpy.ndarray
The data.
nord :
int
, optionalTo be documented.
npoly :
int
, optionalTo be documented.
bkpt :
numpy.ndarray
, optionalTo be documented.
bkspread :
float
, optionalTo be documented.
verbose :
bool
, optional.If
True
print extra information.Attributes
breakpoints To be documented. nord To be documented. npoly To be documented. mask To be documented. coeff To be documented. icoeff To be documented. xmin To be documented. xmax To be documented. funcname To be documented. Init creates an object whose attributes are similar to the structure returned by the create_bspline function.
Methods Summary
action
(x[, x2])Construct banded bspline matrix, with dimensions [ndata, bandwidth]. bsplvn
(x, ileft)To be documented. fit
(xdata, ydata, invvar[, x2])Calculate a B-spline in the least-squares sense. intrv
(x)Find the segment between breakpoints which contain each value in the array x. maskpoints
(err)Perform simple logic of which breakpoints to mask. value
(x[, x2, action, lower, upper])Evaluate a bspline at specified values. Methods Documentation
-
action
(x, x2=None)[source]¶ Construct banded bspline matrix, with dimensions [ndata, bandwidth].
Parameters: x :
numpy.ndarray
Independent variable.
x2 :
numpy.ndarray
, optionalOrthogonal dependent variable for 2d fits.
Returns: A tuple containing the b-spline action matrix; the ‘lower’ parameter, a list of pixel positions, each corresponding to the first occurence of position greater than breakpoint indx; and ‘upper’, Same as lower, but denotes the upper pixel positions.
-
bsplvn
(x, ileft)[source]¶ To be documented.
Parameters: x :
numpy.ndarray
To be documented.
ileft :
int
To be documented
Returns: To be documented.
-
fit
(xdata, ydata, invvar, x2=None)[source]¶ Calculate a B-spline in the least-squares sense.
Fit is based on two variables: x which is sorted and spans a large range where bkpts are required y which can be described with a low order polynomial.
Parameters: xdata :
numpy.ndarray
Independent variable.
ydata :
numpy.ndarray
Dependent variable.
invvar :
numpy.ndarray
Inverse variance of
ydata
.x2 :
numpy.ndarray
, optionalOrthogonal dependent variable for 2d fits.
Returns: A tuple containing an integer error code, and the evaluation of the b-spline at the input values. An error code of -2 is a failure, -1 indicates dropped breakpoints, 0 is success, and positive integers indicate ill-conditioned breakpoints.
-
intrv
(x)[source]¶ Find the segment between breakpoints which contain each value in the array x.
The minimum breakpoint is nbkptord -1, and the maximum is nbkpt - nbkptord - 1.
Parameters: x :
numpy.ndarray
Data values, assumed to be monotonically increasing.
Returns: Position of array elements with respect to breakpoints.
-
maskpoints
(err)[source]¶ Perform simple logic of which breakpoints to mask.
Parameters: err :
numpy.ndarray
The list of indexes returned by the cholesky routines.
Returns: An integer indicating the results of the masking. -1 indicates that the error points were successfully masked. -2 indicates failure; the calculation should be aborted.
Notes
The mask attribute is modified, assuming it is possible to create the mask.
-
value
(x, x2=None, action=None, lower=None, upper=None)[source]¶ Evaluate a bspline at specified values.
Parameters: x :
numpy.ndarray
Independent variable.
x2 :
numpy.ndarray
, optionalOrthogonal dependent variable for 2d fits.
action :
numpy.ndarray
, optionalAction matrix to use. If not supplied it is calculated.
lower :
numpy.ndarray
, optionalIf the action parameter is supplied, this parameter must also be supplied.
upper :
numpy.ndarray
, optionalIf the action parameter is supplied, this parameter must also be supplied.
Returns: A tuple containing the results of the bspline evaluation and a mask indicating where the evaluation was good.
-