@@ -29,10 +29,13 @@ def __init__(self, degree, Cache=None):
29
29
"""Initialize a polynomial function of degree d.
30
30
31
31
Parameters
32
- degree: The degree of the polynomial. Any negative value is interpreted
33
- as the polynomial of negative infinite degree.
34
- Cache: A class (not instance) which implements caching of BaseFunction
35
- evaluations.
32
+ ----------
33
+ degree: int
34
+ The degree of the polynomial. Any negative value is interpreted
35
+ as the polynomial of negative infinite degree.
36
+ Cache: class
37
+ The class (not instance) which implements caching of BaseFunction
38
+ evaluations.
36
39
"""
37
40
# Guarantee valid degree
38
41
try :
@@ -62,13 +65,20 @@ def estimate_parameters(self, r, y):
62
65
y=baseline+signal, where signal is primarily positive.
63
66
64
67
Parameters
65
- r: (Numpy array) Data along r from which to estimate
66
- y: (Numpy array) Data along y from which to estimate
67
-
68
- Returns Numpy array of parameters in the default internal format.
69
- Raises NotImplementedError if estimation is not implemented for this
70
- degree, or SrMiseEstimationError if parameters cannot be estimated for
71
- any other reason."""
68
+ ----------
69
+ r : array-like
70
+ The data along r from which to estimate
71
+ y : array-like
72
+ The data along y from which to estimate
73
+
74
+ Returns
75
+ -------
76
+ array-like
77
+ The Numpy array of parameters in the default internal format.
78
+ Raises NotImplementedError if estimation is not implemented for this
79
+ degree, or SrMiseEstimationError if parameters cannot be estimated for
80
+ any other reason.
81
+ """
72
82
if self .degree > 1 :
73
83
emsg = "Polynomial implements estimation for baselines of degree <= 1 only."
74
84
raise NotImplementedError (emsg )
@@ -105,14 +115,23 @@ def _jacobianraw(self, pars, r, free):
105
115
"""Return the Jacobian of a polynomial.
106
116
107
117
Parameters
108
- pars: Sequence of parameters for a polynomial of degree d
109
- pars[0] = a_degree
110
- pars[1] = a_(degree-1)
111
- ...
112
- pars[d] = a_0
113
- r: sequence or scalar over which pars is evaluated
114
- free: sequence of booleans which determines which derivatives are
115
- needed. True for evaluation, False for no evaluation.
118
+ ----------
119
+ pars : array-like
120
+ The sequence of parameters for a polynomial of degree d
121
+ pars[0] = a_degree
122
+ pars[1] = a_(degree-1)
123
+ ...
124
+ pars[d] = a_0
125
+ r : array-like
126
+ The sequence or scalar over which pars is evaluated
127
+ free : bool
128
+ The sequence of booleans which determines which derivatives are
129
+ needed. True for evaluation, False for no evaluation.
130
+
131
+ Returns
132
+ -------
133
+ jacobian: array-like
134
+ The Jacobian of polynomial with degree d
116
135
"""
117
136
if len (pars ) != self .npars :
118
137
emsg = "Argument pars must have " + str (self .npars ) + " elements."
@@ -135,12 +154,22 @@ def _transform_parametersraw(self, pars, in_format, out_format):
135
154
"""Convert parameter values from in_format to out_format.
136
155
137
156
Parameters
138
- pars: Sequence of parameters
139
- in_format: A format defined for this class
140
- out_format: A format defined for this class
157
+ pars : array-like
158
+ The sequence of parameters
159
+ in_format : str
160
+ The format defined for this class
161
+ out_format : str
162
+ The format defined for this class
141
163
142
164
Defined Formats
143
- internal: [a_degree, a_(degree-1), ..., a_0]"""
165
+ ---------------
166
+ internal: [a_degree, a_(degree-1), ..., a_0]
167
+
168
+ Returns
169
+ -------
170
+ array-like
171
+ The transformed parameters in out_format
172
+ """
144
173
temp = np .array (pars )
145
174
146
175
# Convert to intermediate format "internal"
@@ -160,13 +189,22 @@ def _valueraw(self, pars, r):
160
189
"""Return value of polynomial for the given parameters and r values.
161
190
162
191
Parameters
163
- pars: Sequence of parameters for a polynomial of degree d
164
- pars[0] = a_degree
165
- pars[1] = a_(degree-1)
166
- ...
167
- pars[d] = a_0
168
- If degree is negative infinity, pars is an empty sequence.
169
- r: sequence or scalar over which pars is evaluated"""
192
+ ----------
193
+ pars : array-like
194
+ The sequence of parameters for a polynomial of degree d
195
+ pars[0] = a_degree
196
+ pars[1] = a_(degree-1)
197
+ ...
198
+ pars[d] = a_0
199
+ If degree is negative infinity, pars is an empty sequence.
200
+ r : array-like
201
+ The sequence or scalar over which pars is evaluated
202
+
203
+ Returns
204
+ -------
205
+ float
206
+ The value of polynomial for the given parameters and r values.
207
+ """
170
208
if len (pars ) != self .npars :
171
209
emsg = "Argument pars must have " + str (self .npars ) + " elements."
172
210
raise ValueError (emsg )
0 commit comments