Update ccl_io.py

Added try except for mag_field, since some of the data dont have this value and script fails.
This commit is contained in:
JakHolzer 2020-10-30 14:10:01 +01:00 committed by GitHub
parent dbc643aba9
commit 468f33e606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,7 +187,11 @@ def parse_1D(fileobj, data_type):
print("seems hkl is not in title") print("seems hkl is not in title")
data_cols["temperature"] = metadata["temp"] data_cols["temperature"] = metadata["temp"]
try:
data_cols["mag_field"] = metadata["mf"] data_cols["mag_field"] = metadata["mf"]
except KeyError:
print("Mag_field not present in dat file")
data_cols["omega_angle"] = metadata["omega"] data_cols["omega_angle"] = metadata["omega"]
data_cols["number_of_measurements"] = len(data_cols["om"]) data_cols["number_of_measurements"] = len(data_cols["om"])
data_cols["monitor"] = data_cols["Monitor1"][0] data_cols["monitor"] = data_cols["Monitor1"][0]