Package qubx :: Module fit :: Class BaseFitter
[hide private]
[frames] | no frames]

Class BaseFitter

source code

object --+
         |
        BaseFitter
Known Subclasses:

Defines the interface of a fitter object; fitters need not subclass, but they must behave like it.

Instance Methods [hide private]
 
__call__(self, curve, param_vals, xx, yy, vvv=[], ww=None, on_iter=<__builtin__.function object>, on_status=<__builtin__.function object>)
Returns improved param_vals, which minimize the sum-squared-residual between yy and curve.eval(param_vals, xx, vvv).
source code
 
__init__(self, max_iter=200, toler=1e-10)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
stop(self, cancel_exception)
By default fitting is stopped by KeyboardInterrupt; this method can do additional stuff, and can call cancel_exception() to inhibit the default behavior.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  max_iter
maximum iterations
  name
index (string) in Fitters
  toler
how close to get before stopping
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__call__(self, curve, param_vals, xx, yy, vvv=[], ww=None, on_iter=<__builtin__.function object>, on_status=<__builtin__.function object>)
(Call operator)

source code 

Returns improved param_vals, which minimize the sum-squared-residual between yy and curve.eval(param_vals, xx, vvv).

Parameters:
  • curve - BaseCurve
  • param_vals - list of float corresponding to curve.params
  • xx - numpy.array(dtype='float32') of x coords
  • yy - numpy.array(dtype='float32') of y coords
  • vvv - list of numpy.array(dtype='float32') of additional named data series, available to curve expr
  • ww - numpy.array(dtype='float32') of weighting factors, per sample, or None
  • on_iter - each improvement in param_vals, calls on_iter(param_vals, iter) -> True to continue iterating
  • on_status - text output callback: on_status(msg)
Returns:
(fitted param_vals, sum_sqr_residual, iterations, fit curve array)

__init__(self, max_iter=200, toler=1e-10)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)