diff --git a/doc/index.rst b/doc/index.rst index 0b2d8c569..04699582a 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -6,16 +6,6 @@ Non-Linear Least-Square Minimization and Curve-Fitting for Python .. _Levenberg-Marquardt: http://en.wikipedia.org/wiki/Levenberg-Marquardt_algorithm .. _MINPACK-1: http://en.wikipedia.org/wiki/MINPACK - -.. warning:: - - Upgrading scripts from version 0.8.3 to 0.9.0? See :ref:`whatsnew_090_label` - -.. warning:: - - Support for Python 2.6 and scipy 0.13 will be dropped with version 0.9.5. - - Lmfit provides a high-level interface to non-linear optimization and curve fitting problems for Python. Lmfit builds on and extends many of the optimization algorithm of :mod:`scipy.optimize`, especially the @@ -51,8 +41,8 @@ fitting problems, including: .. _lmfit github repository: http://github.com/lmfit/lmfit-py -The lmfit package is Free software, using an MIT license. The software and -this document are works in progress. If you are interested in +The lmfit package is Free software, using an Open Source license. The +software and this document are works in progress. If you are interested in participating in this effort please use the `lmfit github repository`_. @@ -70,3 +60,4 @@ participating in this effort please use the `lmfit github repository`_. confidence bounds constraints + whatsnew diff --git a/doc/installation.rst b/doc/installation.rst index ac222f3e3..f1aa08f7e 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -12,12 +12,10 @@ Prerequisites The lmfit package requires Python, Numpy, and Scipy. -Lmfit works with Python 2.7, 3.3, 3.4, and 3.5. Lmfit version 0.9.4 works -with Python 2.6, but support for it will dropped in version 0.9.5. Scipy -version 0.13 or higher is required, with 0.17 or higher recommended to be -able to use the latest optimization features from scipy. Support for scipy -0.13 will be dropped in version 0.9.5. Numpy version 1.5 or higher is -required. +Lmfit works with Python 2.7, 3.3, 3.4, and 3.5. Support for Python 2.6 +ended with Lmfit version 0.9.4. Scipy version 0.14 or higher is required, +with 0.17 or higher recommended to be able to use the latest optimization +features from scipy. Numpy version 1.5 or higher is required. In order to run the test suite, the `nose`_ framework is required. Some parts of lmfit will be able to make use of IPython (version 4 or higher), diff --git a/doc/whatsnew.rst b/doc/whatsnew.rst index 125f2c7c6..063c6c9ea 100644 --- a/doc/whatsnew.rst +++ b/doc/whatsnew.rst @@ -11,6 +11,45 @@ changes to the use and behavior of the library. This is not meant to be a comprehensive list of changes. For such a complete record, consult the `lmfit github repository`_. +.. _whatsnew_095_label: + +Version 0.9.5 Release Notes +========================================== + +Support for Python 2.6 and scipy 0.13 has been dropped. + +.. _whatsnew_094_label: + +Version 0.9.4 Release Notes +========================================== + +Some support for the new `least_squares` routine from scipy 0.17 has been +added. + + +Parameters can now be used directly in floating point or array expressions, +so that the Parameter value does not need `sigma = params['sigma'].value`. +The older, explicit usage still works, but the docs, samples, and tests +have been updated to use the simpler usage. + +Support for Python 2.6 and scipy 0.13 is now explicitly deprecated and wil +be dropped in version 0.9.5. + +.. _whatsnew_093_label: + +Version 0.9.3 Release Notes +========================================== + +Models involving complex numbers have been improved. + +The `emcee` module can now be used for uncertainty estimation. + +Many bug fixes, and an important fix for performance slowdown on getting +parameter values. + +ASV benchmarking code added. + + .. _whatsnew_090_label: Version 0.9.0 Release Notes diff --git a/lmfit/__init__.py b/lmfit/__init__.py index 655b8f77e..ccfd8986c 100644 --- a/lmfit/__init__.py +++ b/lmfit/__init__.py @@ -25,9 +25,9 @@ * Many pre-built models for common lineshapes are included and ready to use. - version: 0.9.4 - last update: 2016-Jul-1 - License: MIT + version: 0.9.5 + last update: 2016-Jul-26 + License: BSD Authors: Matthew Newville, The University of Chicago Till Stensitzki, Freie Universitat Berlin Daniel B. Allen, Johns Hopkins University @@ -57,11 +57,11 @@ # PY26 Depreciation Warning if sys.version_info[:2] == (2, 6): - warnings.warn('Support for Python 2.6.x will be dropped in lmfit 0.9.5') + warnings.warn('Support for Python 2.6.x was dropped with lmfit 0.9.5') # SCIPY 0.13 Depreciation Warning import scipy scipy_major, scipy_minor, scipy_other = scipy.__version__.split('.', 2) -if int(scipy_major) == 0 and int(scipy_minor) < 14: - warnings.warn('Support for Scipy 0.13 will be dropped in lmfit 0.9.5') +if int(scipy_major) == 0 and int(scipy_minor) < 15: + warnings.warn('Support for Scipy 0.14 was dropped with lmfit 0.9.5') diff --git a/lmfit/minimizer.py b/lmfit/minimizer.py index 1ebbe5f24..46a582fec 100644 --- a/lmfit/minimizer.py +++ b/lmfit/minimizer.py @@ -14,13 +14,24 @@ from copy import deepcopy import numpy as np from numpy import (dot, eye, ndarray, ones_like, - sqrt, take, transpose, triu, deprecate) + sqrt, take, transpose, triu) from numpy.dual import inv from numpy.linalg import LinAlgError import multiprocessing import numbers +## +## scipy version notes: +## currently scipy 0.14 is required. +## feature scipy version added +## minimize 0.11 +## OptimizeResult 0.13 +## diff_evolution 0.15 +## least_squares 0.17 +## + from scipy.optimize import leastsq as scipy_leastsq +from scipy.optimize import minimize as scipy_minimize # differential_evolution is only present in scipy >= 0.15 try: @@ -28,6 +39,14 @@ except ImportError: from ._differentialevolution import differential_evolution as scipy_diffev +# check for scipy.opitimize.least_squares +HAS_LEAST_SQUARES = False +try: + from scipy.optimize import least_squares + HAS_LEAST_SQUARES = True +except ImportError: + pass + # check for EMCEE HAS_EMCEE = False try: @@ -44,22 +63,6 @@ except ImportError: pass -# check for scipy.optimize.minimize -HAS_SCALAR_MIN = False -try: - from scipy.optimize import minimize as scipy_minimize - HAS_SCALAR_MIN = True -except ImportError: - pass - -# check for scipy.opitimize.least_squares -HAS_LEAST_SQUARES = False -try: - from scipy.optimize import least_squares - HAS_LEAST_SQUARES = True -except ImportError: - pass - from .parameter import Parameter, Parameters # use locally modified version of uncertainties package @@ -528,8 +531,6 @@ def scalar_minimize(self, method='Nelder-Mead', params=None, **kws): .. versionchanged:: 0.9.0 return value changed to :class:`MinimizerResult` """ - if not HAS_SCALAR_MIN: - raise NotImplementedError result = self.prepare_fit(params=params) result.method = method @@ -1232,17 +1233,12 @@ def minimize(self, method='leastsq', params=None, **kws): function = self.leastsq elif user_method.startswith('least_s'): function = self.least_squares - elif HAS_SCALAR_MIN: + else: function = self.scalar_minimize for key, val in SCALAR_METHODS.items(): if (key.lower().startswith(user_method) or val.lower().startswith(user_method)): kwargs['method'] = val - elif (user_method.startswith('nelder') or - user_method.startswith('fmin')): - function = self.fmin - elif user_method.startswith('lbfgsb'): - function = self.lbfgsb return function(**kwargs) diff --git a/requirements.txt b/requirements.txt index fe73b4fb5..99f0a77d8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ numpy>=1.5 -scipy>=0.13 +scipy>=0.14