Add option to restore original scan after merging

This commit is contained in:
2021-05-27 15:40:59 +02:00
parent 502a4b8096
commit 6c2e221595
2 changed files with 20 additions and 1 deletions

View File

@@ -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