Update fit2.py

Added check for stderr of fit area which can be None in case fit failure and can break the rest of the code.
This commit is contained in:
JakHolzer 2020-10-06 16:47:00 +02:00 committed by GitHub
parent b4a0f43695
commit ca5579ddd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,6 +142,11 @@ def fitccl(
# u.ufloat to work with uncertanities # u.ufloat to work with uncertanities
fit_area = u.ufloat(result.params["g_amp"].value, result.params["g_amp"].stderr) fit_area = u.ufloat(result.params["g_amp"].value, result.params["g_amp"].stderr)
comps = result.eval_components() comps = result.eval_components()
if result.params["g_amp"].stderr is None:
result.params["g_amp"].stderr = result.params["g_amp"].value
elif result.params["g_amp"].stderr > result.params["g_amp"].value:
result.params["g_amp"].stderr = result.params["g_amp"].value
if len(meas["peak_indexes"]) == 0: if len(meas["peak_indexes"]) == 0:
# for case of no peak, there is no reason to integrate, therefore fit and int are equal # for case of no peak, there is no reason to integrate, therefore fit and int are equal