Add option to restore original scan after merging
This commit is contained in:
parent
502a4b8096
commit
6c2e221595
@ -343,6 +343,13 @@ def create():
|
||||
merge_button = Button(label="Merge scans", width=145)
|
||||
merge_button.on_click(merge_button_callback)
|
||||
|
||||
def restore_button_callback():
|
||||
pyzebra.restore_scan(_get_selected_scan())
|
||||
_update_plot(_get_selected_scan())
|
||||
|
||||
restore_button = Button(label="Restore scan", width=145)
|
||||
restore_button.on_click(restore_button_callback)
|
||||
|
||||
def fit_from_spinner_callback(_attr, _old, new):
|
||||
fit_from_span.location = new
|
||||
|
||||
@ -567,7 +574,7 @@ def create():
|
||||
|
||||
scan_layout = column(
|
||||
scan_table,
|
||||
monitor_spinner,
|
||||
row(monitor_spinner, column(Spacer(height=19), restore_button)),
|
||||
row(column(Spacer(height=19), merge_button), merge_into_select, merge_from_select),
|
||||
)
|
||||
|
||||
|
@ -76,6 +76,10 @@ def merge_datasets(dataset_into, dataset_from):
|
||||
|
||||
def merge_scans(scan_into, scan_from):
|
||||
# TODO: does it need to be "scan_motor" instead of omega for a generalized solution?
|
||||
if "init_omega" not in scan_into:
|
||||
scan_into["init_omega"] = scan_into["omega"]
|
||||
scan_into["init_counts"] = scan_into["counts"]
|
||||
|
||||
omega = np.concatenate((scan_into["omega"], scan_from["omega"]))
|
||||
counts = np.concatenate((scan_into["counts"], scan_from["counts"]))
|
||||
|
||||
@ -91,6 +95,14 @@ def merge_scans(scan_into, scan_from):
|
||||
print(f'Merging scans: {scan_into["idx"]} ({fname1}) <-- {scan_from["idx"]} ({fname2})')
|
||||
|
||||
|
||||
def restore_scan(scan):
|
||||
if "init_omega" in scan:
|
||||
scan["omega"] = scan["init_omega"]
|
||||
scan["counts"] = scan["init_counts"]
|
||||
del scan["init_omega"]
|
||||
del scan["init_counts"]
|
||||
|
||||
|
||||
def fit_scan(scan, model_dict, fit_from=None, fit_to=None):
|
||||
if fit_from is None:
|
||||
fit_from = -np.inf
|
||||
|
Loading…
x
Reference in New Issue
Block a user