Update fit2.py

Second apology, that broke the code in another way, hopefully now its alrigh
This commit is contained in:
JakHolzer 2020-10-14 16:43:33 +02:00 committed by GitHub
parent 8bf62274c0
commit 2e737df2bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,19 +67,25 @@ def fitccl(
# return in case of more than 1 peaks
print("More than 1 peak, measurement skipped")
return
if binning is None or binning == 0 or binning == 1:
x = list(meas["om"])
y = list(meas["Counts"])
y_err = list(np.sqrt(y)) if meas.get("sigma", None) is None else list(meas["sigma"])
print(meas["peak_indexes"])
if not meas["peak_indexes"]:
centre = np.mean(x)
else:
centre = x[int(meas["peak_indexes"])]
else:
x = list(meas["om"])
if not meas["peak_indexes"]:
centre = np.mean(x)
else:
centre = x[int(meas["peak_indexes"])]
x = bin_data(x, binning)
y = list(meas["Counts"])
y_err = list(np.sqrt(y)) if meas.get("sigma", None) is None else list(meas["sigma"])
combined = bin_data(create_uncertanities(y, y_err), binning)
combined = bin_data(create_uncertanities(y,y_err), binning)
y = [combined[i].n for i in range(len(combined))]
y_err = [combined[i].s for i in range(len(combined))]