From 58641ab94f34e63aabc78ce9cd9dc4ffb2ad658c Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Thu, 5 Nov 2020 14:55:25 +0100 Subject: [PATCH] Fix #17 --- pyzebra/fit2.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyzebra/fit2.py b/pyzebra/fit2.py index 7c5ba2a..7ac0c8e 100644 --- a/pyzebra/fit2.py +++ b/pyzebra/fit2.py @@ -128,10 +128,9 @@ def fitccl( ("intercept", guess[4], bool(vary[4]), constraints_min[4], constraints_max[4], None, None), ) # the weighted fit + weights = [np.abs(1 / val) if val != 0 else 1 for val in y_err] try: - result = mod.fit( - y, params, weights=[np.abs(1 / val) for val in y_err], x=x, calc_covar=True, - ) + result = mod.fit(y, params, weights=weights, x=x, calc_covar=True) except ValueError: print(f"Couldn't fit scan {scan['scan_number']}") return