Skip to content

Commit

Permalink
Update i20-1 to use device_factory
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph authored and stan-dot committed Nov 26, 2024
1 parent 86d798a commit 7134287
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
31 changes: 10 additions & 21 deletions src/dodal/beamlines/i20_1.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,32 @@
from dodal.common.beamlines.beamline_utils import device_instantiation
from dodal.common.beamlines.beamline_utils import device_factory
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
from dodal.devices.turbo_slit import TurboSlit
from dodal.devices.xspress3.xspress3 import Xspress3
from dodal.log import set_beamline as set_log_beamline
from dodal.utils import get_beamline_name
from dodal.utils import BeamlinePrefix, get_beamline_name

BL = get_beamline_name("i20_1")
PREFIX = BeamlinePrefix(BL)
set_log_beamline(BL)
set_utils_beamline(BL)


def turbo_slit(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> TurboSlit:
@device_factory()
def turbo_slit() -> TurboSlit:
"""
turboslit for selecting energy from the polychromator
"""

return device_instantiation(
TurboSlit,
prefix="-OP-PCHRO-01:TS:",
name="turbo_slit",
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)
return TurboSlit(f"{PREFIX.beamline_prefix}-OP-PCHRO-01:TS:")


def xspress3(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> Xspress3:
@device_factory()
def xspress3() -> Xspress3:
"""
16 channels Xspress3 detector
"""

return device_instantiation(
Xspress3,
prefix="-EA-DET-03:",
name="Xspress3",
return Xspress3(
f"{PREFIX.beamline_prefix}-EA-DET-03:",
num_channels=16,
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
)
2 changes: 1 addition & 1 deletion src/dodal/devices/turbo_slit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TurboSlit(Device):
- xfine selects the energy as part of the high frequency scan
"""

def __init__(self, prefix: str, name: str):
def __init__(self, prefix: str, name: str = ""):
self.gap = Motor(prefix=prefix + "GAP")
self.arc = Motor(prefix=prefix + "ARC")
self.xfine = Motor(prefix=prefix + "XFINE")
Expand Down

0 comments on commit 7134287

Please sign in to comment.