class IterativeFitter( BaseFitter ) | Source |
---|
Base class with methods common to all iterative fitters.
Author: Do Kester.
Attributes
-
tolerance : float
When absolute and relative steps in subsequent chisq steps are less than
tolerance, the fitter stops. Default = 0.0001 -
maxIter : int
When the number of iterations gets larger than maxiter the fitter
stops with a ConvergenceError Default = 1000 * nparams -
iter : int (read only)
iteration counter -
ntrans : int (read only)
number of transforms -
verbose : int
information per iteration.
0 : silent
1 : base information (default)
2 : report about every 100th iteration
3 : report about every ietration -
tooLarge : int
When the length parameter array is too large to make a Hessian.
To avert OutOfMemory. Default = 100 -
plotter : Plotter
Iteration plotter class. Default = IterationPlotter -
plotIter : int
Produce a plot for every plotIter-th iteration.
Default = 0 (no plotting)
Raises
ConvergenceError Something went wrong during the convergence if the fit.
IterativeFitter( xdata, model, maxIter=None, tolerance=0.0001, verbose=1, **kwargs ) |
---|
Create a new iterative fitter, providing xdatas and model.
This is a base class. It collects stuff common to all iterative fitters. It does not work by itself.
Parameters
-
xdata : array_like
array of independent input values -
model : Model
the model function to be fitted -
tolerance : float
When absolute and relative steps in subsequent chisq steps are less than
tolerance, the fitter stops. Default = 0.01 -
maxIter : None or int
When the number of iterations gets larger than maxiter the fitter
stops with a ConvergenceError Default = 1000 * nparams -
verbose : int
0 : silent
1 : report result
2 : report every 100th iteration
3 : report every iteration kwargs for BaseFitter
map, keep, fixedScale
setParameters( params ) |
---|
Parameters
- params : array_like
initial parameters
doPlot( param, force=False ) |
---|
Parameters
- param : array_like
of the model - force : bool
do the plot
fitprolog( ydata, weights=None, accuracy=None, keep=None ) |
---|
- Sets up plotting (if requested)
- Sets self.iter and self.ntrans to 0
- Checks data/weighs for Nans
- Makes fitIndex.
Parameters
- ydata : array_like
the data vector to be fitted - weights : array_like
weights pertaining to the data - accuracy : float or array_like
accuracy of (individual) data - keep : dict of {int:float}
dictionary of indices (int) to be kept at a fixed value (float)
Returns
- fitIndex : ndarray of int
Indices of the parameters that need fitting
fit( ydata, weights=None, keep=None, **kwargs ) |
---|
It will calculate the hessian matrix and chisq.
Parameters
- ydata : array_like
the data vector to be fitted - weights : array_like
weights pertaining to the data - keep : dict of {int:float}
dictionary of indices (int) to be kept at a fixed value (float) - kwargs :
passed to the fitter
Raises
ConvergenceError if it stops when the tolerance has not yet been reached.
report( verbose, param, chi, more=None, force=False ) |
---|
Methods inherited from BaseFitter |
---|
- setMinimumScale( scale=0 )
- fitpostscript( ydata, plot=False )
- keepFixed( keep=None )
- insertParameters( fitpar, index=None, into=None )
- modelFit( ydata, weights=None, keep=None )
- limitsFit( ydata, weights=None, keep=None )
- checkNan( ydata, weights=None, accuracy=None )
- getVector( ydata, index=None )
- getHessian( params=None, weights=None, index=None )
- getInverseHessian( params=None, weights=None, index=None )
- getCovarianceMatrix( )
- makeVariance( scale=None )
- normalize( normdfdp, normdata, weight=1.0 )
- getDesign( params=None, xdata=None, index=None )
- chiSquared( ydata, params=None, weights=None )
- getStandardDeviations( )
- monteCarloError( xdata=None, monteCarlo=None)
- getScale( )
- getEvidence( limits=None, noiseLimits=None )
- getLogLikelihood( autoscale=False, var=1.0 )
- getLogZ( limits=None, noiseLimits=None )
- plotResult( xdata=None, ydata=None, model=None, residuals=True,