@@ -42,8 +42,10 @@ def __init__(self, Cache=None):
42
42
"""Initialize a spherical nanoparticle baseline.
43
43
44
44
Parameters
45
- Cache - A class (not instance) which implements caching of BaseFunction
46
- evaluations.
45
+ ----------
46
+ Cache : class
47
+ THe class (not instance) which implements caching of BaseFunction
48
+ evaluations.
47
49
"""
48
50
# Define parameterdict
49
51
parameterdict = {"scale" : 0 , "radius" : 1 }
@@ -74,12 +76,21 @@ def _jacobianraw(self, pars, r, free):
74
76
"""Return the Jacobian of the spherical baseline.
75
77
76
78
Parameters
77
- pars - Sequence of parameters for a spherical baseline
78
- pars[0] = scale
79
- pars[1] = radius
80
- r - sequence or scalar over which pars is evaluated.
81
- free - sequence of booleans which determines which derivatives are
82
- needed. True for evaluation, False for no evaluation.
79
+ ----------
80
+ pars : array-like
81
+ The Sequence of parameters for a spherical baseline
82
+ pars[0] = scale
83
+ pars[1] = radius
84
+ r : array-like
85
+ The sequence or scalar over which pars is evaluated.
86
+ free : bool
87
+ The sequence of booleans which determines which derivatives are
88
+ needed. True for evaluation, False for no evaluation.
89
+
90
+ Returns
91
+ -------
92
+ array-like
93
+ The Jacobian of the nanospherical baseline.
83
94
"""
84
95
if len (pars ) != self .npars :
85
96
emsg = "Argument pars must have " + str (self .npars ) + " elements."
@@ -116,10 +127,18 @@ def _jacobianrawscale(self, pars, r):
116
127
"""Return partial Jacobian wrt scale without bounds checking.
117
128
118
129
Parameters
119
- pars - Sequence of parameters for a spherical baseline
120
- pars[0] = scale
121
- pars[1] = radius
122
- r - sequence or scalar over which pars is evaluated.
130
+ ----------
131
+ pars : array-like
132
+ The sequence of parameters for a spherical baseline
133
+ pars[0] = scale
134
+ pars[1] = radius
135
+ r : array-like
136
+ The sequence or scalar over which pars is evaluated.
137
+
138
+ Returns
139
+ -------
140
+ array-like
141
+ The partial Jacobian of the nanoparticle baseline wrt scale without bounds checking.
123
142
"""
124
143
np .abs (pars [0 ])
125
144
R = np .abs (pars [1 ])
@@ -134,10 +153,18 @@ def _jacobianrawradius(self, pars, r):
134
153
"""Return partial Jacobian wrt radius without bounds checking.
135
154
136
155
Parameters
137
- pars - Sequence of parameters for a spherical baseline
138
- pars[0] = scale
139
- pars[1] = radius
140
- r - sequence or scalar over which pars is evaluated.
156
+ ----------
157
+ pars : array-like
158
+ The Sequence of parameters for a spherical baseline
159
+ pars[0] = scale
160
+ pars[1] = radius
161
+ r : array-like
162
+ The sequence or scalar over which pars is evaluated.
163
+
164
+ Returns
165
+ -------
166
+ array-like
167
+ The partial Jacobian of the nanoparticle baseline wrt radius without bounds checking.
141
168
"""
142
169
s = np .abs (pars [0 ])
143
170
R = np .abs (pars [1 ])
@@ -150,12 +177,22 @@ def _transform_parametersraw(self, pars, in_format, out_format):
150
177
"""Convert parameter values from in_format to out_format.
151
178
152
179
Parameters
153
- pars - Sequence of parameters
154
- in_format - A format defined for this class
155
- out_format - A format defined for this class
180
+ ----------
181
+ pars : array-like
182
+ The sequence of parameters
183
+ in_format : str
184
+ The format defined for this class
185
+ out_format : str
186
+ The format defined for this class
156
187
157
188
Defined Formats
189
+ ---------------
158
190
internal - [scale, radius]
191
+
192
+ Returns
193
+ -------
194
+ array-like
195
+ The transformed parameter values with out_format.
159
196
"""
160
197
temp = np .array (pars )
161
198
@@ -180,10 +217,18 @@ def _valueraw(self, pars, r):
180
217
Outside the interval [0, radius] the baseline is 0.
181
218
182
219
Parameters
183
- pars - Sequence of parameters for a spherical baseline
184
- pars[0] = scale
185
- pars[1] = radius
186
- r - sequence or scalar over which pars is evaluated.
220
+ ----------
221
+ pars : array-like
222
+ The sequence of parameters for a spherical baseline
223
+ pars[0] = scale
224
+ pars[1] = radius
225
+ r : array-like
226
+ The sequence or scalar over which pars is evaluated.
227
+
228
+ Returns
229
+ -------
230
+ float
231
+ The value of the spherical baseline.
187
232
"""
188
233
if len (pars ) != self .npars :
189
234
emsg = "Argument pars must have " + str (self .npars ) + " elements."
@@ -203,18 +248,39 @@ def _valueraw2(self, pars, r):
203
248
"""Return value of spherical baseline without bounds checking for given parameters and r values.
204
249
205
250
Parameters
206
- pars - Sequence of parameters for a spherical baseline
207
- pars[0] = scale
208
- pars[1] = radius
209
- r - sequence or scalar over which pars is evaluated.
251
+ ----------
252
+ pars : array-like
253
+ The sequence of parameters for a spherical baseline
254
+ pars[0] = scale
255
+ pars[1] = radius
256
+ r : array-like
257
+ The sequence or scalar over which pars is evaluated.
258
+
259
+ Returns
260
+ -------
261
+ float
262
+ The value of spherical baseline without bounds checking for given parameters and r values
210
263
"""
211
264
s = np .abs (pars [0 ])
212
265
R = np .abs (pars [1 ])
213
266
rdivR = r / R
214
267
return - s * r * (1 - (3.0 / 4.0 ) * rdivR + (1.0 / 16.0 ) * rdivR ** 3 )
215
268
216
269
def _getdomain (self , pars , r ):
217
- """Return slice object for which r > 0 and r < twice the radius"""
270
+ """Return slice object for which r > 0 and r < twice the radius
271
+
272
+ Parameters
273
+ ----------
274
+ pars : array-like
275
+ The sequence of parameters for a spherical baseline
276
+ r : array-like
277
+ The sequence or scalar over which pars is evaluated.
278
+
279
+ Returns
280
+ -------
281
+ slice object
282
+ The slice object for which r > 0 and r < twice the radius
283
+ """
218
284
low = r .searchsorted (0.0 , side = "right" )
219
285
high = r .searchsorted (2.0 * pars [1 ], side = "left" )
220
286
return slice (low , high )
0 commit comments