Skip to content
Open
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
56 changes: 12 additions & 44 deletions src/dodal/beamlines/i02_1.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""Beamline i02-1 is also known as VMXm, or I02J"""

from dodal.common.beamlines.beamline_utils import (
device_factory,
device_instantiation,
)
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
from dodal.device_manager import DeviceManager
from dodal.devices.attenuator.attenuator import EnumFilterAttenuator
from dodal.devices.attenuator.filter_selections import (
I02_1FilterFourSelections,
Expand Down Expand Up @@ -37,77 +34,48 @@
sources=ZebraSources(),
)

devices = DeviceManager()

@device_factory()
def eiger(mock: bool = False) -> EigerDetector:
"""Get the i02-1 Eiger device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-1, it will return the existing object.
"""
return device_instantiation(
device_factory=EigerDetector,
prefix=f"{PREFIX.beamline_prefix}-EA-EIGER-01:",
bl_prefix=False,
wait=False,
fake=mock,
name="eiger",
beamline="i02-1",
ispyb_detector_id=101,
)

@devices.v1_init(EigerDetector, prefix="BL03I-EA-EIGER-01:", wait=False)
def eiger(eiger: EigerDetector) -> EigerDetector:
return eiger

@device_factory()

@devices.factory()
def zebra_fast_grid_scan() -> ZebraFastGridScanTwoD:
"""Get the i02-1 zebra_fast_grid_scan device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-1, it will return the existing object.
"""
return ZebraFastGridScanTwoD(
prefix=f"{PREFIX.beamline_prefix}-MO-SAMP-11:",
motion_controller_prefix="BL02J-MO-STEP-11:",
)


@device_factory()
@devices.factory()
def synchrotron() -> Synchrotron:
"""Get the i02-1 synchrotron device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-1, it will return the existing object.
"""
return Synchrotron()


@device_factory()
@devices.factory()
def zebra() -> Zebra:
"""Get the i02-1 zebra device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-1, it will return the existing object.
"""
return Zebra(
prefix=f"{PREFIX.beamline_prefix}-EA-ZEBRA-01:",
mapping=I02_1_ZEBRA_MAPPING,
)


# Device not needed after https://github.com/DiamondLightSource/mx-bluesky/issues/1299
@device_factory()
@devices.factory()
def zocalo() -> ZocaloResults:
"""Get the i02-1 ZocaloResults device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-1, it will return the existing object.
"""
return ZocaloResults()


@device_factory()
@devices.factory()
def goniometer() -> SampleMotors:
"""Get the i02-1 goniometer device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-1, it will return the existing object.
"""
return SampleMotors(f"{PREFIX.beamline_prefix}-MO-SAMP-01:")


@device_factory()
@devices.factory()
def attenuator() -> EnumFilterAttenuator:
"""Get the i02-1 attenuator device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-1, it will return the existing object.
"""

return EnumFilterAttenuator(
f"{PREFIX.beamline_prefix}-OP-ATTN-01:",
(
Expand Down
10 changes: 5 additions & 5 deletions src/dodal/beamlines/i02_2.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""Beamline i02-2 is also known as VMXi, or I02I"""

from dodal.common.beamlines.beamline_utils import (
device_factory,
)
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
from dodal.device_manager import DeviceManager
from dodal.devices.motors import XYStage
from dodal.devices.synchrotron import Synchrotron
from dodal.log import set_beamline as set_log_beamline
Expand All @@ -15,16 +13,18 @@
set_utils_beamline(BL)
DAQ_CONFIGURATION_PATH = "/dls_sw/i02-2/software/daq_configuration"

devices = DeviceManager()

@device_factory()

@devices.factory()
def synchrotron() -> Synchrotron:
"""Get the i02-2 synchrotron device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-2, it will return the existing object.
"""
return Synchrotron()


@device_factory()
@devices.factory()
def sample_motors() -> XYStage:
"""Get the i02-2 goniometer device, instantiate it if it hasn't already been.
If this is called when already instantiated in i02-2, it will return the existing object.
Expand Down
Loading
Loading