File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -426,8 +426,16 @@ def handle_meta(
426426
427427 dt_list_iso = [time.replace(".", "-").replace(" ", "T") for time in time_list]
428428 datetime_list = [dt.datetime.fromisoformat(dt_iso) for dt_iso in dt_list_iso]
429- ts_from = dt.datetime.timestamp(datetime_list[0]) # POSIX timestamp
430- ts_to = dt.datetime.timestamp(datetime_list[-1]) # POSIX timestamp
429+ ts_from = dt.datetime.timestamp(min(datetime_list)) # POSIX timestamp
430+ ts_to = dt.datetime.timestamp(max(datetime_list)) # POSIX timestamp
431+ if ts_from == ts_to:
432+ try:
433+ ts_to = (
434+ ts_from
435+ + metadata["scan_info"]["Exposure"] / 1000 * metadata["scan_info"]["Averages"]
436+ )
437+ except KeyError:
438+ pass
431439 metadata["timing"] = {
432440 "acquisition_start": dt.datetime.fromtimestamp(ts_from, dt.timezone.utc).isoformat(),
433441 "acquisition_stop": dt.datetime.fromtimestamp(ts_to, dt.timezone.utc).isoformat(),
You can’t perform that action at this time.
0 commit comments