Check fit results instead of excepting KeyError
This commit is contained in:
parent
a48b1f64c1
commit
2f4e097a68
@ -32,7 +32,10 @@ def export_comm(data, path, lorentz=False):
|
||||
with open(str(path + extension), "w") as out_file:
|
||||
for meas_num, meas in data["Measurements"].items():
|
||||
print(meas_num)
|
||||
try:
|
||||
if meas.get("fit") is None:
|
||||
print("Measurement skipped - no fit value for:", meas_num)
|
||||
continue
|
||||
|
||||
meas_number_str = f"{meas_num[1:]:{align}{padding[0]}}"
|
||||
h_str = f'{int(meas["h_index"]):{padding[1]}}'
|
||||
k_str = f'{int(meas["k_index"]):{padding[1]}}'
|
||||
@ -55,9 +58,7 @@ def export_comm(data, path, lorentz=False):
|
||||
angle_str3 = f'{meas["nu_angle"]:{padding[3]}}'
|
||||
angle_str4 = f'{meas["unkwn_angle"]:{padding[3]}}'
|
||||
|
||||
sigma_str = (
|
||||
f'{"{:8.2f}".format(float(meas["fit"]["g_width"][0])):{align}{padding[2]}}'
|
||||
)
|
||||
sigma_str = f'{"{:8.2f}".format(float(meas["fit"]["g_width"][0])):{align}{padding[2]}}'
|
||||
line = (
|
||||
meas_number_str
|
||||
+ h_str
|
||||
@ -72,6 +73,3 @@ def export_comm(data, path, lorentz=False):
|
||||
+ "\n"
|
||||
)
|
||||
out_file.write(line)
|
||||
|
||||
except KeyError:
|
||||
print("Measurement skipped - no fit value for:", meas_num)
|
||||
|
Loading…
x
Reference in New Issue
Block a user