Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update i20-1 to use device_factory #922

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading