From 780e64d81d0d6814486251c62457bfbeeb994faa Mon Sep 17 00:00:00 2001 From: gac-x05la Date: Thu, 25 Jul 2024 17:58:17 +0200 Subject: [PATCH] Half of GFClient instantiates --- .../device_configs/microxas_test_bed.yaml | 29 +++--- .../devices/gigafrost/gigafrostclient.py | 88 +++++++++++++++++-- 2 files changed, 96 insertions(+), 21 deletions(-) diff --git a/tomcat_bec/device_configs/microxas_test_bed.yaml b/tomcat_bec/device_configs/microxas_test_bed.yaml index 1fef45e..8edf221 100644 --- a/tomcat_bec/device_configs/microxas_test_bed.yaml +++ b/tomcat_bec/device_configs/microxas_test_bed.yaml @@ -107,21 +107,20 @@ gf2: readoutPriority: monitored softwareTrigger: true -#gf2: -# description: GigaFrost camera controls -# deviceClass: tomcat_bec.devices.gigafrost.gigafrostclient.GigaFrostClient -# deviceConfig: -# prefix: 'X02DA-CAM-GF2:' -# backend_url: 'http://xbl-daq-28:8080' -# auto_soft_enable: true -# deviceTags: -# - camera -# enabled: true -# onFailure: buffer -# readOnly: false -# readoutPriority: monitored -# softwareTrigger: true - +gfclient: + description: GigaFrost camera controls + deviceClass: tomcat_bec.devices.gigafrost.gigafrostclient.GigaFrostClient + deviceConfig: + prefix: 'X02DA-CAM-GF2:' + backend_url: 'http://xbl-daq-28:8080' + auto_soft_enable: true + deviceTags: + - camera + enabled: true + onFailure: buffer + readOnly: false + readoutPriority: monitored + softwareTrigger: true daq: description: Standard DAQ controls diff --git a/tomcat_bec/devices/gigafrost/gigafrostclient.py b/tomcat_bec/devices/gigafrost/gigafrostclient.py index 27f6df0..cced95a 100644 --- a/tomcat_bec/devices/gigafrost/gigafrostclient.py +++ b/tomcat_bec/devices/gigafrost/gigafrostclient.py @@ -6,7 +6,6 @@ Created on Thu Jun 27 17:28:43 2024 @author: mohacsi_i """ -import sys from time import sleep from ophyd import Device, Component, EpicsSignal, EpicsSignalRO, Kind, DeviceStatus from ophyd.device import Staged @@ -16,16 +15,21 @@ from ophyd_devices.interfaces.base_classes.psi_detector_base import ( PSIDetectorBase, ) +try: + import gfconstants as const +except ModuleNotFoundError: + import tomcat_bec.devices.gigafrost.gfconstants as const + try: from StdDaqClient import StdDaqClient except ModuleNotFoundError: - from tomcat_bec.devices.gigafrost.StdDaqClient import StdDaqClient + from tomcat_bec.devices.gigafrost.stddaq_ws import StdDaqWsClient try: - from gfcamera import GigaFrostCamera + from gigafrostcamera import GigaFrostCamera except ModuleNotFoundError: - from tomcat_bec.devices.gigafrost.gfcamera import GigaFrostCamera + from tomcat_bec.devices.gigafrost.gigafrostcamera import GigaFrostCamera @@ -219,8 +223,80 @@ class GigaFrostClient(PSIDetectorBase): """ # pylint: disable=too-many-instance-attributes - cam = Component(GigaFrostCamera, "", auto_monitor=True) - daq = Component(StdDaqClient, "", auto_monitor=True) + cam = Component(GigaFrostCamera, prefix="X02DA-CAM-GF2:", name="cam") + #daq = Component(StdDaqWsClient, "") + + def __init__( + self, + prefix="", + *, + name, + auto_soft_enable=False, + backend_url=const.BE999_DAFL_CLIENT, + kind=None, + read_attrs=None, + configuration_attrs=None, + parent=None, + **kwargs, + ): + + self.__class__.__dict__["cam"].kwargs.update({'backend_url':"http://xbl-daq-28:8080",}) + self.__class__.__dict__["cam"].kwargs.update({'auto_soft_enable': True}) + + + + + + + super().__init__( + prefix=prefix, + name=name, + kind=kind, + read_attrs=read_attrs, + configuration_attrs=configuration_attrs, + parent=parent, + **kwargs, + ) + + + + def configure(self, d: dict=None, **kwargs): + """Configure the next scan with the GigaFRoST camera + + Parameters + ---------- + nimages : int, optional + Number of images to be taken during each scan. Set to -1 for an + unlimited number of images (limited by the ringbuffer size and + backend speed). (default = 10) + exposure : float, optional + Exposure time [ms]. (default = 0.2) + period : float, optional + Exposure period [ms], ignored in soft trigger mode. (default = 1.0) + roix : int, optional + ROI size in the x-direction [pixels] (default = 2016) + roiy : int, optional + ROI size in the y-direction [pixels] (default = 2016) + scanid : int, optional + Scan identification number to be associated with the scan data + (default = 0) + correction_mode : int, optional + The correction to be applied to the imaging data. The following + modes are available (default = 5): + + * 0: Bypass. No corrections are applied to the data. + * 1: Send correction factor A instead of pixel values + * 2: Send correction factor B instead of pixel values + * 3: Send correction factor C instead of pixel values + * 4: Invert pixel values, but do not apply any linearity correction + * 5: Apply the full linearity correction + """ + # If Bluesky style configure + old = self.read_configuration() + self.cam.configure(d) + self.daq.configure(d) + new = self.read_configuration() + return old, new def stage(self): px_daq_h = self.daq.config.cfg_image_pixel_height.get()