More BEC-like interface for example scans

This commit is contained in:
gac-x05la
2024-11-21 16:45:16 +01:00
committed by mohacsi_i
parent f385e5c441
commit 36b0c4d4d9
3 changed files with 23 additions and 40 deletions
@@ -49,8 +49,9 @@ class AerotechDriveDataCollectionMixin(CustomDeviceMixin):
self.parent.configure(d=d)
# Stage the DDC distance module
# NOTE: This expects explicit device disabling when not configured
self.parent._switch.set("Start", settle_time=0.2).wait()
# NOTE: Scripted scans start acquiring from the scrits
if self.parent.scaninfo.scan_type not in ("script", "scripted"):
self.parent._switch.set("Start", settle_time=0.2).wait()
def on_unstage(self):
"""Standard bluesky unstage"""
+17 -33
View File
@@ -127,7 +127,7 @@ class TomcatSnapNStep(AsyncFlyScanBase):
required_kwargs = ["scan_start", "scan_end", "steps"]
gui_config = {
"Movement parameters": ["steps"],
"Acquisition parameters": ["exp_time", "exp_burst", "image_width", "image_height"],
"Acquisition parameters": ["exp_time", "exp_burst"],
}
def _get_scan_motors(self):
@@ -141,29 +141,23 @@ class TomcatSnapNStep(AsyncFlyScanBase):
exp_time:float=0.005,
settling_time:float=0.2,
exp_burst:int=1,
image_width:int=2016,
image_height:int=2016,
sync:str="event",
**kwargs,
):
# Converting generic kwargs to tomcat device configuration parameters
# Used by stdDAQ and DDC
t_modes = {"pso": 0, "event": 1, "inp0": 2, "inp1": 4}
ddc_trigger = t_modes[sync]
kwargs["parameter"]["kwargs"]["ddc_trigger"] = ddc_trigger
# Use PSO trigger (disable triggering)
kwargs["parameter"]["kwargs"]["pso_distance"] = 0
# For position calculation
# For substitution calculation
self.scan_start = scan_start
self.scan_end = scan_end
self.scan_steps = steps
self.scan_stepsize = (scan_end - scan_start) / steps
self.scan_ntotal = exp_burst * (steps + 1)
self.exp_time = exp_time
self.exp_burst = exp_burst
self.settling_time = settling_time
self.scan_sync = sync
# General device configuration
kwargs["parameter"]["kwargs"]["acq_mode"] = "ext_enable"
# Used for Aeroscript file substitutions for the task interface
filename = "AerotechSnapAndStepTemplate.ascript"
filesubs = self.get_filesubs()
@@ -228,7 +222,7 @@ class TomcatSnapNStep(AsyncFlyScanBase):
t_end = time.time()
t_elapsed = t_end - t_start
print(f"Elapsed scan time: {t_elapsed}")
logger.warning(f"Elapsed scan time: {t_elapsed}")
time.sleep(0.5)
# Collect
@@ -265,8 +259,6 @@ class TomcatSimpleSequence(AsyncFlyScanBase):
"gate_low",
"exp_time",
"exp_burst",
"image_width",
"image_height",
"sync",
],
}
@@ -283,8 +275,6 @@ class TomcatSimpleSequence(AsyncFlyScanBase):
repmode: str = "PosNeg",
exp_time: float = 0.005,
exp_burst: float = 180,
image_width: int = 2016,
image_height: int = 2016,
sync: str = "pso",
**kwargs,
):
@@ -315,13 +305,8 @@ class TomcatSimpleSequence(AsyncFlyScanBase):
else:
raise RuntimeError(f"Unsupported repetition mode: {self.scan_repmode}")
# Converting generic kwargs to tomcat device configuration parameters
# Used by DDC
t_modes = {"pso": 0, "event": 1, "inp0": 2, "inp1": 4}
ddc_trigger = t_modes[sync]
kwargs["parameter"]["kwargs"]["ddc_trigger"] = ddc_trigger
# Use PSO trigger (disable triggering)
kwargs["parameter"]["kwargs"]["pso_distance"] = 0
# General device configuration
kwargs["parameter"]["kwargs"]["acq_mode"] = "ext_enable"
# Used for Aeroscript file substitutions for the task interface
filename = "AerotechSimpleSequenceTemplate.ascript"
@@ -342,15 +327,14 @@ class TomcatSimpleSequence(AsyncFlyScanBase):
def render_file(self, filename, filesubs):
"""Prepare action: render AeroScript file"""
# Load the test file
if filename is not None:
filename = os.path.join(os.path.dirname(__file__), "../devices/aerotech/" + filename)
logger.info(f"Attempting to load file {filename}")
with open(filename) as f:
templatetext = f.read()
filename = os.path.join(os.path.dirname(__file__), "../devices/aerotech/" + filename)
logger.info(f"Attempting to load file {filename}")
with open(filename) as f:
templatetext = f.read()
# Substitute jinja template
tm = jinja2.Template(templatetext)
filetext = tm.render(scan=filesubs)
# Substitute jinja template
tm = jinja2.Template(templatetext)
filetext = tm.render(scan=filesubs)
return filetext
def scan_core(self):
@@ -369,7 +353,7 @@ class TomcatSimpleSequence(AsyncFlyScanBase):
t_end = time.time()
t_elapsed = t_end - t_start
print(f"Elapsed scan time: {t_elapsed}")
logger.warning(f"Elapsed scan time: {t_elapsed}")
time.sleep(0.5)
# Collect
+3 -5
View File
@@ -133,11 +133,9 @@ def anothersnapnstepscan(
):
"""Demo snapnstep scan with GigaFrost
This is a small BEC user-space sequence scan at the microXAS testbench
triggering a customized scripted scan on the controller. The scan uses
a pre-written custom low-level sequence scan, so it is really minimal.
NOTE: It calls the AeroScript template version.
This is a small BEC user-space scan at the microXAS testbench that handles
enabling/disabling devices before handing over to the low level scan.
The actual logic is implemented in a templated AeroScript file.
Example:
--------