Consolidate temp, mf and zebra_mode naming
This commit is contained in:
parent
239949b7c0
commit
e09538eaeb
@ -99,15 +99,15 @@ def create():
|
||||
image_glyph.color_mapper.low = im_min
|
||||
image_glyph.color_mapper.high = im_max
|
||||
|
||||
if "magnetic_field" in det_data:
|
||||
magnetic_field_spinner.value = det_data["magnetic_field"][index]
|
||||
if "mf" in det_data:
|
||||
mf_spinner.value = det_data["mf"][index]
|
||||
else:
|
||||
magnetic_field_spinner.value = None
|
||||
mf_spinner.value = None
|
||||
|
||||
if "temperature" in det_data:
|
||||
temperature_spinner.value = det_data["temperature"][index]
|
||||
if "temp" in det_data:
|
||||
temp_spinner.value = det_data["temp"][index]
|
||||
else:
|
||||
temperature_spinner.value = None
|
||||
temp_spinner.value = None
|
||||
|
||||
gamma, nu = calculate_pol(det_data, index)
|
||||
omega = np.ones((IMAGE_H, IMAGE_W)) * det_data["omega"][index]
|
||||
@ -158,7 +158,11 @@ def create():
|
||||
index_spinner.value = 0
|
||||
index_spinner.high = det_data["data"].shape[0] - 1
|
||||
|
||||
geometry_textinput.value = det_data["zebra_mode"]
|
||||
zebra_mode = det_data["zebra_mode"]
|
||||
if zebra_mode == "nb":
|
||||
geometry_textinput.value = "normal beam"
|
||||
else: # zebra_mode == "bi"
|
||||
geometry_textinput.value = "bisecting"
|
||||
|
||||
update_image(0)
|
||||
update_overview_plot()
|
||||
@ -553,10 +557,10 @@ def create():
|
||||
selection_button = Button(label="Add selection")
|
||||
selection_button.on_click(selection_button_callback)
|
||||
|
||||
magnetic_field_spinner = Spinner(
|
||||
mf_spinner = Spinner(
|
||||
title="Magnetic field:", format="0.00", width=145, disabled=True
|
||||
)
|
||||
temperature_spinner = Spinner(title="Temperature:", format="0.00", width=145, disabled=True)
|
||||
temp_spinner = Spinner(title="Temperature:", format="0.00", width=145, disabled=True)
|
||||
geometry_textinput = TextInput(title="Geometry:", disabled=True)
|
||||
|
||||
# Final layout
|
||||
@ -571,7 +575,7 @@ def create():
|
||||
),
|
||||
)
|
||||
hkl_layout = column(geometry_textinput, hkl_button)
|
||||
params_layout = row(magnetic_field_spinner, temperature_spinner)
|
||||
params_layout = row(mf_spinner, temp_spinner)
|
||||
|
||||
layout_controls = row(
|
||||
column(selection_button, selection_list),
|
||||
@ -617,10 +621,10 @@ def calculate_hkl(det_data, index):
|
||||
ub = det_data["UB"]
|
||||
geometry = det_data["zebra_mode"]
|
||||
|
||||
if geometry == "bisecting":
|
||||
if geometry == "bi":
|
||||
chi = det_data["chi"][index]
|
||||
phi = det_data["phi"][index]
|
||||
elif geometry == "normal beam":
|
||||
elif geometry == "nb":
|
||||
chi = 0
|
||||
phi = 0
|
||||
else:
|
||||
|
@ -74,8 +74,8 @@ CCL_SECOND_LINE = (
|
||||
("n_points", int),
|
||||
("angle_step", float),
|
||||
("monitor", float),
|
||||
("temperature", float),
|
||||
("mag_field", float),
|
||||
("temp", float),
|
||||
("mf", float),
|
||||
("date", str),
|
||||
("time", str),
|
||||
("scan_type", str),
|
||||
@ -180,11 +180,11 @@ def parse_1D(fileobj, data_type):
|
||||
|
||||
s["om"] = np.array(s["om"])
|
||||
|
||||
s["temperature"] = metadata["temp"]
|
||||
s["temp"] = metadata["temp"]
|
||||
try:
|
||||
s["mag_field"] = metadata["mf"]
|
||||
s["mf"] = metadata["mf"]
|
||||
except KeyError:
|
||||
print("Mag_field not present in dat file")
|
||||
print("Magnetic field is not present in dat file")
|
||||
|
||||
s["omega"] = metadata["omega"]
|
||||
s["n_points"] = len(s["om"])
|
||||
|
@ -53,13 +53,9 @@ def read_detector_data(filepath):
|
||||
det_data = {"data": data}
|
||||
|
||||
if "/entry1/zebra_mode" in h5f:
|
||||
zebra_mode = h5f["/entry1/zebra_mode"][0].decode()
|
||||
if zebra_mode == "nb":
|
||||
det_data["zebra_mode"] = "normal beam"
|
||||
else:
|
||||
det_data["zebra_mode"] = "bisecting"
|
||||
det_data["zebra_mode"] = h5f["/entry1/zebra_mode"][0].decode()
|
||||
else:
|
||||
det_data["zebra_mode"] = "normal beam"
|
||||
det_data["zebra_mode"] = "nb"
|
||||
|
||||
# om, sometimes ph
|
||||
if det_data["zebra_mode"] == "nb":
|
||||
@ -85,9 +81,9 @@ def read_detector_data(filepath):
|
||||
|
||||
# optional parameters
|
||||
if "/entry1/sample/magnetic_field" in h5f:
|
||||
det_data["magnetic_field"] = h5f["/entry1/sample/magnetic_field"][:]
|
||||
det_data["mf"] = h5f["/entry1/sample/magnetic_field"][:]
|
||||
|
||||
if "/entry1/sample/temperature" in h5f:
|
||||
det_data["temperature"] = h5f["/entry1/sample/temperature"][:]
|
||||
det_data["temp"] = h5f["/entry1/sample/temperature"][:]
|
||||
|
||||
return det_data
|
||||
|
@ -118,15 +118,15 @@ def check_temp_mag(scan1, scan2):
|
||||
mag_diff = 0.001
|
||||
truth_list = list()
|
||||
try:
|
||||
if abs(abs(scan1["mag_field"]) - abs(scan2["mag_field"])) <= mag_diff:
|
||||
if abs(abs(scan1["mf"]) - abs(scan2["mf"])) <= mag_diff:
|
||||
truth_list.append(True)
|
||||
else:
|
||||
truth_list.append(False)
|
||||
except KeyError:
|
||||
print("mag_field missing")
|
||||
print("Magnetic field is missing")
|
||||
|
||||
try:
|
||||
if abs(abs(scan1["temperature"]) - abs(scan2["temperature"])) <= temp_diff:
|
||||
if abs(abs(scan1["temp"]) - abs(scan2["temp"])) <= temp_diff:
|
||||
truth_list.append(True)
|
||||
else:
|
||||
truth_list.append(False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user