Switch to lmfit-py for minimization

Registered by Vinothan N. Manoharan

lmfit-py (https://github.com/lmfit/lmfit-py) is a python implementation of the Levenberg-Marquardt algorithm. It has support for bounds. Switching to lmfit from nmpfit would offer the following advantages:

- we get uncertainty calculations for free, and in a transparent way (http://lmfit.github.io/lmfit-py/fitting.html#goodness-of-fit-and-estimated-uncertainty-and-correlations).
- we could eliminate a lot of the code that is built around nmpfit. lmfit has its own Parameter class that supports bounds and constraints
- we could eliminate the dependency on nmpfit
- lmfit has support for other minimizers supported by scipy, so users would have access to these without having to install OpenOpt.
- potentially we could also parallelize the Jacobian calculation. This is the most expensive part of fitting, as it requires calculating holograms multiple times. See lmfit-py enhancement request (https://github.com/lmfit/lmfit-py/issues/76) and sample code (http://stackoverflow.com/a/19679060)
- lmfit is under active development, and the developers are quite responsive. So if there is a feature we need (such as tied parameters) we can modify the code and submit a pull request to have it incorporated upstream

We would probably still need to wrap lmfit-py to make it compatible with our existing API, but there is already work on writing a high-level Model class and fit() function (https://github.com/lmfit/lmfit-py/pull/57)

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Vinothan N. Manoharan
Direction:
Needs approval
Assignee:
None
Definition:
Discussion
Series goal:
None
Implementation:
Unknown
Milestone target:
milestone icon 3.0

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.