lbl-anp / becquerel

Becquerel is a Python package for analyzing nuclear spectroscopic measurements.
Other
43 stars 16 forks source link

ErfModel fails unless coupled to a GaussModel #305

Closed jvavrek closed 2 years ago

jvavrek commented 2 years ago

The guess() method of ErfModel defines its guess for its sigma parameter by looking for an existing parameter called gauss_sigma:

(f"{self.prefix}sigma", "expr", "gauss_sigma")

But if your peak is an expgauss, then it won't find anything, and it'll error out. Is there a more robust guess we can use?

Tagging @cosama

cosama commented 2 years ago

That was not intended to be like that. We especially moved to a GaussErfModel to be able to couple the two. They were separated earlier in the development of the fitting module, but we thought it was odd to have it coupled.

I would use a guess similar to the gaussian case:

sigma = xspan * width_ratio / 10.0

with an additional arguement to the guess function of something like width_ratio=0.5.

Side note: Not sure about that factor of 10. That seems kind of a random choice as well, it could (should?) just be absorbed into the width_ratio. If I hear width_ratio I would not guess that it will be divided by 10 for some reason.

I can file a pull request later.