@@ -206,9 +206,10 @@ def create():
|
|||||||
monitor_spinner = Spinner(title="Monitor:", mode="int", value=100_000, low=1, width=145)
|
monitor_spinner = Spinner(title="Monitor:", mode="int", value=100_000, low=1, width=145)
|
||||||
monitor_spinner.on_change("value", monitor_spinner_callback)
|
monitor_spinner.on_change("value", monitor_spinner_callback)
|
||||||
|
|
||||||
def _update_table():
|
def _update_datatable():
|
||||||
fit_ok = [(1 if "fit" in scan else 0) for scan in det_data]
|
fit_ok = [(1 if "fit" in scan else 0) for scan in det_data]
|
||||||
scan_table_source.data.update(fit=fit_ok)
|
export = [scan.get("active", True) for scan in det_data]
|
||||||
|
scan_table_source.data.update(fit=fit_ok, export=export)
|
||||||
|
|
||||||
def _update_plot(scan):
|
def _update_plot(scan):
|
||||||
scan_motor = scan["scan_motor"]
|
scan_motor = scan["scan_motor"]
|
||||||
@@ -358,6 +359,7 @@ def create():
|
|||||||
return
|
return
|
||||||
|
|
||||||
pyzebra.merge_scans(scan_into, scan_from)
|
pyzebra.merge_scans(scan_into, scan_from)
|
||||||
|
_update_datatable()
|
||||||
_update_plot(_get_selected_scan())
|
_update_plot(_get_selected_scan())
|
||||||
|
|
||||||
merge_button = Button(label="Merge into current", width=145)
|
merge_button = Button(label="Merge into current", width=145)
|
||||||
@@ -365,6 +367,7 @@ def create():
|
|||||||
|
|
||||||
def restore_button_callback():
|
def restore_button_callback():
|
||||||
pyzebra.restore_scan(_get_selected_scan())
|
pyzebra.restore_scan(_get_selected_scan())
|
||||||
|
_update_datatable()
|
||||||
_update_plot(_get_selected_scan())
|
_update_plot(_get_selected_scan())
|
||||||
|
|
||||||
restore_button = Button(label="Restore scan", width=145)
|
restore_button = Button(label="Restore scan", width=145)
|
||||||
@@ -502,7 +505,7 @@ def create():
|
|||||||
)
|
)
|
||||||
|
|
||||||
_update_plot(_get_selected_scan())
|
_update_plot(_get_selected_scan())
|
||||||
_update_table()
|
_update_datatable()
|
||||||
|
|
||||||
proc_all_button = Button(label="Process All", button_type="primary", width=145)
|
proc_all_button = Button(label="Process All", button_type="primary", width=145)
|
||||||
proc_all_button.on_click(proc_all_button_callback)
|
proc_all_button.on_click(proc_all_button_callback)
|
||||||
@@ -519,7 +522,7 @@ def create():
|
|||||||
)
|
)
|
||||||
|
|
||||||
_update_plot(scan)
|
_update_plot(scan)
|
||||||
_update_table()
|
_update_datatable()
|
||||||
|
|
||||||
proc_button = Button(label="Process Current", width=145)
|
proc_button = Button(label="Process Current", width=145)
|
||||||
proc_button.on_click(proc_button_callback)
|
proc_button.on_click(proc_button_callback)
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ def merge_scans(scan_into, scan_from):
|
|||||||
scan_into["init_omega"] = scan_into["omega"]
|
scan_into["init_omega"] = scan_into["omega"]
|
||||||
scan_into["init_counts"] = scan_into["counts"]
|
scan_into["init_counts"] = scan_into["counts"]
|
||||||
|
|
||||||
|
if "merged_scans" not in scan_into:
|
||||||
|
scan_into["merged_scans"] = []
|
||||||
|
scan_into["merged_scans"].append(scan_from)
|
||||||
|
|
||||||
omega = np.concatenate((scan_into["omega"], scan_from["omega"]))
|
omega = np.concatenate((scan_into["omega"], scan_from["omega"]))
|
||||||
counts = np.concatenate((scan_into["counts"], scan_from["counts"]))
|
counts = np.concatenate((scan_into["counts"], scan_from["counts"]))
|
||||||
|
|
||||||
@@ -107,6 +111,11 @@ def restore_scan(scan):
|
|||||||
del scan["init_omega"]
|
del scan["init_omega"]
|
||||||
del scan["init_counts"]
|
del scan["init_counts"]
|
||||||
|
|
||||||
|
if "merged_scans" in scan:
|
||||||
|
for merged_scan in scan["merged_scans"]:
|
||||||
|
merged_scan["active"] = True
|
||||||
|
del scan["merged_scans"]
|
||||||
|
|
||||||
|
|
||||||
def fit_scan(scan, model_dict, fit_from=None, fit_to=None):
|
def fit_scan(scan, model_dict, fit_from=None, fit_to=None):
|
||||||
if fit_from is None:
|
if fit_from is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user