Add support for multiple scan motors
This commit is contained in:
parent
fe61d3c4cb
commit
313bd8bc62
@ -110,6 +110,8 @@ def create():
|
||||
scan_table_source.selected.indices = []
|
||||
scan_table_source.selected.indices = [0]
|
||||
|
||||
scan_motor_select.options = det_data[0]["scan_motors"]
|
||||
scan_motor_select.value = det_data[0]["scan_motor"]
|
||||
param_select.value = "user defined"
|
||||
|
||||
file_select = MultiSelect(title="Available .ccl/.dat files:", width=210, height=250)
|
||||
@ -194,6 +196,15 @@ def create():
|
||||
monitor_spinner = Spinner(title="Monitor:", mode="int", value=100_000, low=1, width=145)
|
||||
monitor_spinner.on_change("value", monitor_spinner_callback)
|
||||
|
||||
def scan_motor_select_callback(_attr, _old, new):
|
||||
if det_data:
|
||||
for scan in det_data:
|
||||
scan["scan_motor"] = new
|
||||
_update_plot()
|
||||
|
||||
scan_motor_select = Select(title="Scan motor:", options=[], width=145)
|
||||
scan_motor_select.on_change("value", scan_motor_select_callback)
|
||||
|
||||
def _update_table():
|
||||
fit_ok = [(1 if "fit" in scan else 0) for scan in det_data]
|
||||
scan_table_source.data.update(fit=fit_ok)
|
||||
@ -705,7 +716,7 @@ def create():
|
||||
column(fit_to_spinner, proc_button, proc_all_button),
|
||||
)
|
||||
|
||||
scan_layout = column(scan_table, row(monitor_spinner, param_select))
|
||||
scan_layout = column(scan_table, row(monitor_spinner, scan_motor_select, param_select))
|
||||
|
||||
import_layout = column(
|
||||
proposal_textinput,
|
||||
|
@ -159,6 +159,7 @@ def parse_1D(fileobj, data_type):
|
||||
|
||||
# "om" -> "omega"
|
||||
s["scan_motor"] = "omega"
|
||||
s["scan_motors"] = ["omega", ]
|
||||
# overwrite metadata, because it only refers to the scan center
|
||||
half_dist = (s["n_points"] - 1) / 2 * s["angle_step"]
|
||||
s["omega"] = np.linspace(s["omega"] - half_dist, s["omega"] + half_dist, s["n_points"])
|
||||
@ -182,16 +183,8 @@ def parse_1D(fileobj, data_type):
|
||||
s = defaultdict(list)
|
||||
|
||||
match = re.search("Scanning Variables: (.*), Steps: (.*)", next(fileobj))
|
||||
if match.group(1) == "h, k, l":
|
||||
steps = match.group(2).split()
|
||||
for step, ind in zip(steps, "hkl"):
|
||||
if float(step) != 0:
|
||||
scan_motor = ind
|
||||
break
|
||||
else:
|
||||
scan_motor = match.group(1)
|
||||
|
||||
s["scan_motor"] = scan_motor
|
||||
s["scan_motors"] = [var.lower() for var in match.group(1).split(", ")]
|
||||
s["scan_motor"] = s["scan_motors"][0]
|
||||
|
||||
match = re.search("(.*) Points, Mode: (.*), Preset (.*)", next(fileobj))
|
||||
if match.group(2) != "Monitor":
|
||||
@ -212,13 +205,17 @@ def parse_1D(fileobj, data_type):
|
||||
s[name] = np.array(s[name])
|
||||
|
||||
# "om" -> "omega"
|
||||
if "om" in s["scan_motors"]:
|
||||
s["scan_motors"][s["scan_motors"].index("om")] = "omega"
|
||||
if s["scan_motor"] == "om":
|
||||
s["scan_motor"] = "omega"
|
||||
s["omega"] = s["om"]
|
||||
del s["om"]
|
||||
|
||||
# "tt" -> "temp"
|
||||
elif s["scan_motor"] == "tt":
|
||||
elif "tt" in s["scan_motors"]:
|
||||
s["scan_motors"][s["scan_motors"].index("tt")] = "temp"
|
||||
if s["scan_motor"] == "tt":
|
||||
s["scan_motor"] = "temp"
|
||||
s["temp"] = s["tt"]
|
||||
del s["tt"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user