Software stepscan with GF
This commit is contained in:
@@ -6,7 +6,8 @@ Created on Thu Jun 27 17:28:43 2024
|
||||
|
||||
@author: mohacsi_i
|
||||
"""
|
||||
from ophyd import Device, Component, EpicsSignal, EpicsSignalRO, Kind
|
||||
from time import sleep
|
||||
from ophyd import Device, Component, EpicsSignal, EpicsSignalRO, Kind, DeviceStatus
|
||||
from ophyd.device import Staged
|
||||
|
||||
try:
|
||||
@@ -371,9 +372,19 @@ class GigaFrostClient(Device):
|
||||
"""Standard ophyd method to stop an acquisition"""
|
||||
self.unstage()
|
||||
|
||||
def trigger(self):
|
||||
def trigger(self) -> DeviceStatus:
|
||||
"""Sends a software trigger"""
|
||||
self.cmdSoftTrigger.set(1).wait()
|
||||
# Soft triggering based on operation mode
|
||||
if self._auto_soft_enable:
|
||||
# BEC teststand operation mode: poedge of SoftEnable if Started
|
||||
self.cmdSoftEnable.set(0).wait()
|
||||
self.cmdSoftEnable.set(1).wait()
|
||||
else:
|
||||
self.cmdSoftTrigger.set(1).wait()
|
||||
status = DeviceStatus(self, settle_time=2.0)
|
||||
status.set_finished()
|
||||
sleep(2.0)
|
||||
return status
|
||||
|
||||
@property
|
||||
def exposure_mode(self):
|
||||
|
||||
@@ -27,11 +27,11 @@ class StdDaqPreview(Device):
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
|
||||
# Status attributes
|
||||
status = Component(Signal, value="detached")
|
||||
status = Component(Signal, value="detached", kind=Kind.omitted)
|
||||
image = Component(Signal, kind=Kind.hinted)
|
||||
frame = Component(Signal, kind=Kind.hinted)
|
||||
shape = Component(Signal, kind=Kind.hinted)
|
||||
_throttle = 0.5
|
||||
shape = Component(Signal, kind=Kind.omitted)
|
||||
_throttle = 0.05
|
||||
|
||||
def __init__(
|
||||
self, *args, url: str = "tcp://129.129.95.38:20000", parent: Device = None, **kwargs
|
||||
@@ -73,12 +73,12 @@ class StdDaqPreview(Device):
|
||||
|
||||
Example:
|
||||
----------
|
||||
std.configure(throttle=0.5)
|
||||
std.configure(throttle=0.05)
|
||||
|
||||
Parameters
|
||||
----------
|
||||
throttle : float, optional
|
||||
Additional throtling for the ophyd device. (default = 0.5 sec)
|
||||
Additional throtling for the ophyd device. (default = 0.05 sec)
|
||||
"""
|
||||
self._throttle = throttle
|
||||
|
||||
@@ -127,18 +127,22 @@ class StdDaqPreview(Device):
|
||||
|
||||
t_curr = time()
|
||||
t_elapsed = t_curr - t_last
|
||||
if t_elapsed > self._throttle:
|
||||
if t_elapsed > 999999*self._throttle:
|
||||
self.frame.put(header['frame'], force=True)
|
||||
self.shape.put(header['shape'], force=True)
|
||||
self.image.put(image, force=True)
|
||||
t_last=t_curr
|
||||
#print(header)
|
||||
print(f"Frame: {header['frame']}\tMin: {np.min(image)}\tMax: {np.max(image)}")
|
||||
print(f"Frame: {header['frame']}\t<<<<<too fast>>>>>")
|
||||
else:
|
||||
print(f"Frame: {header['frame']}\tMin: {np.min(image)}\tMax: {np.max(image)}")
|
||||
|
||||
if self._stop_polling:
|
||||
self.status.set("detached", force=True)
|
||||
print("Detaching monitor")
|
||||
break
|
||||
except ValueError:
|
||||
# Happens when ZMQ partially delivers the multipart message
|
||||
pass
|
||||
except zmq.error.Again:
|
||||
sleep(0.1)
|
||||
except Exception as ex:
|
||||
|
||||
@@ -30,7 +30,7 @@ class StdDaqWsClient(Device):
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
|
||||
# Status attributes
|
||||
status = Component(Signal, value="unknown")
|
||||
status = Component(Signal, value="unknown", kind=Kind.hinted)
|
||||
n_images = Component(Signal, value=10000, kind=Kind.config)
|
||||
file_path = Component(Signal, value="/gpfs/test/test-beamline", kind=Kind.config)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user