From 904f7dd244513b93ae7c84d4da9cd280754e9004 Mon Sep 17 00:00:00 2001 From: jennmald Date: Fri, 22 Nov 2024 16:00:01 -0500 Subject: [PATCH] update all src files with capitalized enums --- src/ophyd_async/core/_detector.py | 18 ++--- .../epics/adaravis/_aravis_controller.py | 14 ++-- src/ophyd_async/epics/adaravis/_aravis_io.py | 8 +-- src/ophyd_async/epics/adcore/_core_io.py | 42 +++++------ src/ophyd_async/epics/adcore/_core_logic.py | 2 +- src/ophyd_async/epics/adcore/_hdf_writer.py | 2 +- .../epics/adcore/_single_trigger.py | 2 +- src/ophyd_async/epics/adcore/_utils.py | 70 +++++++++---------- .../epics/adkinetix/_kinetix_controller.py | 14 ++-- .../epics/adkinetix/_kinetix_io.py | 14 ++-- src/ophyd_async/epics/adpilatus/_pilatus.py | 6 +- .../epics/adpilatus/_pilatus_io.py | 10 +-- .../epics/adsimdetector/_sim_controller.py | 4 +- .../epics/advimba/_vimba_controller.py | 28 ++++---- src/ophyd_async/epics/advimba/_vimba_io.py | 46 ++++++------ src/ophyd_async/epics/demo/_sensor.py | 4 +- .../epics/eiger/_eiger_controller.py | 8 +-- src/ophyd_async/epics/eiger/_eiger_io.py | 6 +- src/ophyd_async/epics/testing/_example_ioc.py | 6 +- src/ophyd_async/fastcs/panda/_block.py | 18 ++--- src/ophyd_async/fastcs/panda/_control.py | 4 +- src/ophyd_async/fastcs/panda/_trigger.py | 14 ++-- 22 files changed, 170 insertions(+), 170 deletions(-) diff --git a/src/ophyd_async/core/_detector.py b/src/ophyd_async/core/_detector.py index d2990c9fc8..507c33f50e 100644 --- a/src/ophyd_async/core/_detector.py +++ b/src/ophyd_async/core/_detector.py @@ -30,13 +30,13 @@ class DetectorTrigger(StrictEnum): """Type of mechanism for triggering a detector to take frames""" #: Detector generates internal trigger for given rate - internal = "internal" + INTERNAL = "internal" #: Expect a series of arbitrary length trigger signals - edge_trigger = "edge_trigger" + EDGE_TRIGGER = "edge_trigger" #: Expect a series of constant width external gate signals - constant_gate = "constant_gate" + CONSTANT_GATE = "constant_gate" #: Expect a series of variable width external gate signals - variable_gate = "variable_gate" + VARIABLE_GATE = "variable_gate" class TriggerInfo(BaseModel): @@ -53,7 +53,7 @@ class TriggerInfo(BaseModel): #: - 3 times for final flat field images number_of_triggers: NonNegativeInt | list[NonNegativeInt] #: Sort of triggers that will be sent - trigger: DetectorTrigger = Field(default=DetectorTrigger.internal) + trigger: DetectorTrigger = Field(default=DetectorTrigger.INTERNAL) #: What is the minimum deadtime between triggers deadtime: float | None = Field(default=None, ge=0) #: What is the maximum high time of the triggers @@ -265,14 +265,14 @@ async def trigger(self) -> None: await self.prepare( TriggerInfo( number_of_triggers=1, - trigger=DetectorTrigger.internal, + trigger=DetectorTrigger.INTERNAL, deadtime=None, livetime=None, frame_timeout=None, ) ) assert self._trigger_info - assert self._trigger_info.trigger is DetectorTrigger.internal + assert self._trigger_info.trigger is DetectorTrigger.INTERNAL # Arm the detector and wait for it to finish. indices_written = await self.writer.get_indices_written() await self.controller.arm() @@ -303,7 +303,7 @@ async def prepare(self, value: TriggerInfo) -> None: Args: value: TriggerInfo describing how to trigger the detector """ - if value.trigger != DetectorTrigger.internal: + if value.trigger != DetectorTrigger.INTERNAL: assert ( value.deadtime ), "Deadtime must be supplied when in externally triggered mode" @@ -323,7 +323,7 @@ async def prepare(self, value: TriggerInfo) -> None: self._describe, _ = await asyncio.gather( self.writer.open(value.multiplier), self.controller.prepare(value) ) - if value.trigger != DetectorTrigger.internal: + if value.trigger != DetectorTrigger.INTERNAL: await self.controller.arm() self._fly_start = time.monotonic() diff --git a/src/ophyd_async/epics/adaravis/_aravis_controller.py b/src/ophyd_async/epics/adaravis/_aravis_controller.py index ee75affe4d..7c79b4b955 100644 --- a/src/ophyd_async/epics/adaravis/_aravis_controller.py +++ b/src/ophyd_async/epics/adaravis/_aravis_controller.py @@ -31,9 +31,9 @@ def get_deadtime(self, exposure: float | None) -> float: async def prepare(self, trigger_info: TriggerInfo): if trigger_info.total_number_of_triggers == 0: - image_mode = adcore.ImageMode.continuous + image_mode = adcore.ImageMode.CONTINUOUS else: - image_mode = adcore.ImageMode.multiple + image_mode = adcore.ImageMode.MULTIPLE if (exposure := trigger_info.livetime) is not None: await self._drv.acquire_time.set(exposure) @@ -58,9 +58,9 @@ def _get_trigger_info( self, trigger: DetectorTrigger ) -> tuple[AravisTriggerMode, AravisTriggerSource]: supported_trigger_types = ( - DetectorTrigger.constant_gate, - DetectorTrigger.edge_trigger, - DetectorTrigger.internal, + DetectorTrigger.CONSTANT_GATE, + DetectorTrigger.EDGE_TRIGGER, + DetectorTrigger.INTERNAL, ) if trigger not in supported_trigger_types: raise ValueError( @@ -68,8 +68,8 @@ def _get_trigger_info( f"types: {supported_trigger_types} but was asked to " f"use {trigger}" ) - if trigger == DetectorTrigger.internal: - return AravisTriggerMode.off, AravisTriggerSource.freerun + if trigger == DetectorTrigger.INTERNAL: + return AravisTriggerMode.OFF, AravisTriggerSource.FREERUN else: return (AravisTriggerMode.on, f"Line{self.gpio_number}") # type: ignore diff --git a/src/ophyd_async/epics/adaravis/_aravis_io.py b/src/ophyd_async/epics/adaravis/_aravis_io.py index e16beb41f4..40db8e2aec 100644 --- a/src/ophyd_async/epics/adaravis/_aravis_io.py +++ b/src/ophyd_async/epics/adaravis/_aravis_io.py @@ -6,8 +6,8 @@ class AravisTriggerMode(StrictEnum): """GigEVision GenICAM standard: on=externally triggered""" - on = "On" - off = "Off" + ON = "On" + OFF = "Off" """A minimal set of TriggerSources that must be supported by the underlying record. @@ -20,8 +20,8 @@ class AravisTriggerMode(StrictEnum): class AravisTriggerSource(SubsetEnum): - freerun = "Freerun" - line1 = "Line1" + FREERUN = "Freerun" + LINE1 = "Line1" class AravisDriverIO(adcore.ADBaseIO): diff --git a/src/ophyd_async/epics/adcore/_core_io.py b/src/ophyd_async/epics/adcore/_core_io.py index 97332d9a15..8f231b425e 100644 --- a/src/ophyd_async/epics/adcore/_core_io.py +++ b/src/ophyd_async/epics/adcore/_core_io.py @@ -9,8 +9,8 @@ class Callback(StrictEnum): - Enable = "Enable" - Disable = "Disable" + ENABLE = "Enable" + DISABLE = "Disable" class NDArrayBaseIO(Device): @@ -72,17 +72,17 @@ class DetectorState(StrictEnum): See definition in ADApp/ADSrc/ADDriver.h in https://github.com/areaDetector/ADCore """ - Idle = "Idle" - Acquire = "Acquire" - Readout = "Readout" - Correct = "Correct" - Saving = "Saving" - Aborting = "Aborting" - Error = "Error" - Waiting = "Waiting" - Initializing = "Initializing" - Disconnected = "Disconnected" - Aborted = "Aborted" + IDLE = "Idle" + ACQUIRE = "Acquire" + READOUT = "Readout" + CORRECT = "Correct" + SAVING = "Saving" + ABORTING = "Aborting" + ERROR = "Error" + WAITING = "Waiting" + INITIALIZING = "Initializing" + DISCONNECTED = "Disconnected" + ABORTED = "Aborted" class ADBaseIO(NDArrayBaseIO): @@ -99,14 +99,14 @@ def __init__(self, prefix: str, name: str = "") -> None: class Compression(StrictEnum): - none = "None" - nbit = "N-bit" - szip = "szip" - zlib = "zlib" - blosc = "Blosc" - bslz4 = "BSLZ4" - lz4 = "LZ4" - jpeg = "JPEG" + NONE = "None" + NBIT = "N-bit" + SZIP = "szip" + ZLIB = "zlib" + BLOSC = "Blosc" + BSLZ4 = "BSLZ4" + LZ4 = "LZ4" + JPEG = "JPEG" class NDFileHDFIO(NDPluginBaseIO): diff --git a/src/ophyd_async/epics/adcore/_core_logic.py b/src/ophyd_async/epics/adcore/_core_logic.py index e927717046..54e642a081 100644 --- a/src/ophyd_async/epics/adcore/_core_logic.py +++ b/src/ophyd_async/epics/adcore/_core_logic.py @@ -14,7 +14,7 @@ # Default set of states that we should consider "good" i.e. the acquisition # is complete and went well DEFAULT_GOOD_STATES: frozenset[DetectorState] = frozenset( - [DetectorState.Idle, DetectorState.Aborted] + [DetectorState.IDLE, DetectorState.ABORTED] ) diff --git a/src/ophyd_async/epics/adcore/_hdf_writer.py b/src/ophyd_async/epics/adcore/_hdf_writer.py index 7d9bfd2b11..c33be0f8f5 100644 --- a/src/ophyd_async/epics/adcore/_hdf_writer.py +++ b/src/ophyd_async/epics/adcore/_hdf_writer.py @@ -67,7 +67,7 @@ async def open(self, multiplier: int = 1) -> dict[str, DataKey]: self.hdf.file_path.set(str(info.directory_path)), self.hdf.file_name.set(info.filename), self.hdf.file_template.set("%s/%s.h5"), - self.hdf.file_write_mode.set(FileWriteMode.stream), + self.hdf.file_write_mode.set(FileWriteMode.STREAM), # Never use custom xml layout file but use the one defined # in the source code file NDFileHDF5LayoutXML.cpp self.hdf.xml_file_name.set(""), diff --git a/src/ophyd_async/epics/adcore/_single_trigger.py b/src/ophyd_async/epics/adcore/_single_trigger.py index 165204d371..e3caa40af2 100644 --- a/src/ophyd_async/epics/adcore/_single_trigger.py +++ b/src/ophyd_async/epics/adcore/_single_trigger.py @@ -34,7 +34,7 @@ def __init__( @AsyncStatus.wrap async def stage(self) -> None: await asyncio.gather( - self.drv.image_mode.set(ImageMode.single), + self.drv.image_mode.set(ImageMode.SINGLE), self.drv.wait_for_plugins.set(True), ) await super().stage() diff --git a/src/ophyd_async/epics/adcore/_utils.py b/src/ophyd_async/epics/adcore/_utils.py index bedbd474c2..ec56efb723 100644 --- a/src/ophyd_async/epics/adcore/_utils.py +++ b/src/ophyd_async/epics/adcore/_utils.py @@ -11,42 +11,42 @@ class ADBaseDataType(StrictEnum): - Int8 = "Int8" - UInt8 = "UInt8" - Int16 = "Int16" - UInt16 = "UInt16" - Int32 = "Int32" - UInt32 = "UInt32" - Int64 = "Int64" - UInt64 = "UInt64" - Float32 = "Float32" - Float64 = "Float64" + INT8 = "Int8" + UINT8 = "UInt8" + INT16 = "Int16" + UINT16 = "UInt16" + INT32 = "Int32" + UINT32 = "UInt32" + INT64 = "Int64" + UINT64 = "UInt64" + FLOAT32 = "Float32" + FLOAT64 = "Float64" def convert_ad_dtype_to_np(ad_dtype: ADBaseDataType) -> str: ad_dtype_to_np_dtype = { - ADBaseDataType.Int8: "|i1", - ADBaseDataType.UInt8: "|u1", - ADBaseDataType.Int16: " str: _pvattribute_to_ad_datatype = { - "DBR_SHORT": ADBaseDataType.Int16, - "DBR_ENUM": ADBaseDataType.Int16, - "DBR_INT": ADBaseDataType.Int32, - "DBR_LONG": ADBaseDataType.Int32, - "DBR_FLOAT": ADBaseDataType.Float32, - "DBR_DOUBLE": ADBaseDataType.Float64, + "DBR_SHORT": ADBaseDataType.INT16, + "DBR_ENUM": ADBaseDataType.INT16, + "DBR_INT": ADBaseDataType.INT32, + "DBR_LONG": ADBaseDataType.INT32, + "DBR_FLOAT": ADBaseDataType.FLOAT32, + "DBR_DOUBLE": ADBaseDataType.FLOAT64, } if datatype in ["DBR_STRING", "DBR_CHAR"]: np_datatype = "s40" @@ -62,9 +62,9 @@ def convert_pv_dtype_to_np(datatype: str) -> str: def convert_param_dtype_to_np(datatype: str) -> str: _paramattribute_to_ad_datatype = { - "INT": ADBaseDataType.Int32, - "INT64": ADBaseDataType.Int64, - "DOUBLE": ADBaseDataType.Float64, + "INT": ADBaseDataType.INT32, + "INT64": ADBaseDataType.INT64, + "DOUBLE": ADBaseDataType.FLOAT64, } if datatype in ["STRING"]: np_datatype = "s40" @@ -79,15 +79,15 @@ def convert_param_dtype_to_np(datatype: str) -> str: class FileWriteMode(StrictEnum): - single = "Single" - capture = "Capture" - stream = "Stream" + SINGLE = "Single" + CAPTURE = "Capture" + STREAM = "Stream" class ImageMode(StrictEnum): - single = "Single" - multiple = "Multiple" - continuous = "Continuous" + SINGLE = "Single" + MULTIPLE = "Multiple" + CONTINUOUS = "Continuous" class NDAttributeDataType(StrictEnum): diff --git a/src/ophyd_async/epics/adkinetix/_kinetix_controller.py b/src/ophyd_async/epics/adkinetix/_kinetix_controller.py index 7bc142d321..53dbb9a029 100644 --- a/src/ophyd_async/epics/adkinetix/_kinetix_controller.py +++ b/src/ophyd_async/epics/adkinetix/_kinetix_controller.py @@ -11,10 +11,10 @@ from ._kinetix_io import KinetixDriverIO, KinetixTriggerMode KINETIX_TRIGGER_MODE_MAP = { - DetectorTrigger.internal: KinetixTriggerMode.internal, - DetectorTrigger.constant_gate: KinetixTriggerMode.gate, - DetectorTrigger.variable_gate: KinetixTriggerMode.gate, - DetectorTrigger.edge_trigger: KinetixTriggerMode.edge, + DetectorTrigger.INTERNAL: KinetixTriggerMode.INTERNAL, + DetectorTrigger.CONSTANT_GATE: KinetixTriggerMode.GATE, + DetectorTrigger.VARIABLE_GATE: KinetixTriggerMode.GATE, + DetectorTrigger.EDGE_TRIGGER: KinetixTriggerMode.EDGE, } @@ -33,11 +33,11 @@ async def prepare(self, trigger_info: TriggerInfo): await asyncio.gather( self._drv.trigger_mode.set(KINETIX_TRIGGER_MODE_MAP[trigger_info.trigger]), self._drv.num_images.set(trigger_info.total_number_of_triggers), - self._drv.image_mode.set(adcore.ImageMode.multiple), + self._drv.image_mode.set(adcore.ImageMode.MULTIPLE), ) if trigger_info.livetime is not None and trigger_info.trigger not in [ - DetectorTrigger.variable_gate, - DetectorTrigger.constant_gate, + DetectorTrigger.VARIABLE_GATE, + DetectorTrigger.CONSTANT_GATE, ]: await self._drv.acquire_time.set(trigger_info.livetime) diff --git a/src/ophyd_async/epics/adkinetix/_kinetix_io.py b/src/ophyd_async/epics/adkinetix/_kinetix_io.py index bbe53eb410..d2fda58562 100644 --- a/src/ophyd_async/epics/adkinetix/_kinetix_io.py +++ b/src/ophyd_async/epics/adkinetix/_kinetix_io.py @@ -4,16 +4,16 @@ class KinetixTriggerMode(StrictEnum): - internal = "Internal" - edge = "Rising Edge" - gate = "Exp. Gate" + INTERNAL = "Internal" + EDGE = "Rising Edge" + GATE = "Exp. Gate" class KinetixReadoutMode(StrictEnum): - sensitivity = 1 - speed = 2 - dynamic_range = 3 - sub_electron = 4 + SENSITIVITY = 1 + SPEED = 2 + DYNAMIC_RANGE = 3 + SUB_ELECTRON = 4 class KinetixDriverIO(adcore.ADBaseIO): diff --git a/src/ophyd_async/epics/adpilatus/_pilatus.py b/src/ophyd_async/epics/adpilatus/_pilatus.py index 113b780fa2..89c464c145 100644 --- a/src/ophyd_async/epics/adpilatus/_pilatus.py +++ b/src/ophyd_async/epics/adpilatus/_pilatus.py @@ -17,10 +17,10 @@ class PilatusReadoutTime(float, Enum): """Pilatus readout time per model in ms""" # Cite: https://media.dectris.com/User_Manual-PILATUS2-V1_4.pdf - pilatus2 = 2.28e-3 + PILATUS2 = 2.28e-3 # Cite: https://media.dectris.com/user-manual-pilatus3-2020.pdf - pilatus3 = 0.95e-3 + PILATUS3 = 0.95e-3 class PilatusDetector(StandardDetector): @@ -33,7 +33,7 @@ def __init__( self, prefix: str, path_provider: PathProvider, - readout_time: PilatusReadoutTime = PilatusReadoutTime.pilatus3, + readout_time: PilatusReadoutTime = PilatusReadoutTime.PILATUS3, drv_suffix: str = "cam1:", hdf_suffix: str = "HDF1:", name: str = "", diff --git a/src/ophyd_async/epics/adpilatus/_pilatus_io.py b/src/ophyd_async/epics/adpilatus/_pilatus_io.py index 093398ec61..54c69f72c8 100644 --- a/src/ophyd_async/epics/adpilatus/_pilatus_io.py +++ b/src/ophyd_async/epics/adpilatus/_pilatus_io.py @@ -4,11 +4,11 @@ class PilatusTriggerMode(StrictEnum): - internal = "Internal" - ext_enable = "Ext. Enable" - ext_trigger = "Ext. Trigger" - mult_trigger = "Mult. Trigger" - alignment = "Alignment" + INTERNAL = "Internal" + EXT_ENABLE = "Ext. Enable" + EXT_TRIGGER = "Ext. Trigger" + MULT_TRIGGER = "Mult. Trigger" + ALIGNMENT = "Alignment" class PilatusDriverIO(adcore.ADBaseIO): diff --git a/src/ophyd_async/epics/adsimdetector/_sim_controller.py b/src/ophyd_async/epics/adsimdetector/_sim_controller.py index cf10674f12..84b458c78b 100644 --- a/src/ophyd_async/epics/adsimdetector/_sim_controller.py +++ b/src/ophyd_async/epics/adsimdetector/_sim_controller.py @@ -26,14 +26,14 @@ def get_deadtime(self, exposure: float | None) -> float: async def prepare(self, trigger_info: TriggerInfo): assert ( - trigger_info.trigger == DetectorTrigger.internal + trigger_info.trigger == DetectorTrigger.INTERNAL ), "fly scanning (i.e. external triggering) is not supported for this device" self.frame_timeout = ( DEFAULT_TIMEOUT + await self.driver.acquire_time.get_value() ) await asyncio.gather( self.driver.num_images.set(trigger_info.total_number_of_triggers), - self.driver.image_mode.set(adcore.ImageMode.multiple), + self.driver.image_mode.set(adcore.ImageMode.MULTIPLE), ) async def arm(self): diff --git a/src/ophyd_async/epics/advimba/_vimba_controller.py b/src/ophyd_async/epics/advimba/_vimba_controller.py index 69aba6bf39..b96e5a208d 100644 --- a/src/ophyd_async/epics/advimba/_vimba_controller.py +++ b/src/ophyd_async/epics/advimba/_vimba_controller.py @@ -11,17 +11,17 @@ from ._vimba_io import VimbaDriverIO, VimbaExposeOutMode, VimbaOnOff, VimbaTriggerSource TRIGGER_MODE = { - DetectorTrigger.internal: VimbaOnOff.off, - DetectorTrigger.constant_gate: VimbaOnOff.on, - DetectorTrigger.variable_gate: VimbaOnOff.on, - DetectorTrigger.edge_trigger: VimbaOnOff.on, + DetectorTrigger.INTERNAL: VimbaOnOff.OFF, + DetectorTrigger.CONSTANT_GATE: VimbaOnOff.ON, + DetectorTrigger.VARIABLE_GATE: VimbaOnOff.ON, + DetectorTrigger.EDGE_TRIGGER: VimbaOnOff.ON, } EXPOSE_OUT_MODE = { - DetectorTrigger.internal: VimbaExposeOutMode.timed, - DetectorTrigger.constant_gate: VimbaExposeOutMode.trigger_width, - DetectorTrigger.variable_gate: VimbaExposeOutMode.trigger_width, - DetectorTrigger.edge_trigger: VimbaExposeOutMode.timed, + DetectorTrigger.INTERNAL: VimbaExposeOutMode.TIMED, + DetectorTrigger.CONSTANT_GATE: VimbaExposeOutMode.TRIGGER_WIDTH, + DetectorTrigger.VARIABLE_GATE: VimbaExposeOutMode.TRIGGER_WIDTH, + DetectorTrigger.EDGE_TRIGGER: VimbaExposeOutMode.TIMED, } @@ -41,17 +41,17 @@ async def prepare(self, trigger_info: TriggerInfo): self._drv.trigger_mode.set(TRIGGER_MODE[trigger_info.trigger]), self._drv.exposure_mode.set(EXPOSE_OUT_MODE[trigger_info.trigger]), self._drv.num_images.set(trigger_info.total_number_of_triggers), - self._drv.image_mode.set(adcore.ImageMode.multiple), + self._drv.image_mode.set(adcore.ImageMode.MULTIPLE), ) if trigger_info.livetime is not None and trigger_info.trigger not in [ - DetectorTrigger.variable_gate, - DetectorTrigger.constant_gate, + DetectorTrigger.VARIABLE_GATE, + DetectorTrigger.CONSTANT_GATE, ]: await self._drv.acquire_time.set(trigger_info.livetime) - if trigger_info.trigger != DetectorTrigger.internal: - self._drv.trigger_source.set(VimbaTriggerSource.line1) + if trigger_info.trigger != DetectorTrigger.INTERNAL: + self._drv.trigger_source.set(VimbaTriggerSource.LINE1) else: - self._drv.trigger_source.set(VimbaTriggerSource.freerun) + self._drv.trigger_source.set(VimbaTriggerSource.FREERUN) async def arm(self): self._arm_status = await adcore.start_acquiring_driver_and_ensure_status( diff --git a/src/ophyd_async/epics/advimba/_vimba_io.py b/src/ophyd_async/epics/advimba/_vimba_io.py index c95a873831..82d877d136 100644 --- a/src/ophyd_async/epics/advimba/_vimba_io.py +++ b/src/ophyd_async/epics/advimba/_vimba_io.py @@ -4,44 +4,44 @@ class VimbaPixelFormat(StrictEnum): - internal = "Mono8" - ext_enable = "Mono12" - ext_trigger = "Ext. Trigger" - mult_trigger = "Mult. Trigger" - alignment = "Alignment" + INTERNAL = "Mono8" + EXT_ENABLE = "Mono12" + EXT_TRIGGER = "Ext. Trigger" + MULT_TRIGGER = "Mult. Trigger" + ALIGNMENT = "Alignment" class VimbaConvertFormat(StrictEnum): - none = "None" - mono8 = "Mono8" - mono16 = "Mono16" - rgb8 = "RGB8" - rgb16 = "RGB16" + NONE = "None" + MONO8 = "Mono8" + MONO16 = "Mono16" + RGB8 = "RGB8" + RGB16 = "RGB16" class VimbaTriggerSource(StrictEnum): - freerun = "Freerun" - line1 = "Line1" - line2 = "Line2" - fixed_rate = "FixedRate" - software = "Software" - action0 = "Action0" - action1 = "Action1" + FREERUN = "Freerun" + LINE1 = "Line1" + LINE2 = "Line2" + FIXED_RATE = "FixedRate" + SOFTWARE = "Software" + ACTION0 = "Action0" + ACTION1 = "Action1" class VimbaOverlap(StrictEnum): - off = "Off" - prev_frame = "PreviousFrame" + OFF = "Off" + PREV_FRAME = "PreviousFrame" class VimbaOnOff(StrictEnum): - on = "On" - off = "Off" + ON = "On" + OFF = "Off" class VimbaExposeOutMode(StrictEnum): - timed = "Timed" # Use ExposureTime PV - trigger_width = "TriggerWidth" # Expose for length of high signal + TIMED = "Timed" # Use ExposureTime PV + TRIGGER_WIDTH = "TriggerWidth" # Expose for length of high signal class VimbaDriverIO(adcore.ADBaseIO): diff --git a/src/ophyd_async/epics/demo/_sensor.py b/src/ophyd_async/epics/demo/_sensor.py index 1004a04dae..0cc99d090a 100644 --- a/src/ophyd_async/epics/demo/_sensor.py +++ b/src/ophyd_async/epics/demo/_sensor.py @@ -15,9 +15,9 @@ class EnergyMode(StrictEnum): """Energy mode for `Sensor`""" #: Low energy mode - low = "Low Energy" + LOW = "Low Energy" #: High energy mode - high = "High Energy" + HIGH = "High Energy" class Sensor(StandardReadable, EpicsDevice): diff --git a/src/ophyd_async/epics/eiger/_eiger_controller.py b/src/ophyd_async/epics/eiger/_eiger_controller.py index b8d5319dad..2b5049eac2 100644 --- a/src/ophyd_async/epics/eiger/_eiger_controller.py +++ b/src/ophyd_async/epics/eiger/_eiger_controller.py @@ -11,10 +11,10 @@ from ._eiger_io import EigerDriverIO, EigerTriggerMode EIGER_TRIGGER_MODE_MAP = { - DetectorTrigger.internal: EigerTriggerMode.internal, - DetectorTrigger.constant_gate: EigerTriggerMode.gate, - DetectorTrigger.variable_gate: EigerTriggerMode.gate, - DetectorTrigger.edge_trigger: EigerTriggerMode.edge, + DetectorTrigger.INTERNAL: EigerTriggerMode.INTERNAL, + DetectorTrigger.CONSTANT_GATE: EigerTriggerMode.GATE, + DetectorTrigger.VARIABLE_GATE: EigerTriggerMode.GATE, + DetectorTrigger.EDGE_TRIGGER: EigerTriggerMode.EDGE, } diff --git a/src/ophyd_async/epics/eiger/_eiger_io.py b/src/ophyd_async/epics/eiger/_eiger_io.py index ef4451aa7d..484843ed30 100644 --- a/src/ophyd_async/epics/eiger/_eiger_io.py +++ b/src/ophyd_async/epics/eiger/_eiger_io.py @@ -3,9 +3,9 @@ class EigerTriggerMode(StrictEnum): - internal = "ints" - edge = "exts" - gate = "exte" + INTERNAL = "ints" + EDGE = "exts" + GATE = "exte" class EigerDriverIO(Device): diff --git a/src/ophyd_async/epics/testing/_example_ioc.py b/src/ophyd_async/epics/testing/_example_ioc.py index bffbf074b1..7c1b64ed11 100644 --- a/src/ophyd_async/epics/testing/_example_ioc.py +++ b/src/ophyd_async/epics/testing/_example_ioc.py @@ -23,9 +23,9 @@ class ExampleEnum(StrictEnum): - a = "Aaa" - b = "Bbb" - c = "Ccc" + A = "Aaa" + B = "Bbb" + C = "Ccc" class ExampleTable(Table): diff --git a/src/ophyd_async/fastcs/panda/_block.py b/src/ophyd_async/fastcs/panda/_block.py index 67767ba372..45943a491f 100644 --- a/src/ophyd_async/fastcs/panda/_block.py +++ b/src/ophyd_async/fastcs/panda/_block.py @@ -36,14 +36,14 @@ class PulseBlock(Device): class PcompDirection(StrictEnum): - positive = "Positive" - negative = "Negative" - either = "Either" + POSITIVE = "Positive" + NEGATIVE = "Negative" + EITHER = "Either" class BitMux(SubsetEnum): - zero = "ZERO" - one = "ONE" + ZERO = "ZERO" + ONE = "ONE" class PcompBlock(Device): @@ -57,10 +57,10 @@ class PcompBlock(Device): class TimeUnits(StrictEnum): - min = "min" - s = "s" - ms = "ms" - us = "us" + MIN = "min" + S = "s" + MS = "ms" + US = "us" class SeqBlock(Device): diff --git a/src/ophyd_async/fastcs/panda/_control.py b/src/ophyd_async/fastcs/panda/_control.py index 1fe14c7909..35a995aaae 100644 --- a/src/ophyd_async/fastcs/panda/_control.py +++ b/src/ophyd_async/fastcs/panda/_control.py @@ -19,8 +19,8 @@ def get_deadtime(self, exposure: float | None) -> float: async def prepare(self, trigger_info: TriggerInfo): assert trigger_info.trigger in ( - DetectorTrigger.constant_gate, - DetectorTrigger.variable_gate, + DetectorTrigger.CONSTANT_GATE, + DetectorTrigger.VARIABLE_GATE, ), "Only constant_gate and variable_gate triggering is supported on the PandA" async def arm(self): diff --git a/src/ophyd_async/fastcs/panda/_trigger.py b/src/ophyd_async/fastcs/panda/_trigger.py index 0aa3633760..05702a0b14 100644 --- a/src/ophyd_async/fastcs/panda/_trigger.py +++ b/src/ophyd_async/fastcs/panda/_trigger.py @@ -20,8 +20,8 @@ def __init__(self, seq: SeqBlock) -> None: async def prepare(self, value: SeqTableInfo): await asyncio.gather( - self.seq.prescale_units.set(TimeUnits.us), - self.seq.enable.set(BitMux.zero), + self.seq.prescale_units.set(TimeUnits.US), + self.seq.enable.set(BitMux.ZERO), ) await asyncio.gather( self.seq.prescale.set(value.prescale_as_us), @@ -30,14 +30,14 @@ async def prepare(self, value: SeqTableInfo): ) async def kickoff(self) -> None: - await self.seq.enable.set(BitMux.one) + await self.seq.enable.set(BitMux.ONE) await wait_for_value(self.seq.active, True, timeout=1) async def complete(self) -> None: await wait_for_value(self.seq.active, False, timeout=None) async def stop(self): - await self.seq.enable.set(BitMux.zero) + await self.seq.enable.set(BitMux.ZERO) await wait_for_value(self.seq.active, False, timeout=1) @@ -68,7 +68,7 @@ def __init__(self, pcomp: PcompBlock) -> None: self.pcomp = pcomp async def prepare(self, value: PcompInfo): - await self.pcomp.enable.set(BitMux.zero) + await self.pcomp.enable.set(BitMux.ZERO) await asyncio.gather( self.pcomp.start.set(value.start_postion), self.pcomp.width.set(value.pulse_width), @@ -78,12 +78,12 @@ async def prepare(self, value: PcompInfo): ) async def kickoff(self) -> None: - await self.pcomp.enable.set(BitMux.one) + await self.pcomp.enable.set(BitMux.ONE) await wait_for_value(self.pcomp.active, True, timeout=1) async def complete(self, timeout: float | None = None) -> None: await wait_for_value(self.pcomp.active, False, timeout=timeout) async def stop(self): - await self.pcomp.enable.set(BitMux.zero) + await self.pcomp.enable.set(BitMux.ZERO) await wait_for_value(self.pcomp.active, False, timeout=1)