From fc70bdcb1386ccbd601f35c4400b706525f25d9c Mon Sep 17 00:00:00 2001 From: JakHolzer <53743814+JakHolzer@users.noreply.github.com> Date: Tue, 13 Oct 2020 18:07:47 +0200 Subject: [PATCH] Update fit2.py fixed the weighted fit --- pyzebra/fit2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyzebra/fit2.py b/pyzebra/fit2.py index 6d68a09..fdec9b1 100644 --- a/pyzebra/fit2.py +++ b/pyzebra/fit2.py @@ -157,7 +157,7 @@ def fitccl( ), ) # the weighted fit - result = mod.fit(y, params, weights=y_err, x=x, calc_covar=True) + result = mod.fit(y, params, weights=[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()