Skip to content

Commit

Permalink
Merge pull request #320 from spc-group/enums
Browse files Browse the repository at this point in the history
Converted ophyd enum types to uppercase.

Needed for compatibility with ophyd-async==0.8.1 upcoming release.
  • Loading branch information
canismarko authored Dec 16, 2024
2 parents 0ed8d8b + 1f7da38 commit f60f453
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
34 changes: 17 additions & 17 deletions src/haven/devices/srs570.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,27 +302,27 @@ class GainMode(StrictEnum):
LOW_DRIFT = "LOW DRIFT"

class SensValue(StrictEnum):
_1 = "1"
_2 = "2"
_5 = "5"
_10 = "10"
_20 = "20"
_50 = "50"
_100 = "100"
_200 = "200"
_500 = "500"
ONE = "1"
TWO = "2"
FIVE = "5"
TEN = "10"
TWENTY = "20"
FIFTY = "50"
ONE_HUNDRED = "100"
TWO_HUNDRED = "200"
FIVE_HUNDRED = "500"

class SensUnit(StrictEnum):
pA_V = "pA/V"
nA_V = "nA/V"
uA_V = "uA/V"
mA_V = "mA/V"
PICOAMP_PER_VOLT = "pA/V"
NANOAMP_PER_VOLT = "nA/V"
MICROAMP_PER_VOLT = "uA/V"
MILLIAMP_PER_VOLT = "mA/V"

class OffsetUnit(StrictEnum):
pA = "pA"
nA = "nA"
uA = "uA"
mA = "mA"
PICOAMP = "pA"
NANOAMP = "nA"
MICROAMP = "uA"
MILLIAMP = "mA"

def __init__(self, prefix: str, name: str = ""):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/haven/positioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def __init__(
self.put_complete = put_complete
super().__init__(name=name)

def set_name(self, name: str):
def set_name(self, name: str, *args, **kwargs):
super().set_name(name)
# Readback should be named the same as its parent in read()
self.readback.set_name(name)
self.readback.set_name(name, *args, **kwargs)

def watch_done(
self, value, done_event: asyncio.Event, started_event: asyncio.Event
Expand Down
2 changes: 1 addition & 1 deletion src/haven/tests/test_srs570.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def preamp():

async def test_preamp_signals(preamp):
# Check the enums
await preamp.sensitivity_value.set(SRS570PreAmplifier.SensValue._5)
await preamp.sensitivity_value.set(SRS570PreAmplifier.SensValue.FIVE)


@pytest.mark.parametrize("gain_mode", gain_modes)
Expand Down

0 comments on commit f60f453

Please sign in to comment.