Skip to content

Commit

Permalink
replaced ad_r
Browse files Browse the repository at this point in the history
  • Loading branch information
ZohebShaikh committed May 3, 2024
1 parent f592309 commit 3a5c228
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 35 deletions.
4 changes: 0 additions & 4 deletions src/ophyd_async/epics/areadetector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
ImageMode,
NDAttributeDataType,
NDAttributesXML,
ad_r,
ad_rw,
)
from .vimba import VimbaDetector

Expand All @@ -19,8 +17,6 @@
"SingleTriggerDet",
"FileWriteMode",
"ImageMode",
"ad_r",
"ad_rw",
"NDAttributeDataType",
"NDAttributesXML",
"PilatusDetector",
Expand Down
10 changes: 5 additions & 5 deletions src/ophyd_async/epics/areadetector/drivers/ad_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
set_and_wait_for_value,
)

from ...signal.signal import epics_signal_rw, epics_signal_rw_rbv
from ..utils import ImageMode, ad_r
from ...signal.signal import epics_signal_r, epics_signal_rw, epics_signal_rw_rbv
from ..utils import ImageMode
from ..writers.nd_plugin import NDArrayBase


Expand Down Expand Up @@ -48,9 +48,9 @@ def __init__(self, prefix: str, name: str = "") -> None:
self.num_images = epics_signal_rw_rbv(int, prefix + "NumImages")
self.image_mode = epics_signal_rw_rbv(ImageMode, prefix + "ImageMode")
self.array_counter = epics_signal_rw_rbv(int, prefix + "ArrayCounter")
self.array_size_x = ad_r(int, prefix + "ArraySizeX")
self.array_size_y = ad_r(int, prefix + "ArraySizeY")
self.detector_state = ad_r(DetectorState, prefix + "DetectorState")
self.array_size_x = epics_signal_r(int, prefix + "ArraySizeX")
self.array_size_y = epics_signal_r(int, prefix + "ArraySizeY")
self.detector_state = epics_signal_r(DetectorState, prefix + "DetectorState")
# There is no _RBV for this one
self.wait_for_plugins = epics_signal_rw(bool, prefix + "WaitForPlugins")
super().__init__(prefix, name=name)
Expand Down
5 changes: 2 additions & 3 deletions src/ophyd_async/epics/areadetector/drivers/aravis_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from typing import Callable, Dict, Literal, Optional, Tuple

from ophyd_async.epics.areadetector.drivers import ADBase
from ophyd_async.epics.areadetector.utils import ad_r
from ophyd_async.epics.signal.signal import epics_signal_rw_rbv
from ophyd_async.epics.signal.signal import epics_signal_r, epics_signal_rw_rbv


class AravisTriggerMode(str, Enum):
Expand Down Expand Up @@ -143,7 +142,7 @@ def __init__(self, prefix: str, name: str = "") -> None:
AravisTriggerMode, prefix + "TriggerMode"
)
self.trigger_source = epics_signal_rw_rbv(str, prefix + "TriggerSource")
self.model = ad_r(str, prefix + "Model")
self.model = epics_signal_r(str, prefix + "Model")
self.pixel_format = epics_signal_rw_rbv(str, prefix + "PixelFormat")
self.dead_time: Optional[float] = None
super().__init__(prefix, name=name)
Expand Down
14 changes: 2 additions & 12 deletions src/ophyd_async/epics/areadetector/utils.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
from enum import Enum
from typing import Optional, Type
from typing import Optional
from xml.etree import cElementTree as ET

from ophyd_async.core import DEFAULT_TIMEOUT, SignalR, SignalRW, T, wait_for_value

from ..signal.signal import epics_signal_r, epics_signal_rw


def ad_rw(datatype: Type[T], prefix: str) -> SignalRW[T]:
return epics_signal_rw(datatype, prefix + "_RBV", prefix)


def ad_r(datatype: Type[T], prefix: str) -> SignalR[T]:
return epics_signal_r(datatype, prefix + "_RBV")
from ophyd_async.core import DEFAULT_TIMEOUT, SignalRW, T, wait_for_value


class FileWriteMode(str, Enum):
Expand Down
14 changes: 7 additions & 7 deletions src/ophyd_async/epics/areadetector/writers/nd_file_hdf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import Enum

from ...signal.signal import epics_signal_rw, epics_signal_rw_rbv
from ..utils import FileWriteMode, ad_r
from ...signal.signal import epics_signal_r, epics_signal_rw, epics_signal_rw_rbv
from ..utils import FileWriteMode
from .nd_plugin import NDPluginBase


Expand All @@ -24,19 +24,19 @@ def __init__(self, prefix: str, name="") -> None:
self.num_extra_dims = epics_signal_rw_rbv(int, prefix + "NumExtraDims")
self.file_path = epics_signal_rw_rbv(str, prefix + "FilePath")
self.file_name = epics_signal_rw_rbv(str, prefix + "FileName")
self.file_path_exists = ad_r(bool, prefix + "FilePathExists")
self.file_path_exists = epics_signal_r(bool, prefix + "FilePathExists")
self.file_template = epics_signal_rw_rbv(str, prefix + "FileTemplate")
self.full_file_name = ad_r(str, prefix + "FullFileName")
self.full_file_name = epics_signal_r(str, prefix + "FullFileName")
self.file_write_mode = epics_signal_rw_rbv(
FileWriteMode, prefix + "FileWriteMode"
)
self.num_capture = epics_signal_rw_rbv(int, prefix + "NumCapture")
self.num_captured = ad_r(int, prefix + "NumCaptured")
self.num_captured = epics_signal_r(int, prefix + "NumCaptured")
self.swmr_mode = epics_signal_rw_rbv(bool, prefix + "SWMRMode")
self.lazy_open = epics_signal_rw_rbv(bool, prefix + "LazyOpen")
self.capture = epics_signal_rw_rbv(bool, prefix + "Capture")
self.flush_now = epics_signal_rw(bool, prefix + "FlushNow")
self.array_size0 = ad_r(int, prefix + "ArraySize0")
self.array_size1 = ad_r(int, prefix + "ArraySize1")
self.array_size0 = epics_signal_r(int, prefix + "ArraySize0")
self.array_size1 = epics_signal_r(int, prefix + "ArraySize1")
self.xml_file_name = epics_signal_rw_rbv(str, prefix + "XMLFileName")
super().__init__(prefix, name)
6 changes: 2 additions & 4 deletions src/ophyd_async/epics/areadetector/writers/nd_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

from ophyd_async.core import Device
from ophyd_async.epics.signal import epics_signal_rw
from ophyd_async.epics.signal.signal import epics_signal_rw_rbv

from ..utils import ad_r
from ophyd_async.epics.signal.signal import epics_signal_r, epics_signal_rw_rbv


class Callback(str, Enum):
Expand All @@ -14,7 +12,7 @@ class Callback(str, Enum):

class NDArrayBase(Device):
def __init__(self, prefix: str, name: str = "") -> None:
self.unique_id = ad_r(int, prefix + "UniqueId")
self.unique_id = epics_signal_r(int, prefix + "UniqueId")
self.nd_attributes_file = epics_signal_rw(str, prefix + "NDAttributesFile")
super().__init__(name)

Expand Down

0 comments on commit 3a5c228

Please sign in to comment.