## Prerequisites¶

The lmfit package requires Python, NumPy, SciPy, asteval, six, and uncertainties.

Lmfit works with Python versions 2.7, 3.4, 3.5, and 3.6. Support for Python 2.6 and 3.3 ended with lmfit versions 0.9.4 and 0.9.8, respectively. Scipy version 0.17, NumPy version 1.10, asteval version 0.9.12, six version 1.10, and uncertainties version 3.0 are the minimum requirements.

In order to run the test suite, either the nose or pytest package is required. Some functionality of lmfit requires the emcee package, some functionality will make use of the pandas, Jupyter, matplotlib, or dill packages if available. We highly recommend each of these packages.

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

## Installation¶

With pip now widely avaliable, you can install lmfit with:

pip install lmfit


Alternatively, you can download the source kit, unpack it and install with:

python setup.py install


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, use:

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


and install using:

python setup.py install


## Testing¶

A battery of tests scripts that can be run with either the nose or 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 or nosetests 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 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 very difficult to get perfect, and there are no doubt important
contributions missing or under-represented here.  Please consider this file as
part of the documentation that may have bugs that need fixing.

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

Matthew Newville wrote the original version and maintains the project.

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

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

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.

J. J. Helmus wrote the MINUT bounds for leastsq, originally in
leastsqbounds.py, and ported to lmfit.

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.

Additional patches, bug fixes, and suggestions have come from 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.


The LMFIT-py code is distribution under the following license:

Copyright, Licensing, and Re-distribution
-----------------------------------------

The LMFIT-py code is distribution under the following license:

Copyright (c) 2014 Matthew Newville, The University of Chicago
Till Stensitzki, Freie Universitat Berlin
Daniel B. Allen, Johns Hopkins University
Michal Rawlik, Eidgenossische Technische Hochschule, Zurich
Antonino Ingargiola, University of California, Los Angeles
A. R. J. Nelson, Australian Nuclear Science and Technology Organisation

Permission to use and redistribute the source code or binary forms of this
software and its documentation, with or without modification is hereby
and the disclaimer of warranty below appear in the source code and
documentation, and that none of the names of above institutions or
authors appear in advertising or endorsement of works derived from this
software without specific prior written permission from all parties.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THIS SOFTWARE.

-----------------------------------------
Some code sections have been taken from the scipy library whose licence is below.

Copyright (c) 2001, 2002 Enthought, Inc.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

a. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
b. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
c. Neither the name of Enthought nor the names of the SciPy Developers
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.