@@ -620,6 +620,34 @@ class SplineInterpolateFitter(_SplineFitter):
620620 Fit an interpolating spline.
621621 """
622622
623+ def __call__ (self , model , x , y , ** kwargs ):
624+ """
625+ Fit an interpolating spline to data.
626+
627+ Parameters
628+ ----------
629+ model : `Spline1D`
630+ The spline model to fit.
631+ x : array-like
632+ The x data values.
633+ y : array-like
634+ The y data values.
635+ **kwargs : dict, optional
636+ Additional keyword arguments:
637+
638+ - ``weights`` : array-like, optional
639+ Weights for the data points.
640+ - ``bbox`` : array-like, optional
641+ The bounding box limits as ``[xmin, xmax]``. Default is
642+ ``[None, None]``.
643+
644+ Returns
645+ -------
646+ fitted_model : `Spline1D`
647+ A copy of the input model with fitted parameters.
648+ """
649+ return super ().__call__ (model , x , y , ** kwargs )
650+
623651 def _fit_method (self , model , x , y , ** kwargs ):
624652 weights = kwargs .pop ("weights" , None )
625653 bbox = kwargs .pop ("bbox" , [None , None ])
@@ -649,6 +677,42 @@ class SplineSmoothingFitter(_SplineFitter):
649677 Fit a smoothing spline.
650678 """
651679
680+ def __call__ (self , model , x , y , ** kwargs ):
681+ """
682+ Fit a smoothing spline to data.
683+
684+ Parameters
685+ ----------
686+ model : `Spline1D`
687+ The spline model to fit.
688+ x : array-like
689+ The x data values.
690+ y : array-like
691+ The y data values.
692+ s : float, optional
693+ Positive smoothing factor used to choose the number
694+ of knots. The parameter can be used to control the
695+ tradeoff between closeness and smoothness of fit.
696+ Larger ``s`` means more smoothing while smaller values
697+ of ``s`` indicate less smoothing. automatically. A
698+ value of 0 results in an interpolating spline. See
699+ `scipy.interpolate.UnivariateSpline` for details.
700+ **kwargs : dict, optional
701+ Additional keyword arguments:
702+
703+ - ``weights`` : array-like, optional
704+ Weights for the data points.
705+ - ``bbox`` : array-like, optional
706+ The bounding box limits as ``[xmin, xmax]``. Default is
707+ ``[None, None]``.
708+
709+ Returns
710+ -------
711+ fitted_model : `Spline1D`
712+ A copy of the input model with fitted parameters.
713+ """
714+ return super ().__call__ (model , x , y , ** kwargs )
715+
652716 def _fit_method (self , model , x , y , ** kwargs ):
653717 s = kwargs .pop ("s" , None )
654718 weights = kwargs .pop ("weights" , None )
@@ -677,6 +741,39 @@ class SplineExactKnotsFitter(_SplineFitter):
677741 Fit a spline using least-squares regression.
678742 """
679743
744+ def __call__ (self , model , x , y , ** kwargs ):
745+ """
746+ Fit a spline to data using least-squares with exact knots.
747+
748+ Parameters
749+ ----------
750+ model : `Spline1D`
751+ The spline model to fit.
752+ x : array-like
753+ The x data values.
754+ y : array-like
755+ The y data values.
756+ **kwargs : dict, optional
757+ Additional keyword arguments:
758+
759+ - ``t`` : array-like, optional
760+ Interior knots for the spline. If not provided, the
761+ model's existing interior knots (``t_interior``) are
762+ used if available. See
763+ `scipy.interpolate.LSQUnivariateSpline` for details.
764+ - ``weights`` : array-like, optional
765+ Weights for the data points.
766+ - ``bbox`` : array-like, optional
767+ The bounding box limits as ``[xmin, xmax]``. Default is
768+ ``[None, None]``.
769+
770+ Returns
771+ -------
772+ fitted_model : `Spline1D`
773+ A copy of the input model with fitted parameters.
774+ """
775+ return super ().__call__ (model , x , y , ** kwargs )
776+
680777 def _fit_method (self , model , x , y , ** kwargs ):
681778 t = kwargs .pop ("t" , None )
682779 weights = kwargs .pop ("weights" , None )
@@ -715,6 +812,55 @@ def __init__(self):
715812 super ().__init__ ()
716813 self .fit_info = {"fp" : None , "ier" : None , "msg" : None }
717814
815+ def __call__ (self , model , x , y , ** kwargs ):
816+ """
817+ Fit a spline to data using the splrep interface.
818+
819+ Parameters
820+ ----------
821+ model : `Spline1D`
822+ The spline model to fit.
823+ x : array-like
824+ The x data values.
825+ y : array-like
826+ The y data values.
827+ task : int, optional
828+ Task parameter for splrep. Default is 0. See
829+ `scipy.interpolate.splrep` for details.
830+ t : array-like, optional
831+ The interior knots needed for ``task=-1``. If given,
832+ then ``task`` is automatically set to -1. see
833+ `scipy.interpolate.splrep` for details. Interior knots for
834+ the spline. If not provided, the model's existing interior
835+ knots (``t_interior``) are used if available.
836+ s : float, optional
837+ Positive smoothing factor used to choose the number of
838+ knots. The user can use ``s`` to control the tradeoff
839+ between closeness and smoothness of fit. Larger ``s`` means
840+ more smoothing while smaller values of ``s`` indicate less
841+ smoothing. If not provided or `None`, ``s`` is calculated
842+ automatically based on the data.
843+ **kwargs : dict, optional
844+ Additional keyword arguments:
845+
846+ - ``weights`` : array-like, optional
847+ Weights for the data points.
848+ - ``bbox`` : array-like, optional
849+ The bounding box limits as ``[xmin, xmax]``. Default is
850+ ``[None, None]``.
851+
852+ Returns
853+ -------
854+ fitted_copy : `Spline1D`
855+ A copy of the input model with fitted parameters.
856+
857+ Notes
858+ -----
859+ The fit information (fp, ier, msg) from splrep is stored in
860+ the ``fit_info`` attribute of the fitter instance.
861+ """
862+ return super ().__call__ (model , x , y , ** kwargs )
863+
718864 def _fit_method (self , model , x , y , ** kwargs ):
719865 t = kwargs .pop ("t" , None )
720866 s = kwargs .pop ("s" , None )
0 commit comments