@@ -78,12 +78,19 @@ def estimate_parameters(self, r, y):
7878 """Estimate parameters for single peak from data provided.
7979
8080 Parameters
81- r: (Numpy array) Data along r from which to estimate
82- y: (Numpy array) Data along y from which to estimate
83-
84- Returns Numpy array of parameters in the default internal format.
85- Raises SrMiseEstimationError if parameters cannot be estimated for any
86- reason."""
81+ ----------
82+ r : array-like
83+ The data along r from which to estimate
84+ y : array-like
85+ The data along y from which to estimate
86+
87+ Returns
88+ -------
89+ array-like
90+ Numpy array of parameters in the default internal format.
91+ Raises SrMiseEstimationError if parameters cannot be estimated for any
92+ reason.
93+ """
8794 if len (r ) != len (y ):
8895 emsg = "Arrays r, y must have equal length."
8996 raise SrMiseEstimationError (emsg )
@@ -154,9 +161,18 @@ def scale_at(self, pars, x, scale):
154161 SrMiseScalingError if the parameters cannot be scaled.
155162
156163 Parameters
157- pars: (Array) Parameters corresponding to a single peak
158- x: (float) Position of the border
159- scale: (float > 0) Size of scaling at x."""
164+ ----------
165+ pars : array-like
166+ The parameters corresponding to a single peak
167+ x : float
168+ The position of the border
169+ scale : float
170+ The size of scaling at x. Must be positive.
171+
172+ Returns
173+ -------
174+ tuple
175+ mu, area, and sigma that are scaled."""
160176 if scale <= 0 :
161177 emsg = "" .join (["Cannot scale by " , str (scale ), "." ])
162178 raise SrMiseScalingError (emsg )
@@ -190,16 +206,36 @@ def scale_at(self, pars, x, scale):
190206 return tpars
191207
192208 def _jacobianraw (self , pars , r , free ):
193- """Return Jacobian of width-limited Gaussian.
194-
195- pars: Sequence of parameters for a single width-limited Gaussian
196- pars[0]=peak position
197- pars[1]=effective width, up to fwhm=maxwidth as par[1] -> inf.
198- =tan(pi/2*fwhm/maxwidth)
199- pars[2]=multiplicative constant a, equivalent to peak area
200- r: sequence or scalar over which pars is evaluated
201- free: sequence of booleans which determines which derivatives are
202- needed. True for evaluation, False for no evaluation.
209+ """Compute the Jacobian of a width-limited Gaussian function.
210+
211+ This method calculates the partial derivatives of a Gaussian function
212+ with respect to its parameters, considering a limiting width. The Gaussian's
213+ width approaches its maximum FWHM (maxwidth) as the effective width parameter
214+ (`pars[1]`) tends to infinity.
215+
216+ Parameters
217+ ----------
218+ pars : array-like
219+ The sequence of parameters defining a single width-limited Gaussian:
220+ - pars[0]: Peak position.
221+ - pars[1]: Effective width, which scales up to the full width at half maximum (fwhm=maxwidth) as
222+ `pars[1]` approaches infinity. It is mathematically represented as `tan(pi/2 * fwhm / maxwidth)`.
223+ - pars[2]: Multiplicative constant 'a', equivalent to the peak area.
224+
225+ r : array-like or scalar
226+ The sequence or scalar over which the Gaussian parameters `pars` are evaluated.
227+
228+ free : array-like of bools
229+ Determines which derivatives need to be computed. A `True` value indicates that the derivative
230+ with respect to the corresponding parameter in `pars` should be calculated;
231+ `False` indicates no evaluation is needed.
232+
233+ Returns
234+ -------
235+ jacobian : ndarray
236+ The Jacobian matrix, where each column corresponds to the derivative of the Gaussian function
237+ with respect to one of the input parameters `pars`, evaluated at points `r`.
238+ Only columns corresponding to `True` values in `free` are computed.
203239 """
204240 jacobian = [None , None , None ]
205241 if (free is False ).sum () == self .npars :
@@ -236,20 +272,29 @@ def _jacobianraw(self, pars, r, free):
236272 return jacobian
237273
238274 def _transform_parametersraw (self , pars , in_format , out_format ):
239- """Convert parameter values from in_format to out_format .
275+ """Convert parameter values from one format to another .
240276
241- Also restores parameters to a preferred range if it permits multiple
242- values that correspond to the same physical result.
277+ This method also facilitates restoring parameters to a preferred range if the
278+ target format allows for multiple representations of the same physical result.
243279
244280 Parameters
245- pars: Sequence of parameters
246- in_format: A format defined for this class
247- out_format: A format defined for this class
248-
249- Defined Formats
250- internal: [position, parameterized width-squared, area]
251- pwa: [position, full width at half maximum, area]
252- mu_sigma_area: [mu, sigma, area]
281+ ----------
282+ pars : array_like
283+ The sequence of parameters in the `in_format`.
284+ in_format : str, optional
285+ The input format of the parameters. Supported formats are:
286+ - 'internal': [position, parameterized width-squared, area]
287+ - 'pwa': [position, full width at half maximum, area]
288+ - 'mu_sigma_area': [mu, sigma, area]
289+ Default is 'internal'.
290+ out_format : str, optional
291+ The desired output format of the parameters. Same options as `in_format`.
292+ Default is 'pwa'.
293+
294+ Returns
295+ -------
296+ array_like
297+ The transformed parameters in the `out_format`.
253298 """
254299 temp = np .array (pars )
255300
@@ -301,14 +346,29 @@ def _transform_parametersraw(self, pars, in_format, out_format):
301346 return temp
302347
303348 def _valueraw (self , pars , r ):
304- """Return value of width-limited Gaussian for the given parameters and r values.
305-
306- pars: Sequence of parameters for a single width-limited Gaussian
307- pars[0]=peak position
308- pars[1]=effective width, up to fwhm=maxwidth as par[1] -> inf.
309- =tan(pi/2*fwhm/maxwidth)
310- pars[2]=multiplicative constant a, equivalent to peak area
311- r: sequence or scalar over which pars is evaluated
349+ """Compute the value of a width-limited Gaussian for the specified parameters at given radial distances.
350+
351+ This function calculates the value of a Gaussian distribution, where its effective width is constrained and
352+ related to the maxwidth. As `pars[1]` approaches infinity,
353+ the effective width reaches `FWHM` (maxwidth). The returned values represent the Gaussian's intensity
354+ across the provided radial coordinates `r`.
355+
356+ Parameters
357+ ----------
358+ pars : array_like
359+ A sequence of parameters defining the Gaussian shape:
360+ - pars[0]: Peak position of the Gaussian.
361+ - pars[1]: Effective width factor, approaching infinity implies the FWHM equals `maxwidth`.
362+ It is related to the FWHM by `tan(pi/2*FWHM/maxwidth)`.
363+ - pars[2]: Multiplicative constant 'a', equivalent to the peak area of the Gaussian when integrated.
364+
365+ r : array_like or float
366+ The radial distances or a single value at which the Gaussian is to be evaluated.
367+
368+ Returns
369+ -------
370+ float
371+ The value of a width-limited Gaussian for the specified parameters at given radial distances.
312372 """
313373 return (
314374 np .abs (pars [2 ])
@@ -322,7 +382,16 @@ def getmodule(self):
322382 # Other methods ####
323383
324384 def max (self , pars ):
325- """Return position and height of the peak maximum."""
385+ """Return position and height of the peak maximum.
386+ Parameters
387+ ----------
388+ pars : array_like
389+ A sequence of parameters defining the Gaussian shape.
390+
391+ Returns
392+ -------
393+ array_like
394+ The position and height of the peak maximum."""
326395 # TODO: Reconsider this behavior
327396 if len (pars ) == 0 :
328397 return None
0 commit comments