Module Expr Str ImportFrom alias alias alias alias alias alias alias alias alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore NameLoad TryExcept body ImportFrom alias identifier Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Pass ImportFrom alias ImportFrom alias TryExcept body ImportFrom alias handlers ExceptHandler body Assign NameStore NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args defaults vararg kwarg body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad If BoolOpOr CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad CompareIs AttributeLoad NameLoad attr NameLoad body Return Num For TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad body Assign AttributeStore SubscriptLoad NameLoad Index NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If Call NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr Return NameLoad decorator_list Assign NameStore Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str If UnaryOpNot Call NameLoad NameLoad body Return If CompareIs AttributeLoad NameLoad attr NameLoad body Return Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad NameLoad TryExcept body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad handlers ExceptHandler body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults TupleLoad NameLoad Num Num Num Num NameLoad Num NameLoad body Expr Str Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr Assign NameStore Call NameLoad NameLoad If UnaryOpNot Call NameLoad NameLoad NameLoad body Assign NameStore TupleLoad NameLoad Assign NameStore Call NameLoad Str Str NameLoad NameLoad NameLoad NameLoad If BoolOpAnd Call NameLoad NameLoad NameLoad CompareGt Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num If CompareGt NameLoad NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad If CompareEq NameLoad Num body Assign NameStore BinOpMult Num BinOpAdd NameLoad Num If CompareIs NameLoad NameLoad body Assign NameStore Num If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Num NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad orelse Expr Call NameLoad Str Str NameLoad NameLoad NameLoad NameLoad TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Num Num NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Dict Num Num Num Num Num Num Num Num Num Str ListLoad Str NameLoad ListLoad BinOpMod Str NameLoad NameLoad ListLoad BinOpMod Str NameLoad NameLoad ListLoad BinOpMod Str TupleLoad NameLoad NameLoad NameLoad ListLoad BinOpMod Str NameLoad NameLoad ListLoad BinOpMod Str NameLoad NameLoad ListLoad BinOpMod Str NameLoad NameLoad ListLoad BinOpMod Str NameLoad NameLoad ListLoad BinOpMod Str NameLoad NameLoad ListLoad Str NameLoad Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Num Assign NameStore NameLoad If CompareIn NameLoad ListLoad Num Num Num Num body Assign NameStore Call NameLoad Call NameLoad NameLoad BinOpSub SubscriptLoad SubscriptLoad NameLoad Index Num Index Str Num Num Assign NameStore Call NameLoad SubscriptLoad Call NameLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Str ExtSlice Slice NameLoad Slice Assign NameStore Call NameLoad NameLoad NameLoad TryExcept body Assign NameStore Call NameLoad Call NameLoad Call NameLoad NameLoad NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad body Pass Return BinOpAdd BinOpAdd TupleLoad SubscriptLoad NameLoad Index Num NameLoad SubscriptLoad NameLoad Slice Num Num TupleLoad NameLoad NameLoad decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad Num NameLoad NameLoad kwarg body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr NameLoad If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Print Str Assign NameStore AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If BoolOpAnd AttributeLoad NameLoad attr UnaryOpNot NameLoad body Return If Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr AttributeLoad NameLoad attr body Assign AttributeStore AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Str Return Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr Num For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad If Call NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If CompareIsNot AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr If BoolOpOr UnaryOpNot Call NameLoad NameLoad Str CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str Expr Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword BinOpMult Num BinOpAdd AttributeLoad NameLoad attr Num keyword NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad If CompareIsNot SubscriptLoad NameLoad Index Str NameLoad body Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign SubscriptStore NameLoad Index Str AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Delete AttributeDel NameLoad attr Assign TupleStore NameStore NameStore NameStore NameStore NameStore NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad BinOpPow NameLoad Num attr Assign NameStore BinOpSub NameLoad AttributeLoad NameLoad attr Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Dict For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index NameLoad NameStore Call NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad Assign SubscriptStore NameLoad Index Str Call NameLoad BinOpDiv Call NameLoad SubscriptLoad NameLoad Index Str Call NameLoad NameLoad BinOpSub SubscriptLoad NameLoad Index Str Num Assign NameStore Call NameLoad Call NameLoad SubscriptLoad Call NameLoad SubscriptLoad NameLoad Index Str ExtSlice Slice AttributeLoad NameLoad attr Slice Call NameLoad Call NameLoad AttributeLoad NameLoad attr BinOpSub SubscriptLoad NameLoad Index Str Num Num TryExcept body Assign NameStore Call NameLoad Call NameLoad Call NameLoad NameLoad NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign NameStore NameLoad If CompareIsNot NameLoad NameLoad body If AttributeLoad NameLoad attr body Assign NameStore BinOpDiv BinOpMult NameLoad NameLoad NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign TupleStore NameStore NameStore TupleLoad NameLoad NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index NameLoad Assign AttributeStore NameLoad attr Dict For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body If CompareNotEq NameLoad NameLoad body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad BinOpDiv SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad BinOpMult AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign AttributeStore SubscriptLoad NameLoad Index NameLoad attr AttributeLoad NameLoad attr If AttributeLoad AttributeLoad NameLoad attr attr body Assign AttributeStore AttributeLoad NameLoad attr attr ListLoad Assign NameStore Str If CompareEq NameLoad Num body Assign NameStore Str orelse If CompareEq NameLoad Num body Assign NameStore BinOpMod AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str orelse If CompareGt NameLoad Num body Assign NameStore Str If CompareIs NameLoad NameLoad body Assign NameStore BinOpMod Str NameLoad Assign NameStore NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr CompareIn NameLoad ListLoad Num Num Num Num Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr CompareIsNot NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str kwarg body Expr Str If UnaryOpNot NameLoad body Raise NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore BinOpMult Num BinOpAdd AttributeLoad NameLoad attr Num Assign NameStore Dict Str NameLoad If CompareNotIn NameLoad TupleLoad Str Str Str body Assign SubscriptStore NameLoad Index Str NameLoad Assign NameStore Call NameLoad keyword NameLoad keyword AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad BinOpMult NameLoad NameLoad attr Return NameLoad decorator_list Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr NameLoad Delete AttributeDel NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad BinOpPow NameLoad Num attr Assign NameStore BinOpSub NameLoad AttributeLoad NameLoad attr Assign NameStore BinOpDiv NameLoad NameLoad Assign NameStore NameStore AttributeLoad NameLoad attr If CompareIsNot NameLoad NameLoad body Assign NameStore AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad Str NameLoad kwarg body Expr Str If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return Str Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore NameLoad If NameLoad body For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr NameLoad body Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr keyword NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad Num NameLoad NameLoad kwarg body Expr Str If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Print Str Return Assign AttributeStore AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore ListLoad NameLoad Assign NameStore Str Assign NameStore Str Assign NameStore Str If CompareIsNot NameLoad NameLoad body Assign NameStore BinOpMod Str NameLoad Assign NameStore BinOpMod Str NameLoad Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Str NameLoad If CompareIs NameLoad NameLoad body Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad Str Str Assign NameStore Call NameLoad NameLoad Str NameLoad If NameLoad body Assign NameStore Str orelse Assign NameStore Str Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad TupleLoad Str NameLoad If Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr If Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad NameLoad attr If Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr BinOpMod BinOpMod Str NameLoad AttributeLoad NameLoad attr If Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr BinOpMod BinOpMod Str NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad TupleLoad Str Str Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad If CompareLt Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad BinOpAdd NameLoad BinOpMult Str Num Slice Num If Call NameLoad NameLoad body Assign NameStore BinOpMod NameLoad AttributeLoad NameLoad attr If CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign NameStore BinOpMod NameLoad TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad TupleLoad NameLoad NameLoad AttributeLoad NameLoad attr orelse If CompareIsNot AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad TupleLoad NameLoad NameLoad AttributeLoad NameLoad attr If CompareGt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad TupleLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad Str ListLoad If BoolOpAnd NameLoad CompareGt Call NameLoad NameLoad Num body Assign NameStore BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod NameLoad TupleLoad Str NameLoad Assign NameStore Dict For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad If UnaryOpNot AttributeLoad NameLoad attr body Continue If BoolOpAnd Call NameLoad NameLoad Str CompareIsNot AttributeLoad NameLoad attr NameLoad body For NameStore SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num body If BoolOpAnd CompareNotEq NameLoad NameLoad CompareIn NameLoad AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index BinOpMod Str TupleLoad NameLoad NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr keyword Lambda arguments args NameParam defaults Call NameLoad SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr For TupleStore NameStore NameStore NameLoad body If CompareLt Call NameLoad NameLoad NameLoad body Break If CompareLt Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad BinOpAdd NameLoad BinOpMult Str Num Slice Num Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMult Str Call NameLoad NameLoad Return Call AttributeLoad Str attr NameLoad decorator_list
N/A N/A 
minimizer for Larch, similar to lmfit-py.

Minimizer is a wrapper around scipy.leastsq, allowing a user to build
a fitting model as a function of general purpose fit parameters which
can be fixed or floated, bounded, or written as larch expressions.

The user sets up a model with a Group which contains all the fitting
parameters, and writes a larch procedure to calculate the residual to
be minimized in terms of the parameters of this Group.

The procedure to calculate the residual will take the parameter Group
as the first argument, and can take additional optional arguments.
    params = Group()
    params.slope  = Param(0, vary=True, min=0)
    params.offset = Param(10, vary=True)

    def residual(pgroup, xdata=None, ydata=None):
        line = pgroup.offset + xdata * pgroup.slope
        pgroup.this_line = line
        return (ydata - line)
    end def

    minimize(residual, params, kws={'xdata': x, 'ydata': y})

After this, each of the parameters in the params group will contain
best fit values, uncertainties and correlations, and the params group
will contain fit statistics chisquare, etc.


   Copyright (c) 2012 Matthew Newville, The University of Chicago
   <newville@cars.uchicago.edu>
 numpy abs array asarray dot eye ndarray ones_like sqrt take transpose triu numpy.dual inv numpy.linalg LinAlgError scipy.optimize _minpack scipy.optimize.minpack _check_func N/A HAS_SCALAR_MIN False N/A N/A scipy.optimize minimize scipy_minimize N/A HAS_SCALAR_MIN True N/A N/A N/A ImportError N/A N/A N/A uncertainties parameter isParameter N/A N/A symboltable Group N/A N/A N/A N/A Group None MinimizerException N/A Exception N/A N/A General Purpose Exception __init__ N/A N/A self msg N/A N/A N/A N/A N/A Exception __init__ self N/A N/A self msg msg N/A __str__ N/A N/A self N/A N/A N/A N/A 
%s N/A self msg N/A N/A larcheval_with_uncertainties N/A N/A N/A vals kwargs N/A N/A 
    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.
     N/A _obj N/A N/A kwargs get _obj None N/A _pars N/A N/A kwargs get _pars None N/A _names N/A N/A kwargs get _names None N/A _larch N/A N/A kwargs get _larch None N/A N/A N/A _obj None N/A _pars None N/A _names None N/A _larch None N/A N/A _obj _ast None N/A N/A 0 N/A N/A val name N/A zip vals _names N/A N/A N/A N/A _pars N/A name _val val N/A result N/A N/A _larch eval N/A _obj _ast N/A N/A isParameter result N/A N/A result N/A result value N/A result N/A N/A wrap_ueval N/A N/A uncertainties wrap larcheval_with_uncertainties eval_stderr N/A N/A obj uvars _names _pars _larch N/A N/A N/A 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.
     N/A N/A N/A isParameter obj N/A N/A N/A N/A N/A obj _ast None N/A N/A N/A uval N/A wrap_ueval _obj obj _names _names _pars _pars _larch _larch uvars N/A N/A N/A N/A obj stderr N/A N/A uval std_dev N/A N/A obj _uval uval N/A N/A N/A N/A N/A obj stderr 0 N/A N/A obj _uval None N/A leastsq N/A N/A func x0 args Dfun ftol xtol gtol maxfev epsfcn factor diag N/A N/A None 1e-07 1e-07 1e-07 0 None 100 None N/A N/A 
    Minimize the sum of squares of a set of equations.
    Adopted from scipy.optimize.leastsq

    ::

        x = arg min(sum(func(y)**2,axis=0))
                 y

    Parameters
    ----------
    func : callable
        should take at least one (possibly length N vector) argument and
        returns M floating point numbers.
    x0 : ndarray
        The starting estimate for the minimization.
    args : tuple
        Any extra arguments to func are placed in this tuple.
    Dfun : callable
        A function or method to compute the Jacobian of func with derivatives
        across the rows. If this is None, the Jacobian will be estimated.
    ftol : float
        Relative error desired in the sum of squares.
    xtol : float
        Relative error desired in the approximate solution.
    gtol : float
        Orthogonality desired between the function vector and the columns of
        the Jacobian.
    maxfev : int
        The maximum number of calls to the function. If zero, then 100*(N+1) is
        the maximum where N is the number of elements in x0.
    epsfcn : float
        A suitable step length for the forward-difference approximation of the
        Jacobian (for Dfun=None). If epsfcn is less than the machine precision,
        it is assumed that the relative errors in the functions are of the
        order of the machine precision.
    factor : float
        A parameter determining the initial step bound
        (``factor * || diag * x||``). Should be in interval ``(0.1, 100)``.
    diag : sequence
        N positive entries that serve as a scale factors for the variables.

    Returns
    -------
    x : ndarray
        The solution (or the result of the last iteration for an unsuccessful
        call).
    cov_x : ndarray
        Uses the fjac and ipvt optional outputs to construct an
        estimate of the jacobian around the solution.  ``None`` if a
        singular matrix encountered (indicates very flat curvature in
        some direction).  This matrix must be multiplied by the
        residual variance to get the covariance of the
        parameter estimates -- see curve_fit.
    infodict : dict
        a dictionary of optional outputs with the key s::

            - 'nfev' : the number of function calls
            - 'fvec' : the function evaluated at the output
            - 'fjac' : A permutation of the R matrix of a QR
                     factorization of the final approximate
                     Jacobian matrix, stored column wise.
                     Together with ipvt, the covariance of the
                     estimate can be approximated.
            - 'ipvt' : an integer array of length N which defines
                     a permutation matrix, p, such that
                     fjac*p = q*r, where r is upper triangular
                     with diagonal elements of nonincreasing
                     magnitude. Column j of p is column ipvt(j)
                     of the identity matrix.
            - 'qtf'  : the vector (transpose(q) * fvec).

    mesg : str
        A string message giving information about the cause of failure.
    ier : int
        An integer flag.  If it is equal to 1, 2, 3 or 4, the solution was
        found.  Otherwise, the solution was not found. In either case, the
        optional output variable 'mesg' gives more information.

    Notes
    -----
    "leastsq" is a wrapper around MINPACK's lmdif and lmder algorithms.

    cov_x is a Jacobian approximation to the Hessian of the least squares
    objective function.
    This approximation assumes that the objective function is based on the
    difference between some observed target data (ydata) and a (non-linear)
    function of the parameters `f(xdata, params)` ::

           func(params) = ydata - f(xdata, params)

    so that the objective function is ::

           min   sum((ydata - f(xdata, params))**2, axis=0)
         params

     N/A x0 N/A N/A N/A asarray x0 flatten N/A n N/A len x0 N/A N/A N/A isinstance args tuple N/A N/A args N/A args N/A shape N/A _check_func leastsq func func x0 args n N/A N/A N/A isinstance shape tuple N/A N/A len shape 1 N/A N/A shape N/A shape N/A 0 N/A m N/A shape N/A 0 N/A N/A n m N/A N/A N/A TypeError N/A Improper input: N=%s must not exceed M=%s N/A n m N/A N/A maxfev 0 N/A N/A maxfev N/A 200 N/A n 1 N/A N/A epsfcn None N/A N/A epsfcn 2e-05 N/A N/A Dfun None N/A N/A retval N/A N/A _minpack _lmdif func x0 args 1 ftol xtol gtol maxfev epsfcn factor diag N/A N/A N/A _check_func leastsq Dfun Dfun x0 args n N/A m n N/A retval N/A N/A _minpack _lmder func Dfun x0 args 1 0 ftol xtol gtol maxfev factor diag N/A errors N/A 0 1 2 3 4 5 6 7 8 unknown N/A Improper input parameters. TypeError N/A N/A Both actual and predicted relative reductions in the sum of squares
  are at most %f ftol None N/A N/A The relative error between two consecutive iterates is at most %f xtol None N/A N/A Both actual and predicted relative reductions in the sum of squares
  are at most %f and the relative error between two consecutive iterates is at 
  most %f N/A ftol xtol None N/A N/A The cosine of the angle between func(x) and any column of the
  Jacobian is at most %f in absolute value gtol None N/A N/A Number of calls to function has reached maxfev = %d. maxfev ValueError N/A N/A ftol=%f is too small, no further reduction in the sum of squares
  is possible. ftol ValueError N/A N/A xtol=%f is too small, no further improvement in the approximate
  solution is possible. xtol ValueError N/A N/A gtol=%f is too small, func(x) is orthogonal to the columns of
  the Jacobian to machine precision. gtol ValueError N/A Unknown error. TypeError N/A info N/A retval N/A -1 N/A mesg N/A N/A errors N/A info N/A 0 N/A cov_x None N/A N/A info N/A 1 2 3 4 N/A N/A perm N/A take N/A eye n N/A N/A N/A retval N/A 1 N/A ipvt 1 0 N/A r N/A triu N/A N/A transpose N/A N/A retval N/A 1 N/A fjac N/A N/A n N/A N/A R N/A dot r perm N/A N/A N/A cov_x N/A inv N/A dot N/A transpose R R N/A N/A N/A N/A LinAlgError ValueError N/A N/A N/A N/A N/A N/A N/A retval N/A 0 cov_x N/A retval N/A 1 -1 N/A mesg info N/A Minimizer N/A object N/A N/A general minimizer N/A err_maxfev Too many function calls (max set to  %i)!  Use:
    minimize(func, params, ...., maxfev=NNN)
or set  leastsq_kws['maxfev']  to increase this maximum. __init__ N/A N/A self fcn params fcn_args fcn_kws scale_covar toler _larch jacfcn N/A None None True 1e-07 None None kws N/A N/A N/A self userfcn fcn N/A N/A self paramgroup params N/A N/A self userargs fcn_args N/A N/A N/A self userargs None N/A N/A N/A self userargs N/A N/A N/A self userkws fcn_kws N/A N/A N/A self userkws None N/A N/A N/A self userkws N/A N/A N/A self _larch _larch N/A N/A self toler toler N/A N/A self scale_covar scale_covar N/A N/A self kws kws N/A N/A self jacfcn jacfcn N/A N/A self __prepared False N/A N/A N/A self prepare_fit N/A __update_params N/A N/A self fvars N/A N/A N/A 
        set parameter values from values of fitted variables
         N/A N/A N/A self __prepared N/A N/A fit not prepared! N/A group N/A self paramgroup N/A N/A name val N/A zip N/A self var_names fvars N/A N/A par N/A getattr group name N/A N/A par _val N/A N/A par _from_internal val N/A __residual N/A N/A self fvars N/A N/A N/A 
        residual function used for least-squares fit.
        With the new, candidate values of fvars (the fitting variables),
        this evaluates all parameters, including setting bounds and
        evaluating constraints, and then passes those to the
        user-supplied function to calculate the residual.
         N/A N/A N/A self __update_params fvars N/A N/A N/A self userfcn N/A self paramgroup N/A self userargs N/A self userkws N/A __jacobian N/A N/A self fvars N/A N/A N/A 
        analytical jacobian to be used with the Levenberg-Marquardt
         N/A N/A N/A self __update_params fvars N/A N/A N/A self jacfcn N/A self paramgroup N/A self userargs N/A self userkws N/A prepare_fit N/A N/A self force N/A False N/A N/A prepare parameters for fit
        determine which parameters are actually variables
        and which are defined expressions.
         N/A N/A N/A self __prepared N/A force N/A N/A N/A N/A N/A N/A N/A self _larch symtable isgroup N/A self paramgroup N/A N/A N/A N/A N/A N/A self _larch symtable _sys paramGroup N/A self paramgroup N/A N/A N/A N/A N/A N/A self _larch write write Minimize Error: invalid parameter group! N/A N/A N/A self var_names N/A N/A N/A self vars N/A N/A N/A self nvarys 0 N/A name N/A dir N/A self paramgroup N/A N/A par N/A getattr N/A self paramgroup name N/A N/A isParameter par N/A N/A val0 N/A N/A par setup_bounds N/A N/A par vary N/A N/A N/A N/A N/A self var_names append name N/A N/A N/A N/A self vars append val0 N/A N/A N/A N/A par expr None N/A N/A N/A N/A par _getval N/A N/A N/A N/A hasattr par name N/A N/A par name None N/A N/A N/A par name name N/A N/A self nvarys N/A len N/A self vars N/A N/A self __prepared True N/A leastsq N/A N/A self N/A kws N/A N/A 
        use Levenberg-Marquardt minimization to perform fit.
        This assumes that ModelParameters have been stored,
        and a function to minimize has been properly set up.

        This wraps scipy.optimize.leastsq, and keyward arguments are passed
        directly as options to scipy.optimize.leastsq

        When possible, this calculates the estimated uncertainties and
        variable correlations from the covariance matrix.

        writes outputs to many internal attributes, and
        returns True if fit was successful, False if not.
         N/A N/A N/A self prepare_fit force True N/A toler N/A self toler N/A lskws N/A dict xtol toler ftol toler gtol toler maxfev N/A 1000 N/A N/A self nvarys 1 Dfun None N/A N/A N/A lskws update N/A self kws N/A N/A N/A lskws update kws N/A N/A N/A lskws N/A Dfun None N/A N/A N/A self jacfcn N/A lskws N/A Dfun N/A N/A lskws N/A Dfun N/A self __jacobian N/A lsout N/A leastsq N/A self __residual N/A self vars lskws N/A N/A self vars N/A N/A _best cov infodict errmsg ier lsout N/A resid N/A infodict N/A fvec N/A ndata N/A len resid N/A chisqr N/A N/A N/A resid 2 sum N/A nfree N/A ndata N/A self nvarys N/A redchi N/A chisqr nfree N/A group N/A self paramgroup N/A grad N/A ones_like _best N/A vbest N/A ones_like _best N/A named_params N/A N/A N/A ivar name N/A enumerate N/A self var_names N/A N/A N/A named_params N/A name par N/A getattr group name N/A N/A grad N/A ivar N/A N/A par scale_gradient N/A _best N/A ivar N/A N/A vbest N/A ivar N/A par value N/A N/A par stderr 0 N/A N/A par correl N/A N/A N/A par _uval None N/A N/A infodict N/A fjac N/A transpose N/A N/A transpose N/A infodict N/A fjac N/A take grad N/A N/A infodict N/A ipvt 1 N/A rvec N/A dot N/A triu N/A N/A transpose N/A infodict N/A fjac N/A N/A N/A self nvarys N/A N/A take N/A eye N/A self nvarys N/A N/A infodict N/A ipvt 1 0 N/A N/A N/A cov N/A inv N/A dot N/A transpose rvec rvec N/A N/A N/A N/A LinAlgError ValueError N/A N/A cov None N/A N/A cov None N/A N/A N/A self scale_covar N/A N/A cov N/A N/A cov chisqr nfree N/A N/A N/A uvars N/A N/A uncertainties correlated_values vbest cov N/A N/A N/A N/A LinAlgError ValueError N/A N/A N/A cov uvars N/A None None N/A N/A group covar_vars N/A self var_names N/A N/A group covar cov N/A N/A uvars None N/A N/A N/A iv name N/A enumerate N/A self var_names N/A N/A p N/A named_params N/A name N/A N/A p stderr N/A N/A N/A uvars N/A iv std_dev N/A N/A p _uval N/A uvars N/A iv N/A N/A p correl N/A N/A N/A jv name2 N/A enumerate N/A self var_names N/A N/A N/A jv iv N/A N/A N/A N/A p correl N/A name2 N/A N/A cov N/A N/A iv jv N/A N/A p stderr N/A sqrt N/A cov N/A N/A jv jv N/A nam N/A dir N/A self paramgroup N/A N/A obj N/A getattr N/A self paramgroup nam N/A N/A eval_stderr obj uvars N/A self var_names named_params N/A self _larch N/A N/A uval nam N/A zip uvars N/A self var_names N/A N/A N/A N/A named_params N/A nam _val N/A uval nominal_value N/A N/A N/A self _larch error N/A N/A N/A N/A self _larch error N/A N/A message Fit succeeded. N/A N/A ier 0 N/A N/A message Invalid Input Parameters. N/A N/A N/A ier 5 N/A N/A message N/A N/A self err_maxfev N/A lskws N/A maxfev N/A N/A N/A ier 5 N/A N/A message See lmdif_message. N/A N/A cov None N/A N/A message N/A %s Could not estimate error-bars message N/A ofit group N/A N/A Group None N/A N/A ofit N/A group fit_details N/A Group N/A N/A ofit method leastsq N/A N/A ofit fjac N/A infodict N/A fjac N/A N/A ofit fvec N/A infodict N/A fvec N/A N/A ofit qtf N/A infodict N/A qtf N/A N/A ofit ipvt N/A infodict N/A ipvt N/A N/A ofit nfev N/A infodict N/A nfev N/A N/A ofit status ier N/A N/A ofit message errmsg N/A N/A ofit success N/A ier N/A 1 2 3 4 N/A N/A ofit toler N/A self toler N/A N/A group residual resid N/A N/A group message message N/A N/A group chi_square chisqr N/A N/A group chi_reduced redchi N/A N/A group nvarys N/A self nvarys N/A N/A group nfree nfree N/A N/A group errorbars N/A cov None N/A ier N/A scalar_minimize N/A N/A self method N/A Nelder-Mead kws N/A N/A 
        use one of the scaler minimization methods from scipy.
        Available methods include:
          Nelder-Mead
          Powell
          CG  (conjugate gradient)
          BFGS
          Newton-CG
          Anneal
          L-BFGS-B
          TNC
          COBYLA
          SLSQP

        If the objective function returns a numpy array instead
        of the expected scalar, the sum of squares of the array
        will be used.

        Note that bounds and constraints can be set on Parameters
        for any of these methods, so are not supported separately
        for those designed to use bounds.

         N/A N/A HAS_SCALAR_MIN N/A N/A NotImplementedError N/A N/A N/A self prepare_fit N/A maxfev N/A 1000 N/A N/A self nvarys 1 N/A opts N/A maxiter maxfev N/A N/A method N/A L-BFGS-B TNC SLSQP N/A N/A N/A opts N/A maxfev maxfev N/A fmin_kws N/A dict method method tol N/A self toler options opts N/A N/A N/A fmin_kws update N/A self kws N/A N/A N/A fmin_kws update kws penalty N/A N/A parvals N/A N/A N/A local penalty function -- eval sum-squares residual N/A r N/A N/A self __residual parvals N/A N/A isinstance r ndarray N/A N/A r N/A N/A N/A r r sum N/A r N/A N/A ret N/A scipy_minimize penalty N/A self vars fmin_kws N/A N/A self vars N/A resid N/A N/A self __residual N/A ret x N/A ndata N/A len resid N/A chisqr N/A N/A N/A resid 2 sum N/A nfree N/A ndata N/A self nvarys N/A redchi N/A chisqr nfree N/A ofit group N/A self paramgroup N/A N/A Group None N/A N/A ofit N/A group fit_details N/A Group N/A N/A ofit method method N/A N/A ofit nfev N/A ret nfev N/A N/A ofit success N/A ret success N/A N/A ofit status N/A ret status N/A N/A group nvarys N/A self nvarys N/A N/A group nfree nfree N/A N/A group residual resid N/A N/A group message N/A ret message N/A N/A group chi_square chisqr N/A N/A group chi_reduced redchi N/A N/A group errorbars False N/A N/A minimize N/A N/A fcn group args kws method _larch N/A None None leastsq None fit_kws N/A N/A simple minimization function,
    finding the values for the params which give the
    minimal sum-of-squares of the array return by fcn
     N/A N/A N/A N/A N/A _larch symtable isgroup group N/A N/A param group is not a Larch Group N/A fit N/A Minimizer fcn group fcn_args args fcn_kws kws scale_covar True _larch _larch fit_kws N/A _scalar_methods N/A nelder powell cg bfgs newton lbfgs l-bfgs tnc cobyla slsqp Nelder-Mead Powell CG BFGS Newton-CG L-BFGS-B L-BFGS-B TNC COBYLA SLSQP N/A meth N/A N/A method lower N/A meth_found False N/A HAS_SCALAR_MIN N/A N/A N/A name method N/A N/A _scalar_methods items N/A N/A N/A N/A meth startswith name N/A N/A meth_found True N/A N/A N/A fit scalar_minimize method method N/A N/A meth_found N/A N/A N/A N/A fit leastsq N/A fit N/A fit_report N/A N/A group show_correl min_correl precision _larch N/A True 0.1 None None kws N/A N/A print report of fit statistics given 'fit parameter group'
     N/A N/A N/A N/A N/A _larch symtable isgroup group N/A N/A must pass Group to fit_report() N/A N/A N/A N/A N/A _larch symtable _sys paramGroup group N/A topline ===================== FIT RESULTS ===================== N/A header [[%s]] %s N/A exprformat    %12s = %s = '%s' N/A out N/A topline N/A varformat    %12s = %s (init= % f) N/A fmt_sca % f N/A fmt_err % f +/- %f N/A N/A precision None N/A N/A varformat N/A    %%12s = %%s (init= %% .%if) precision N/A fmt_sca N/A %% .%if precision N/A fmt_err N/A %% .%if +/- %%.%if N/A precision precision N/A npts N/A len N/A group residual N/A ofit N/A getattr group fit_details None N/A N/A ofit None N/A N/A ofit group N/A methodname N/A getattr ofit method leastsq N/A success N/A getattr ofit success False N/A success N/A N/A subtitle    Fit succeeded,  N/A N/A subtitle    Fit Failed,  N/A subtitle N/A %s method = '%s'. N/A subtitle methodname N/A N/A N/A out append N/A header N/A Statistics subtitle N/A N/A hasattr group message N/A N/A N/A N/A out append N/A    Message from fit    = %s N/A group message N/A N/A N/A out append N/A    npts, nvarys, nfree = %i, %i, %i N/A npts N/A group nvarys N/A group nfree N/A N/A hasattr ofit nfev N/A N/A N/A N/A out append N/A    nfev (func calls)   = %i N/A ofit nfev N/A N/A hasattr group chi_square N/A N/A N/A N/A out append N/A N/A    chi_square          = %s fmt_sca N/A group chi_square N/A N/A hasattr group chi_reduced N/A N/A N/A N/A out append N/A N/A    reduced chi_square  = %s fmt_sca N/A group chi_reduced N/A N/A N/A out append N/A N/A N/A out append N/A header N/A Variables N/A exprs N/A N/A name N/A dir group N/A N/A var N/A getattr group name N/A N/A N/A len name 14 N/A N/A name N/A N/A name N/A 14 N/A 14 N/A N/A isParameter var N/A N/A sval N/A fmt_sca N/A var value N/A N/A N/A var stderr None N/A N/A sval N/A fmt_err N/A N/A var value N/A var stderr N/A N/A var vary N/A N/A N/A N/A out append N/A varformat N/A name sval N/A var _initval N/A N/A N/A N/A var expr None N/A N/A N/A N/A exprs append N/A exprformat N/A name sval N/A var expr N/A N/A N/A len exprs 0 N/A N/A N/A N/A out append N/A header N/A Constraint Expressions N/A N/A N/A out extend exprs N/A covar_vars N/A getattr group covar_vars N/A N/A N/A show_correl N/A N/A len covar_vars 0 N/A N/A subtitle N/A     (unreported correlations are < % .3f) min_correl N/A N/A N/A out append N/A N/A N/A out append N/A header N/A Correlations subtitle N/A correls N/A N/A N/A i name N/A enumerate covar_vars N/A N/A par N/A getattr group name N/A N/A N/A par vary N/A N/A N/A N/A N/A hasattr par correl N/A N/A par correl None N/A N/A name2 N/A covar_vars N/A N/A i 1 N/A N/A N/A N/A name name2 N/A name2 N/A par correl N/A N/A N/A correls N/A N/A %s, %s N/A name name2 N/A N/A par correl N/A name2 N/A sort_correl N/A sorted N/A N/A correls items key N/A N/A N/A it N/A N/A abs N/A it N/A 1 N/A N/A N/A sort_correl reverse N/A N/A name val sort_correl N/A N/A N/A N/A abs val min_correl N/A N/A N/A N/A N/A len name 20 N/A N/A name N/A N/A name N/A 20 N/A 20 N/A N/A N/A out append N/A    %s = % .3f  N/A name val N/A N/A N/A out append N/A = N/A len topline N/A N/A N/A join out N/A