bspline_fit

jwst.adaptive_trace_model.bspline.bspline_fit(xvec, yvec, nbkpts=50, wrapsig_low=3.0, wrapsig_high=3.0, wrapiter=3, space_ratio=1.2, verbose=False)[source]

Fit a univariate basis spline to a vector with iterative rejection.

Parameters:
xvecndarray

1D array of x values for the vector.

yvecndarray

1D array of y values to fit.

nbkptsint, optional

Number of spline breakpoints (knots).

wrapsig_lowfloat, optional

Low sigma threshold for iterative fit.

wrapsig_highfloat, optional

High sigma threshold for iterative fit.

wrapiterint, optional

Number of iterations for the fit.

space_ratiofloat, optional

Maximum spacing ratio to allow fitting to continue. If the tenth-largest spacing in the input xvec is larger than the knot spacing by this ratio, then return None instead of attempting to fit the data.

verbosebool, optional

If True, an info log message is generated for each fitting iteration.

Returns:
spline_modelBSpline or None

The spline model fit to the data. If the fit failed, None is returned.