Update fit2.py

added abs value to weights just in case
This commit is contained in:
JakHolzer 2020-10-13 18:15:20 +02:00 committed by GitHub
parent fc70bdcb13
commit 6886279884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,7 @@ def fitccl(
),
)
# the weighted fit
result = mod.fit(y, params, weights=[1/y_err[i] for i in range(len(y_err))], x=x, calc_covar=True)
result = mod.fit(y, params, weights=[np.abs(1/y_err[i]) for i in range(len(y_err))], x=x, calc_covar=True)
# u.ufloat to work with uncertanities
fit_area = u.ufloat(result.params["g_amp"].value, result.params["g_amp"].stderr)
comps = result.eval_components()