New additions from klaus

This commit is contained in:
gac-x05la
2025-02-19 16:58:25 +01:00
parent 0bc3778d3f
commit 76cf6ac447
4 changed files with 41 additions and 40 deletions

View File

@@ -33,20 +33,10 @@ class AerotechTasksMixin(CustomDeviceMixin):
PSO is not needed or when it'd conflict with other devices.
"""
# Fish out our configuration from scaninfo (via explicit or generic addressing)
d = {}
if "kwargs" in self.parent.scaninfo.scan_msg.info:
scanargs = self.parent.scaninfo.scan_msg.info["kwargs"]
if self.parent.scaninfo.scan_type in ("script", "scripted"):
# NOTE: Scans don't have to fully configure the device
if "script_text" in scanargs and scanargs["script_text"] is not None:
d["script_text"] = scanargs["script_text"]
if "script_file" in scanargs and scanargs["script_file"] is not None:
d["script_file"] = scanargs["script_file"]
if "script_task" in scanargs and scanargs["script_task"] is not None:
d["script_task"] = scanargs["script_task"]
d = self.parent.scan_info.scan_msg.scan_parameters.get("aerotech_config")
# Perform bluesky-style configuration
if len(d) > 0:
if d:
# logger.warning(f"[{self.parent.name}] Configuring with:\n{d}")
self.parent.configure(d=d)

View File

@@ -6,6 +6,7 @@ Created on Thu Jun 27 17:28:43 2024
@author: mohacsi_i
"""
import copy
from time import sleep
from ophyd import Signal, Component, EpicsSignal, EpicsSignalRO, Kind, DeviceStatus
from ophyd.device import DynamicDeviceComponent
@@ -164,26 +165,25 @@ class GigaFrostCameraMixin(CustomDetectorMixin):
)
# Fish out our configuration from scaninfo (via explicit or generic addressing)
scanparam = self.parent.scaninfo.scan_msg.info
scan_msg = self.parent.scaninfo.scan_msg
scanargs = {**scan_msg.request_inputs["inputs"], **scan_msg.request_inputs["kwargs"]}
d = {}
if "kwargs" in scanparam:
scanargs = scanparam["kwargs"]
if "image_width" in scanargs and scanargs["image_width"] is not None:
d["image_width"] = scanargs["image_width"]
if "image_height" in scanargs and scanargs["image_height"] is not None:
d["image_height"] = scanargs["image_height"]
if "exp_time" in scanargs and scanargs["exp_time"] is not None:
d["exposure_time_ms"] = scanargs["exp_time"]
if "acq_time" in scanargs and scanargs["acq_time"] is not None:
d["exposure_time_ms"] = scanargs["acq_time"]
if "acq_period" in scanargs and scanargs["acq_period"] is not None:
d["exposure_period_ms"] = scanargs["acq_period"]
if "exp_burst" in scanargs and scanargs["exp_burst"] is not None:
d["exposure_num_burst"] = scanargs["exp_burst"]
if "acq_mode" in scanargs and scanargs["acq_mode"] is not None:
d["acq_mode"] = scanargs["acq_mode"]
# elif self.parent.scaninfo.scan_type == "step":
# d['acq_mode'] = "default"
if "image_width" in scanargs and scanargs["image_width"] is not None:
d["image_width"] = scanargs["image_width"]
if "image_height" in scanargs and scanargs["image_height"] is not None:
d["image_height"] = scanargs["image_height"]
if "exp_time" in scanargs and scanargs["exp_time"] is not None:
d["exposure_time_ms"] = scanargs["exp_time"]
if "acq_time" in scanargs and scanargs["acq_time"] is not None:
d["exposure_time_ms"] = scanargs["acq_time"]
if "acq_period" in scanargs and scanargs["acq_period"] is not None:
d["exposure_period_ms"] = scanargs["acq_period"]
if "exp_burst" in scanargs and scanargs["exp_burst"] is not None:
d["exposure_num_burst"] = scanargs["exp_burst"]
if "acq_mode" in scanargs and scanargs["acq_mode"] is not None:
d["acq_mode"] = scanargs["acq_mode"]
# elif self.parent.scaninfo.scan_type == "step":
# d['acq_mode'] = "default"
# Perform bluesky-style configuration
if len(d) > 0:
@@ -497,13 +497,13 @@ class GigaFrostCamera(PSIDetectorBase):
def trigger(self) -> DeviceStatus:
"""Sends a software trigger to GigaFrost"""
super().trigger()
return super().trigger()
# There's no status readback from the camera, so we just wait
sleep_time = self.cfgExposure.value * self.cfgCntNum.value * 0.001 + 0.2
logger.warning(f"Gigafrost sleeping for {sleep_time} sec")
sleep(sleep_time)
return DeviceStatus(self, done=True, success=True, settle_time=sleep_time)
# sleep_time = self.cfgExposure.value * self.cfgCntNum.value * 0.001 + 0.2
# logger.warning(f"Gigafrost sleeping for {sleep_time} sec")
# sleep(sleep_time)
# return DeviceStatus(self, done=True, success=True, settle_time=sleep_time)
def configure(self, d: dict = None):
"""Configure the next scan with the GigaFRoST camera

View File

@@ -75,8 +75,14 @@ class TomcatSnapNStep(AsyncFlyScanBase):
filename = "AerotechSnapAndStepTemplate.ascript"
filesubs = self.get_filesubs()
filetext = self.render_file(filename, filesubs)
kwargs["parameter"]["kwargs"]["script_text"] = filetext
kwargs["parameter"]["kwargs"]["script_file"] = "bec.ascript"
self.scan_parameters["aerotech_config"] = {
"script_text":filetext,
"script_file":"bec.ascript",
"script_task": 4,
}
# self.scan_parameters["script_file"] = "bec.ascript"
# kwargs["parameter"]["kwargs"]["script_text"] = filetext
# kwargs["parameter"]["kwargs"]["script_file"] = "bec.ascript"
super().__init__(
acq_time=acq_time,

View File

@@ -123,7 +123,11 @@ class AcquireWhite(Acquire):
class AcquireProjections(AsyncFlyScanBase):
scan_name = "acquire_projections"
gui_config = {"Acquisition parameters": ["exp_burst"]}
gui_config = {
"Motor": ["motor"],
"Acquisition parameters": ["sample_position_in", "start_angle", "angular_range" ],
"Camera": ["exp_time", "exp_burst"]
}
def __init__(self,
motor: DeviceBase,
@@ -131,6 +135,7 @@ class AcquireProjections(AsyncFlyScanBase):
sample_position_in: float,
start_angle: float,
angular_range: float,
exp_time:float,
**kwargs):
"""
Acquire projection images.
@@ -171,7 +176,7 @@ class AcquireProjections(AsyncFlyScanBase):
"""
self.motor = motor
super().__init__(**kwargs)
super().__init__(exp_time=exp_time,**kwargs)
self.burst_at_each_point = 1
self.sample_position_in = sample_position_in