Package gmisclib :: Module g_lin_fit
[frames] | no frames]

Module g_lin_fit

source code

Generic linear best fits.

Functions
tuple
fit(idata, fitting_fcns, ff_info=None, wt=None)
Fits data to a linear combination of fitting_fcns.
source code
 
test() source code
 
test1() source code
 
test2() source code
 
test3() source code
 
test4() source code
 
test5() source code
 
test6() source code
Variables
  __package__ = 'gmisclib'

Imports: types, Num


Function Details

fit(idata, fitting_fcns, ff_info=None, wt=None)

source code 

Fits data to a linear combination of fitting_fcns.

Parameters:
  • fitting_fcns (an array of functions.) - the basis functions for the linear regression. The fitting functions return vectors (which must match the data). Fitting functions are called as f(info, ff_info, len(vector)). Vectors may have different lengths, as long as the corresponding data and fit vectors agree.
  • idata (an array of (vector, info).)
Returns: tuple
The returned value is a tuple of: the coefficients of the optimal solution (as an array), the residual (a single float number), the rank of the fit (int), an array of the singular values, and the best fit to the data. The returned value follows Num.LA.linear_least_squares(), except that residual is always calculated and is a scalar.