Skip to main content
`Ctrl`+`K`

# SplineSplrepFitter

class astropy.modeling.spline.SplineSplrepFitter

  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)

    Fit a spline to data using the splrep interface.

    Parameters:
      model `Spline1D`

        The spline model to fit.

      x numpy:array_like

        The x data values.

      y numpy:array_like

        The y data values.

      task `python:int`, optional

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

      t numpy: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.

      s `python: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.

      **kwargs `python:dict`, optional

        Additional keyword arguments:

        - `weights` array-like, optional

            Weights for the data points.

        - `bbox` array-like, optional

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

    Returns:
      fitted_copy `Spline1D`

        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.