Skip to content

Commit

Permalink
Merge pull request #759 from reneeotten/last_changes_before_release
Browse files Browse the repository at this point in the history
(Last) minor changes before release?
  • Loading branch information
newville authored Oct 14, 2021
2 parents e4f85a2 + fae74b8 commit 9f9af6f
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 59 deletions.
5 changes: 2 additions & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
codecov:
token: 11c28e95-6e64-4829-9887-04e4cd661bf6

comment:
after_n_builds: 8
comment:
after_n_builds: 8

coverage:
status:
Expand Down
2 changes: 1 addition & 1 deletion THANKS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Roam, Alexander Stark, Alexandre Beelen, Andrey Aristov, Nicholas Zobrist,
Ethan Welty, Julius Zimmermann, Mark Dean, Arun Persaud, Ray Osborn, @lneuhaus,
Marcel Stimberg, Yoshiera Huang, Leon Foks, Sebastian Weigand, Florian LB,
Michael Hudson-Doyle, Ruben Verweij, @jedzill4, @spalato, Jens Hedegaard Nielsen,
Martin Majli, Kristian Meyer, and many others.
Martin Majli, Kristian Meyer, @azelcer, Ivan Usov, 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
Expand Down
10 changes: 5 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ stages:
python setup.py install
displayName: 'Install lmfit'
- script: |
sudo apt update && sudo apt install -qq -y texlive-latex-extra latexmk
sudo apt-get update && sudo apt-get install -qq -y texlive-latex-extra latexmk
displayName: 'Install TeX Live'
- script: |
cd doc ; make all
Expand Down Expand Up @@ -74,7 +74,7 @@ stages:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
sudo apt update && sudo apt install -yq --no-install-suggests --no-install-recommends \
sudo apt-get update && sudo apt-get install -yq --no-install-suggests --no-install-recommends \
libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache \
swig libmpc-dev
displayName: 'Install dependencies'
Expand Down Expand Up @@ -130,7 +130,7 @@ stages:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
sudo apt update && sudo apt install -yq --no-install-suggests --no-install-recommends \
sudo apt-get update && sudo apt-get install -yq --no-install-suggests --no-install-recommends \
libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache \
swig libmpc-dev
displayName: 'Install dependencies'
Expand Down Expand Up @@ -206,10 +206,10 @@ stages:
steps:
- script: |
sudo add-apt-repository ppa:deadsnakes/nightly
sudo apt update && sudo apt install -y --no-install-recommends python3.10-dev python3.10-distutils
sudo apt-get update && sudo apt-get install -y --no-install-recommends python3.10-dev python3.10-distutils
displayName: Install Python development version from the deadsnakes PPA
- script: |
sudo apt update && sudo apt install -yq --no-install-suggests --no-install-recommends \
sudo apt-get update && sudo apt-get install -yq --no-install-suggests --no-install-recommends \
libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache \
swig libmpc-dev
displayName: 'Install dependencies'
Expand Down
6 changes: 4 additions & 2 deletions doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ consult the `lmfit GitHub repository`_.

.. _whatsnew_103_label:

Version 1.0.3 Release Notes (unreleased)
========================================
Version 1.0.3 Release Notes (October 14, 2021)
==============================================

Potentially breaking change:

Expand All @@ -39,6 +39,7 @@ Bug fixes/enhancements:
``float``, ``int``, or ``complex`` return value to a ``numpy.ndarray`` (Issue #684 and PR #754)
- fix ``dho`` (Damped Harmonic Oscillator) lineshape (PR #755; @rayosborn)
- reset ``Minimizer._abort`` to ``False`` before starting a new fit (Issue #756 and PR #757; @azelcer)
- fix typo in ``guess_from_peak2d`` (@ivan-usovl; PR #758)

Various:

Expand All @@ -54,6 +55,7 @@ Various:
- mark ``test_manypeaks_speed.py`` as flaky to avoid intermittent test failures (repeat up to 5 times; PR #745)
- update scipy dependency to >= 1.14.0 (PR #751)
- improvement to output of examples in sphinx-gallery and use higher resolution figures (PR #753)
- remove deprecated functions ``lmfit.printfuncs.report_errors`` and ``asteval`` argument in ``Parameters`` class (PR #759)


.. _whatsnew_102_label:
Expand Down
3 changes: 1 addition & 2 deletions lmfit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
from .confidence import conf_interval, conf_interval2d
from .minimizer import Minimizer, MinimizerException, minimize
from .parameter import Parameter, Parameters
from .printfuncs import (ci_report, fit_report, report_ci, report_errors,
report_fit)
from .printfuncs import ci_report, fit_report, report_ci, report_fit
from .model import Model, CompositeModel
from . import lineshapes, models

Expand Down
19 changes: 3 additions & 16 deletions lmfit/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from copy import deepcopy
import json
import warnings

from asteval import Interpreter, get_ast_names, valid_symbol_name
from numpy import arcsin, array, cos, inf, isclose, sin, sqrt
Expand Down Expand Up @@ -45,30 +44,18 @@ class Parameters(dict):
"""

def __init__(self, asteval=None, usersyms=None):
def __init__(self, usersyms=None):
"""
Arguments
---------
asteval : :class:`asteval.Interpreter`, optional
Instance of the `asteval.Interpreter` to use for constraint
expressions. If None (default), a new interpreter will be
created. **Warning: deprecated**, use `usersyms` if possible!
usersyms : dict, optional
Dictionary of symbols to add to the
:class:`asteval.Interpreter` (default is None).
"""
super().__init__(self)

self._asteval = asteval
if asteval is None:
self._asteval = Interpreter()
else:
msg = ("The use of the 'asteval' argument for the Parameters class"
" was deprecated in lmfit v0.9.12 and will be removed in a "
"later release. Please use the 'usersyms' argument instead!")
warnings.warn(FutureWarning(msg))
self._asteval = asteval
self._asteval = Interpreter()

_syms = {}
_syms.update(SCIPY_FUNCTIONS)
Expand Down Expand Up @@ -101,7 +88,7 @@ def __deepcopy__(self, memo):
all individual Parameter objects are copied.
"""
_pars = self.__class__(asteval=None)
_pars = self.__class__()

# find the symbols that were added by users, not during construction
unique_symbols = {key: self._asteval.symtable[key]
Expand Down
9 changes: 0 additions & 9 deletions lmfit/printfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from math import log10
import re
import warnings

import numpy as np

Expand Down Expand Up @@ -341,14 +340,6 @@ def cell(x, cat='td'):
return ''.join(html)


def report_errors(params, **kws):
"""Print a report for fitted params: see error_report()."""
warnings.warn("The function 'report_errors' is deprecated as of lmfit "
"0.9.14 and will be removed in the next release. Please "
"use 'report_fit' instead.", FutureWarning)
print(fit_report(params, **kws))


def report_fit(params, **kws):
"""Print a report of the fitting results."""
print(fit_report(params, **kws))
Expand Down
15 changes: 1 addition & 14 deletions tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from copy import copy, deepcopy
import pickle

import asteval
import numpy as np
from numpy.testing import assert_allclose
import pytest
Expand Down Expand Up @@ -45,21 +44,9 @@ def test_check_ast_errors():
pars.add('par1', expr='2.0*par2')


def test_parameters_init_with_asteval():
"""Test for initialization of the Parameters class with asteval."""
ast_int = asteval.Interpreter()

msg = ("The use of the 'asteval' argument for the Parameters class was "
"deprecated in lmfit v0.9.12 and will be removed in a later "
"release. Please use the 'usersyms' argument instead!")
with pytest.warns(FutureWarning, match=msg):
pars = lmfit.Parameters(asteval=ast_int)
assert pars._asteval == ast_int


def test_parameters_init_with_usersyms():
"""Test for initialization of the Parameters class with usersyms."""
pars = lmfit.Parameters(asteval=None, usersyms={'test': np.sin})
pars = lmfit.Parameters(usersyms={'test': np.sin})
assert 'test' in pars._asteval.symtable


Expand Down
8 changes: 1 addition & 7 deletions tests/test_printfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import lmfit
from lmfit import (Minimizer, Parameters, ci_report, conf_interval, fit_report,
report_ci, report_errors, report_fit)
report_ci, report_fit)
from lmfit.lineshapes import gaussian
from lmfit.models import GaussianModel
from lmfit.printfuncs import alphanumeric_sort, getfloat_attr, gformat
Expand Down Expand Up @@ -222,12 +222,6 @@ def test_report_fit(fitresult, capsys):
assert header in captured.out


def test_report_errors_deprecated(fitresult):
"""Verify that a FutureWarning is shown when calling report_errors."""
with pytest.warns(FutureWarning):
report_errors(params=fitresult.params)


def test_report_leastsq_no_errorbars(fitresult):
"""Verify correct message when uncertainties could not be estimated."""
# general warning is shown
Expand Down

0 comments on commit 9f9af6f

Please sign in to comment.