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

Fix problems with arguments that are neither fit parameters nor independent variables #926

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lmfit/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,9 +1047,9 @@ def fit(self, data, params=None, weights=None, method='leastsq',
params[name].set(value=p)
del kwargs[name]

# All remaining kwargs should correspond to independent variables.
# Check for spurious kwargs.
for name in kwargs:
if name not in self.independent_vars:
if name not in self._func_allargs:
warnings.warn(f"The keyword argument {name} does not " +
"match any arguments of the model function. " +
"It will be ignored.", UserWarning)
Expand Down Expand Up @@ -2079,7 +2079,7 @@ def plot_fit(self, ax=None, datafmt='o', fitfmt='-', initfmt='--',
ax.plot(x_array, reduce_complex(self.data),
datafmt, label='data', **data_kws)

y_eval = self.model.eval(self.params, **{independent_var: x_array_dense})
y_eval = self.eval(self.params, **{independent_var: x_array_dense})
if isinstance(self.model, (lmfit.models.ConstantModel,
lmfit.models.ComplexConstantModel)):
y_eval *= np.ones(x_array_dense.size)
Expand Down