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.set(title=f"PXIII: Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
||||
|
||||
def keyword_handler(self, info: ScanInfo) -> None:
|
||||
"""Simple keyword handler
|
||||
def plot_handler(self, info: ScanInfo) -> None:
|
||||
"""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
|
||||
scans.
|
||||
"""
|
||||
print(info.scan_report_devices)
|
||||
|
||||
dev_x = info.scan_report_devices[0]
|
||||
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:
|
||||
dev_y = None
|
||||
if not dev_y:
|
||||
det = None
|
||||
if not det:
|
||||
return
|
||||
|
||||
plt1 = self.get_default_figure()
|
||||
# clear_all() will throw RPCResponseTimeoutError
|
||||
try:
|
||||
# This will throw RPCResponseTimeoutError
|
||||
plt1.clear_all()
|
||||
except RPCResponseTimeoutError:
|
||||
pass
|
||||
|
||||
# plot() will throw RPCResponseTimeoutError
|
||||
try:
|
||||
# TODO: What about 2D scans?
|
||||
# This will throw RPCResponseTimeoutError
|
||||
plt1.plot(x_name=dev_x, y_name=dev_y)
|
||||
if len(info.scan_report_devices)==2:
|
||||
# 2D plot
|
||||
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:
|
||||
pass
|
||||
try:
|
||||
# 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")
|
||||
# plt1.add_dap(dev_x, det, dap="LinearModel")
|
||||
|
||||
def handler(self, info: ScanInfo) -> None:
|
||||
"""Dock configuration handler"""
|
||||
@@ -70,4 +97,5 @@ class PlotUpdate(AutoUpdates):
|
||||
# self.run_grid_scan_update(info)
|
||||
# return
|
||||
super().handler(info)
|
||||
self.keyword_handler(info)
|
||||
self.plot_handler(info)
|
||||
|
||||
|
||||
@@ -27,10 +27,6 @@ abs_press:
|
||||
softwareTrigger: false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sldi_cenx:
|
||||
description: FE slit-diaphragm horizontal center
|
||||
deviceClass: ophyd.EpicsMotor
|
||||
|
||||
Reference in New Issue
Block a user