Skip to content

Commit

Permalink
Revert MX beamlines to old slits
Browse files Browse the repository at this point in the history
  • Loading branch information
callumforrester committed Apr 24, 2024
1 parent d75a999 commit 8fe6867
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 19 deletions.
22 changes: 15 additions & 7 deletions src/dodal/beamlines/i03.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from dodal.devices.panda_fast_grid_scan import PandAFastGridScan
from dodal.devices.qbpm1 import QBPM1
from dodal.devices.robot import BartRobot
from dodal.devices.s4_slit_gaps import S4SlitGaps
from dodal.devices.sample_shutter import SampleShutter
from dodal.devices.slits import Slits
from dodal.devices.smargon import Smargon
from dodal.devices.synchrotron import Synchrotron
from dodal.devices.undulator import Undulator
Expand All @@ -31,8 +31,6 @@
from dodal.log import set_beamline as set_log_beamline
from dodal.utils import BeamlinePrefix, get_beamline_name, skip_device

from ._device_helpers import numbered_slits

ZOOM_PARAMS_FILE = (
"/dls_sw/i03/software/gda/configurations/i03-config/xml/jCameraManZoomLevels.xml"
)
Expand Down Expand Up @@ -211,7 +209,11 @@ def panda_fast_grid_scan(


@skip_device(lambda: BL == "s03")
def oav(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> OAV:
def oav(
wait_for_connection: bool = True,
fake_with_ophyd_sim: bool = False,
params: OAVConfigParams | None = None,
) -> OAV:
"""Get the i03 OAV device, instantiate it if it hasn't already been.
If this is called when already instantiated in i03, it will return the existing object.
"""
Expand All @@ -221,7 +223,7 @@ def oav(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) ->
"",
wait_for_connection,
fake_with_ophyd_sim,
params=OAVConfigParams(ZOOM_PARAMS_FILE, DISPLAY_CONFIG),
params=params or OAVConfigParams(ZOOM_PARAMS_FILE, DISPLAY_CONFIG),
)


Expand Down Expand Up @@ -258,11 +260,17 @@ def smargon(

def s4_slit_gaps(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> Slits:
) -> S4SlitGaps:
"""Get the i03 s4_slit_gaps device, instantiate it if it hasn't already been.
If this is called when already instantiated in i03, it will return the existing object.
"""
return numbered_slits(4, wait_for_connection, fake_with_ophyd_sim)
return device_instantiation(
S4SlitGaps,
"s4_slit_gaps",
"-AL-SLITS-04:",
wait_for_connection,
fake_with_ophyd_sim,
)


@skip_device(lambda: BL == "s03")
Expand Down
14 changes: 9 additions & 5 deletions src/dodal/beamlines/i04.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from dodal.devices.ipin import IPin
from dodal.devices.motors import XYZPositioner
from dodal.devices.oav.oav_detector import OAV, OAVConfigParams
from dodal.devices.s4_slit_gaps import S4SlitGaps
from dodal.devices.sample_shutter import SampleShutter
from dodal.devices.slits import Slits
from dodal.devices.smargon import Smargon
from dodal.devices.synchrotron import Synchrotron
from dodal.devices.undulator import Undulator
Expand All @@ -24,8 +24,6 @@
from dodal.log import set_beamline as set_log_beamline
from dodal.utils import BeamlinePrefix, get_beamline_name, skip_device

from ._device_helpers import numbered_slits

ZOOM_PARAMS_FILE = (
"/dls_sw/i04/software/gda/configurations/i04-config/xml/jCameraManZoomLevels.xml"
)
Expand Down Expand Up @@ -278,11 +276,17 @@ def fast_grid_scan(

def s4_slit_gaps(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> Slits:
) -> S4SlitGaps:
"""Get the i04 s4_slit_gaps device, instantiate it if it hasn't already been.
If this is called when already instantiated in i04, it will return the existing object.
"""
return numbered_slits(4, wait_for_connection, fake_with_ophyd_sim)
return device_instantiation(
S4SlitGaps,
"s4_slit_gaps",
"-AL-SLITS-04:",
wait_for_connection,
fake_with_ophyd_sim,
)


def undulator(
Expand Down
14 changes: 9 additions & 5 deletions src/dodal/beamlines/i04_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
from dodal.devices.detector import DetectorParams
from dodal.devices.eiger import EigerDetector
from dodal.devices.oav.oav_detector import OAV, OAVConfigParams
from dodal.devices.slits import Slits
from dodal.devices.s4_slit_gaps import S4SlitGaps
from dodal.devices.synchrotron import Synchrotron
from dodal.devices.undulator import Undulator
from dodal.devices.zebra import Zebra
from dodal.log import set_beamline as set_log_beamline
from dodal.utils import BeamlinePrefix, get_beamline_name, skip_device

from ._device_helpers import numbered_slits

ZOOM_PARAMS_FILE = "/dls_sw/i04-1/software/gda/config/xml/jCameraManZoomLevels.xml"
DISPLAY_CONFIG = "/dls_sw/i04-1/software/gda_versions/var/display.configuration"

Expand Down Expand Up @@ -83,11 +81,17 @@ def oav(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) ->

def s4_slit_gaps(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> Slits:
) -> S4SlitGaps:
"""Get the i04_1 s4_slit_gaps device, instantiate it if it hasn't already been.
If this is called when already instantiated in i04_1, it will return the existing object.
"""
return numbered_slits(4, wait_for_connection, fake_with_ophyd_sim)
return device_instantiation(
S4SlitGaps,
"s4_slit_gaps",
"-AL-SLITS-04:",
wait_for_connection,
fake_with_ophyd_sim,
)


@skip_device(_check_for_simulation)
Expand Down
8 changes: 8 additions & 0 deletions src/dodal/devices/s4_slit_gaps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from ophyd import Component, Device, EpicsMotor


class S4SlitGaps(Device):
"""Note that the S4 slits have a different PV fromat to other beamline slits"""

xgap = Component(EpicsMotor, "XGAP")
ygap = Component(EpicsMotor, "YGAP")
4 changes: 2 additions & 2 deletions tests/devices/system_tests/test_slit_gaps_system.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest

from dodal.devices.slits import Slits
from dodal.devices.s4_slit_gaps import S4SlitGaps


@pytest.mark.s03
def test_when_s4_slit_gaps_created_against_s03_then_can_connect():
slit_gaps = Slits("BL03S-AL-SLITS-04:", name="slit_gaps")
slit_gaps = S4SlitGaps("BL03S-AL-SLITS-04:", name="slit_gaps")

slit_gaps.wait_for_connection()

0 comments on commit 8fe6867

Please sign in to comment.