Package ComboCode :: Package cc :: Package ivs :: Package sigproc :: Package lmfit :: Module minimizer
[hide private]
[frames] | no frames]

Module minimizer

source code


Simple minimizer  is a wrapper around scipy.leastsq, allowing a
user to build a fitting model as a function of general purpose
Fit Parameters that can be fixed or floated, bounded, and written
as a simple expression of other Fit Parameters.

The user sets up a model in terms of instance of Parameters, writes a
function-to-be-minimized (residual function) in terms of these Parameters.

   Copyright (c) 2011 Matthew Newville, The University of Chicago
   <newville@cars.uchicago.edu>

Classes [hide private]
  MinimizerException
General Purpose Exception
  Minimizer
general minimizer
Functions [hide private]
 
asteval_with_uncertainties(*vals, **kwargs)
given values for variables, calculate object value.
source code
 
eval_stderr(obj, uvars, _names, _pars, _asteval)
evaluate uncertainty and set .stderr for a parameter `obj` given the uncertain values `uvars` (a list of uncertainties.ufloats), a list of parameter names that matches uvars, and a dict of param objects, keyed by name.
source code
 
check_ast_errors(error)
check for errors derived from asteval, raise MinimizerException
source code
 
minimize(fcn, params, method='leastsq', args=None, kws=None, scale_covar=True, engine=None, iter_cb=None, **fit_kws)
simple minimization function, finding the values for the params which give the minimal sum-of-squares of the array return by fcn
source code
 
make_paras_and_func(fcn, x0, used_kwargs=None)
nach A function which takes a function a makes a parameters-dict for it.
source code
Variables [hide private]
  HAS_SCALAR_MIN = True
  __package__ = 'ComboCode.cc.ivs.sigproc.lmfit'
Function Details [hide private]

asteval_with_uncertainties(*vals, **kwargs)

source code 

given values for variables, calculate object value. This is used by the uncertainties package to calculate the uncertainty in an object even with a complicated expression.

eval_stderr(obj, uvars, _names, _pars, _asteval)

source code 

evaluate uncertainty and set .stderr for a parameter `obj` given the uncertain values `uvars` (a list of uncertainties.ufloats), a list of parameter names that matches uvars, and a dict of param objects, keyed by name.

This uses the uncertainties package wrapped function to evaluate the uncertainty for an arbitrary expression (in obj.ast) of parameters.

make_paras_and_func(fcn, x0, used_kwargs=None)

source code 

nach A function which takes a function a makes a parameters-dict for it.

Takes the function fcn. A starting guess x0 for the non kwargs paramter must be also given. If kwargs are used, used_kwargs is dict were the keys are the used kwarg and the values are the starting values.