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

adds ability to pass kwargs to guess_param_defaults in Fitter #378

Merged
merged 10 commits into from
Mar 13, 2024

Conversation

cosama
Copy link
Contributor

@cosama cosama commented Jul 27, 2023

This quick fix, adds the ability to call

fitter.guess_param_defaults(...)

before fitting a module to change the default parameters of the guess. Parameters can be passed to the various components simply by referencing them with their prefix. Calling the following code:

import becquerel as bq

model = bq.fitting.GaussModel

fitter = bq.Fitter(
    model,
    ...
)

fitter.guess_param_defaults(gauss_width_ratio=0.05, update=True)

fitter.fit(backend="lmfit-pml")

for example will use the proper width_ratio in the model.guess(...) function, instead of the default value as done right now.

The current behavior -- ignoring all kwarg arguments -- looks like a bug to me.

Additionally I also added the ability to the ExpGauss model to create a left tailing distribution, by selecting gamma as negative. So far we only were able to define right tailing distributions.

@markbandstra
Copy link
Member

Please add a test or two to cover these changes.

becquerel/core/fitting.py Outdated Show resolved Hide resolved
@cosama cosama merged commit 56264bb into main Mar 13, 2024
22 checks passed
@cosama cosama deleted the fix_fit_comp_guess branch March 13, 2024 22:10
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 this pull request may close these issues.

2 participants