From 5c5be065be01a339077eb21dcc8e9c8a5f3a2b72 Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Fri, 6 May 2022 12:27:31 +0200 Subject: [PATCH] Adapt 'monitor' and 'omega' to new h5 file format --- pyzebra/h5.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pyzebra/h5.py b/pyzebra/h5.py index 77c7113..43e71c2 100644 --- a/pyzebra/h5.py +++ b/pyzebra/h5.py @@ -88,13 +88,17 @@ def read_detector_data(filepath, cami_meta=None): if "zebra_mode" in cami_meta: scan["zebra_mode"] = cami_meta["zebra_mode"][0] - scan["monitor"] = h5f["/entry1/control/data"][0] + if "/entry1/control/Monitor" in h5f: + scan["monitor"] = h5f["/entry1/control/Monitor"][0] + else: # old path + scan["monitor"] = h5f["/entry1/control/data"][0] + scan["idx"] = 1 - if scan["zebra_mode"] == "nb": - scan["omega"] = h5f["/entry1/area_detector2/rotation_angle"][:] - else: # bi + if "/entry1/sample/rotation_angle" in h5f: scan["omega"] = h5f["/entry1/sample/rotation_angle"][:] + else: + scan["omega"] = h5f["/entry1/area_detector2/rotation_angle"][:] scan["gamma"] = h5f["/entry1/ZEBRA/area_detector2/polar_angle"][:] scan["twotheta"] = h5f["/entry1/ZEBRA/area_detector2/polar_angle"][:]