Keyword scans for 2D
This commit is contained in:
@@ -24,41 +24,68 @@ class PlotUpdate(AutoUpdates):
|
|||||||
# plt = self.figure.plot(dev_x, dev_y)
|
# plt = self.figure.plot(dev_x, dev_y)
|
||||||
# plt.set(title=f"PXIII: Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
# plt.set(title=f"PXIII: Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
||||||
|
|
||||||
def keyword_handler(self, info: ScanInfo) -> None:
|
def plot_handler(self, info: ScanInfo) -> None:
|
||||||
"""Simple keyword handler
|
"""Simple keyword handler for 'plot'
|
||||||
|
|
||||||
This simple keyword handler looks for the keyword 'datasource' in the scan arguments.
|
This simple keyword handler looks for the keyword 'plot' in the scan arguments.
|
||||||
This allows the user to explictly specify the desired data source. Useful for alignment
|
This allows the user to explictly specify the desired data source. Useful for alignment
|
||||||
scans.
|
scans.
|
||||||
"""
|
"""
|
||||||
|
print(info.scan_report_devices)
|
||||||
|
|
||||||
dev_x = info.scan_report_devices[0]
|
dev_x = info.scan_report_devices[0]
|
||||||
if "kwargs" in self._scan_msg.info:
|
if "kwargs" in self._scan_msg.info:
|
||||||
dev_y = self._scan_msg.info["kwargs"].get("datasource", None)
|
det = self._scan_msg.info["kwargs"].get("plot", None)
|
||||||
else:
|
else:
|
||||||
dev_y = None
|
det = None
|
||||||
if not dev_y:
|
if not det:
|
||||||
return
|
return
|
||||||
|
|
||||||
plt1 = self.get_default_figure()
|
plt1 = self.get_default_figure()
|
||||||
|
# clear_all() will throw RPCResponseTimeoutError
|
||||||
try:
|
try:
|
||||||
# This will throw RPCResponseTimeoutError
|
|
||||||
plt1.clear_all()
|
plt1.clear_all()
|
||||||
except RPCResponseTimeoutError:
|
except RPCResponseTimeoutError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# plot() will throw RPCResponseTimeoutError
|
||||||
try:
|
try:
|
||||||
# TODO: What about 2D scans?
|
if len(info.scan_report_devices)==2:
|
||||||
# This will throw RPCResponseTimeoutError
|
# 2D plot
|
||||||
plt1.plot(x_name=dev_x, y_name=dev_y)
|
dev_x = info.scan_report_devices[0]
|
||||||
|
dev_y = info.scan_report_devices[1]
|
||||||
|
plt1.plot(
|
||||||
|
x_name=dev_x,
|
||||||
|
y_name=dev_y,
|
||||||
|
z_name=det,
|
||||||
|
title=f"Scan {info.scan_number}",
|
||||||
|
x_label=dev_x,
|
||||||
|
y_label=dev_y,
|
||||||
|
z_label=det
|
||||||
|
)
|
||||||
|
elif len(info.scan_report_devices)==1:
|
||||||
|
# 1D plot
|
||||||
|
dev_x = info.scan_report_devices[0]
|
||||||
|
plt1.plot(
|
||||||
|
x_name=dev_x,
|
||||||
|
y_name=det,
|
||||||
|
title=f"Scan {info.scan_number}",
|
||||||
|
x_label=dev_x,
|
||||||
|
y_label=det,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Default is 1D
|
||||||
|
dev_x = info.scan_report_devices[0]
|
||||||
|
plt1.plot(
|
||||||
|
x_name=dev_x,
|
||||||
|
y_name=det,
|
||||||
|
title=f"Scan {info.scan_number}",
|
||||||
|
x_label=dev_x,
|
||||||
|
y_label=det,
|
||||||
|
)
|
||||||
except RPCResponseTimeoutError:
|
except RPCResponseTimeoutError:
|
||||||
pass
|
pass
|
||||||
try:
|
# plt1.add_dap(dev_x, det, dap="LinearModel")
|
||||||
# This will throw RPCResponseTimeoutError
|
|
||||||
plt1.set(title=f"PXIII: Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
|
||||||
except RPCResponseTimeoutError:
|
|
||||||
pass
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
# plt1.add_dap(dev_x, dev_y, dap="LinearModel")
|
|
||||||
|
|
||||||
def handler(self, info: ScanInfo) -> None:
|
def handler(self, info: ScanInfo) -> None:
|
||||||
"""Dock configuration handler"""
|
"""Dock configuration handler"""
|
||||||
@@ -70,4 +97,5 @@ class PlotUpdate(AutoUpdates):
|
|||||||
# self.run_grid_scan_update(info)
|
# self.run_grid_scan_update(info)
|
||||||
# return
|
# return
|
||||||
super().handler(info)
|
super().handler(info)
|
||||||
self.keyword_handler(info)
|
self.plot_handler(info)
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ abs_press:
|
|||||||
softwareTrigger: false
|
softwareTrigger: false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sldi_cenx:
|
sldi_cenx:
|
||||||
description: FE slit-diaphragm horizontal center
|
description: FE slit-diaphragm horizontal center
|
||||||
deviceClass: ophyd.EpicsMotor
|
deviceClass: ophyd.EpicsMotor
|
||||||
|
|||||||
Reference in New Issue
Block a user