First running scan

This commit is contained in:
gac-x05la
2024-07-09 15:30:20 +02:00
committed by mohacsi_i
parent 8936902a86
commit 35927e46d2
2 changed files with 25 additions and 10 deletions

View File

@@ -9,6 +9,7 @@ Created on Thu Jun 27 17:28:43 2024
from time import sleep
from ophyd import Device, Component, EpicsSignal, EpicsSignalRO, Kind, DeviceStatus
from ophyd.device import Staged
import warnings
try:
import gfconstants as const
@@ -388,14 +389,16 @@ class GigaFrostClient(Device):
def trigger(self) -> DeviceStatus:
"""Sends a software trigger and approximately waits to finnish"""
status = DeviceStatus(self, settle_time=2.0)
status = DeviceStatus(self)
# Soft triggering based on operation mode
if self._auto_soft_enable and self.trigger_mode=='auto' and self.enable_mode=='soft':
# BEC teststand operation mode: poedge of SoftEnable if Started
# BEC teststand operation mode: posedge of SoftEnable if Started
self.cmdSoftEnable.set(0).wait()
self.cmdSoftEnable.set(1).wait()
sleep(self.cfgFramerate.value*self.cfgCntNum.value*0.001+0.050)
sleep_time = self.cfgFramerate.value*self.cfgCntNum.value*0.001+0.050
sleep(sleep_time)
warnings.warn(f"[GF2] Slept for: {sleep_time} seconds")
else:
self.cmdSoftTrigger.set(1).wait()
status.set_finished()

View File

@@ -57,6 +57,13 @@ class StdDaqWsClient(Device):
sleep(5)
self._client = connect(self._ws_url)
def monitor(self):
self._client = connect(self._ws_url)
self._mon = Thread(target=self.poll)
self._mon.start()
def configure(self, n_images: int = None, file_path: str = None) -> tuple:
"""Set the standard DAQ parameters for the next run
@@ -165,13 +172,18 @@ class StdDaqWsClient(Device):
def poll(self):
"""Monitor status messages until connection is open"""
for msg in self._client:
try:
message = json.loads(msg)
self.status.put(message["status"], force=True)
except Exception as ex:
print(ex)
return
try:
for msg in self._client:
try:
message = json.loads(msg)
self.status.put(message["status"], force=True)
except (ConnectionClosedError, ConnectionClosedOK) as ex:
return
except Exception as ex:
print(ex)
return
finally:
self._mon = None
# Automatically connect to MicroSAXS testbench if directly invoked