From 4456dd2225d67281067782ffd4a63e56b68b0f1f Mon Sep 17 00:00:00 2001 From: Will Barnett Date: Wed, 7 Aug 2024 14:58:59 +0100 Subject: [PATCH] Pressure jump adc initial attempt based on area detector. --- src/dodal/beamlines/p38.py | 15 +++++ src/dodal/devices/pressure_jump_cell_adc.py | 63 +++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/dodal/devices/pressure_jump_cell_adc.py diff --git a/src/dodal/beamlines/p38.py b/src/dodal/beamlines/p38.py index 0157d1bca5..5ccdba94cd 100644 --- a/src/dodal/beamlines/p38.py +++ b/src/dodal/beamlines/p38.py @@ -16,6 +16,7 @@ from dodal.devices.i22.fswitch import FSwitch from dodal.devices.linkam3 import Linkam3 from dodal.devices.pressure_jump_cell import PressureJumpCell +from dodal.devices.pressure_jump_cell_adc import PressureJumpCellADC, PressureJumpAdcConfigParams from dodal.devices.slits import Slits from dodal.devices.tetramm import TetrammDetector from dodal.devices.undulator import Undulator @@ -333,3 +334,17 @@ def high_pressure_xray_cell( cell_prefix="-HPXC-01:", adc_prefix="-ADC", ) + +def high_pressure_xray_cell_adc( + wait_for_connection: bool = True, + fake_with_ophyd_sim: bool = False, + params: PressureJumpAdcConfigParams | None = None, +) -> PressureJumpCellADC: + return device_instantiation( + PressureJumpCellADC, + "high_pressure_xray_cell_adc", + "", + wait_for_connection, + fake_with_ophyd_sim, + params=params or None, + ) diff --git a/src/dodal/devices/pressure_jump_cell_adc.py b/src/dodal/devices/pressure_jump_cell_adc.py new file mode 100644 index 0000000000..63665401af --- /dev/null +++ b/src/dodal/devices/pressure_jump_cell_adc.py @@ -0,0 +1,63 @@ +from enum import Enum +from functools import partial + +from ophyd_async.core import ( + ConfigSignal, + DeviceVector, + SignalR, + StandardReadable, +) +from ophyd_async.epics.signal import epics_signal_r, epics_signal_rw + +from ophyd import ADComponent as ADC +from ophyd import ( + AreaDetector, + CamBase, + Component, + Device, + EpicsSignal, + HDF5Plugin, + OverlayPlugin, + ProcessPlugin, + ROIPlugin, + StatsPlugin, + Signal, + StatusBase, +) + +class PressureJumpAdcConfigParams: + pass + +class PressureJumpCellADC(AreaDetector): + """ + High pressure X-ray cell fast ADC, used to capture pressure jumps. + """ + cam = ADC(CamBase, "-EA-HPXC-01:CAM:") + scale = ADC(ROIPlugin, "-EA-HPXC-01:SCALE:") + # trig = # TODO support module adUtil NDPluginReframe? + # arr = # TODO support module ADCore NDPluginStdArrays? required? + hdf5 = ADC(HDF5Plugin, "-DI-OAV-01:HDF5:") + + p1Roi = ADC(ROIPlugin, "-EA-HPXC-01:ROIP1:") + p1Proc = ADC(ProcessPlugin, "-EA-HPXC-01:PROCP1:") + p1Stats = ADC(StatsPlugin, "-EA-HPXC-01:STATP1:") + + p2Roi = ADC(ROIPlugin, "-EA-HPXC-01:ROIP2:") + p2Proc = ADC(ProcessPlugin, "-EA-HPXC-01:PROCP2:") + p2Stats = ADC(StatsPlugin, "-EA-HPXC-01:STATP2:") + + p3Roi = ADC(ROIPlugin, "-EA-HPXC-01:ROIP3:") + p3Proc = ADC(ProcessPlugin, "-EA-HPXC-01:PROCP3:") + p3Stats = ADC(StatsPlugin, "-EA-HPXC-01:STATP3:") + + def __init__(self, *args, params: PressureJumpAdcConfigParams, **kwargs): + super().__init__(*args, **kwargs) + self.parameters = params + self.snapshot.oav_params = params + self.subscription_id = None + self._snapshot_trigger_subscription_id = None + + def wait_for_connection(self, all_signals=False, timeout=2): + connected = super().wait_for_connection(all_signals, timeout) + return connected +