Skip to content

Commit 9d79ed5

Browse files
committed
Add scint into beam + change Enum to be be more descriptive compared to just In and Out.
1 parent 7f2d3e3 commit 9d79ed5

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/dodal/devices/scintillator.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99

1010
class InOut(StrictEnum):
11-
"""Currently Hyperion only needs to move the scintillator out for data collection."""
11+
"""Moves scintillator in and out of the beam"""
1212

13-
OUT = "Out"
13+
OUT = "Out_Beam"
14+
IN = "In_Beam"
1415
UNKNOWN = "Unknown"
1516

1617

@@ -45,6 +46,9 @@ def __init__(
4546
self._scintillator_out_yz_mm = [
4647
float(beamline_parameters[f"scin_{axis}_SCIN_OUT"]) for axis in ("y", "z")
4748
]
49+
self._scintillator_in_yz_mm = [
50+
float(beamline_parameters[f"scin_{axis}_SCIN_IN"]) for axis in ("y", "z")
51+
]
4852
self._yz_tolerance_mm = [
4953
float(beamline_parameters[f"scin_{axis}_tolerance"]) for axis in ("y", "z")
5054
]
@@ -63,6 +67,18 @@ def _get_selected_position(self, y: float, z: float) -> InOut:
6367
)
6468
):
6569
return InOut.OUT
70+
71+
elif all(
72+
isclose(axis_pos, axis_in_beam, abs_tol=axis_tolerance)
73+
for axis_pos, axis_in_beam, axis_tolerance in zip(
74+
current_pos,
75+
self._scintillator_in_yz_mm,
76+
self._yz_tolerance_mm,
77+
strict=False,
78+
)
79+
):
80+
return InOut.IN
81+
6682
else:
6783
return InOut.UNKNOWN
6884

@@ -78,5 +94,15 @@ async def _set_selected_position(self, position: InOut) -> None:
7894
)
7995
await self.y_mm.set(self._scintillator_out_yz_mm[0])
8096
await self.z_mm.set(self._scintillator_out_yz_mm[1])
97+
case InOut.IN:
98+
if (
99+
self._aperture_scatterguard().selected_aperture.get_value()
100+
!= ApertureValue.PARKED
101+
):
102+
raise ValueError(
103+
"Cannot move scintillator out if aperture/scatterguard is not parked"
104+
)
105+
await self.z_mm.set(self._scintillator_in_yz_mm[1])
106+
await self.y_mm.set(self._scintillator_in_yz_mm[0])
81107
case _:
82108
raise ValueError(f"Cannot set scintillator to position {position}")

0 commit comments

Comments
 (0)