@@ -43,15 +43,18 @@ def __init__(self, npars, valuef, jacobianf=None, estimatef=None, Cache=None):
4343 """Initialize an arbitrary baseline.
4444
4545 Parameters
46- npars: Number of parameters which define the function
47- valuef: Function which calculates the value of the baseline
48- at x.
49- jacobianf: (None) Function which calculates the Jacobian of the
46+ ----------
47+ npars : int
48+ The number of parameters which define the function
49+ valuef : array-like or int
50+ The function which calculates the value of the baseline at x.
51+ jacobianf : array-like or None
52+ The function which calculates the Jacobian of the
5053 baseline function with respect to free pars.
51- estimatef: (None) Function which estimates function parameters given the
52- data x and y.
53- Cache: ( None) A class (not instance) which implements caching of
54- BaseFunction evaluations.
54+ estimatef : array-like or None
55+ The function which estimates function parameters given the data x and y.
56+ Cache : None or callable
57+ The class (not instance) which implements caching of BaseFunction evaluations.
5558 """
5659 # Guarantee valid number of parameters
5760 try :
@@ -103,11 +106,17 @@ def estimate_parameters(self, r, y):
103106 """Estimate parameters for data baseline.
104107
105108 Parameters
106- r: (Numpy array) Data along r from which to estimate
107- y: (Numpy array) Data along y from which to estimate
109+ ----------
110+ r : array-like
111+ The data along r from which to estimate
112+ y : array-like
113+ The data along y from which to estimate
108114
109- Returns Numpy array of parameters in the default internal format.
110- Raises NotImplementedError if no estimation routine is defined, and
115+ Returns
116+ -------
117+ The numpy array of parameters in the default internal format.
118+
119+ we raise NotImplementedError if no estimation routine is defined, and
111120 SrMiseEstimationError if parameters cannot be estimated for any other."""
112121 if self .estimatef is None :
113122 emsg = "No estimation routine provided to Arbitrary."
@@ -124,13 +133,23 @@ def _jacobianraw(self, pars, r, free):
124133 """Return the Jacobian of a polynomial.
125134
126135 Parameters
127- pars: Sequence of parameters
128- pars[0] = a_0
129- pars[1] = a_1
130- ...
131- r: sequence or scalar over which pars is evaluated
132- free: sequence of booleans which determines which derivatives are
133- needed. True for evaluation, False for no evaluation."""
136+ ----------
137+ pars : array-like
138+ The sequence of parameters
139+ pars[0] = a_0
140+ pars[1] = a_1
141+ ...
142+ r : array-like or int
143+ The sequence or scalar over which pars is evaluated
144+ free : array-like of bools
145+ The sequence of booleans which determines which derivatives are needed.
146+ True for evaluation, False for no evaluation.
147+
148+ Returns
149+ -------
150+ numpy.ndarray
151+ The Jacobian of polynomial with respect to free pars.
152+ """
134153 nfree = None
135154 if self .jacobianf is None :
136155 nfree = (pars is True ).sum ()
@@ -159,12 +178,23 @@ def _transform_parametersraw(self, pars, in_format, out_format):
159178 """Convert parameter values from in_format to out_format.
160179
161180 Parameters
162- pars: Sequence of parameters
163- in_format: A format defined for this class
164- out_format: A format defined for this class
165-
166- Defined Formats
167- internal: [a_0, a_1, ...]"""
181+ ----------
182+ pars : array-like
183+ The sequence of parameters
184+ in_format : internal
185+ The format defined for this class
186+ out_format: internal
187+ The format defined for this class
188+
189+ Defined Format
190+ --------------
191+ internal: [a_0, a_1, ...]
192+
193+ Returns
194+ -------
195+ numpy.ndarray
196+ The standard output of transformed parameters
197+ """
168198 temp = np .array (pars )
169199
170200 # Convert to intermediate format "internal"
@@ -181,14 +211,28 @@ def _transform_parametersraw(self, pars, in_format, out_format):
181211 return temp
182212
183213 def _valueraw (self , pars , r ):
184- """Return value of polynomial for the given parameters and r values.
214+ """Compute the value of the polynomial given a set of parameters and evaluation points.
215+
216+ This method ensures that the input parameters conform to the expected count
217+ and then delegates the computation to an internal method `valuef`.
185218
186219 Parameters
187- pars: Sequence of parameters
188- pars[0] = a_0
189- pars[1] = a_1
190- ...
191- r: sequence or scalar over which pars is evaluated"""
220+ ----------
221+ pars : array_like
222+ The sequence of coefficients for the polynomial where each element corresponds to:
223+ - pars[0] = a_0, the constant term
224+ - pars[1] = a_1, the coefficient of the first degree term, and so on.
225+ The length of `pars` must match the expected number of parameters defined in the class.
226+
227+ r : array_like or float
228+ The sequence of points or a single point at which the polynomial is to be evaluated.
229+ If a scalar is provided, it will be treated as a single point for evaluation.
230+
231+ Returns
232+ -------
233+ ndarray or float
234+ The computed values of the polynomial for each point in `r`.
235+ """
192236 if len (pars ) != self .npars :
193237 emsg = "Argument pars must have " + str (self .npars ) + " elements."
194238 raise ValueError (emsg )
0 commit comments