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

add backend kwarg to spectrum.fit() #249

Merged
merged 1 commit into from
Mar 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions becquerel/core/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ def fill_between(self, **kwargs):
plotter = plotting.SpectrumPlotter(self, **kwargs)
return plotter.fill_between()

def fit(self, model, xmode, ymode, roi=None, perform_fit=True):
def fit(self, model, xmode, ymode, roi=None, perform_fit=True, backend="lmfit"):
"""Create a Fitter object based on this Spectrum and perform the fit.

Parameters
Expand All @@ -1366,6 +1366,8 @@ def fit(self, model, xmode, ymode, roi=None, perform_fit=True):
perform_fit : bool
If True, perform the fit now, otherwise, set up fitter without
performing the fit.
backend : {'lmfit', 'lmfit-pml'}
Backend fitting module to use. Only used if perform_fit=True.

Returns
-------
Expand All @@ -1380,7 +1382,7 @@ def fit(self, model, xmode, ymode, roi=None, perform_fit=True):
fitter._xmode = xmode
fitter._ymode = ymode
if perform_fit:
fitter.fit()
fitter.fit(backend=backend)
return fitter


Expand Down