Update export column on scan merge/restore

For #37
This commit is contained in:
2021-08-25 15:13:00 +02:00
parent abf4750030
commit 20e99c35ba
2 changed files with 16 additions and 4 deletions

View File

@@ -206,9 +206,10 @@ def create():
monitor_spinner = Spinner(title="Monitor:", mode="int", value=100_000, low=1, width=145)
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]
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):
scan_motor = scan["scan_motor"]
@@ -358,6 +359,7 @@ def create():
return
pyzebra.merge_scans(scan_into, scan_from)
_update_datatable()
_update_plot(_get_selected_scan())
merge_button = Button(label="Merge into current", width=145)
@@ -365,6 +367,7 @@ def create():
def restore_button_callback():
pyzebra.restore_scan(_get_selected_scan())
_update_datatable()
_update_plot(_get_selected_scan())
restore_button = Button(label="Restore scan", width=145)
@@ -502,7 +505,7 @@ def create():
)
_update_plot(_get_selected_scan())
_update_table()
_update_datatable()
proc_all_button = Button(label="Process All", button_type="primary", width=145)
proc_all_button.on_click(proc_all_button_callback)
@@ -519,7 +522,7 @@ def create():
)
_update_plot(scan)
_update_table()
_update_datatable()
proc_button = Button(label="Process Current", width=145)
proc_button.on_click(proc_button_callback)

View File

@@ -85,6 +85,10 @@ def merge_scans(scan_into, scan_from):
scan_into["init_omega"] = scan_into["omega"]
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"]))
counts = np.concatenate((scan_into["counts"], scan_from["counts"]))
@@ -107,6 +111,11 @@ def restore_scan(scan):
del scan["init_omega"]
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):
if fit_from is None: