mxcubecore 1.403.0__py3-none-any.whl → 1.405.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.

Files changed (33) hide show
  1. mxcubecore/Command/Mockup.py +0 -0
  2. mxcubecore/Command/Pool.py +0 -0
  3. mxcubecore/Command/Tine.py +0 -0
  4. mxcubecore/HardwareObjects/GenericDiffractometer.py +0 -0
  5. mxcubecore/HardwareObjects/MAXIV/MAXIVAutoProcessing.py +0 -0
  6. mxcubecore/HardwareObjects/MAXIV/MachInfo.py +0 -0
  7. mxcubecore/HardwareObjects/QtAxisCamera.py +0 -0
  8. mxcubecore/HardwareObjects/SampleStage.py +0 -0
  9. mxcubecore/HardwareObjects/TangoLimaVideo.py +0 -0
  10. mxcubecore/HardwareObjects/autoprocessing.py +0 -0
  11. mxcubecore/HardwareObjects/mockup/MicrodiffInOutMockup.py +0 -0
  12. mxcubecore/HardwareObjects/mockup/QtVideoMockup.py +0 -0
  13. {mxcubecore-1.403.0.dist-info → mxcubecore-1.405.0.dist-info}/METADATA +1 -1
  14. {mxcubecore-1.403.0.dist-info → mxcubecore-1.405.0.dist-info}/RECORD +5 -21
  15. mxcubecore/HardwareObjects/LNLS/EPICSActuator.py +0 -78
  16. mxcubecore/HardwareObjects/LNLS/EPICSMotor.py +0 -104
  17. mxcubecore/HardwareObjects/LNLS/EPICSNState.py +0 -87
  18. mxcubecore/HardwareObjects/LNLS/LNLSAperture.py +0 -69
  19. mxcubecore/HardwareObjects/LNLS/LNLSBeam.py +0 -125
  20. mxcubecore/HardwareObjects/LNLS/LNLSCamera.py +0 -507
  21. mxcubecore/HardwareObjects/LNLS/LNLSCollect.py +0 -482
  22. mxcubecore/HardwareObjects/LNLS/LNLSDetDistMotor.py +0 -76
  23. mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py +0 -538
  24. mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py +0 -81
  25. mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py +0 -478
  26. mxcubecore/HardwareObjects/LNLS/LNLSSlits.py +0 -48
  27. mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py +0 -82
  28. mxcubecore/HardwareObjects/LNLS/LNLSZoom.py +0 -93
  29. mxcubecore/HardwareObjects/LNLS/read_transmission_mnc.py +0 -149
  30. mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py +0 -306
  31. {mxcubecore-1.403.0.dist-info → mxcubecore-1.405.0.dist-info}/COPYING +0 -0
  32. {mxcubecore-1.403.0.dist-info → mxcubecore-1.405.0.dist-info}/COPYING.LESSER +0 -0
  33. {mxcubecore-1.403.0.dist-info → mxcubecore-1.405.0.dist-info}/WHEEL +0 -0
@@ -1,478 +0,0 @@
1
- import logging
2
- import time
3
-
4
- import epics
5
-
6
- from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector
7
-
8
-
9
- class LNLSPilatusDet(AbstractDetector):
10
- DET_THRESHOLD = "det_threshols_energy"
11
- # DET_STATUS = 'det_status_message'
12
- DET_WAVELENGTH = "det_wavelength"
13
- DET_DETDIST = "det_detdist"
14
- DET_BEAM_X = "det_beam_x"
15
- DET_BEAM_Y = "det_beam_y"
16
- USER_BEAM_X = "user_beam_x"
17
- USER_BEAM_Y = "user_beam_y"
18
- DET_TRANSMISSION = "det_transmission"
19
- DET_START_ANGLE = "det_start_angle"
20
- DET_ANGLE_INCR = "det_angle_incr"
21
-
22
- def __init__(self, name):
23
- """
24
- Descript. :
25
- """
26
- AbstractDetector.__init__(self, name)
27
-
28
- def init(self):
29
- """
30
- Descript. :
31
- """
32
- AbstractDetector.init(self)
33
-
34
- # self.distance = 500
35
- self._temperature = 25
36
- self._humidity = 60
37
- self.actual_frame_rate = 50
38
- self._roi_modes_list = ("0", "C2", "C16")
39
- self._roi_mode = 0
40
- self._exposure_time_limits = [0.04, 60000]
41
- self.status = "ready"
42
- self.pv_status = epics.PV(self.getProperty("channel_status"))
43
- self.threshold = -1 # Starts with invalid value. To be set.
44
- self.wavelength = -1
45
- self.det_distance = -1
46
- self.beam_x = -1
47
- self.beam_y = -1
48
- self.default_beam_x = float(self.getProperty("default_beam_x"))
49
- self.default_beam_y = float(self.getProperty("default_beam_y"))
50
-
51
- self._distance_motor_hwobj = self.get_object_by_role("detector_distance")
52
- self.threshold = self.get_threshold_energy()
53
-
54
- def set_roi_mode(self, roi_mode):
55
- self._roi_mode = roi_mode
56
- self.emit("detectorModeChanged", (self._roi_mode,))
57
-
58
- def has_shutterless(self):
59
- """Returns always True"""
60
- return True
61
-
62
- def get_beam_position(self, distance=None, wavelength=None):
63
- """Get approx detector centre"""
64
- xval, yval = super(LNLSPilatusDet, self).get_beam_position(distance=distance)
65
- if None in (xval, yval):
66
- # default to Pilatus values
67
- xval = self.getProperty("width", 2463) / 2.0 + 0.4
68
- yval = self.getProperty("height", 2527) / 2.0 + 0.4
69
- return xval, yval
70
-
71
- def update_values(self):
72
- self.emit("detectorModeChanged", (self._roi_mode,))
73
- self.emit("temperatureChanged", (self._temperature, True))
74
- self.emit("humidityChanged", (self._humidity, True))
75
- self.emit("expTimeLimitsChanged", (self._exposure_time_limits,))
76
- self.emit("frameRateChanged", self.actual_frame_rate)
77
- self.emit("statusChanged", (self.status, "Ready"))
78
-
79
- def prepare_acquisition(self, *args, **kwargs):
80
- """
81
- Prepares detector for acquisition
82
- """
83
- return
84
-
85
- def last_image_saved(self):
86
- """
87
- Returns:
88
- str: path to last image
89
- """
90
- return
91
-
92
- def start_acquisition(self):
93
- """
94
- Starts acquisition
95
- """
96
- return
97
-
98
- def stop_acquisition(self):
99
- """
100
- Stops acquisition
101
- """
102
- return
103
-
104
- def get_threshold_energy(self):
105
- """
106
- Returns:
107
- float: threshold energy
108
- """
109
- value = float(self.get_channel_value(self.DET_THRESHOLD))
110
- return value
111
-
112
- def set_threshold_energy(self, energy):
113
- """
114
- Set threshold energy and returns whether it was successful or not.
115
- """
116
- try:
117
- float(energy)
118
- except Exception as e:
119
- self.log.error(
120
- "Error while setting Pilatus threshold. Value must be float."
121
- )
122
-
123
- self.log.exception("")
124
- return False
125
-
126
- target_threshold = energy / 2
127
- if abs(self.get_threshold_energy() - target_threshold) < 0.0001:
128
- return True
129
-
130
- self.log.info("Setting Pilatus threshold...")
131
- for i in range(3):
132
- logging.getLogger("user_level_log").info("Setting Pilatus threshold...")
133
-
134
- self.set_channel_value(self.DET_THRESHOLD, target_threshold)
135
-
136
- # wait for threshold setting to be done
137
- time.sleep(2)
138
- # Using epics because we need 'as_string' option
139
- status = self.pv_status.get(as_string=True)
140
- self.log.info("Pilatus status: %s" % status)
141
-
142
- while status == "Setting threshold":
143
- self.log.info("Pilatus status: %s (this may take a minute)..." % status)
144
- time.sleep(3)
145
- status = self.pv_status.get(as_string=True)
146
-
147
- self.threshold = self.get_threshold_energy()
148
- self.log.info(
149
- "Pilatus: current threshold is %s (target is %s)"
150
- % (self.threshold, target_threshold)
151
- )
152
- if status == "Camserver returned OK" and self.threshold == target_threshold:
153
- self.log.info("Pilatus status: %s" % status)
154
- self.log.info("Pilatus threshold successfully set.")
155
- return True
156
-
157
- self.log.error("Pilatus status: %s" % status)
158
- self.log.error(
159
- "Error while setting Pilatus threshold. Please, check the detector."
160
- )
161
- return False
162
-
163
- def get_wavelength(self):
164
- """
165
- Returns:
166
- float: wavelength
167
- """
168
- value = float(self.get_channel_value(self.DET_WAVELENGTH))
169
- return value
170
-
171
- def set_wavelength(self, wavelength):
172
- """
173
- Set wavelength and returns whether it was successful or not.
174
- """
175
- try:
176
- float(wavelength)
177
- except Exception as e:
178
- self.log.error(
179
- "Error while setting Pilatus wavelength. Value must be float."
180
- )
181
-
182
- self.log.exception("")
183
- return False
184
-
185
- # if abs(self.wavelength - wavelength) < 0.0001:
186
- # self.log.info(
187
- # "Pilatus wavelength still okay."
188
- # )
189
- # return True
190
-
191
- # As the set of Pilatus wavelength, det dist and beam xy is fast,
192
- # there is no need to compare the target value with the current one.
193
- self.log.info("Setting Pilatus wavelength...")
194
- self.set_channel_value(self.DET_WAVELENGTH, wavelength)
195
- time.sleep(0.6)
196
-
197
- print("WAVELENGHT WAS SET: " + str(wavelength))
198
- self.wavelength = self.get_wavelength()
199
- print("WAVELENGHT GOT: " + str(self.wavelength))
200
-
201
- if abs(self.wavelength - wavelength) < 0.0001:
202
- self.log.info("Pilatus wavelength successfully set.")
203
- return True
204
-
205
- self.log.error(
206
- "Error while setting Pilatus wavelength. Please, check the detector."
207
- )
208
- return False
209
-
210
- def get_detector_distance(self):
211
- """
212
- Returns:
213
- float: detector distance
214
- """
215
- value = float(self.get_channel_value(self.DET_DETDIST))
216
- return value
217
-
218
- def set_detector_distance(self, det_distance):
219
- """
220
- Set detector distance and returns whether it was successful or not.
221
- """
222
- try:
223
- float(det_distance)
224
- except Exception as e:
225
- self.log.error(
226
- "Error while setting Pilatus det distance. Value must be float."
227
- )
228
-
229
- self.log.exception("")
230
- return False
231
-
232
- # if abs(self.det_distance - det_distance) < 0.001:
233
- # self.log.info(
234
- # "Pilatus det distance still okay."
235
- # )
236
- # return True
237
-
238
- self.log.info("Setting Pilatus det distance...")
239
- self.set_channel_value(self.DET_DETDIST, det_distance)
240
- time.sleep(0.3)
241
-
242
- self.det_distance = self.get_detector_distance()
243
-
244
- if abs(self.det_distance - det_distance) < 0.001:
245
- self.log.info("Pilatus det distance successfully set.")
246
- return True
247
-
248
- self.log.error(
249
- "Error while setting Pilatus det distance. Please, check the detector."
250
- )
251
- return False
252
-
253
- def get_user_beam_x(self):
254
- """
255
- Returns:
256
- float: user beam x
257
- """
258
- value = float(self.get_channel_value(self.USER_BEAM_X))
259
- return value
260
-
261
- def get_beam_x(self):
262
- """
263
- Returns:
264
- float: detector beam x
265
- """
266
- value = float(self.get_channel_value(self.DET_BEAM_X))
267
- return value
268
-
269
- def set_beam_x(self, from_user=False, beam_x=None):
270
- """
271
- Set detector beam_x and returns whether it was successful or not.
272
-
273
- Beam X value can come from different sources. The priority (from
274
- high to low) is:
275
- * from_user
276
- * beam_x argument
277
- * default_beam_x (value set on xml file)
278
- """
279
- if from_user:
280
- self.log.info("Getting beam X from user...")
281
- beam_x = self.get_user_beam_x()
282
-
283
- if beam_x is None:
284
- if from_user:
285
- self.log.error(
286
- "Could not get user beam X. Setting default value (from xml)."
287
- )
288
- beam_x = self.default_beam_x
289
-
290
- # if abs(self.beam_x - beam_x) == 0:
291
- # self.log.info(
292
- # "Pilatus beam X still okay."
293
- # )
294
- # return True
295
-
296
- self.log.info("Setting Pilatus beam X to {}...".format(beam_x))
297
- self.set_channel_value(self.DET_BEAM_X, beam_x)
298
- time.sleep(1)
299
-
300
- self.beam_x = self.get_beam_x()
301
-
302
- if float(self.beam_x) == float(beam_x):
303
- self.log.info("Pilatus det beam X successfully set.")
304
- return True
305
-
306
- self.log.error(
307
- "Error while setting Pilatus beam X. Please, check the detector."
308
- )
309
- return False
310
-
311
- def get_user_beam_y(self):
312
- """
313
- Returns:
314
- float: user beam y
315
- """
316
- value = float(self.get_channel_value(self.USER_BEAM_Y))
317
- return value
318
-
319
- def get_beam_y(self):
320
- """
321
- Returns:
322
- float: detector beam y
323
- """
324
- value = float(self.get_channel_value(self.DET_BEAM_Y))
325
- return value
326
-
327
- def set_beam_y(self, from_user=False, beam_y=None):
328
- """
329
- Set detector beam_y and returns whether it was successful or not.
330
-
331
- Beam Y value can come from different sources. The priority (from
332
- high to low) is:
333
- * from_user
334
- * beam_y argument
335
- * default_beam_y (value set on xml file)
336
- """
337
- if from_user:
338
- self.log.info("Getting beam Y from user...")
339
- beam_y = self.get_user_beam_y()
340
-
341
- if beam_y is None:
342
- if from_user:
343
- self.log.error(
344
- "Could not get user beam Y. Setting default value (from xml)."
345
- )
346
- beam_y = self.default_beam_y
347
-
348
- # if abs(self.beam_y - beam_y) == 0:
349
- # self.log.info(
350
- # "Pilatus beam X still okay."
351
- # )
352
- # return True
353
-
354
- self.log.info("Setting Pilatus beam Y to {}...".format(beam_y))
355
- self.set_channel_value(self.DET_BEAM_Y, beam_y)
356
- time.sleep(1)
357
-
358
- self.beam_y = self.get_beam_y()
359
-
360
- if float(self.beam_y) == float(beam_y):
361
- self.log.info("Pilatus det beam Y successfully set.")
362
- return True
363
-
364
- self.log.error(
365
- "Error while setting Pilatus beam Y. Please, check the detector."
366
- )
367
- return False
368
-
369
- def get_transmission(self):
370
- """
371
- Returns:
372
- float: detector filter transmission value
373
- """
374
- value = float(self.get_channel_value(self.DET_TRANSMISSION))
375
- return value
376
-
377
- def set_transmission(self, transmission):
378
- """
379
- Set filter transmission and returns whether it was successful or not.
380
- """
381
- try:
382
- float(transmission)
383
- except Exception as e:
384
- self.log.error(
385
- "Error while setting Pilatus transmission. Value must be float."
386
- )
387
-
388
- self.log.exception("")
389
- return False
390
-
391
- self.log.info("Setting Pilatus transmission to {}...".format(transmission))
392
- self.set_channel_value(self.DET_TRANSMISSION, transmission)
393
- time.sleep(0.3)
394
-
395
- self.transmission = self.get_transmission()
396
-
397
- if abs(self.transmission - transmission) < 0.0001:
398
- self.log.info("Pilatus transmission successfully set.")
399
- return True
400
-
401
- self.log.error(
402
- "Error while setting Pilatus transmission. Please, check the detector."
403
- )
404
- return False
405
-
406
- def get_start_angle(self):
407
- """
408
- Returns:
409
- float: detector start angle value
410
- """
411
- value = float(self.get_channel_value(self.DET_START_ANGLE))
412
- return value
413
-
414
- def set_start_angle(self, start_angle):
415
- """
416
- Set start angle and returns whether it was successful or not.
417
- """
418
- try:
419
- float(start_angle)
420
- except Exception as e:
421
- self.log.error(
422
- "Error while setting Pilatus start angle. Value must be float."
423
- )
424
-
425
- self.log.exception("")
426
- return False
427
-
428
- self.log.info("Setting Pilatus start angle to {}...".format(start_angle))
429
- self.set_channel_value(self.DET_START_ANGLE, start_angle)
430
- time.sleep(3)
431
-
432
- self.start_angle = self.get_start_angle()
433
-
434
- if abs(self.start_angle - start_angle) < 0.0001:
435
- self.log.info("Pilatus start angle successfully set.")
436
- return True
437
-
438
- self.log.error(
439
- "Error while setting Pilatus start angle. Please, check the detector."
440
- )
441
- return False
442
-
443
- def get_angle_incr(self):
444
- """
445
- Returns:
446
- float: detector angle increment value
447
- """
448
- value = float(self.get_channel_value(self.DET_ANGLE_INCR))
449
- return value
450
-
451
- def set_angle_incr(self, angle_incr):
452
- """
453
- Set angle increment and returns whether it was successful or not.
454
- """
455
- try:
456
- float(angle_incr)
457
- except Exception as e:
458
- self.log.error(
459
- "Error while setting Pilatus angle increment. Value must be float."
460
- )
461
-
462
- self.log.exception("")
463
- return False
464
-
465
- self.log.info("Setting Pilatus angle increment to {}...".format(angle_incr))
466
- self.set_channel_value(self.DET_ANGLE_INCR, angle_incr)
467
- time.sleep(3)
468
-
469
- self.angle_incr = self.get_angle_incr()
470
-
471
- if abs(self.angle_incr - angle_incr) < 0.0001:
472
- self.log.info("Pilatus angle increment successfully set.")
473
- return True
474
-
475
- self.log.error(
476
- "Error while setting Pilatus angle increment. Please, check the detector."
477
- )
478
- return False
@@ -1,48 +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 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 General Public License for more details.
16
- #
17
- # You should have received a copy of the GNU General Public License
18
- # along with MXCuBE. If not, see <http://www.gnu.org/licenses/>.
19
-
20
-
21
- from mxcubecore.HardwareObjects.abstract.AbstractSlits import AbstractSlits
22
-
23
- __credits__ = ["MXCuBE collaboration"]
24
-
25
-
26
- class LNLSSlits(AbstractSlits):
27
- def __init__(self, *args):
28
- AbstractSlits.__init__(self, *args)
29
-
30
- def init(self):
31
- # Slits start wide open
32
- self._value = [1.00, 1.00]
33
- self._min_limits = [0.001, 0.001]
34
- self._max_limits = [1, 1]
35
-
36
- def set_horizontal_gap(self, value):
37
- self._value[0] = value
38
- self.emit("valueChanged", self._value)
39
-
40
- def set_vertical_gap(self, value):
41
- self._value[1] = value
42
- self.emit("valueChanged", self._value)
43
-
44
- def stop_horizontal_gap_move(self):
45
- return
46
-
47
- def stop_vertical_gap_move(self):
48
- return
@@ -1,82 +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 General Lesser Public License
19
- # along with MXCuBE. If not, see <http://www.gnu.org/licenses/>.
20
-
21
-
22
- from mxcubecore import HardwareRepository as HWR
23
- from mxcubecore.HardwareObjects.abstract.AbstractTransmission import (
24
- AbstractTransmission,
25
- )
26
- from mxcubecore.HardwareObjects.LNLS.EPICSActuator import EPICSActuator
27
- from mxcubecore.HardwareObjects.LNLS.read_transmission_mnc import read_transmission
28
- from mxcubecore.HardwareObjects.LNLS.set_transmission_mnc import (
29
- get_transmission,
30
- set_foils,
31
- )
32
-
33
- __copyright__ = """ Copyright © 2020 by the MXCuBE collaboration """
34
- __license__ = "LGPLv3+"
35
-
36
-
37
- class LNLSTransmission(EPICSActuator, AbstractTransmission):
38
- """Transmission value as a percentage"""
39
-
40
- def init(self):
41
- """Override method."""
42
- AbstractTransmission.init(self)
43
- self.energy = HWR.beamline.energy
44
-
45
- def get_value(self):
46
- """Override method."""
47
- try:
48
- energy_val = float(self.energy.get_value()) # Check if valid energy
49
- value, status = read_transmission(energy_val)
50
- except Exception as e:
51
- return "--"
52
-
53
- if status == 1:
54
- return "--" # Invalid transmission read
55
-
56
- percentage = round(value * 100, 2)
57
- return percentage
58
-
59
- def _set_value(self, value):
60
- """Override method."""
61
- try:
62
- energy_val = float(self.energy.get_value()) # Check if valid energy
63
- _, actual_transmission, filter_setup = get_transmission(energy_val, value)
64
- actual_transmission = round(actual_transmission * 100, 2)
65
-
66
- self.log.info(
67
- "Requested transmission: %s. Closest possible value: %s"
68
- % (str(value), str(actual_transmission))
69
- )
70
-
71
- # status 0 is ok, status 1 is failure
72
- foil_status = set_foils(filter_setup)
73
- except Exception as e:
74
- self.log.error("Error while setting transmission: %s" % str(e))
75
- else:
76
- if foil_status == 0:
77
- self.log.info("Transmission is successfully set!")
78
- return
79
- self.log.error(
80
- "Error: transmission could not be set (returned status %s)."
81
- % foil_status
82
- )
@@ -1,93 +0,0 @@
1
- """
2
- Example xml file
3
- <object class="LNLSZoom">
4
- <username>zoom</username>
5
- <actuator_name>zoom</actuator_name>
6
- <exporter_address>130.235.94.124:9001</exporter_address>
7
- <values>{"LEVEL1": 1, "LEVEL2": 2, "LEVEL3": 3, "LEVEL4": 4, "LEVEL5": 5, "LEV
8
- EL6": 6}</values>
9
- </object>
10
- """
11
-
12
- import time
13
- from enum import Enum
14
-
15
- from mxcubecore.HardwareObjects.abstract.AbstractNState import (
16
- AbstractNState,
17
- BaseValueEnum,
18
- )
19
- from mxcubecore.HardwareObjects.LNLS.EPICSActuator import EPICSActuator
20
-
21
-
22
- class LNLSZoom(EPICSActuator, AbstractNState):
23
- """MicrodiffZoomMockup class"""
24
-
25
- def __init__(self, name):
26
- super(LNLSZoom, self).__init__(name)
27
-
28
- def init(self):
29
- """Initialize the zoom"""
30
- EPICSActuator.init(self)
31
- AbstractNState.init(self)
32
-
33
- self.initialise_values()
34
- _len = len(self.VALUES) - 1
35
- if _len > 0:
36
- # we can only assume that the values are consecutive integers
37
- # so the limits correspond to the keys
38
- limits = (1, _len)
39
- self.set_limits(limits)
40
- else:
41
- # Normally we get the limits from the hardware
42
- limits = (1, 10)
43
- self.set_limits(limits)
44
- # there is nothing in the xml file, create ValueEnum from the limits
45
- self._initialise_values()
46
-
47
- self.update_limits(limits)
48
- current_value = self.get_value()
49
- self.update_value(current_value)
50
- self.update_state(self.STATES.READY)
51
-
52
- def set_limits(self, limits=(None, None)):
53
- """Overridden from AbstractActuator"""
54
- self._nominal_limits = limits
55
-
56
- def update_limits(self, limits=None):
57
- """Overridden from AbstractNState"""
58
- if limits is None:
59
- limits = self.get_limits()
60
-
61
- self._nominal_limits = limits
62
- self.emit("limitsChanged", (limits,))
63
-
64
- def _initialise_values(self):
65
- """Initialise the ValueEnum"""
66
- low, high = self.get_limits()
67
-
68
- values = {"LEVEL%s" % str(v): v for v in range(low, high + 1)}
69
- self.VALUES = Enum(
70
- "ValueEnum",
71
- dict(values, **{item.name: item.value for item in BaseValueEnum}),
72
- )
73
-
74
- def _move(self, value):
75
- """Override super class method."""
76
- self.update_state(self.STATES.BUSY)
77
- time.sleep(0.2)
78
- self.update_state(self.STATES.READY)
79
- current_value = self.get_value()
80
- self.update_value(current_value)
81
- return value
82
-
83
- def get_value(self):
84
- """Override super class method."""
85
- current_val = super(LNLSZoom, self).get_value()
86
- current_enum = self.value_to_enum(current_val)
87
- return current_enum
88
-
89
- def _set_value(self, value):
90
- """Override super class method."""
91
- enum = value
92
- target_val = enum.value
93
- super(LNLSZoom, self)._set_value(target_val)