Module gwy :: Class NLFitPreset
[hide private]
[frames] | no frames]

Class NLFitPreset

source code

Instance Methods [hide private]
 
get_value(x, params, fres)
Calculates preset function value in a single point with given parameters.
source code
 
get_formula()
Gets function formula of preset (with Pango markup).
source code
 
get_nparams()
Return the number of parameters of preset.
source code
 
get_param_name(param)
Gets the name of a fitting parameter of a fitter preset.
source code
 
get_param_units(param, siunit_x, siunit_y)
Derives the SI unit of a fitting parameter from the units of abscissa and ordinate.
source code
 
fit(fitter, n_dat, x, y, params, err, fixed_param)
Performs a nonlinear fit with a preset.
source code
Method Details [hide private]

get_value(x, params, fres)

source code 

Calculates preset function value in a single point with given parameters.

Parameters:
  • x - The point to compute value at. (float)
  • params - Preset parameter values. (const-gdouble*)
  • fres - Set to True if succeeds, False on failure. (gboolean*)
Returns:
The function value. (float)

get_formula()

source code 

Gets function formula of preset (with Pango markup).

Returns:
The preset function formula. (string)

get_nparams()

source code 

Return the number of parameters of preset.

Returns:
The number of function parameters. (int)

get_param_name(param)

source code 

Gets the name of a fitting parameter of a fitter preset.

The name may contain Pango markup.

Parameters:
  • param - A parameter number. (int)
Returns:
The name of parameter @param. (string)

get_param_units(param, siunit_x, siunit_y)

source code 

Derives the SI unit of a fitting parameter from the units of abscissa and ordinate.

Parameters:
  • param - A parameter number. (int)
  • siunit_x - SI unit of abscissa. (SIUnit)
  • siunit_y - SI unit of ordinate. (SIUnit)
Returns:
A newly created SIUnit with the units of the parameter @param. If the units of @param are not representable as SIUnit, the result is unitless (i.e. it will be presented as a mere number). (SIUnit)

Since: 2.5

fit(fitter, n_dat, x, y, params, err, fixed_param)

source code 

Performs a nonlinear fit with a preset.

See gwy_math_nlfit_fit_full() for details.

Parameters:
  • fitter - A Marquardt-Levenberg nonlinear fitter already initialized for preset's function, or None. (MathNLFit*)
  • n_dat - The number of data points (number of items in x and y). (int)
  • x - Abscissa points. (const-gdouble*)
  • y - Ordinate points. (const-gdouble*)
  • params - Initial parameter estimate (the number of parameters depends on the fitted preset and it can be obtained with gwy_nlfit_preset_get_nparams()). (gdouble*)
  • err - Array to store parameter errros to, may be None. (gdouble*)
  • fixed_param - Which parameters should be treated as fixed (set corresponding element to True for them). May be None if all parameters are variable. (const-gboolean*)
Returns:
Either fitter itself, or a newly created fitter if it was None. (MathNLFit*)