Skip to content

Commit 225ceeb

Browse files
Antonia Betevamarcus-oscarsson
authored andcommitted
The check for beam is done the beam object, not in flux one any more.
1 parent c6e9797 commit 225ceeb

File tree

4 files changed

+9
-40
lines changed

4 files changed

+9
-40
lines changed

mxcubecore/HardwareObjects/ESRF/ESRFBeam.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
objects:
3434
aperture: udiff_aperture.yml
3535
definer: beam_definer.yml
36+
monitor_beam: monitor_beam.yaml
3637
"""
3738

3839
__copyright__ = """ Copyright © by the MXCuBE collaboration """
@@ -99,9 +100,10 @@ def init(self) -> None:
99100

100101
self._monitorbeam_obj = self.get_object_by_role("monitor_beam")
101102

102-
beam_check = self.get_property("beam_check_name")
103-
if beam_check and _bliss_obj:
104-
self._beam_check_obj = getattr(_bliss_obj, beam_check)
103+
if self._monitorbeam_obj:
104+
beam_check = self._monitorbeam_obj.actuator_name
105+
if beam_check and _bliss_obj:
106+
self._beam_check_obj = getattr(_bliss_obj, beam_check)
105107

106108
def _re_emit_values(self, value):
107109
"""Redefine as re_emit_values takes no arguments"""
@@ -394,7 +396,6 @@ def wait_for_beam(self, timeout: float | None = None):
394396
try:
395397
timeout = timeout or self._beam_check_obj.timeout
396398
if self._monitorbeam_obj.get_value().value:
397-
return self._beam_check_obj.wait_for_beam(timeout)
399+
self._beam_check_obj.wait_for_beam(timeout)
398400
except AttributeError:
399-
return True
400-
return True
401+
pass

mxcubecore/HardwareObjects/ESRF/ESRFPhotonFlux.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@
2525
2626
class: ESRF.ESRFPhotonFlux.ESRFPhotonFlux
2727
configuration:
28-
beam_check_name: checkbeam
2928
counter_name: i0
3029
threshold: 5000000000.0
3130
username: Photon flux
3231
objects:
3332
aperture: udiff_aperture.yaml
3433
controller: bliss.yaml
35-
monitor_beam: monitor_beam.yaml
3634
"""
3735

3836
import logging
@@ -50,13 +48,10 @@ def __init__(self, name):
5048
super().__init__(name)
5149
self._counter = None
5250
self._flux_calc = None
53-
self._beam_check_obj = None
54-
self.beam_check_name = None
5551
self.counter_name = None
5652
self.threshold = None
5753
self.aperture = None
5854
self.controller = None
59-
self.monitor_beam = None
6055

6156
def init(self):
6257
"""Initialisation"""
@@ -80,9 +75,6 @@ def init(self):
8075
"Counter to read the flux is not configured"
8176
)
8277

83-
if self.beam_check_name:
84-
self._beam_check_obj = getattr(self.controller, self.beam_check_name)
85-
8678
try:
8779
HWR.beamline.safety_shutter.connect("stateChanged", self.update_value)
8880
except AttributeError as err:
@@ -132,27 +124,3 @@ def get_value(self):
132124
return 0.0
133125

134126
return counts
135-
136-
@property
137-
def check_beam(self):
138-
"""Check if there is beam
139-
Returns:
140-
(bool): True if beam present, False otherwise
141-
"""
142-
return self._beam_check_obj.check_beam()
143-
144-
def wait_for_beam(self, timeout=None):
145-
"""Wait until beam present.
146-
Args:
147-
timeout (float): optional - timeout [s],
148-
If timeout == 0: return at once and do not wait
149-
(default);
150-
if timeout is None: wait forever.
151-
"""
152-
try:
153-
if self.monitor_beam.get_value().value is True:
154-
if self._beam_check_obj:
155-
return self._beam_check_obj.wait_for_beam(timeout)
156-
return True
157-
except AttributeError:
158-
return True

mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def do_collect(self, owner, data_collect_parameters):
801801
self.open_safety_shutter()
802802

803803
try:
804-
HWR.beamline.flux.wait_for_beam()
804+
HWR.beamline.beam.wait_for_beam()
805805
HWR.beamline.cryo.wait_temperature()
806806
except AttributeError:
807807
pass

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,8 +1807,8 @@ convention = "google"
18071807
]
18081808
"mxcubecore/HardwareObjects/ESRF/ESRFBeam.py" = [
18091809
"ARG002",
1810+
"C901",
18101811
"EM101",
1811-
"ERA001",
18121812
"N814",
18131813
"N999",
18141814
"TRY003",

0 commit comments

Comments
 (0)