Use a dummy UB matrix if it's absent in hdf file

This commit is contained in:
usov_i 2022-05-30 15:20:59 +02:00
parent b8cf76220c
commit 4bcfaf8c80

View File

@ -119,6 +119,9 @@ def read_detector_data(filepath, cami_meta=None):
scan["phi"] = h5f["/entry1/sample/phi"][:]
if len(scan["phi"]) == 1:
scan["phi"] = np.ones(n) * scan["phi"]
if h5f["/entry1/sample/UB"].size == 0:
scan["ub"] = np.eye(3) * 0.177
else:
scan["ub"] = h5f["/entry1/sample/UB"][:].reshape(3, 3)
scan["name"] = h5f["/entry1/sample/name"][0].decode()
scan["cell"] = h5f["/entry1/sample/cell"][:]