Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model.make_params() sometimes ignores set a parameter with a prefix #893

Closed
newville opened this issue Jun 22, 2023 · 0 comments · Fixed by #895
Closed

Model.make_params() sometimes ignores set a parameter with a prefix #893

newville opened this issue Jun 22, 2023 · 0 comments · Fixed by #895

Comments

@newville
Copy link
Member

newville commented Jun 22, 2023

Description

This issue was shown in #892

A Minimal, Complete, and Verifiable example
from lmfit.models import GaussianModel

mod = GausssiaModel(prefix='g1_')

# this works
mod.make_params(amplitude=1, center=2000, sigma=20) 

# this fails
mod.make_params(g1_amplitude=1, g1_center=2000, g1_sigma=20) 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/..../lmfit-py/lmfit/model.py", line 703, in make_params
    setpar(par, kwargs[basename])
KeyError: 'amplitude'

Note that if a composite model was created, the g1_amplitude variation would work and be required

Fit report:
Error message:

The error is shown in #892, but repeated here:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/..../lmfit-py/lmfit/model.py", line 703, in make_params
    setpar(par, kwargs[basename])
KeyError: 'amplitude'
Version information

Latest.

Link(s)

#892

newville added a commit that referenced this issue Jun 23, 2023
@newville newville mentioned this issue Jun 23, 2023
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant