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

Module fit

source code

Curve Fitting.

Copyright 2007-2011 Research Foundation State University of New York This file is part of QUB Express.

QUB Express is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QUB Express is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License, named LICENSE.txt, in the QUB Express program directory. If not, see <http://www.gnu.org/licenses/>.

Classes [hide private]
  BaseCurve
Defines the interface of a curve object; curves need not subclass, but they must behave like it.
  BaseFitter
Defines the interface of a fitter object; fitters need not subclass, but they must behave like it.
  Curve
Fittable curve from a parsed Python expression; either simple algebraic, or system of ODEs; see acceptODEs.
  DblDecExpoCurve
  DblGaussianCurve
  DblGaussianUnitCurve
  DecExpoCurve
  GaussianCurve
  GaussianUnitCurve
  HillCurve
  HillCurveNorm
  LMFitter
Minimizes sum-squared-residual using lmmin from qubx.fast.
  LinearCurve
  LogExpoCurve
  LogExpoCurve2
  LogExpoCurve3
  LogExpoCurve4
  LogExpoCurve5
  LorentzianCurve
  OutOfBounds
  QuadGaussianCurve
  QuadGaussianUnitCurve
  QuintGaussianCurve
  QuintGaussianUnitCurve
  SimplexFitter
Minimizes the sum-squared-residual using scipy.optimize.fmin.
  Simplex_LM_Fitter
Minimizes sum-squared-residual using SimplexFitter then LMFitter; using half the max_iter for each algorithm.
  Stop
  TriGaussianCurve
  TriGaussianUnitCurve
Functions [hide private]
 
Correlation(curve, param_vals, xx, yy, vvv, ww)
Returns (cross_correlation, is_pseudo, std_err_est, ssr, r2) cross_correlation matrix[i][j] for curve param indices i,j is_pseudo whether Hessian was non-positive-definite, requiring Cholesky factorization std_err_est error estimates for each curve param ssr sum-sqr residual r2 R^2
source code
 
Covariance(curve, param_vals, xx, yy, vvv, ww)
Returns the covariance matrix[i][j] (inverse Hessian), for curve param indices i,j.
source code
 
Hessian(curve, param_vals, xx, yy, vvv, ww, dev=1e-07)
Returns the numpy.array(shape=(i,j)) of d(dResidual)/dP_i,dP_j, for i,j in len(non-const-params).
source code
 
RunsProb(yy, ff)
Counts the number of runs of y>f and y<f; returns probability it's from random noise.
source code
 
calc_r(xx, logbase=10.0) source code
 
main() source code
 
on_iter_pass(param_vals, iter)
Default fitter iteration callback; does nothing.
source code
 
on_status_print(msg)
Default fitter status callback; prints to stdout.
source code
 
pool_sub_eval(args) source code
 
pseudovar(var)
Minimally after Gill-Murray: if covariance matrix is not positive definite, some diagonals are negative, with unknown meaning.
source code
 
sub_eval(xx, vvv, func, pval_by_name, avail) source code
Variables [hide private]
  cpu_count = 4
  erfc = <ufunc 'erfc'>
  Curves = {'AllExponentials': <class 'qubx_single.dur_hist.AllE...
  D1_DIFF_CENTRAL = False
  D2_DIFF_CENTRAL = True
  DIFF_DEV = 1e-07
  Fitters = {'Levenburg-Marquardt': <class 'qubx.fit.LMFitter'>,...
  GaussianCurves = [<class 'qubx.fit.GaussianCurve'>, <class 'qu...
  GaussianUnitCurves = [<class 'qubx.fit.GaussianUnitCurve'>, <c...
  USE_POOL_THRESHOLD = 1024
  __package__ = 'qubx'
Function Details [hide private]

Hessian(curve, param_vals, xx, yy, vvv, ww, dev=1e-07)

source code 

Returns the numpy.array(shape=(i,j)) of d(dResidual)/dP_i,dP_j, for i,j in len(non-const-params).

Returns:
(hessian_matrix, sum_sqr_residual)

pseudovar(var)

source code 

Minimally after Gill-Murray: if covariance matrix is not positive definite, some diagonals are negative, with unknown meaning. here we look for trouble and if necessary replace the covariance matrix with a generalized cholesky factorization.


Variables Details [hide private]

Curves

Value:
{'AllExponentials': <class 'qubx_single.dur_hist.AllExponentials_Displ\
ay'>,
 'Custom': <class 'qubx.fit.Curve'>,
 'Declining Exponential': <class 'qubx.fit.DecExpoCurve'>,
 'Double Declining Exponential': <class 'qubx.fit.DblDecExpoCurve'>,
 'Exponential (log x)': <class 'qubx.fit.LogExpoCurve'>,
 'Exponential (log x) (2)': <class 'qubx.fit.LogExpoCurve2'>,
 'Exponential (log x) (3)': <class 'qubx.fit.LogExpoCurve3'>,
...

Fitters

Value:
{'Levenburg-Marquardt': <class 'qubx.fit.LMFitter'>,
 'Simplex': <class 'qubx.fit.SimplexFitter'>,
 'Simplex-LM': <class 'qubx.fit.Simplex_LM_Fitter'>}

GaussianCurves

Value:
[<class 'qubx.fit.GaussianCurve'>,
 <class 'qubx.fit.DblGaussianCurve'>,
 <class 'qubx.fit.TriGaussianCurve'>,
 <class 'qubx.fit.QuadGaussianCurve'>,
 <class 'qubx.fit.QuintGaussianCurve'>]

GaussianUnitCurves

Value:
[<class 'qubx.fit.GaussianUnitCurve'>,
 <class 'qubx.fit.DblGaussianUnitCurve'>,
 <class 'qubx.fit.TriGaussianUnitCurve'>,
 <class 'qubx.fit.QuadGaussianUnitCurve'>,
 <class 'qubx.fit.QuintGaussianUnitCurve'>]