Package PyDSTool :: Module common :: Class fit_diff_of_exp
[hide private]
[frames] | no frames]

Class fit_diff_of_exp

source code

  object --+    
           |    
fit_function --+
               |
              fit_diff_of_exp

Fit a 'difference of two exponentials' function y = k*a*b*(exp(-a*x)-exp(-b*x))/(b-a) to the (x,y) array data. If initial parameter values = (k,a,b) are not given, the values (1,1,1) will be used (where the function degenerates to y = k*a*a*x*exp(-a*x).

Optional use_xoff feature adds offset to x, so that y = k*a*a*(x+xoff)*exp(-a*(x+xoff)) (yes, "+ xoff") etc., in case fitting data that starts at larger values than its tail. Then initial parameter values will be (1,1,1,0) unless given otherwise.

If peak_constraint option is used, it is a tuple of values (x_index, y_value, weight_x, weight_y) for the approximate position of a turning point in the data, then this will be used as a soft constraint in the fit.

result.peak_pos is a (xpeak, ypeak) pair. result.f is the fitted function (accepts x values).

Instance Methods [hide private]
 
fn(self, x, k, a, b, xoff=0) source code
 
fit(self, xs, ys, pars_ic=None, opts=None) source code

Inherited from fit_function: __init__

Inherited from fit_function (private): _do_fit

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

fn(self, x, k, a, b, xoff=0)

source code 
Overrides: fit_function.fn

fit(self, xs, ys, pars_ic=None, opts=None)

source code 
Overrides: fit_function.fit