Table Of Contents

Previous topic

nmrglue.helpers

Next topic

nmrglue.linesh

This Page

nmrglue.leastsqbound

Constrained multivariate Levenberg-Marquardt optimization

This module is imported as nmrglue.leastsqbound and can be called as such.

Low-Level Functions

These functions are typically not used directly by users. They are called by high level functions.

nmrglue.analysis.leastsqbound.leastsqbound(func, x0, bounds, args=(), **kw)

Constrained multivariant Levenberg-Marquard optimization

Minimize the sum of squares of a given function using the Levenberg-Marquard algorithm. Contraints on parameters are inforced using variable transformations as described in the MINUIT User’s Guide by Fred James and Matthias Winkler.

Parameters:

  • func functions to call for optimization.

  • x0 Starting estimate for the minimization.

  • bounds (min,max) pair for each element of x, defining the bounds on

    that parameter. Use None for one of min or max when there is no bound in that direction.

  • args Any extra arguments to func are places in this tuple.

Returns: (x,{cov_x,infodict,mesg},ier)

Return is described in the scipy.optimize.leastsq function. x and con_v are corrected to take into account the parameter transformation, infodic is not corrected.

Additional keyword arguments are passed directly to the scipy.optimize.leastsq algorithm.

nmrglue.analysis.leastsqbound.internal2external(xi, bounds)
Convert a series of internal variables to external variables
nmrglue.analysis.leastsqbound.external2internal(xe, bounds)
Convert a series of external variables to internal variables
nmrglue.analysis.leastsqbound.internal2external_grad(xi, bounds)

Calculate the internal to external gradiant

Calculates the partial of external over internal

nmrglue.analysis.leastsqbound.i2e_cov_x(xi, bounds, cov_x)
nmrglue.analysis.leastsqbound.err(p, bounds, efunc, args)
nmrglue.analysis.leastsqbound.calc_cov_x(infodic, p)
Calculate cov_x from fjac, ipvt and p as is done in leastsq