mxcubecore 1.402.0__py3-none-any.whl → 1.404.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mxcubecore might be problematic. Click here for more details.
- mxcubecore/Command/Epics.py +1 -1
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/METADATA +1 -1
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/RECORD +6 -22
- mxcubecore/HardwareObjects/LNLS/EPICSActuator.py +0 -78
- mxcubecore/HardwareObjects/LNLS/EPICSMotor.py +0 -104
- mxcubecore/HardwareObjects/LNLS/EPICSNState.py +0 -87
- mxcubecore/HardwareObjects/LNLS/LNLSAperture.py +0 -69
- mxcubecore/HardwareObjects/LNLS/LNLSBeam.py +0 -125
- mxcubecore/HardwareObjects/LNLS/LNLSCamera.py +0 -507
- mxcubecore/HardwareObjects/LNLS/LNLSCollect.py +0 -482
- mxcubecore/HardwareObjects/LNLS/LNLSDetDistMotor.py +0 -76
- mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py +0 -538
- mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py +0 -81
- mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py +0 -478
- mxcubecore/HardwareObjects/LNLS/LNLSSlits.py +0 -48
- mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py +0 -82
- mxcubecore/HardwareObjects/LNLS/LNLSZoom.py +0 -93
- mxcubecore/HardwareObjects/LNLS/read_transmission_mnc.py +0 -149
- mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py +0 -306
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/COPYING +0 -0
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/COPYING.LESSER +0 -0
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/WHEEL +0 -0
mxcubecore/Command/Epics.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
mxcubecore/BaseHardwareObjects.py,sha256=Rzt34pY2_adftj2hTFSfhZyHjnR-FROH_a2CKqDRQTE,41302
|
|
2
|
-
mxcubecore/Command/Epics.py,sha256=
|
|
2
|
+
mxcubecore/Command/Epics.py,sha256=_LZZEcQXNeTIGKIrJynFBGeL5wMzlCv12U15IHNh2AE,7815
|
|
3
3
|
mxcubecore/Command/Exporter.py,sha256=HL6hncI_EUjjVX7frOsmxGa2Gyc-3PwUPXLUBJk4B20,8076
|
|
4
4
|
mxcubecore/Command/Mockup.py,sha256=OrGAJC0JjTTjGSMZl7NiWJmVUQeEThMYdSQzuBD-bEc,1949
|
|
5
5
|
mxcubecore/Command/Pool.py,sha256=ZS8sRafNSAo2Da_F-m-NOpJ1kmHi_l2SidZsdCxa7fY,9274
|
|
@@ -198,23 +198,7 @@ mxcubecore/HardwareObjects/Harvester.py,sha256=0TYUXmz-Pmfd7Dhz7ToUGHzJRuJmnga8-
|
|
|
198
198
|
mxcubecore/HardwareObjects/HarvesterMaintenance.py,sha256=8s4yHDEFG-C1WYyW_RlwrFPSpc8o5hGi14aQuFQFrHs,9405
|
|
199
199
|
mxcubecore/HardwareObjects/ICATLIMS.py,sha256=rrFwvYbBQovZtwfGZTS8GvHsbzAHbdIpVS2fGUxKLQA,54545
|
|
200
200
|
mxcubecore/HardwareObjects/ISARAMaint.py,sha256=I8LHXK6wCfzixsxWmmcqWlrdaL3AOX91XmVeAwT7GPk,8959
|
|
201
|
-
mxcubecore/HardwareObjects/LNLS/EPICSActuator.py,sha256=3dDj6aXyTz03m8osdA6udq_a4bch-KNcUMrXSNvbG5Q,2587
|
|
202
|
-
mxcubecore/HardwareObjects/LNLS/EPICSMotor.py,sha256=_ClmRdhSvfwgLY3hbBaE_Io3pFpzkkSwYM0UOTa5TAg,3523
|
|
203
|
-
mxcubecore/HardwareObjects/LNLS/EPICSNState.py,sha256=xZ2sQFeRpZIdn29e7pCFF24KT2cYsoe7VNTD2z-F_IU,3103
|
|
204
|
-
mxcubecore/HardwareObjects/LNLS/LNLSAperture.py,sha256=uj1SGPy5njh9UB4potFatz22M9LJdX1B4UGevbUsUQE,2225
|
|
205
|
-
mxcubecore/HardwareObjects/LNLS/LNLSBeam.py,sha256=GaO5GeqXB2hwkYRcWGF8cR3uC0oEJexEgYBtd-4K8WI,4094
|
|
206
|
-
mxcubecore/HardwareObjects/LNLS/LNLSCamera.py,sha256=mqHoPggm5-FLvPaneCdyOcaJ-rQnFjhwO--G_gh-9qo,16067
|
|
207
|
-
mxcubecore/HardwareObjects/LNLS/LNLSCollect.py,sha256=O-1dua1pJSRowWE__PDqY2FRjRn4l5Cs0WkpYR3wFew,16210
|
|
208
|
-
mxcubecore/HardwareObjects/LNLS/LNLSDetDistMotor.py,sha256=me1X0eu6qr_iw6mUymwiKWa2GJ68-Orlb8S9w4sw-Lw,2587
|
|
209
|
-
mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py,sha256=8MspDeBG2J_Dyjq9CFNHkV8N6hcqyirWM3TFiIDAGQg,17379
|
|
210
|
-
mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py,sha256=ok4fPU5LF6wKYDjrJ8hhWGfEPfXdpArNt77sXtnl08s,2750
|
|
211
|
-
mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py,sha256=NdoP1UAqdDQxDWdBvdp8bi_6rUnd7exr1KeSIUCZyqo,14720
|
|
212
|
-
mxcubecore/HardwareObjects/LNLS/LNLSSlits.py,sha256=6LB2rTdywtWDvwI8N_f1Bs25MO7KWoYS8gowCK17SuA,1466
|
|
213
|
-
mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py,sha256=iQ4FEc2LzM2-kQ_Ca06zNyfjo6ETO5vg-H08Da4yf38,2909
|
|
214
|
-
mxcubecore/HardwareObjects/LNLS/LNLSZoom.py,sha256=Pdr4Pg99hFqxu8usmiirwpYjVEVqm9mWnx9X7862aOg,2862
|
|
215
201
|
mxcubecore/HardwareObjects/LNLS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
216
|
-
mxcubecore/HardwareObjects/LNLS/read_transmission_mnc.py,sha256=AvQOO3QZKcj_2vwzdNaHX5aNl_WxKO24jCiT-eeHjHw,4820
|
|
217
|
-
mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py,sha256=Z6V3ZiCTF66gp_Kih2mS4Qa1NnT_a_4nCHSmPYSoeRU,10764
|
|
218
202
|
mxcubecore/HardwareObjects/LdapAuthenticator.py,sha256=UgK7c4_CisP3T7o1KhW9seRsWR8-5Phhhw_PSqTkwB4,6262
|
|
219
203
|
mxcubecore/HardwareObjects/Lima2Detector.py,sha256=oe_y3jRNXa4Nks7iNCwpRsQZ4GssSR43NMezBqV7z6k,21057
|
|
220
204
|
mxcubecore/HardwareObjects/LimaEigerDetector.py,sha256=2yqLBrU3MIHsSoO5lWoklg_QmPQ51bIKWRISnSOJzcw,11329
|
|
@@ -467,8 +451,8 @@ mxcubecore/utils/conversion.py,sha256=G1bk2Mi2ZwGbZa5pEeiFaKWxhSVXVGqu1L9_SioyUO
|
|
|
467
451
|
mxcubecore/utils/qt_import.py,sha256=DobjYIAhrixXoOH9oaus1-PsW5hSAI4nIyPp06Izw4U,14719
|
|
468
452
|
mxcubecore/utils/tango.py,sha256=vwEVrIrWKEFaeaJUz3xbaC7XWHY8ZeJ-pfcSrTfZPIE,2114
|
|
469
453
|
mxcubecore/utils/units.py,sha256=Gh7ovTUN00XBMUoyDG5W7akCx1pROL-M6pK2z1ouemg,1361
|
|
470
|
-
mxcubecore-1.
|
|
471
|
-
mxcubecore-1.
|
|
472
|
-
mxcubecore-1.
|
|
473
|
-
mxcubecore-1.
|
|
474
|
-
mxcubecore-1.
|
|
454
|
+
mxcubecore-1.404.0.dist-info/COPYING,sha256=u-Mc8zCecwyo4YoP8UulmzCiZZ_MmCLROd_NBtOcRj0,35148
|
|
455
|
+
mxcubecore-1.404.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
456
|
+
mxcubecore-1.404.0.dist-info/METADATA,sha256=0oYKOfPbqd6xkcSQSfKS2Iy12xaPEj5VKWsBpUOrMLo,4259
|
|
457
|
+
mxcubecore-1.404.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
458
|
+
mxcubecore-1.404.0.dist-info/RECORD,,
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Superclass for EPICS actuators.
|
|
3
|
-
|
|
4
|
-
Should be put as the first superclass,
|
|
5
|
-
e.g. class EPICSMotor(EPICSActuator, AbstractMotor):
|
|
6
|
-
|
|
7
|
-
Example of xml file:
|
|
8
|
-
|
|
9
|
-
<object class="LNLS.EPICSActuator">
|
|
10
|
-
<channel type="epics" name="epicsActuator_val">MNC:B:LUCIOLE01:LIGHT_CH1</channel>
|
|
11
|
-
<channel type="epics" name="epicsActuator_rbv" polling="500">MNC:B:LUCIOLE01:LIGHT_CH1</channel>
|
|
12
|
-
<username>BackLight</username>
|
|
13
|
-
<motor_name>BackLight</motor_name>
|
|
14
|
-
<default_limits>(0, 8000)</default_limits>
|
|
15
|
-
</object>
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
import time
|
|
19
|
-
|
|
20
|
-
import gevent
|
|
21
|
-
|
|
22
|
-
from mxcubecore.HardwareObjects.abstract import AbstractActuator
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class EPICSActuator(AbstractActuator.AbstractActuator):
|
|
26
|
-
"""EPCIS actuator class"""
|
|
27
|
-
|
|
28
|
-
ACTUATOR_VAL = "epicsActuator_val" # target
|
|
29
|
-
ACTUATOR_RBV = "epicsActuator_rbv" # readback
|
|
30
|
-
|
|
31
|
-
def __init__(self, name):
|
|
32
|
-
super(EPICSActuator, self).__init__(name)
|
|
33
|
-
self.__wait_actuator_task = None
|
|
34
|
-
self._nominal_limits = (-1e4, 1e4)
|
|
35
|
-
|
|
36
|
-
def init(self):
|
|
37
|
-
"""Initialization method"""
|
|
38
|
-
super(EPICSActuator, self).init()
|
|
39
|
-
self.update_state(self.STATES.READY)
|
|
40
|
-
|
|
41
|
-
def _wait_actuator(self):
|
|
42
|
-
"""Wait actuator to be ready."""
|
|
43
|
-
time.sleep(0.3)
|
|
44
|
-
self.update_state(self.STATES.READY)
|
|
45
|
-
|
|
46
|
-
def get_value(self):
|
|
47
|
-
"""Override AbstractActuator method."""
|
|
48
|
-
return self.get_channel_value(self.ACTUATOR_RBV)
|
|
49
|
-
|
|
50
|
-
def set_value(self, value, timeout=0):
|
|
51
|
-
"""Override AbstractActuator method."""
|
|
52
|
-
if self.read_only:
|
|
53
|
-
raise ValueError("Attempt to set value for read-only Actuator")
|
|
54
|
-
if self.validate_value(value):
|
|
55
|
-
self.update_state(self.STATES.BUSY)
|
|
56
|
-
if timeout or timeout is None:
|
|
57
|
-
with gevent.Timeout(
|
|
58
|
-
timeout, RuntimeError("Motor %s timed out" % self.username)
|
|
59
|
-
):
|
|
60
|
-
self._set_value(value)
|
|
61
|
-
new_value = self._wait_actuator(value)
|
|
62
|
-
else:
|
|
63
|
-
self._set_value(value)
|
|
64
|
-
self.__wait_actuator_task = gevent.spawn(self._wait_actuator)
|
|
65
|
-
else:
|
|
66
|
-
raise ValueError(
|
|
67
|
-
"Invalid value %s; limits are %s" % (value, self.get_limits())
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
def abort(self):
|
|
71
|
-
"""Immediately halt movement. By default self.stop = self.abort"""
|
|
72
|
-
if self.__wait_actuator_task is not None:
|
|
73
|
-
self.__wait_actuator_task.kill()
|
|
74
|
-
self.update_state(self.STATES.READY)
|
|
75
|
-
|
|
76
|
-
def _set_value(self, value):
|
|
77
|
-
"""Override AbstractActuator method."""
|
|
78
|
-
self.set_channel_value(self.ACTUATOR_VAL, value)
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
EPICS implementation of AbstractMotor.
|
|
3
|
-
|
|
4
|
-
Example of xml file:
|
|
5
|
-
|
|
6
|
-
<object class="LNLS.EPICSMotor">
|
|
7
|
-
<channel type="epics" name="epicsActuator_val">SOL:S:m1.VAL</channel>
|
|
8
|
-
<channel type="epics" name="epicsActuator_rbv" polling="500">SOL:S:m1.RBV</channel>
|
|
9
|
-
<channel type="epics" name="epicsMotor_rlv">SOL:S:m1.RLV</channel>
|
|
10
|
-
<channel type="epics" name="epicsMotor_dmov" polling="500">SOL:S:m1.DMOV</channel>
|
|
11
|
-
<channel type="epics" name="epicsMotor_stop">SOL:S:m1.STOP</channel>
|
|
12
|
-
<channel type="epics" name="epicsMotor_velo">SOL:S:m1.VELO</channel>
|
|
13
|
-
<channel type="epics" name="epicsMotor_llm">SOL:S:m1.DLLM</channel>
|
|
14
|
-
<channel type="epics" name="epicsMotor_hlm">SOL:S:m1.DHLM</channel>
|
|
15
|
-
<channel type="epics" name="epicsMotor_egu">SOL:S:m1.EGU</channel>
|
|
16
|
-
<username>Omega</username>
|
|
17
|
-
<motor_name>Omega</motor_name>
|
|
18
|
-
<unit>1e-3</unit>
|
|
19
|
-
<GUIstep>90</GUIstep>
|
|
20
|
-
</object>
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
import time
|
|
24
|
-
|
|
25
|
-
import gevent
|
|
26
|
-
|
|
27
|
-
from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor
|
|
28
|
-
from mxcubecore.HardwareObjects.LNLS.EPICSActuator import EPICSActuator
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class EPICSMotor(EPICSActuator, AbstractMotor):
|
|
32
|
-
"""EPICS Motor class"""
|
|
33
|
-
|
|
34
|
-
MOTOR_DMOV = "epicsMotor_dmov"
|
|
35
|
-
MOTOR_STOP = "epicsMotor_stop"
|
|
36
|
-
MOTOR_RLV = "epicsMotor_rlv"
|
|
37
|
-
MOTOR_VELO = "epicsMotor_velo"
|
|
38
|
-
MOTOR_HLM = "epicsMotor_hlm"
|
|
39
|
-
MOTOR_LLM = "epicsMotor_llm"
|
|
40
|
-
MOTOR_EGU = "epicsMotor_egu"
|
|
41
|
-
|
|
42
|
-
def __init__(self, name):
|
|
43
|
-
super().__init__(name)
|
|
44
|
-
self._wrap_range = None
|
|
45
|
-
|
|
46
|
-
def init(self):
|
|
47
|
-
"""Initialization method"""
|
|
48
|
-
super().init()
|
|
49
|
-
self.get_limits()
|
|
50
|
-
self.get_velocity()
|
|
51
|
-
self.__watch_task = gevent.spawn(self._watch)
|
|
52
|
-
self.update_state(self.STATES.READY)
|
|
53
|
-
|
|
54
|
-
def _watch(self):
|
|
55
|
-
"""Watch motor current value and update it on the UI."""
|
|
56
|
-
while True:
|
|
57
|
-
time.sleep(0.25)
|
|
58
|
-
self.update_value()
|
|
59
|
-
|
|
60
|
-
def _wait_actuator(self):
|
|
61
|
-
"""Override EPICSActuator method."""
|
|
62
|
-
self.update_specific_state(self.SPECIFIC_STATES.MOVING)
|
|
63
|
-
current_value = self.get_value()
|
|
64
|
-
|
|
65
|
-
while not self.done_movement():
|
|
66
|
-
time.sleep(0.25)
|
|
67
|
-
|
|
68
|
-
self.update_specific_state(None)
|
|
69
|
-
self.update_state(self.STATES.READY)
|
|
70
|
-
|
|
71
|
-
def abort(self):
|
|
72
|
-
"""Override EPICSActuator method."""
|
|
73
|
-
self.set_channel_value(self.MOTOR_STOP, 1)
|
|
74
|
-
super().abort()
|
|
75
|
-
|
|
76
|
-
def get_limits(self):
|
|
77
|
-
"""Override AbstractActuator method."""
|
|
78
|
-
try:
|
|
79
|
-
low_limit = float(self.get_channel_value(self.MOTOR_LLM))
|
|
80
|
-
high_limit = float(self.get_channel_value(self.MOTOR_HLM))
|
|
81
|
-
self._nominal_limits = (low_limit, high_limit)
|
|
82
|
-
except BaseException:
|
|
83
|
-
self._nominal_limits = (None, None)
|
|
84
|
-
|
|
85
|
-
if self._nominal_limits in [(0, 0), (float("-inf"), float("inf"))]:
|
|
86
|
-
# Treat infinite limits
|
|
87
|
-
self._nominal_limits = (None, None)
|
|
88
|
-
|
|
89
|
-
self.log.info("Motor %s limits: %s" % (self.motor_name, self._nominal_limits))
|
|
90
|
-
return self._nominal_limits
|
|
91
|
-
|
|
92
|
-
def get_velocity(self):
|
|
93
|
-
"""Override AbstractMotor method."""
|
|
94
|
-
self._velocity = self.get_channel_value(self.MOTOR_VELO)
|
|
95
|
-
return self._velocity
|
|
96
|
-
|
|
97
|
-
def set_velocity(self, value):
|
|
98
|
-
"""Override AbstractMotor method."""
|
|
99
|
-
self.__velocity = self.set_channel_value(self.MOTOR_VELO, value)
|
|
100
|
-
|
|
101
|
-
def done_movement(self):
|
|
102
|
-
"""Return whether motor finished movement or not."""
|
|
103
|
-
dmov = self.get_channel_value(self.MOTOR_DMOV)
|
|
104
|
-
return bool(dmov)
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
EPICS implementation of AbstractNState.
|
|
3
|
-
Example xml file:
|
|
4
|
-
<object class="LNLS.LNLSInOut">
|
|
5
|
-
<channel type="epics" name="epicsActuator_val">SOL:S:m4.SET</channel>
|
|
6
|
-
<channel type="epics" name="epicsActuator_rbv" polling="500">SOL:S:m4.SET</channel>
|
|
7
|
-
<username>Microdiff backlight</username>
|
|
8
|
-
<motor_name>BackLightIsOn</motor_name>
|
|
9
|
-
<values>{"in": True, "out": False}</values>
|
|
10
|
-
</object>
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
import logging
|
|
14
|
-
from enum import Enum
|
|
15
|
-
|
|
16
|
-
from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState
|
|
17
|
-
from mxcubecore.HardwareObjects.LNLS.EPICSActuator import EPICSActuator
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class EPICSNState(AbstractNState, EPICSActuator):
|
|
21
|
-
def __init__(self, name):
|
|
22
|
-
AbstractNState.__init__(self, name)
|
|
23
|
-
self.username = "unknown"
|
|
24
|
-
self.actuatorState = "unknown"
|
|
25
|
-
self.state_attr = None
|
|
26
|
-
|
|
27
|
-
def init(self):
|
|
28
|
-
AbstractNState.initialise_values(self)
|
|
29
|
-
self.username = self.getProperty("username")
|
|
30
|
-
self.states = dict((item.value, item.name) for item in self.VALUES)
|
|
31
|
-
self.moves = dict((item.name, item.value) for item in self.VALUES)
|
|
32
|
-
self.get_actuator_state()
|
|
33
|
-
|
|
34
|
-
def connectNotify(self, signal):
|
|
35
|
-
if signal == "actuatorStateChanged":
|
|
36
|
-
self.valueChanged(self.state_attr)
|
|
37
|
-
|
|
38
|
-
def _set_value(self, value):
|
|
39
|
-
"""Set device to value
|
|
40
|
-
Args:
|
|
41
|
-
value (str, int, float or enum): Value to be set.
|
|
42
|
-
"""
|
|
43
|
-
if isinstance(value, Enum):
|
|
44
|
-
try:
|
|
45
|
-
value = value.value[0]
|
|
46
|
-
except TypeError:
|
|
47
|
-
value = value.value
|
|
48
|
-
EPICSActuator._set_value(self, value)
|
|
49
|
-
# self.set_channel_value(self.ACTUATOR_VAL, value)
|
|
50
|
-
self.update_state()
|
|
51
|
-
|
|
52
|
-
def get_value(self):
|
|
53
|
-
"""Get the device value
|
|
54
|
-
Returns:
|
|
55
|
-
(Enum): Enum member, corresponding to the value or UNKNOWN.
|
|
56
|
-
"""
|
|
57
|
-
value = EPICSActuator.get_value(self)
|
|
58
|
-
# value = self.get_channel_value(self.ACTUATOR_RBV)
|
|
59
|
-
return self.value_to_enum(value)
|
|
60
|
-
|
|
61
|
-
def get_actuator_state(self, read=False):
|
|
62
|
-
current_value = self.get_value()
|
|
63
|
-
self.state_attr = current_value.value # Bool
|
|
64
|
-
self.actuatorState = self.states.get(self.state_attr, "unknown") # Name
|
|
65
|
-
return self.actuatorState
|
|
66
|
-
|
|
67
|
-
def valueChanged(self, value):
|
|
68
|
-
enum_val = self.value_to_enum(value)
|
|
69
|
-
self.set_value(enum_val)
|
|
70
|
-
self.actuatorState = self.states.get(value, "unknown")
|
|
71
|
-
self.emit("actuatorStateChanged", (self.actuatorState,))
|
|
72
|
-
|
|
73
|
-
def actuatorIn(self, wait=True, timeout=None):
|
|
74
|
-
try:
|
|
75
|
-
self.state_attr = self.moves["in"]
|
|
76
|
-
self.valueChanged(self.state_attr)
|
|
77
|
-
except BaseException:
|
|
78
|
-
logging.getLogger("user_level_log").error("Cannot put %s in", self.username)
|
|
79
|
-
|
|
80
|
-
def actuatorOut(self, wait=True, timeout=None):
|
|
81
|
-
try:
|
|
82
|
-
self.state_attr = self.moves["out"]
|
|
83
|
-
self.valueChanged(self.state_attr)
|
|
84
|
-
except BaseException as e:
|
|
85
|
-
logging.getLogger("user_level_log").error(
|
|
86
|
-
"Cannot put %s out: %s", (self.username, e)
|
|
87
|
-
)
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Project name: MXCuBE
|
|
3
|
-
# https://github.com/mxcube.
|
|
4
|
-
#
|
|
5
|
-
# This file is part of MXCuBE software.
|
|
6
|
-
#
|
|
7
|
-
# MXCuBE is free software: you can redistribute it and/or modify
|
|
8
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
-
# the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
# (at your option) any later version.
|
|
11
|
-
#
|
|
12
|
-
# MXCuBE is distributed in the hope that it will be useful,
|
|
13
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
# GNU Lesser General Public License for more details.
|
|
16
|
-
#
|
|
17
|
-
# You should have received a copy of the GNU Lesser General Public License
|
|
18
|
-
# along with MXCuBE. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
from mxcubecore.HardwareObjects.abstract.AbstractAperture import AbstractAperture
|
|
22
|
-
|
|
23
|
-
__credits__ = ["MXCuBE collaboration"]
|
|
24
|
-
__license__ = "LGPLv3"
|
|
25
|
-
|
|
26
|
-
DEFAULT_POSITION_LIST = ("BEAM", "OFF", "PARK")
|
|
27
|
-
DEFAULT_DIAMETER_SIZE_LIST = (5, 10, 20, 30, 50, 100)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class LNLSAperture(AbstractAperture):
|
|
31
|
-
def __init__(self, name):
|
|
32
|
-
AbstractAperture.__init__(self, name)
|
|
33
|
-
|
|
34
|
-
def init(self):
|
|
35
|
-
try:
|
|
36
|
-
self._diameter_size_list = eval(self.getProperty("diameter_size_list"))
|
|
37
|
-
except BaseException:
|
|
38
|
-
self._diameter_size_list = DEFAULT_DIAMETER_SIZE_LIST
|
|
39
|
-
self.log.error(
|
|
40
|
-
"Aperture: no diameter size list defined, using default list"
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
try:
|
|
44
|
-
self._position_list = eval(self.getProperty("position_list"))
|
|
45
|
-
except BaseException:
|
|
46
|
-
self._position_list = DEFAULT_POSITION_LIST
|
|
47
|
-
self.log.error("Aperture: no position list defined, using default list")
|
|
48
|
-
|
|
49
|
-
self.set_position_index(0)
|
|
50
|
-
self.set_diameter_index(1) # 100um as default
|
|
51
|
-
|
|
52
|
-
def set_in(self):
|
|
53
|
-
"""
|
|
54
|
-
Sets aperture in the beam
|
|
55
|
-
"""
|
|
56
|
-
self.set_position("BEAM")
|
|
57
|
-
|
|
58
|
-
def set_out(self):
|
|
59
|
-
"""
|
|
60
|
-
Removes aperture from the beam
|
|
61
|
-
"""
|
|
62
|
-
self.set_position("OFF")
|
|
63
|
-
|
|
64
|
-
def is_out(self):
|
|
65
|
-
"""
|
|
66
|
-
Returns:
|
|
67
|
-
bool: True if aperture is in the beam, otherwise returns false
|
|
68
|
-
"""
|
|
69
|
-
return self._current_position_name != "BEAM"
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
#
|
|
3
|
-
# Project name: MXCuBE
|
|
4
|
-
# https://github.com/mxcube
|
|
5
|
-
#
|
|
6
|
-
# This file is part of MXCuBE software.
|
|
7
|
-
#
|
|
8
|
-
# MXCuBE is free software: you can redistribute it and/or modify
|
|
9
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
|
11
|
-
# (at your option) any later version.
|
|
12
|
-
#
|
|
13
|
-
# MXCuBE is distributed in the hope that it will be useful,
|
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
# GNU Lesser General Public License for more details.
|
|
17
|
-
#
|
|
18
|
-
# You should have received a copy of the GNU Lesser General Public License
|
|
19
|
-
# along with MXCuBE. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
|
|
21
|
-
"""
|
|
22
|
-
LNLSBeam class
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
__copyright__ = """ Copyright © 2016 - 2020 by MXCuBE Collaboration """
|
|
26
|
-
__license__ = "LGPLv3+"
|
|
27
|
-
|
|
28
|
-
import ast
|
|
29
|
-
|
|
30
|
-
from mxcubecore.HardwareObjects.abstract.AbstractBeam import (
|
|
31
|
-
AbstractBeam,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class LNLSBeam(AbstractBeam):
|
|
36
|
-
def __init__(self, name):
|
|
37
|
-
AbstractBeam.__init__(self, name)
|
|
38
|
-
|
|
39
|
-
self._beam_size_dict["slits"] = [9999, 9999]
|
|
40
|
-
self._beam_size_dict["aperture"] = [9999, 9999]
|
|
41
|
-
self._beam_position_on_screen = [1024 / 2, 1024 / 2]
|
|
42
|
-
self._beam_divergence = (0, 0)
|
|
43
|
-
|
|
44
|
-
def init(self):
|
|
45
|
-
self._aperture = self.get_object_by_role("aperture")
|
|
46
|
-
if self._aperture is not None:
|
|
47
|
-
self.connect(
|
|
48
|
-
self._aperture,
|
|
49
|
-
"diameterIndexChanged",
|
|
50
|
-
self.aperture_diameter_changed,
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
ad = self._aperture.get_diameter_size() / 1000.0
|
|
54
|
-
self._beam_size_dict["aperture"] = [ad, ad]
|
|
55
|
-
|
|
56
|
-
self._slits = self.get_object_by_role("slits")
|
|
57
|
-
if self._slits is not None:
|
|
58
|
-
self.connect(self._slits, "valueChanged", self.slits_gap_changed)
|
|
59
|
-
|
|
60
|
-
sx, sy = self._slits.get_gaps()
|
|
61
|
-
self._beam_size_dict["slits"] = [sx, sy]
|
|
62
|
-
|
|
63
|
-
beam_pos = self.getProperty("default_beam_pos_on_screen")
|
|
64
|
-
self._beam_position_on_screen = list(ast.literal_eval(beam_pos))
|
|
65
|
-
|
|
66
|
-
self.evaluate_beam_info()
|
|
67
|
-
self.emit_beam_info_change()
|
|
68
|
-
self.emit("beamPosChanged", (self._beam_position_on_screen,))
|
|
69
|
-
|
|
70
|
-
def aperture_diameter_changed(self, name, size):
|
|
71
|
-
"""
|
|
72
|
-
Method called when the aperture diameter changes
|
|
73
|
-
Args:
|
|
74
|
-
name (str): diameter name - not used.
|
|
75
|
-
size (float): diameter size in microns
|
|
76
|
-
"""
|
|
77
|
-
self._beam_size_dict["aperture"] = [size, size]
|
|
78
|
-
self.evaluate_beam_info()
|
|
79
|
-
self.emit_beam_info_change()
|
|
80
|
-
|
|
81
|
-
def slits_gap_changed(self, size):
|
|
82
|
-
"""
|
|
83
|
-
Method called when the slits gap changes
|
|
84
|
-
Args:
|
|
85
|
-
size (tuple): two floats indicates beam size in microns
|
|
86
|
-
"""
|
|
87
|
-
self._beam_size_dict["slits"] = size
|
|
88
|
-
self.evaluate_beam_info()
|
|
89
|
-
self.emit_beam_info_change()
|
|
90
|
-
|
|
91
|
-
def set_beam_position_on_screen(self, beam_x, beam_y):
|
|
92
|
-
"""
|
|
93
|
-
Sets beam mark position on screen
|
|
94
|
-
#TODO move method to sample_view
|
|
95
|
-
Args:
|
|
96
|
-
beam_x (int): horizontal position in pixels
|
|
97
|
-
beam_y (int): vertical position in pixels
|
|
98
|
-
"""
|
|
99
|
-
self._beam_position_on_screen = (beam_x, beam_y)
|
|
100
|
-
self.emit("beamPosChanged", (self._beam_position_on_screen,))
|
|
101
|
-
|
|
102
|
-
def get_slits_gap(self):
|
|
103
|
-
"""
|
|
104
|
-
Returns: tuple with beam size in microns
|
|
105
|
-
"""
|
|
106
|
-
self.evaluate_beam_info()
|
|
107
|
-
return self._beam_size_dict["slits"]
|
|
108
|
-
|
|
109
|
-
def set_slits_gap(self, width_microns, height_microns):
|
|
110
|
-
"""
|
|
111
|
-
Sets slits gap in microns
|
|
112
|
-
Args:
|
|
113
|
-
width_microns (int):
|
|
114
|
-
height_microns (int):
|
|
115
|
-
"""
|
|
116
|
-
if self._slits:
|
|
117
|
-
self._slits.set_horizontal_gap(width_microns / 1000.0)
|
|
118
|
-
self._slits.set_vertical_gap(height_microns / 1000.0)
|
|
119
|
-
|
|
120
|
-
def get_aperture_pos_name(self):
|
|
121
|
-
"""
|
|
122
|
-
Returns (str): name of current aperture position
|
|
123
|
-
"""
|
|
124
|
-
if self._aperture:
|
|
125
|
-
return self._aperture.get_current_pos_name()
|