From 03e97688a9358ccf588eef83b9f3b0f0e525365b0f0f12f320f5a365082b6b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Thu, 5 Sep 2024 10:13:46 +0000 Subject: [PATCH] - Update to 1.3.2 * fix typo in restoring a _buildmodel dict (PR #957, Issue #956) * fixes for Numpy2 support (PR #959, Issue #958) * ensure that correct initial params are used when re-fitting a ModeRresult (PR #961, Issue #960) * make sure that CompositeModels cannot have a prefix (PR #961, Issue #954) * now require asteval>=1.0 and uncertainties>=3.2.2 - Fix requirements - Drop support-numpy-2.patch - Add lmfit-pr965-asteval.patch gh#lmfit/lmfit-py#965 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-lmfit?expand=0&rev=13 --- .gitattributes | 23 +++ .gitignore | 1 + lmfit-1.2.2.tar.gz | 3 + lmfit-1.3.1.tar.gz | 3 + lmfit-1.3.2.tar.gz | 3 + lmfit-pr965-asteval.patch | 357 +++++++++++++++++++++++++++++++++++++ python-lmfit.changes | 358 ++++++++++++++++++++++++++++++++++++++ python-lmfit.spec | 105 +++++++++++ support-numpy-2.patch | 343 ++++++++++++++++++++++++++++++++++++ 9 files changed, 1196 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 lmfit-1.2.2.tar.gz create mode 100644 lmfit-1.3.1.tar.gz create mode 100644 lmfit-1.3.2.tar.gz create mode 100644 lmfit-pr965-asteval.patch create mode 100644 python-lmfit.changes create mode 100644 python-lmfit.spec create mode 100644 support-numpy-2.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/lmfit-1.2.2.tar.gz b/lmfit-1.2.2.tar.gz new file mode 100644 index 0000000..cded35e --- /dev/null +++ b/lmfit-1.2.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:044a052a11a61da0576274504c17eb7e2803b41128e25821e96632207f23c88c +size 336346 diff --git a/lmfit-1.3.1.tar.gz b/lmfit-1.3.1.tar.gz new file mode 100644 index 0000000..ce0f3a9 --- /dev/null +++ b/lmfit-1.3.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc386244adbd10ef1a2a2c4f9d17b3def905552c0a64aef854f0ad46cc309cc5 +size 629917 diff --git a/lmfit-1.3.2.tar.gz b/lmfit-1.3.2.tar.gz new file mode 100644 index 0000000..807b37a --- /dev/null +++ b/lmfit-1.3.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31beeae1f027c1b8c14dcd7f2e8488a80b75fb389e77fca677549bdc2fe597bb +size 623945 diff --git a/lmfit-pr965-asteval.patch b/lmfit-pr965-asteval.patch new file mode 100644 index 0000000..ee4ae1f --- /dev/null +++ b/lmfit-pr965-asteval.patch @@ -0,0 +1,357 @@ +From e62b1784e7516f543402c013cfd532d6003aa859 Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sun, 4 Aug 2024 20:34:44 -0500 +Subject: [PATCH 1/9] BUG: fix typo in 'create_uvars' method + +Closes: #962 +--- + lmfit/parameter.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lmfit/parameter.py b/lmfit/parameter.py +index a7ec9a65..243d4227 100644 +--- a/lmfit/parameter.py ++++ b/lmfit/parameter.py +@@ -515,9 +515,9 @@ def create_uvars(self, covar=None): + vindex += 1 + vnames.append(par.name) + vbest.append(par.value) +- if getattr(par, 'sdterr', None) is None and covar is not None: ++ if getattr(par, 'stderr', None) is None and covar is not None: + par.stderr = sqrt(covar[vindex, vindex]) +- uvars[par.name] = ufloat(par.value, getattr(par, 'sdterr', 0.0)) ++ uvars[par.name] = ufloat(par.value, getattr(par, 'stderr', 0.0)) + + corr_uvars = None + if covar is not None: + +From 7fd4e42e84b3ab8f0bdc05274aa270d4ded765bf Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sun, 11 Aug 2024 12:40:21 -0500 +Subject: [PATCH 2/9] MAINT: 'uncertainties' fails if 'stderr' is None, so set + to zero + +--- + lmfit/parameter.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/lmfit/parameter.py b/lmfit/parameter.py +index 243d4227..cd6d9626 100644 +--- a/lmfit/parameter.py ++++ b/lmfit/parameter.py +@@ -517,7 +517,10 @@ def create_uvars(self, covar=None): + vbest.append(par.value) + if getattr(par, 'stderr', None) is None and covar is not None: + par.stderr = sqrt(covar[vindex, vindex]) +- uvars[par.name] = ufloat(par.value, getattr(par, 'stderr', 0.0)) ++ stderr = getattr(par, 'stderr', 0.0) ++ if stderr is None: ++ stderr = 0.0 ++ uvars[par.name] = ufloat(par.value, stderr) + + corr_uvars = None + if covar is not None: + +From b812b4731805f9d85d717aff0ad34031c747d1d4 Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sun, 11 Aug 2024 12:44:30 -0500 +Subject: [PATCH 3/9] MAINT: asteval no longer raises NameError to Python + +- so we suppress 'asteval' expections to stderr and look for them when creating parameters +--- + lmfit/parameter.py | 25 +++++++++++++++++++++++-- + tests/test_parameters.py | 3 +-- + 2 files changed, 24 insertions(+), 4 deletions(-) + +diff --git a/lmfit/parameter.py b/lmfit/parameter.py +index cd6d9626..77ba882c 100644 +--- a/lmfit/parameter.py ++++ b/lmfit/parameter.py +@@ -27,6 +27,20 @@ def check_ast_errors(expr_eval): + expr_eval.raise_exception(None) + + ++class Writer: ++ """Replace 'stdout' and 'stderr' for asteval.""" ++ def __init__(self, **kws): ++ self.messages = [] ++ for k, v in kws.items(): ++ setattr(self, k, v) ++ ++ def write(self, msg): ++ """Internal writer.""" ++ o = msg.strip() ++ if len(o) > 0: ++ self.messages.append(msg) ++ ++ + def asteval_with_uncertainties(*vals, obj=None, pars=None, names=None, **kwargs): + """Calculate object value, given values for variables. + +@@ -76,8 +90,9 @@ def __init__(self, usersyms=None): + + """ + super().__init__(self) +- +- self._asteval = Interpreter() ++ self._ast_msgs = Writer() ++ self._asteval = Interpreter(writer=self._ast_msgs, ++ err_writer=self._ast_msgs) + + _syms = {} + _syms.update(SCIPY_FUNCTIONS) +@@ -86,6 +101,9 @@ def __init__(self, usersyms=None): + for key, val in _syms.items(): + self._asteval.symtable[key] = val + ++ def _writer(self, msg): ++ self._asteval_msgs.append(msg) ++ + def copy(self): + """Parameters.copy() should always be a deepcopy.""" + return self.__deepcopy__(None) +@@ -433,6 +451,9 @@ def add(self, name, value=None, vary=True, min=-inf, max=inf, expr=None, + self.__setitem__(name, Parameter(value=value, name=name, vary=vary, + min=min, max=max, expr=expr, + brute_step=brute_step)) ++ if len(self._asteval.error) > 0: ++ err = self._asteval.error[0] ++ raise err.exc(err.msg) + + def add_many(self, *parlist): + """Add many parameters, using a sequence of tuples. +diff --git a/tests/test_parameters.py b/tests/test_parameters.py +index 7e12b1f0..998341e3 100644 +--- a/tests/test_parameters.py ++++ b/tests/test_parameters.py +@@ -39,8 +39,7 @@ def assert_parameter_attributes(par, expected): + def test_check_ast_errors(): + """Assert that an exception is raised upon AST errors.""" + pars = lmfit.Parameters() +- +- msg = r"at expr='<_?ast.Module object at" ++ msg = "name 'par2' is not defined" + with pytest.raises(NameError, match=msg): + pars.add('par1', expr='2.0*par2') + + +From 05fb78e8ebab8d3cc3360f3eb1ee852c8f4a7528 Mon Sep 17 00:00:00 2001 +From: reneeotten +Date: Fri, 16 Aug 2024 10:50:54 -0400 +Subject: [PATCH 4/9] DOC: tweak 'sphinx-gallery' settings + +--- + doc/conf.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/conf.py b/doc/conf.py +index 1a36156b..972b552b 100644 +--- a/doc/conf.py ++++ b/doc/conf.py +@@ -167,7 +167,7 @@ + 'examples_dirs': '../examples', + 'gallery_dirs': 'examples', + 'filename_pattern': r'(\\|/)documentation|(\\|/)example_', +- 'ignore_pattern': r'(\\|/)doc_', ++ 'ignore_pattern': 'doc_', + 'ignore_repr_types': r'matplotlib', + 'image_srcset': ["3x"], + } + +From 07d65bf8ebcf013e7b47ce0c4930aa39d7cd2cc3 Mon Sep 17 00:00:00 2001 +From: reneeotten +Date: Fri, 16 Aug 2024 10:51:28 -0400 +Subject: [PATCH 5/9] MAINT: update pre-commit hooks + +--- + .pre-commit-config.yaml | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml +index ee53e906..bad4bf3f 100644 +--- a/.pre-commit-config.yaml ++++ b/.pre-commit-config.yaml +@@ -2,7 +2,7 @@ exclude: 'doc/conf.py' + + repos: + - repo: https://github.com/asottile/pyupgrade +- rev: v3.16.0 ++ rev: v3.17.0 + hooks: + - id: pyupgrade + args: [--py38-plus] +@@ -12,18 +12,18 @@ repos: + hooks: + - id: check-ast + - id: check-builtin-literals ++ - id: check-docstring-first + - id: check-case-conflict + - id: check-merge-conflict + - id: check-toml ++ - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace +- - id: fix-encoding-pragma +- args: [--remove] + + - repo: https://github.com/PyCQA/flake8 +- rev: 7.1.0 ++ rev: 7.1.1 + hooks: + - id: flake8 + additional_dependencies: [flake8-deprecated, flake8-mutable, Flake8-pyproject] + +From 805263ddfac4f877dfd2c4e834155bd274020e3d Mon Sep 17 00:00:00 2001 +From: reneeotten +Date: Fri, 16 Aug 2024 10:53:22 -0400 +Subject: [PATCH 6/9] CI: update to latest NumPy version + +--- + azure-pipelines.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/azure-pipelines.yml b/azure-pipelines.yml +index 314d8704..01bc9d6e 100644 +--- a/azure-pipelines.yml ++++ b/azure-pipelines.yml +@@ -256,7 +256,7 @@ stages: + displayName: 'Install build, pip, setuptools, wheel, pybind11, and cython' + - script: | + export PATH=/home/vsts/.local/bin:$PATH +- export numpy_version=2.0.0 ++ export numpy_version=2.0.1 + wget https://github.com/numpy/numpy/releases/download/v${numpy_version}/numpy-${numpy_version}.tar.gz + tar xzvf numpy-${numpy_version}.tar.gz + cd numpy-${numpy_version} + +From 16f8cbd176ed5b9f5e1ac6a369c7bd75dbd5046a Mon Sep 17 00:00:00 2001 +From: reneeotten +Date: Fri, 16 Aug 2024 12:39:05 -0400 +Subject: [PATCH 7/9] BLD: remove redundant wheel dependency + +--- + pyproject.toml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index e41e844b..9578466d 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -1,5 +1,5 @@ + [build-system] +-requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] ++requires = ["setuptools>=45", "setuptools_scm>=6.2"] + build-backend = "setuptools.build_meta" + + [project] + +From d6810a558887956f598d58d9876be8fe96090d6d Mon Sep 17 00:00:00 2001 +From: reneeotten +Date: Fri, 16 Aug 2024 18:06:34 -0400 +Subject: [PATCH 8/9] DOC: update names of the documentation examples in + Gallery + +- also rename the file doc_uvars_params.py to follow the usual naming + conventions +--- + doc/doc_examples_to_gallery.py | 13 ++++++++----- + doc/model.rst | 2 +- + ...{doc_uvars_params.py => doc_parameters_uvars.py} | 4 ++-- + 3 files changed, 11 insertions(+), 8 deletions(-) + rename examples/{doc_uvars_params.py => doc_parameters_uvars.py} (96%) + +diff --git a/doc/doc_examples_to_gallery.py b/doc/doc_examples_to_gallery.py +index 4cfeb5bc..49695ffd 100755 +--- a/doc/doc_examples_to_gallery.py ++++ b/doc/doc_examples_to_gallery.py +@@ -5,7 +5,7 @@ + + - create a "documentation" directory within "examples" + - add a README.txt file +-- copy the examples from the documentation, bu remove the "doc_" from the ++- copy the examples from the documentation, removing the "doc_" from the + filename + - add the required docstring to the files for proper rendering + - copy the data files +@@ -46,12 +46,15 @@ def copy_data_files(src_dir, dest_dir): + ) + + for fn in files: ++ sname = fn.name[4:] ++ lmfit_class, *description = sname[:-3].split('_') ++ gallery_name = f"{lmfit_class.capitalize()} - {' '.join(description)}" + + script_text = fn.read_text() + +- gallery_file = examples_documentation_dir / fn.name[4:] +- msg = "" # add optional message f +- gallery_file.write_text(f'"""\n{fn.name}\n{"=" * len(fn.name)}\n\n' ++ gallery_file = examples_documentation_dir / sname ++ msg = "" # add optional message ++ gallery_file.write_text(f'"""\n{gallery_name}\n{"=" * len(gallery_name)}\n\n' + f'{msg}\n"""\n{script_text}') + + # make sure the saved Models and ModelResult are available +@@ -67,5 +70,5 @@ def copy_data_files(src_dir, dest_dir): + + os.chdir(doc_dir) + +-# # data files for the other Gallery examples ++# data files for the other Gallery examples + copy_data_files(examples_documentation_dir, doc_dir) +diff --git a/doc/model.rst b/doc/model.rst +index 5c8ae340..e5d6506a 100644 +--- a/doc/model.rst ++++ b/doc/model.rst +@@ -1166,7 +1166,7 @@ that taking correlations between Parameters into account when performing + calculations can have a noticeable influence on the resulting uncertainties. + + +-.. jupyter-execute:: ../examples/doc_uvars_params.py ++.. jupyter-execute:: ../examples/doc_parameters_uvars.py + + + Note that the :meth:`Model.post_fit` does not need to be limited to this +diff --git a/examples/doc_uvars_params.py b/examples/doc_parameters_uvars.py +similarity index 96% +rename from examples/doc_uvars_params.py +rename to examples/doc_parameters_uvars.py +index 124c3024..1c4f2da8 100644 +--- a/examples/doc_uvars_params.py ++++ b/examples/doc_parameters_uvars.py +@@ -1,4 +1,4 @@ +-# ++# + import numpy as np + + from lmfit.models import ExponentialModel, GaussianModel +@@ -67,4 +67,4 @@ def post_fit(result): + + out = mod.fit(y, pars, x=x) + print(out.fit_report(min_correl=0.5)) +-# ++# + +From ff436c270d07433a7ae404fe76bc9c627b4edc3f Mon Sep 17 00:00:00 2001 +From: reneeotten +Date: Fri, 16 Aug 2024 22:02:40 -0400 +Subject: [PATCH 9/9] BLD: remove numexpr dependency (again) + +--- + pyproject.toml | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 9578466d..cacdb8a4 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -59,7 +59,6 @@ doc = [ + "matplotlib", + "numdifftools", + "pandas", +- "numexpr", # note: Pandas appears to need numexpr to build our docs + "Pillow", + "pycairo;platform_system=='Windows'", + "Sphinx", diff --git a/python-lmfit.changes b/python-lmfit.changes new file mode 100644 index 0000000..e858646 --- /dev/null +++ b/python-lmfit.changes @@ -0,0 +1,358 @@ +------------------------------------------------------------------- +Thu Sep 5 09:41:05 UTC 2024 - Ben Greiner + +- Update to 1.3.2 + * fix typo in restoring a _buildmodel dict (PR #957, Issue #956) + * fixes for Numpy2 support (PR #959, Issue #958) + * ensure that correct initial params are used when re-fitting a + ModeRresult (PR #961, Issue #960) + * make sure that CompositeModels cannot have a prefix (PR #961, + Issue #954) + * now require asteval>=1.0 and uncertainties>=3.2.2 +- Fix requirements +- Drop support-numpy-2.patch +- Add lmfit-pr965-asteval.patch gh#lmfit/lmfit-py#965 + +------------------------------------------------------------------- +Fri Jul 5 03:01:53 UTC 2024 - Steve Kowalik + +- Update to 1.3.1: + * New features: + + add 'min_rel_change' as optional variable in calculation of confidence + intervals with Model.conf_interval(). + + Model.eval_uncertainty now takes an optional dscale parameter (default + value of 0.01) to set the step size for calculating derivatives + + add calculation of predicted_interval to Model.eval_uncertainty + * Bug fixes/enhancements: + + allow Model.eval_uncertainty to be performed with single points for x + independent variables + + allow Model._parse_param to handle older-style passed-in 'argnames' and + 'kwargs' as for variadic function + + better allow (or re-allow) Model function independent variables / keyword + arguments to be given non-default values at model creation time + + add form as independent variable for builtin Step, Rectangle, Thermal + Distribution models. + + use Model._reprstring(long=True) for model Model.__repr__(). + + restore best-fit parameter values for high accuracy values of constrained + values + + improvement to Model for the difference between Parameter, "independent + variable", and "option". + + better saving/loading saved states of Model now use dill, have several + cleanups, and are now versioned for future-proofing. + + fix bug calculating r-squared for fits with weights + + fix bug in modelresult.eval_uncertainty() after load_modelresult() + + add test for MinimizerResult.uvars after successful fit + * Maintenance/Deprecations: + + drop support for Python 3.7 + + fix tests for Python 3.12 and Python 3.13-dev + + increase minimum numpy verstio to 1.23 and scipy to 1.8. + + updates for compatibility with numpy 2.0 + + the dill package is now required +- Switch to autosetup macro. +- Add patch support-numpy-2.patch: + * Support numpy 2.0 more thoroughly. + +------------------------------------------------------------------- +Mon Aug 21 10:32:37 UTC 2023 - Markéta Machová + +- Update to 1.2.2 + * add create_params function + * add ModelResult.summary() to return many resulting fit statistics + and attributes into a JSON-able dict. + * update tests for latest versions of NumPy and SciPy. + * Coercing of user input data and independent data for Model to + float64 ndarrays is somewhat less aggressive and will not increase + the precision of numpy ndarrays + * improve Model.make_params and create_params to take optional dict + of Parameter attributes + * Outputs of residual functions, including Model._residual, are more + explicitly coerced to 1d-arrays of datatype Float64. This decreases the + expectation for the user-supplied code to return ndarrays, and increases + the tolerance for more “array-like” objects or ndarrays that are not + Float64 or 1-dimensional. + +------------------------------------------------------------------- +Fri Jan 13 15:42:09 UTC 2023 - Ben Greiner + +- Update to v1.1.0 + ## New features: + * add Pearson4Model (@lellid; PR #800) + * add SplineModel (PR #804) + * add R^2 rsquared statistic to fit outputs and reports for Model + fits (Issue #803; PR #810) + * add calculation of dely for model components of composite + models (Issue #761; PR #826) + ## Bug fixes/enhancements: + * make sure variable spercent is always defined in + params_html_table functions (reported by @MySlientWind; Issue + #768, PR #770) + * always initialize the variables success and covar the + MinimizerResult (reported by Marc W. Pound; PR #771) + * build package following PEP517/PEP518; use pyproject.toml and + setup.cfg; leave setup.py for now (PR #777) + * components used to create a CompositeModel can now have + different independent variables (@Julian-Hochhaus; Discussion + #787; PR #788) + * fixed function definition for StepModel(form='linear'), was not + consistent with the other ones (@matpompili; PR #794) + * fixed height factor for Gaussian2dModel, was not correct + (@matpompili; PR #795) + * for covariances with negative diagonal elements, we set the + covariance to None (PR #813) + * fixed linear mode for RectangleModel (@arunpersaud; Issue #815; + PR #816) + * report correct initial values for parameters with bounds (Issue + #820; PR #821) + * allow recalculation of confidence intervals (@jagerber48; PR + #798) + * include 'residual' in JSON output of ModelResult.dumps + (@mac01021; PR #830) + * supports and is tested against Python 3.11; updated minimum + required version of SciPy, NumPy, and asteval (PR #832) + ## Deprecations: + * remove support for Python 3.6 which reached EOL on 2021-12-23 + (PR #790) +- Clean check section from extra example + +------------------------------------------------------------------- +Tue Dec 28 19:11:00 UTC 2021 - Ben Greiner + +- Update to v1.0.3 + **Potentially breaking change:** + * argument ``x`` is now required for the ``guess`` method of + Models (Issue #747; PR #748) + + To get reasonable estimates for starting values one should + always supply both ``x`` and ``y`` values; in some cases it + would work when only providing ``data`` (i.e., y-values). With + the change above, ``x`` is now required in the ``guess`` method + call, so scripts might need to be updated to explicitly supply + ``x``. + **Bug fixes/enhancements:** + * do not overwrite user-specified figure titles in Model.plot() + functions and allow setting with ``title`` keyword argument (PR + #711) + * preserve Parameters subclass in deepcopy (@jenshnielsen; PR + #719) + * coerce ``data`` and ``indepdent_vars`` to NumPy array with + ``dtype=float64`` or ``dtype=complex128`` where applicable + (Issues #723 and #728) + * fix collision between parameter names in built-in models and + user-specified parameters (Issue #710 and PR #732) + * correct error message in PolynomialModel (@kremeyer; PR #737) + * improved handling of altered JSON data (Issue #739; PR #740, + reported by Matthew Giammar) + * map ``max_nfev`` to ``maxiter`` when using + ``differential_evolution`` (PR #749, reported by Olivier B.) + * correct use of noise versus experimental uncertainty in the + documentation (PR #751, reported by Andrés Zelcer) + * specify return type of ``eval`` method more precisely and allow + for plotting of (Complex)ConstantModel by coercing their + ``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:** + * update asteval dependency to >= 0.9.22 to avoid + DeprecationWarnings from NumPy v1.20.0 (PR #707) + * remove incorrectly spelled ``DonaichModel`` and ``donaich`` + lineshape, deprecated in version 1.0.1 (PR #707) + * remove occurrences of OrderedDict throughout the code; dict is + order-preserving since Python 3.6 (PR #713) + * update the contributing instructions (PR #718; @martin-majlis) + * (again) defer import of matplotlib to when it is needed + (@zobristnicholas; PR #721) + * fix description of ``name`` argument in ``Parameters.add`` + (@kristianmeyerr; PR #725) + * update dependencies, make sure a functional development + environment is installed on Windows (Issue #712) + * use ``setuptools_scm`` for version info instead of + ``versioneer`` (PR #729) + * transition to using ``f-strings`` (PR #730) + * 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) + +------------------------------------------------------------------- +Wed Feb 17 11:46:57 UTC 2021 - Ben Greiner + +- Update to version 1.0.2 + * officially supports Python 3.9 and has dropped support for + Python 3.5. The minimum version of the following dependencies + were updated: asteval>=0.9.21, numpy>=1.18, and scipy>=1.3. + New features: + * added two-dimensional Gaussian lineshape and model (PR #642; + @mpmdean) + * all built-in models are now registered in lmfit.models. + lmfit_models; new Model class attribute valid_forms (PR #663; + @rayosborn) + * added a SineModel (PR #676; @lneuhaus) + * add the run_mcmc_kwargs argument to Minimizer.emcee to pass to + the emcee.EnsembleSampler.run_mcmc function (PR #694; @rbnvrw) +- Skip python36 build: Numpy 1.20 dropped support for Python 3.6 + (NEP 29) + +------------------------------------------------------------------- +Tue Jun 16 08:44:01 UTC 2020 - Tomáš Chvátal + +- Skip two failing tests that are borked on non 64bit intel + +------------------------------------------------------------------- +Mon Jun 8 07:06:22 UTC 2020 - John Paul Adrian Glaubitz + +- Update to version 1.0.1 + + New features: + - added thermal distribution model and lineshape (PR #620; @mpmdean) + - introduced a new argument ``max_nfev`` to uniformly specify the maximum + number of function evalutions (PR #610) + **Please note: all other arguments (e.g., ``maxfev``, ``maxiter``, ...) + will no longer be passed to the underlying solver. A warning will be emitted + stating that one should use ``max_nfev``.** + - the attribute ``call_kws`` was added to the ``MinimizerResult`` class and + contains the keyword arguments that are supplied to the solver in SciPy. + + Bug fixes: + - fixes to the ``load`` and ``__setstate__`` methods of the Parameter class + - fixed failure of ModelResult.dump() due to missing attributes + (Issue #611, PR #623; @mpmdean) + - ``guess_from_peak`` function now also works correctly with decreasing + x-values or when using pandas (PRs #627 and #629; @mpmdean) + - the ``Parameter.set()`` method now correctly first updates the boundaries + and then the value (Issue #636, PR #637; @arunpersaud) + + Various: + - fixed typo for the use of expressions in the documentation + (Issue #610; @jkrogager) + - removal of PY2-compatibility and unused code and improved test + coverage (PRs #619, #631, and #633) + - removed deprecated ``isParameter`` function and automatic conversion of + an ``uncertainties`` object (PR #626) + - inaccurate FWHM calculations were removed from built-in models, others + labeled as estimates (Issue #616 and PR #630) + - corrected spelling mistake for the Doniach lineshape and model + (Issue #634; @rayosborn) + - removed unsupported/untested code for IPython notebooks in lmfit/ui/* +- from version 1.0.0 + + New features: + - no new features are introduced in 1.0.0. + + Improvements: + - support for Python 2 and use of the ``six`` package are removed. (PR #612) + + Various: + - documentation updates to clarify the use of ``emcee``. (PR #614) +- from version 0.9.15 + + New features, improvements, and bug fixes: + - move application of parameter bounds to setter instead of getter (PR #587) + - add support for non-array Jacobian types in least_squares + (Issue #588, @ezwelty in PR #589) + - add more information (i.e., acor and acceptance_fraction) about + emcee fit (@j-zimmermann in PR #593) + - "name" is now a required positional argument for Parameter class, + update the magic methods (PR #595) + - fix nvars count and bound handling in confidence interval + calculations (Issue #597, PR #598) + - support Python 3.8; requires asteval >= 0.9.16 (PR #599) + - only support emcee version 3 (i.e., no PTSampler anymore) (PR #600) + - fix and refactor prob_bunc in confidence interval calculations (PR #604) + - fix adding Parameters with custom user-defined symbols + (Issue #607, PR #608; thanks to @gbouvignies for the report) + + Various: + - bump requirements to LTS version of SciPy/ NumPy and code clean-up (PR #591) + - documentation updates (PR #596, and others) + - improve test coverage and Travis CI updates (PR #595, and others) + - update pre-commit hooks and configuration in setup.cfg + + To-be deprecated: + - function Parameter.isParameter and conversion from + uncertainties.core.Variable to value in _getval (PR #595) +- from version 0.9.14 + + New features: + - the global optimizers ``shgo`` and ``dual_annealing`` (new in SciPy v1.2) + are now supported (Issue #527; PRs #545 and #556) + - ``eval`` method added to the Parameter class (PR #550 by @zobristnicholas) + - avoid ZeroDivisionError in ``printfuncs.params_html_table`` + (PR #552 by @aaristov and PR #559) + - add parallelization to ``brute`` method (PR #564, requires SciPy v1.3) + + Bug fixes: + - consider only varying parameters when reporting potential issues with calculating + errorbars (PR #549) and compare ``value`` to both ``min`` and ``max`` (PR #571) + - guard against division by zero in lineshape functions and ``FWHM`` + and ``height`` expression calculations (PR #545) + - fix issues with restoring a saved Model (Issue #553; PR #554) + - always set ``result.method`` for ``emcee`` algorithm (PR #558) + - more careful adding of parameters to handle out-of-order + constraint expressions (Issue #560; PR #561) + - make sure all parameters in Model.guess() use prefixes (PRs #567 and #569) + - use ``inspect.signature`` for PY3 to support wrapped functions + (Issue #570; PR #576) + - fix ``result.nfev``` for ``brute`` method when using parallelization + (Issue #578; PR #579) + + Various: + - remove "missing" in the Model class (replaced by nan_policy) and "drop" + as option to nan_policy (replaced by omit) deprecated since 0.9 (PR #565). + - deprecate 'report_errors' in printfuncs.py (PR #571) + - updates to the documentation to use ``jupyter-sphinx`` to include + examples/output (PRs #573 and #575) + - include a Gallery with examples in the documentation + using ``sphinx-gallery`` (PR #574 and #583) + - improve test-coverage (PRs #571, #572 and #585) + - add/clarify warning messages when NaN values are detected (PR #586) + - several updates to docstrings (Issue #584; PR #583, and others) + - update pre-commit hooks and several docstrings +- Update BuildRequires and Requires from setup.py + +------------------------------------------------------------------- +Wed Apr 24 08:42:15 UTC 2019 - pgajdos@suse.com + +- version update to 0.9.13 + New features: + Clearer warning message in fit reports when uncertainties should + but cannot be estimated, including guesses of which Parameters + to examine (#521, #543) + SplitLorenztianModel and split_lorentzian function (#523) + HTML representations for Parameter, MinimizerResult, and Model + so that they can be printed better with Jupyter (#524, #548) + support parallelization for differential evolution (#526) + Bug fixes: + delay import of matplotlib (and so, the selection of its backend) + as late as possible (#528, #529) + fix for saving, loading, and reloading ModelResults (#534) + fix to leastsq to report the best-fit values, not the values tried + last (#535, #536) + fix synchronization of all parameter values on Model.guess() (#539, #542) + improve deprecation warnings for outdated nan_policy keywords (#540) + fix for edge case in gformat() (#547) + Project managements: + using pre-commit framework to improve and enforce coding style (#533) + added code coverage report to github main page + updated docs, github templates, added several tests. + dropped support and testing for Python 3.4. +- deleted patches + - lmfit-scipy.patch (upstreamed) + +------------------------------------------------------------------- +Tue Mar 5 14:57:02 UTC 2019 - Todd R + +- Fix spurious unit test errors. + +------------------------------------------------------------------- +Fri Jan 18 10:24:44 UTC 2019 - Tomáš Chvátal + +- Apply patch to fix build with new scipy: + * lmfit-scipy.patch + +------------------------------------------------------------------- +Fri Jan 18 10:19:27 UTC 2019 - Tomáš Chvátal + +- Update to 0.9.12: + * make exceptions explicit + * use inspect.getfullargspec for Python3 + * test-suite: use pytest features, improve coverage, fix mistakes + +------------------------------------------------------------------- +Thu Mar 22 04:46:08 UTC 2018 - toddrme2178@gmail.com + +- Initial version diff --git a/python-lmfit.spec b/python-lmfit.spec new file mode 100644 index 0000000..c598621 --- /dev/null +++ b/python-lmfit.spec @@ -0,0 +1,105 @@ +# +# spec file for package python-lmfit +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: python-lmfit +Version: 1.3.2 +Release: 0 +Summary: Least-Squares Minimization with Bounds and Constraints +License: BSD-3-Clause AND MIT +URL: https://lmfit.github.io/lmfit-py/ +Source: https://files.pythonhosted.org/packages/source/l/lmfit/lmfit-%{version}.tar.gz +# PATCH-FIX-UPSTREAM lmfit-pr965-asteval.patch gh#lmfit/lmfit-py#965 +Patch0: https://github.com/lmfit/lmfit-py/pull/965.patch#/lmfit-pr965-asteval.patch +BuildRequires: %{python_module base >= 3.8} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-asteval >= 1 +Requires: python-dill >= 0.3.4 +Requires: python-numpy >= 1.19 +Requires: python-scipy >= 1.6 +Requires: python-uncertainties >= 3.2.2 +Recommends: python-emcee +Recommends: python-matplotlib +Recommends: python-pandas +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module asteval >= 1} +BuildRequires: %{python_module dill >= 0.3.4} +BuildRequires: %{python_module flaky} +BuildRequires: %{python_module numpy >= 1.19} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module scipy >= 1.6} +BuildRequires: %{python_module uncertainties >= 3.2.2} +# /SECTION +%python_subpackages + +%description +A library for least-squares minimization and data fitting in +Python. Built on top of scipy.optimize, lmfit provides a Parameter object +which can be set as fixed or free, can have upper and/or lower bounds, or +can be written in terms of algebraic constraints of other Parameters. The +user writes a function to be minimized as a function of these Parameters, +and the scipy.optimize methods are used to find the optimal values for the +Parameters. The Levenberg-Marquardt (leastsq) is the default minimization +algorithm, and provides estimated standard errors and correlations between +varied Parameters. Other minimization methods, including Nelder-Mead's +downhill simplex, Powell's method, BFGS, Sequential Least Squares, and +others are also supported. Bounds and constraints can be placed on +Parameters for all of these methods. + +In addition, methods for explicitly calculating confidence intervals are +provided for exploring minmization problems where the approximation of +estimating Parameter uncertainties from the covariance matrix is +questionable. + +%prep +%autosetup -p1 -n lmfit-%{version} +sed -i -e '/^#!\//, 1d' lmfit/jsonutils.py +sed -i 's/--cov=lmfit --cov-report html//' pyproject.toml + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +# We don't care about speed on obs +donttest="speed" +# these tests fail on non x86_64. Upstream does not care: https://github.com/lmfit/lmfit-py/issues/692 +donttest+=" or test_model_nan_policy" +donttest+=" or test_shgo_scipy_vs_lmfit_2" +# fails on 32-bit +if [ $(getconf LONG_BIT) -ne 64 ]; then + donttest+=" or (test_itercb_minimizer_class and leastsq and False)" + donttest+=" or (test_aborted_solvers and brute)" +fi +%pytest -k "not ($donttest)" + +%files %{python_files} +%doc README.rst AUTHORS.txt +%license LICENSE +%{python_sitelib}/lmfit +%{python_sitelib}/lmfit-%{version}.dist-info + +%changelog diff --git a/support-numpy-2.patch b/support-numpy-2.patch new file mode 100644 index 0000000..3631a3a --- /dev/null +++ b/support-numpy-2.patch @@ -0,0 +1,343 @@ +From eee021f650833f0a2667315b2ab5d8351f0b1a1f Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sat, 29 Jun 2024 10:27:59 -0500 +Subject: [PATCH 1/6] clean un-serializable symbols with NumPy2 that should be + removed from asteval + +--- + lmfit/parameter.py | 31 ++++++++++++++++++++++++------- + pyproject.toml | 3 ++- + 2 files changed, 26 insertions(+), 8 deletions(-) + +diff --git a/lmfit/parameter.py b/lmfit/parameter.py +index ca9ccc72..b68584c4 100644 +--- a/lmfit/parameter.py ++++ b/lmfit/parameter.py +@@ -5,6 +5,8 @@ + + from asteval import Interpreter, get_ast_names, valid_symbol_name + from numpy import arcsin, array, cos, inf, isclose, sin, sqrt ++from numpy import version as npvers ++from packaging.version import Version + from scipy.linalg import LinAlgError + import scipy.special + from uncertainties import correlated_values, ufloat +@@ -21,6 +23,18 @@ + SCIPY_FUNCTIONS[fnc_name] = getattr(scipy.special, fnc_name) + + ++def clean_np2_symbols(user_syms): ++ """clean symbols from self._asteval.user_defined_symbols() ++ that have been deprecated in numpy 2.0 ++ This should be a short term fix, as these are removed from asteval. ++ """ ++ if Version(npvers.version) > Version('1.9'): ++ for sym in ('ogrid', 'mgrid', 'c_', 'r_', 's_', 'index_exp'): ++ if sym in user_syms: ++ user_syms.remove(sym) ++ return user_syms ++ ++ + def check_ast_errors(expr_eval): + """Check for errors derived from asteval.""" + if len(expr_eval.error) > 0: +@@ -95,7 +109,8 @@ def update(self, other): + if not isinstance(other, Parameters): + raise ValueError(f"'{other}' is not a Parameters object") + self.add_many(*other.values()) +- for sym in other._asteval.user_defined_symbols(): ++ usersyms = clean_np2_symbols(other._asteval.user_defined_symbols()) ++ for sym in usersyms: + self._asteval.symtable[sym] = other._asteval.symtable[sym] + return self + +@@ -114,7 +129,8 @@ def __deepcopy__(self, memo): + + # find the symbols that were added by users, not during construction + unique_symbols = {} +- for key in self._asteval.user_defined_symbols(): ++ usersyms = clean_np2_symbols(self._asteval.user_defined_symbols()) ++ for key in usersyms: + try: + val = deepcopy(self._asteval.symtable[key]) + unique_symbols[key] = val +@@ -161,7 +177,8 @@ def __add__(self, other): + raise ValueError(f"'{other}' is not a Parameters object") + out = deepcopy(self) + out.add_many(*other.values()) +- for sym in other._asteval.user_defined_symbols(): ++ usersyms = clean_np2_symbols(other._asteval.user_defined_symbols()) ++ for sym in usersyms: + if sym not in out._asteval.symtable: + out._asteval.symtable[sym] = other._asteval.symtable[sym] + return out +@@ -181,9 +198,9 @@ def __reduce__(self): + params = [self[k] for k in self] + + # find the symbols from _asteval.symtable, that need to be remembered. +- sym_unique = self._asteval.user_defined_symbols() ++ usersyms = clean_np2_symbols(self._asteval.user_defined_symbols()) + unique_symbols = {key: deepcopy(self._asteval.symtable[key]) +- for key in sym_unique} ++ for key in usersyms} + + return self.__class__, (), {'unique_symbols': unique_symbols, + 'params': params} +@@ -567,9 +584,9 @@ def dumps(self, **kws): + + """ + params = [p.__getstate__() for p in self.values()] +- sym_unique = self._asteval.user_defined_symbols() ++ usersyms = clean_np2_symbols(self._asteval.user_defined_symbols()) + unique_symbols = {key: encode4js(deepcopy(self._asteval.symtable[key])) +- for key in sym_unique} ++ for key in usersyms} + return json.dumps({'unique_symbols': unique_symbols, + 'params': params}, **kws) + +diff --git a/pyproject.toml b/pyproject.toml +index 623c6a2d..511e9a97 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -10,7 +10,8 @@ dependencies = [ + "numpy>=1.19", + "scipy>=1.6", + "uncertainties>=3.1.4", +- "dill>=0.3.4" ++ "dill>=0.3.4", ++ "packaging", + ] + requires-python = ">= 3.8" + authors = [ + +From 2a195ac6a375b34245f330f8e60824f564e086bd Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sat, 29 Jun 2024 10:36:34 -0500 +Subject: [PATCH 2/6] fix numpy2 deprecation + +--- + tests/test_model.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_model.py b/tests/test_model.py +index 396ea0b1..24dfbfcd 100644 +--- a/tests/test_model.py ++++ b/tests/test_model.py +@@ -900,7 +900,7 @@ def test_independent_var_parsing(self): + yatan = stepmod2.eval(pars, x=x) + + assert (yatan-yline).std() > 0.1 +- assert (yatan-yline).ptp() > 1.0 ++ assert np.ptp(yatan-yline) > 1.0 + + voigtmod = Model(voigt) + assert 'x' in voigtmod.independent_vars + +From 48d3b5f9338312078186543044fb5d0109cec429 Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sat, 29 Jun 2024 10:38:23 -0500 +Subject: [PATCH 3/6] specify numpy>=2 for latest tests + +--- + azure-pipelines.yml | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/azure-pipelines.yml b/azure-pipelines.yml +index 53c7c7f1..54f70890 100644 +--- a/azure-pipelines.yml ++++ b/azure-pipelines.yml +@@ -139,7 +139,7 @@ stages: + swig libmpc-dev + displayName: 'Install dependencies' + - script: | +- python -m pip install --upgrade build pip setuptools wheel ++ python -m pip install --upgrade build pip setuptools wheel "numpy>=2.0" + displayName: 'Install latest available version of Python dependencies' + - script: | + python -m build +@@ -183,7 +183,7 @@ stages: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + - script: | +- python -m pip install --upgrade build pip setuptools wheel ++ python -m pip install --upgrade build pip setuptools wheel "numpy>=2.0" + displayName: 'Install latest available version of Python dependencies' + - script: | + python -m build +@@ -218,7 +218,7 @@ stages: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + - script: | +- python -m pip install --upgrade build pip setuptools wheel ++ python -m pip install --upgrade build pip setuptools wheel "numpy>=2.0" + displayName: 'Install latest available version of Python dependencies' + - script: | + python -m build + +From 2a40772b20e2c1c48807c6b50d36217d72472d28 Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sat, 29 Jun 2024 10:55:24 -0500 +Subject: [PATCH 4/6] numpy2 not available for Python3.8 + +--- + azure-pipelines.yml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/azure-pipelines.yml b/azure-pipelines.yml +index 54f70890..98f8674b 100644 +--- a/azure-pipelines.yml ++++ b/azure-pipelines.yml +@@ -107,13 +107,13 @@ stages: + - script: | + ./codecov -v -f "coverage.xml" + displayName: 'Upload to codecov.io' +- + - stage: tests_latest_dependencies + dependsOn: check_codestyle + condition: succeededOrFailed() + jobs: + - job: + pool: ++ + vmImage: 'ubuntu-latest' + strategy: + matrix: +@@ -139,7 +139,7 @@ stages: + swig libmpc-dev + displayName: 'Install dependencies' + - script: | +- python -m pip install --upgrade build pip setuptools wheel "numpy>=2.0" ++ python -m pip install --upgrade build pip setuptools wheel numpy + displayName: 'Install latest available version of Python dependencies' + - script: | + python -m build + +From 4a986540dec49cc714faa726a060c5d9dda66feb Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sun, 30 Jun 2024 13:46:26 -0500 +Subject: [PATCH 5/6] remove packaging, clarify when clean_np2_symbols() can be + removed + +--- + lmfit/parameter.py | 10 +++++++--- + pyproject.toml | 1 - + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/lmfit/parameter.py b/lmfit/parameter.py +index b68584c4..56e37f94 100644 +--- a/lmfit/parameter.py ++++ b/lmfit/parameter.py +@@ -6,7 +6,6 @@ + from asteval import Interpreter, get_ast_names, valid_symbol_name + from numpy import arcsin, array, cos, inf, isclose, sin, sqrt + from numpy import version as npvers +-from packaging.version import Version + from scipy.linalg import LinAlgError + import scipy.special + from uncertainties import correlated_values, ufloat +@@ -26,9 +25,9 @@ + def clean_np2_symbols(user_syms): + """clean symbols from self._asteval.user_defined_symbols() + that have been deprecated in numpy 2.0 +- This should be a short term fix, as these are removed from asteval. ++ This function can be removed when asteval 0.9.33 is no longer supported + """ +- if Version(npvers.version) > Version('1.9'): ++ if npvers.version.startswith('2'): + for sym in ('ogrid', 'mgrid', 'c_', 'r_', 's_', 'index_exp'): + if sym in user_syms: + user_syms.remove(sym) +@@ -109,6 +108,7 @@ def update(self, other): + if not isinstance(other, Parameters): + raise ValueError(f"'{other}' is not a Parameters object") + self.add_many(*other.values()) ++ # FIXME: clear_np2_symbols() can be removed when asteval 0.9.33 is not supported + usersyms = clean_np2_symbols(other._asteval.user_defined_symbols()) + for sym in usersyms: + self._asteval.symtable[sym] = other._asteval.symtable[sym] +@@ -129,6 +129,7 @@ def __deepcopy__(self, memo): + + # find the symbols that were added by users, not during construction + unique_symbols = {} ++ # FIXME: clear_np2_symbols() can be removed when asteval 0.9.33 is not supported + usersyms = clean_np2_symbols(self._asteval.user_defined_symbols()) + for key in usersyms: + try: +@@ -177,6 +178,7 @@ def __add__(self, other): + raise ValueError(f"'{other}' is not a Parameters object") + out = deepcopy(self) + out.add_many(*other.values()) ++ # FIXME: clear_np2_symbols() can be removed when asteval 0.9.33 is not supported + usersyms = clean_np2_symbols(other._asteval.user_defined_symbols()) + for sym in usersyms: + if sym not in out._asteval.symtable: +@@ -198,6 +200,7 @@ def __reduce__(self): + params = [self[k] for k in self] + + # find the symbols from _asteval.symtable, that need to be remembered. ++ # FIXME: clear_np2_symbols() can be removed when asteval 0.9.33 is not supported + usersyms = clean_np2_symbols(self._asteval.user_defined_symbols()) + unique_symbols = {key: deepcopy(self._asteval.symtable[key]) + for key in usersyms} +@@ -584,6 +587,7 @@ def dumps(self, **kws): + + """ + params = [p.__getstate__() for p in self.values()] ++ # FIXME: clear_np2_symbols() can be removed when asteval 0.9.33 is not supported + usersyms = clean_np2_symbols(self._asteval.user_defined_symbols()) + unique_symbols = {key: encode4js(deepcopy(self._asteval.symtable[key])) + for key in usersyms} +diff --git a/pyproject.toml b/pyproject.toml +index 511e9a97..a40dad96 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -11,7 +11,6 @@ dependencies = [ + "scipy>=1.6", + "uncertainties>=3.1.4", + "dill>=0.3.4", +- "packaging", + ] + requires-python = ">= 3.8" + authors = [ + +From 8c49b0cebef3bc1e05f6c8ccf3278f1049d8cae2 Mon Sep 17 00:00:00 2001 +From: Matthew Newville +Date: Sun, 30 Jun 2024 13:47:14 -0500 +Subject: [PATCH 6/6] revert azure pipeline to not specify numpy version for + most tests + +--- + azure-pipelines.yml | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/azure-pipelines.yml b/azure-pipelines.yml +index 98f8674b..03a3b132 100644 +--- a/azure-pipelines.yml ++++ b/azure-pipelines.yml +@@ -139,7 +139,7 @@ stages: + swig libmpc-dev + displayName: 'Install dependencies' + - script: | +- python -m pip install --upgrade build pip setuptools wheel numpy ++ python -m pip install --upgrade build pip setuptools wheel + displayName: 'Install latest available version of Python dependencies' + - script: | + python -m build +@@ -183,7 +183,7 @@ stages: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + - script: | +- python -m pip install --upgrade build pip setuptools wheel "numpy>=2.0" ++ python -m pip install --upgrade build pip setuptools wheel + displayName: 'Install latest available version of Python dependencies' + - script: | + python -m build +@@ -218,7 +218,7 @@ stages: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + - script: | +- python -m pip install --upgrade build pip setuptools wheel "numpy>=2.0" ++ python -m pip install --upgrade build pip setuptools wheel + displayName: 'Install latest available version of Python dependencies' + - script: | + python -m build