SplineSplrepFitter#

class astropy.modeling.spline.SplineSplrepFitter[source]#

Bases: _SplineFitter

Fit a spline using the scipy.interpolate.splrep function interface.

Methods Summary

__call__(model, x, y, **kwargs)

Fit a spline to data using the splrep interface.

Methods Documentation

__call__(model, x, y, **kwargs)[source]#

Fit a spline to data using the splrep interface.

Parameters:
modelSpline1D

The spline model to fit.

xnumpy:array_like

The x data values.

ynumpy:array_like

The y data values.

taskpython:int, optional

Task parameter for splrep. Default is 0. See scipy.interpolate.splrep for details.

tnumpy:array_like, optional

The interior knots needed for task=-1. If given, then task is automatically set to -1. see scipy.interpolate.splrep for details. Interior knots for the spline. If not provided, the model’s existing interior knots (t_interior) are used if available.

spython:float, optional

Positive smoothing factor used to choose the number of knots. The user can use s to control the tradeoff between closeness and smoothness of fit. Larger s means more smoothing while smaller values of s indicate less smoothing. If not provided or None, s is calculated automatically based on the data.

**kwargspython:dict, optional

Additional keyword arguments:

  • weightsarray-like, optional

    Weights for the data points.

  • bboxarray-like, optional

    The bounding box limits as [xmin, xmax]. Default is [None, None].

Returns:
fitted_copySpline1D

A copy of the input model with fitted parameters.

Notes

The fit information (fp, ier, msg) from splrep is stored in the fit_info attribute of the fitter instance.