Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lmfit/lmfit-py
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.3.2
Choose a base ref
...
head repository: lmfit/lmfit-py
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
58 changes: 58 additions & 0 deletions .github/ISSUE_TEMPLATE/issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: Issues
about: 'Create a bug report '
title: ''
labels: ''
assignees: ''

---

** DO NOT IGNORE **

READ THESE INSTRUCTIONS FULLY. If you have not submitted a GitHub Issue to lmfit before, read [this](https://github.com/lmfit/lmfit-py/blob/master/.github/CONTRIBUTING.md) first.

***DO NOT USE GitHub Issues for questions, it is only for bug reports***

Issues here should be concerned with errors or problems in the lmfit code. There are other places to get support and help with using lmfit or to discuss ideas about the library.

If you **think** something is an Issue, it probably is not an Issue. If the behavior you
want to report involves a fit that runs to completion without raising an exception but
that gives a result that you think is incorrect, that is almost certainly not an Issue.

Use the [mailing list](https://groups.google.com/group/lmfit-py) or [GitHub discussions
page](https://github.com/lmfit/lmfit-py/discussions) for questions about lmfit or things
you think might be problems. We don't feel obligated to spend our free time helping
people who do not respect our chosen work processes, so if you ignore this advice and post
a question as a GitHub Issue anyway, it is quite likely that your Issue will be closed and
not answered. If you have any doubt at all, do NOT submit an Issue.

To submit an Issue, you MUST provide ALL of the following information. If you delete any
of these sections, your Issue may be closed. If you think one of the sections does not
apply to your Issue, state that explicitly. We will probably disagree with you and insist
that you provide that information. If we have to ask for it twice, we will expect it to be
correct and prompt.

** Description **
Provide a short description of the issue, describe the expected outcome, and give the actual result

** A Minimal, Complete, and Verifiable example **
See, for example, https://stackoverflow.com/help/mcve on how to do this

** Fit report: **
Paste the *full* fit report here

** Error message: **
If any, paste the *full* error message inside a code block (starting from line Traceback)



** Version information: **
Generate version information with this command in the Python shell and copy the output here:
```
import sys, lmfit, numpy, scipy, asteval, uncertainties
print(f"Python: {sys.version}\n\nlmfit: {lmfit.__version__}, scipy: {scipy.__version__}, numpy: {numpy.__version__},"
f"asteval: {asteval.__version__}, uncertainties: {uncertainties.__version__}")
```

** Link(s): **
If you started a discussion on the lmfit mailing list, discussion page, or Stack Overflow, please provide the relevant link(s)
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -2,28 +2,28 @@ exclude: 'doc/conf.py'

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
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]
3 changes: 2 additions & 1 deletion AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -55,7 +55,8 @@ 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, @azelcer, Ivan Usov, and many others.
Martin Majli, Kristian Meyer, @azelcer, Ivan Usov, Ville Yrjänä, Timothy Warner
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
54 changes: 27 additions & 27 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ stages:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- script: |
python -m pip install --upgrade build pip setuptools wheel
displayName: 'Install Python build tools and dependencies'
@@ -43,7 +43,7 @@ stages:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- script: |
python -m pip install --upgrade build pip setuptools wheel
displayName: 'Install Python build tools'
@@ -67,8 +67,8 @@ stages:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'

steps:
- task: UsePythonVersion@0
@@ -82,7 +82,7 @@ stages:
displayName: 'Install dependencies'
- script: |
python -m pip install --upgrade build pip wheel
python -m pip install asteval==1.0 numpy==1.23.0 scipy==1.8.0 uncertainties==3.2.2
python -m pip install asteval==1.0 numpy==1.24.0 scipy==1.10.0 uncertainties==3.2.2
displayName: 'Install minimum required version of dependencies'
- script: |
python -m build
@@ -117,8 +117,6 @@ stages:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
@@ -127,6 +125,8 @@ stages:
python.version: '3.11'
Python312:
python.version: '3.12'
Python313:
python.version: '3.13'

steps:
- task: UsePythonVersion@0
@@ -174,8 +174,8 @@ stages:
vmImage: 'windows-latest'
strategy:
matrix:
Python312:
python.version: '3.12'
Python313:
python.version: '3.13'

steps:
- task: UsePythonVersion@0
@@ -209,8 +209,8 @@ stages:
vmImage: 'macos-latest'
strategy:
matrix:
Python312:
python.version: '3.12'
Python313:
python.version: '3.13'

steps:
- task: UsePythonVersion@0
@@ -236,13 +236,13 @@ stages:
dependsOn: check_codestyle
condition: succeededOrFailed()
jobs:
- job: Python313_dev
- job: Python314_dev
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
sudo add-apt-repository ppa:deadsnakes/nightly
sudo apt-get update && sudo apt-get install -y --no-install-recommends python3.13-dev python3.13-venv
sudo apt-get update && sudo apt-get install -y --no-install-recommends python3.14-dev python3.14-venv
displayName: Install Python development version from the deadsnakes PPA
- script: |
sudo apt-get update && sudo apt-get install -yq --no-install-suggests --no-install-recommends \
@@ -251,47 +251,47 @@ stages:
displayName: 'Install dependencies'
- script: |
export PATH=/home/vsts/.local/bin:$PATH
python3.13 -m ensurepip --upgrade
pip3.13 install -U build pip setuptools wheel pybind11 cython || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
python3.14 -m ensurepip --upgrade
pip3.14 install -U build pip setuptools wheel pybind11 cython || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
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.2.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}
python3.13 -m build || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
python3.13 -m pip install . --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
python3.14 -m build || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
python3.14 -m pip install . --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
displayName: 'Install latest available version of NumPy'
- script: |
export PATH=/home/vsts/.local/bin:$PATH
pip3.13 install -U pythran || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
pip3.14 install -U pythran || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
displayName: 'Install pythran'
- script: |
export PATH=/home/vsts/.local/bin:$PATH
export scipy_version=1.14.0
export scipy_version=1.14.1
wget https://github.com/scipy/scipy/releases/download/v${scipy_version}/scipy-${scipy_version}.tar.gz
tar xzvf scipy-${scipy_version}.tar.gz
cd scipy-${scipy_version}
python3.13 -m build || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
python3.13 -m pip install . --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
python3.14 -m build || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
python3.14 -m pip install . --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
displayName: 'Install latest available version of SciPy'
- script: |
export PATH=/home/vsts/.local/bin:$PATH
# remove numdifftools for now as it pulls in statsmodels, that wants to build with NumPy 1.14.5
pip3.13 install asteval uncertainties dill emcee flaky pytest pytest-cov || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
pip3.14 install asteval uncertainties dill emcee flaky pytest pytest-cov || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
displayName: 'Install latest available version of Python dependencies'
- script: |
python3.13 -m build
python3.13 -m pip install '.[test]' --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
python3.14 -m build
python3.14 -m pip install '.[test]' --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
displayName: 'Build wheel/sdist and install lmfit'
- script: |
export PATH=/home/vsts/.local/bin:$PATH
pip3.13 list || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
pip3.14 list || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
displayName: 'List installed Python packages'
- script: |
export PATH=/home/vsts/.local/bin:$PATH
pip3.13 install pytest-azurepipelines
pip3.14 install pytest-azurepipelines
cd $(Agent.BuildDirectory)/s/tests
pytest || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
displayName: 'Run test-suite'
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
@@ -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"],
}
13 changes: 8 additions & 5 deletions doc/doc_examples_to_gallery.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 5 additions & 1 deletion doc/faq.rst
Original file line number Diff line number Diff line change
@@ -92,7 +92,11 @@ class, which are also complex-aware.
How should I cite LMFIT?
========================

See https://dx.doi.org/10.5281/zenodo.11813
For LMFIT 1.3.2, use https://doi.org/10.5281/zenodo.12785036.

For other versions, see https://zenodo.org/records/12785036




I get errors from NaN in my fit. What can I do?
6 changes: 3 additions & 3 deletions doc/installation.rst
Original file line number Diff line number Diff line change
@@ -32,12 +32,12 @@ Downloading and Installation
Prerequisites
~~~~~~~~~~~~~

Lmfit works with `Python`_ versions 3.8 and higher. Version
Lmfit works with `Python`_ versions 3.9 and higher. Version
0.9.15 is the final version to support Python 2.7.

Lmfit requires the following Python packages, with versions given:
* `NumPy`_ version 1.23 or higher.
* `SciPy`_ version 1.8 or higher.
* `NumPy`_ version 1.24 or higher.
* `SciPy`_ version 1.10 or higher.
* `asteval`_ version 1.0 or higher.
* `uncertainties`_ version 3.2.2 or higher.
* `dill`_ version 0.3.4 or higher.
2 changes: 1 addition & 1 deletion doc/model.rst
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions doc/whatsnew.rst
Original file line number Diff line number Diff line change
@@ -11,6 +11,15 @@ significant 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_133_label:

Version 1.3.3 Release Notes
===========================

Fixes:

- fix loading spline models with more than five knots (Issue #985)


.. _whatsnew_132_label:

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <examples/doc_uvars_params.py>
# <examples/doc_parameters_uvars.py>
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))
# <end examples/doc_uvars_params.py>
# <end examples/doc_parameters_uvars.py>
Loading