Convert scan motors with step=0 to normal params
This commit is contained in:
parent
313bd8bc62
commit
e3368c1817
@ -183,8 +183,8 @@ def parse_1D(fileobj, data_type):
|
|||||||
s = defaultdict(list)
|
s = defaultdict(list)
|
||||||
|
|
||||||
match = re.search("Scanning Variables: (.*), Steps: (.*)", next(fileobj))
|
match = re.search("Scanning Variables: (.*), Steps: (.*)", next(fileobj))
|
||||||
s["scan_motors"] = [var.lower() for var in match.group(1).split(", ")]
|
motors = [motor.lower() for motor in match.group(1).split(", ")]
|
||||||
s["scan_motor"] = s["scan_motors"][0]
|
steps = [float(step) for step in match.group(2).split()]
|
||||||
|
|
||||||
match = re.search("(.*) Points, Mode: (.*), Preset (.*)", next(fileobj))
|
match = re.search("(.*) Points, Mode: (.*), Preset (.*)", next(fileobj))
|
||||||
if match.group(2) != "Monitor":
|
if match.group(2) != "Monitor":
|
||||||
@ -204,6 +204,15 @@ def parse_1D(fileobj, data_type):
|
|||||||
for name in col_names:
|
for name in col_names:
|
||||||
s[name] = np.array(s[name])
|
s[name] = np.array(s[name])
|
||||||
|
|
||||||
|
s["scan_motors"] = []
|
||||||
|
for motor, step in zip(motors, steps):
|
||||||
|
if step == 0:
|
||||||
|
# it's not a scan motor, so keep only the median value
|
||||||
|
s[motor] = np.median(s[motor])
|
||||||
|
else:
|
||||||
|
s["scan_motors"].append(motor)
|
||||||
|
s["scan_motor"] = s["scan_motors"][0]
|
||||||
|
|
||||||
# "om" -> "omega"
|
# "om" -> "omega"
|
||||||
if "om" in s["scan_motors"]:
|
if "om" in s["scan_motors"]:
|
||||||
s["scan_motors"][s["scan_motors"].index("om")] = "omega"
|
s["scan_motors"][s["scan_motors"].index("om")] = "omega"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user