Navigation
class CurveFitter( IterativeFitter ) | Source |
---|
CurveFitter implements scipy.optimize.curvefit.
Author: Do Kester.
Attributes
- method : {'lm', 'trf', 'dogbox'}
'lm' LevenbergMarquardt (default for no limits)
'trf' Trust Region Reflective (default for limits)
'dogbox' for small problems with limits
Raises
ConvergenceError Something went wrong during the convergence if the fit.
CurveFitter( xdata, model, method=None, fixedScale=None, map=False, keep=None ) |
---|
Create a new class, providing inputs and model.
Parameters
- xdata : array_like
array of independent input values - model : Model
the model function to be fitted - method : 'lm' | 'trf' | 'dogbox'
method to be used - fixedScale : None or float
the fixed noise scale. - map : bool (False)
When true, the xdata should be interpreted as a map.
The fitting is done on the pixel indices of the map,
using ImageAssistant - keep : dict of {int:float}
dictionary of indices (int) to be kept at a fixed value (float)
The values of keep will be used by the Fitter as long as the Fitter exists.
See alsofit( ..., keep=dict )
fit( ydata, weights=None, inipar=None, keep=None, limits=None, accuracy=None, plot=False, **kwargs ) |
---|
Parameters
- ydata : array_like
the data vector to be fitted - weights : array_like
weights pertaining to the data
The weights are relative weights unless fixedScale is set. - accuracy : float or array_like
accuracy of (individual) data - inipar : array_like
inital parameters (default from Model) - keep : dict of {int:float}
dictionary of indices (int) to be kept at a fixed value (float)
The values of keep are only valid for this fit
See alsoCurveFitter( ..., keep=dict )
- limits : None or list of 2 floats or list of 2 array_like
None : from Model if Model has limits set else no limits
[-inf,+inf] : no limits applied
[lo,hi] : low and high limits for all values
[la,ha] : low array and high array limits for the values - plot : bool
Plot the results. - kwargs : dict
keywords arguments to be passed to :ref:curve_fit<scipy.optimize.curve_fit>
Raises
ValueError when ydata or weights contain a NaN
result( xdata, *fitpar ) |
---|
Parameters
- xdata : array_like
input data - fitpar : tuple of float
parameters for the model
jacobian( xdata, *fitpar ) |
---|
Parameters
- xdata : array_like
input data - fitpar : (tuple of) float
parameters for the model
Methods inherited from IterativeFitter |
---|
- setParameters( params )
- doPlot( param, force=False )
- fitprolog( ydata, weights=None, accuracy=None, keep=None )
- 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,