parent
48efa93234
commit
b07707b37d
@ -128,20 +128,22 @@ def fitccl(
|
|||||||
("intercept", guess[4], bool(vary[4]), constraints_min[4], constraints_max[4], None, None),
|
("intercept", guess[4], bool(vary[4]), constraints_min[4], constraints_max[4], None, None),
|
||||||
)
|
)
|
||||||
# the weighted fit
|
# the weighted fit
|
||||||
|
try:
|
||||||
result = mod.fit(
|
result = mod.fit(
|
||||||
y, params, weights=[np.abs(1 / y_err[i]) for i in range(len(y_err))], x=x, calc_covar=True
|
y, params, weights=[np.abs(1 / val) for val in y_err], x=x, calc_covar=True,
|
||||||
)
|
)
|
||||||
|
except ValueError:
|
||||||
|
return
|
||||||
|
|
||||||
if result.params["g_amp"].stderr is None:
|
if result.params["g_amp"].stderr is None:
|
||||||
result.params["g_amp"].stderr = result.params["g_amp"].value
|
result.params["g_amp"].stderr = result.params["g_amp"].value
|
||||||
elif 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
|
result.params["g_amp"].stderr = result.params["g_amp"].value
|
||||||
|
|
||||||
# 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 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
|
||||||
int_area = fit_area
|
int_area = fit_area
|
||||||
|
Loading…
x
Reference in New Issue
Block a user