Allow fitting of measurements without peaks

This commit is contained in:
usov_i 2020-10-16 16:43:43 +02:00
parent 23c8a573d7
commit 6337afb4c3

View File

@ -154,8 +154,17 @@ def create():
(params["g_amp"].value - fit["int_area"].n) / params["g_amp"].value,
)
)
numfit_min_span.location = x[fit["numfit"][0]]
numfit_max_span.location = x[fit["numfit"][1]]
numfit_min, numfit_max = fit["numfit"]
if numfit_min is None:
numfit_min_span.location = None
else:
numfit_min_span.location = x[numfit_min]
if numfit_max is None:
numfit_max_span.location = None
else:
numfit_max_span.location = x[numfit_max]
else:
plot_gauss_source.data.update(x=[], y=[])
plot_bkg_source.data.update(x=[], y=[])
@ -334,8 +343,6 @@ def create():
def fit_all_button_callback():
for meas in det_data["meas"].values():
num_of_peaks = meas.get("num_of_peaks")
if num_of_peaks is not None and num_of_peaks == 1:
pyzebra.fitccl(
meas,
guess=[
@ -380,8 +387,6 @@ def create():
sel_ind = meas_table_source.selected.indices[-1]
meas = meas_table_source.data["measurement"][sel_ind]
num_of_peaks = det_data["meas"][meas].get("num_of_peaks")
if num_of_peaks is not None and num_of_peaks == 1:
pyzebra.fitccl(
det_data["meas"][meas],
guess=[