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

Add a simple version to fill the unique needs of slit4 #672

Closed
wants to merge 11 commits into from
11 changes: 6 additions & 5 deletions src/dodal/beamlines/i22.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from dodal.devices.i22.fswitch import FSwitch
from dodal.devices.i22.nxsas import NXSasMetadataHolder, NXSasOAV, NXSasPilatus
from dodal.devices.linkam3 import Linkam3
from dodal.devices.slits import Slits
from dodal.devices.slits import Slits, SlitWithDefiningSlitOpening
from dodal.devices.synchrotron import Synchrotron
from dodal.devices.tetramm import TetrammDetector
from dodal.devices.undulator import Undulator
Expand Down Expand Up @@ -234,13 +234,14 @@ def slits_3(
)


@skip_device()
def slits_4(
wait_for_connection: bool = True,
fake_with_ophyd_sim: bool = False,
) -> Slits:
return numbered_slits(
4,
) -> SlitWithDefiningSlitOpening:
return device_instantiation(
SlitWithDefiningSlitOpening,
"slits_4",
"-AL-SLITS-04:",
wait_for_connection,
fake_with_ophyd_sim,
)
Expand Down
16 changes: 16 additions & 0 deletions src/dodal/devices/slits.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@ def __init__(self, prefix: str, name: str = "") -> None:
self.x_centre = Motor(prefix + "X:CENTRE")
self.y_centre = Motor(prefix + "Y:CENTRE")
super().__init__(name)


class SlitWithDefiningSlitOpening(StandardReadable):
"""
these are unlikely to be moved during a scan
Only HDSO and VDSO are recorded in the scan
DSO means Defining Slit Opening
"""

def __init__(self, prefix: str, name: str = "") -> None:
with self.add_children_as_readables():
self.x_gap = Motor(prefix + "HDSO")
self.y_gap = Motor(prefix + "VDSO")
self.x_centre = Motor(prefix + "X")
self.y_centre = Motor(prefix + "Y")
super().__init__(name)
2 changes: 1 addition & 1 deletion tests/common/beamlines/test_beamline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_instantiating_different_device_with_same_name():
Smargon, "device", "", False, True, None
)
assert dev1.name == dev2.name
assert type(dev1) is not type(dev2)
assert not isinstance(dev2, type(dev1))
assert dev1 not in beamline_utils.ACTIVE_DEVICES.values()
assert dev2 in beamline_utils.ACTIVE_DEVICES.values()

Expand Down
Loading