Downloading and Installation

Prerequisites

Lmfit works with Python versions 2.7 and 3.5, 3.6, or 3.7. Support for 2.7 is expected to end in late 2019.

Lmfit requires the following Python packages, with versions given:

All of these are readily available on PyPI, and should be installed automatically if installing with pip install lmfit.

In order to run the test suite, the pytest package is required. Some functionality requires the emcee, pandas, Jupyter, matplotlib, dill, or numdifftools packages. These are not installed automatically, but we highly recommend each of these packages.

Downloads

The latest stable version of lmfit is 0.9.13 and is available from PyPi.

Installation

The easiest way to install lmfit is with:

pip install lmfit

For Anaconda Python, lmfit is not an official package, but several Anaconda channels provide it, allowing installation with (for example):

conda install -c GSECARS lmfit

or:

conda install -c conda-forge lmfit

Development Version

To get the latest development version from the lmfit GitHub repository, use:

git clone https://github.com/lmfit/lmfit-py.git

and install using:

python setup.py install

We welcome all contributions to lmfit! If you cloned the repository for this purpose, please read CONTRIBUTING.md for more detailed instructions.

Testing

A battery of tests scripts that can be run with the pytest testing framework is distributed with lmfit in the tests folder. These are automatically run as part of the development process. For any release or any master branch from the git repository, running pytest should run all of these tests to completion without errors or failures.

Many of the examples in this documentation are distributed with lmfit in the examples folder, and should also run for you. Some of these examples assume that matplotlib has been installed and is working correctly.

Acknowledgements

Many people have contributed to lmfit.  The attribution of credit in a
project such as this is difficult to get perfect, and there are no doubt
important contributions that are missing or under-represented here.  Please
consider this file as part of the code and documentation that may have bugs
that need fixing.

Some of the largest and most important contributions (in approximate order
of size of the contribution to the existing code) are from:

  Matthew Newville wrote the original version and maintains the project.

  Renee Otten wrote the brute force method, implemented the basin-hopping
  and AMPGO global solvers, implemented uncertainty calculations for scalar
  minimizers and has greatly improved the code, testing, and documentation
  and overall project.

  Till Stensitzki wrote the improved estimates of confidence intervals, and
  contributed many tests, bug fixes, and documentation.

  A. R. J. Nelson added differential_evolution, emcee, and greatly improved
  the code, docstrings, and overall project.

  Antonino Ingargiola wrote much of the high level Model code and has
  provided many bug fixes and improvements.

  Daniel B. Allan wrote much of the original version of the high level Model
  code, and many improvements to the testing and documentation.

  Austen Fox fixed many of the built-in model functions and improved the
  testing and documentation of these.

  Michal Rawlik added plotting capabilities for Models.


  The method used for placing bounds on parameters was derived from the
  clear description in the MINUIT documentation, and adapted from
  J. J. Helmus's python implementation in leastsqbounds.py.

  E. O. Le Bigot wrote the uncertainties package, a version of which was
  used by lmfit for many years, and is now an external dependency.

  The original AMPGO code came from Andrea Gavana and was adopted for
  lmfit.

  The propagation of parameter uncertainties to uncertainties in a Model
  was adapted from the excellent description at
  https://www.astro.rug.nl/software/kapteyn/kmpfittutorial.html#confidence-and-prediction-intervals,
  which references the original work of: J. Wolberg,Data Analysis Using the
  Method of Least Squares, 2006, Springer

Additional patches, bug fixes, and suggestions have come from Faustin
Carter, Christoph Deil, Francois Boulogne, Thomas Caswell, Colin Brosseau,
nmearl, Gustavo Pasquevich, Clemens Prescher, LiCode, Ben Gamari, Yoav
Roam, Alexander Stark, Alexandre Beelen, and many others.

The lmfit code obviously depends on, and owes a very large debt to the code
in scipy.optimize.  Several discussions on the scipy-user and lmfit mailing
lists have also led to improvements in this code.