mxcubecore 1.363.0__py3-none-any.whl → 1.365.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.
@@ -44,6 +44,7 @@ import math
44
44
 
45
45
  from gevent import spawn
46
46
 
47
+ from mxcubecore import HardwareRepository as HWR
47
48
  from mxcubecore.BaseHardwareObjects import HardwareObjectState
48
49
  from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy
49
50
 
@@ -108,9 +109,14 @@ class BlissEnergy(AbstractEnergy):
108
109
  Args:
109
110
  value (float): target energy
110
111
  """
112
+ try:
113
+ defocus = HWR.beamline.beam.definer.defocused_beam
114
+ except AttributeError:
115
+ defocus = False
116
+
111
117
  self.update_state(HardwareObjectState.BUSY)
112
118
  try:
113
- self.controller.change_energy(value)
119
+ self.controller.change_energy(value, defocus=defocus)
114
120
  except (AttributeError, RuntimeError):
115
121
  self.energy_motor.set_value(value)
116
122
  self.update_state(HardwareObjectState.READY)
@@ -53,14 +53,14 @@ class ESRFBeamDefiner(AbstractNState):
53
53
  def __init__(self, *args):
54
54
  super().__init__(*args)
55
55
  self.beam_config = {}
56
- self.config = []
56
+ self.bd_config = []
57
57
 
58
58
  def init(self):
59
59
  super().init()
60
60
  self._default_name = self.get_property("default_size_name")
61
61
 
62
62
  # keep the config is needed by the inheriring classes
63
- self.config = self.init_config()
63
+ self.bd_config = self.init_config()
64
64
 
65
65
  # check if we have values other that UNKNOWN
66
66
  if len(self.VALUES) == 1:
@@ -0,0 +1,156 @@
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
+ ID30-B Beam Definer.
22
+
23
+ Example xml configuration:
24
+
25
+ .. code-block:: xml
26
+
27
+ <object class="ESRF.ID30BBeamDefiner">
28
+ <object href="/udiff_aperture" role="controller"/>
29
+ <object href="/bliss" role="bliss"/>
30
+ <transfocator>tf</transfocator>
31
+ <beam_config>
32
+ <name>A10</name>
33
+ <beam_size>0.01, 0.05</beam_size>
34
+ <aperture_size>10</aperture_size>
35
+ <defocused_beam>False</defocused_beam>
36
+ </beam_config>
37
+ <beam_config>
38
+ <name>A20 um</name>
39
+ <beam_size>0.02, 0.02</beam_size>
40
+ <aperture_size>20</aperture_size>
41
+ <defocused_beam>False</defocused_beam>
42
+ </beam_config>
43
+ <beam_config>
44
+ <name>A30</name>
45
+ <beam_size>0.03, 0.03</beam_size>
46
+ <aperture_size>30</aperture_size>
47
+ <defocused_beam>False</defocused_beam>
48
+ </beam_config>
49
+ <beam_config>
50
+ <name>A50</name>
51
+ <beam_size>0.05, 0.05</beam_size>
52
+ <aperture_size>50</aperture_size>
53
+ <defocused_beam>True</defocused_beam>
54
+ </beam_config>
55
+ <beam_config>
56
+ <name>A75</name>
57
+ <beam_size>0.075, 0.075</beam_size>
58
+ <aperture_size>75</aperture_size>
59
+ <defocused_beam>True</defocused_beam>
60
+ </beam_config>
61
+ </object>
62
+ """
63
+
64
+ __copyright__ = """ Copyright © by the MXCuBE collaboration """
65
+ __license__ = "LGPLv3+"
66
+
67
+
68
+ from enum import Enum
69
+
70
+ from mxcubecore.HardwareObjects.ESRF.ESRFBeamDefiner import ESRFBeamDefiner
71
+
72
+
73
+ class ID30BBeamDefiner(ESRFBeamDefiner):
74
+ """ID30B beam definer implementation"""
75
+
76
+ def __init__(self, *args):
77
+ super().__init__(*args)
78
+ self.controller = None
79
+ self.defocused_beam = None
80
+ self.tf_obj = None
81
+
82
+ def init(self):
83
+ """Initialisation"""
84
+ super().init()
85
+
86
+ self.controller = self.get_object_by_role("controller")
87
+ bliss = self.get_object_by_role("bliss")
88
+ self.tf_obj = getattr(bliss, self.get_property("transfocator"))
89
+ _dict = {}
90
+
91
+ for beam_cfg in self.bd_config:
92
+ name = beam_cfg.get_property("name")
93
+ _ap_size = beam_cfg.get_property("aperture_size")
94
+ _aperture = self.controller.value_to_enum(_ap_size, idx=1)
95
+ _defocused_beam = bool(beam_cfg.get_property("defocused_beam"))
96
+ _dict[name] = {"aperture": _aperture, "defocus": _defocused_beam}
97
+
98
+ self.beam_config = _dict
99
+ self._initialise_values()
100
+ self.connect(self.controller, "valueChanged", self._update_name)
101
+
102
+ self.defocused_beam = _dict[self.get_current_position_name()]["defocus"]
103
+
104
+ def get_state(self):
105
+ """Get the device state.
106
+ Returns:
107
+ (enum 'HardwareObjectState'): Device state.
108
+ """
109
+ return self.controller.get_state()
110
+
111
+ def _update_name(self, value=None):
112
+ """
113
+ Emits:
114
+ valueChanged (str): Current beam size name.
115
+ """
116
+ name = self.get_current_position_name()
117
+ self.emit("valueChanged", name)
118
+
119
+ def get_current_position_name(self):
120
+ """Get the current beam size name.
121
+ Returns:
122
+ (str): Current beam size name.
123
+ """
124
+ _aperture = self.controller.get_value()
125
+ for name, value in self.beam_config.items():
126
+ if value["aperture"] == _aperture:
127
+ return name
128
+ return "UNKNOWN"
129
+
130
+ def get_value(self):
131
+ """Get the device value
132
+ Returns:
133
+ (Enum): The current position Enum.
134
+ """
135
+ try:
136
+ value = self.VALUES[self.get_current_position_name()]
137
+ if isinstance(value.value, tuple):
138
+ return value
139
+ return Enum("Dummy", {value.name: value.value[0]})[value.name]
140
+ except (ValueError, KeyError):
141
+ return self.VALUES.UNKNOWN
142
+
143
+ def set_value(self, value, timeout=None):
144
+ """Set the beam size.
145
+ Args:
146
+ value(str): name of the beam size to set.
147
+ timeout(float): Timeout to wait for the execution to finish [s].
148
+ Raises:
149
+ RuntimeError: Cannot change beam size.
150
+ """
151
+ if isinstance(value, Enum):
152
+ value = value.name
153
+
154
+ self.controller.set_value(self.beam_config[value]["aperture"], timeout=timeout)
155
+ self.defocused_beam = self.beam_config[value]["defocus"]
156
+ self.tf_obj.change_tf(defocus=self.defocused_beam)
@@ -107,7 +107,7 @@ class ExporterNStateMockup(AbstractNState):
107
107
  else:
108
108
  value = value.value
109
109
 
110
- self._nominal_value = self.value_to_enum(value)
110
+ self.update_value(self.value_to_enum(value))
111
111
  self.update_state(self.STATES.READY)
112
112
 
113
113
  def get_value(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mxcubecore
3
- Version: 1.363.0
3
+ Version: 1.365.0
4
4
  Summary: Core libraries for the MXCuBE application
5
5
  License: LGPL-3.0-or-later
6
6
  Keywords: mxcube,mxcube3,mxcubecore
@@ -52,7 +52,7 @@ mxcubecore/HardwareObjects/BeamlineActions.py,sha256=Nwf2Gkq6_YIfkSngDGw7VYCkHa9
52
52
  mxcubecore/HardwareObjects/BeamlineTools.py,sha256=rsvNsKb4ReN_w_OvUbuey_zy0gSYYQy-TfdHASYU0nY,1959
53
53
  mxcubecore/HardwareObjects/Bliss.py,sha256=apa2fUXLREwKURq10hYktWnNhC-7ygcSyZWJb1nSPOc,3332
54
54
  mxcubecore/HardwareObjects/BlissActuator.py,sha256=4KwrGPkAespCumlCuQtE-iwRL2liKGsYXbXWRL_QDH0,1819
55
- mxcubecore/HardwareObjects/BlissEnergy.py,sha256=-8obf_zxWN5o86ziWA-S3zkzSuz20Rp8_1pC0FySbtA,5099
55
+ mxcubecore/HardwareObjects/BlissEnergy.py,sha256=IYSKXL6_N4_5a4uuJ0_UzBrgLOWZGLeYRPmql9vvkWs,5301
56
56
  mxcubecore/HardwareObjects/BlissHutchTrigger.py,sha256=Dp1jrUbgQP3f9mhOadhQRpnyAxaV6gN2GLOWitp5pkg,4065
57
57
  mxcubecore/HardwareObjects/BlissMotor.py,sha256=gJvbgGY4_fMBQ9WS3Ws5nNwR3P_zuWaoOCOp5TS2WzE,6494
58
58
  mxcubecore/HardwareObjects/BlissMotorWPositions.py,sha256=NzT7SySPTrGxesIKYE2S8MFS5WVHJ4apxxy5CH9-dn8,4170
@@ -138,7 +138,7 @@ mxcubecore/HardwareObjects/ESRF/BlissHutchTrigger.py,sha256=LTD6X0S8k3NVekxINzPv
138
138
  mxcubecore/HardwareObjects/ESRF/BlissTurret.py,sha256=PpCItrM2S3SuQtt1xgDN2Bi9x3-D7eZxC8MuDWcwqZY,1400
139
139
  mxcubecore/HardwareObjects/ESRF/BlissVolpi.py,sha256=SLLmlUZ7aTcCgsymp_fsbpx5WwgBQ_ug4ihm-dQ3Jr4,1002
140
140
  mxcubecore/HardwareObjects/ESRF/ESRFBeam.py,sha256=9B6VgoG5pUIExgY08sUyvL3LYniUW9Bkb5PRVm-1nsY,13251
141
- mxcubecore/HardwareObjects/ESRF/ESRFBeamDefiner.py,sha256=K9wqsD2sD7HpeC-L6e2AUmpbR8nlPYJOCf9Twmen3j8,3792
141
+ mxcubecore/HardwareObjects/ESRF/ESRFBeamDefiner.py,sha256=D_dG30DRQNInpfzLlDHPTbhvPq6fExCU4AquzHg8Dw4,3798
142
142
  mxcubecore/HardwareObjects/ESRF/ESRFBeamInfo.py,sha256=_JLCOPwhcwd-9REnrBOQlgvJgKqTseaA2aRc4cM_ai8,2298
143
143
  mxcubecore/HardwareObjects/ESRF/ESRFBeamlineActions.py,sha256=GGC1_9rEd1RQzGdOoVdIAGAjOPtwpjpoUFVcJHT9oTc,3259
144
144
  mxcubecore/HardwareObjects/ESRF/ESRFEnergyScan.py,sha256=FztM1wCtbcqLWaCg34z-IPq_HPd9u2KWuPxdsH7oXiQ,13427
@@ -155,6 +155,7 @@ mxcubecore/HardwareObjects/ESRF/ID232BeamDefiner.py,sha256=AivYp-Ty_hz19ytzMoN9Y
155
155
  mxcubecore/HardwareObjects/ESRF/ID29EnergyScan.py,sha256=9Nscojz8KonwWZltpIcRwH06RC2AtZKZGu-oEbMqLLg,2778
156
156
  mxcubecore/HardwareObjects/ESRF/ID29HutchTrigger.py,sha256=vKLuCSuKcHQLvTysQ3r2PGlzY5FkVIDRZt5oOZd3cBE,2949
157
157
  mxcubecore/HardwareObjects/ESRF/ID30A3BeamDefiner.py,sha256=8-hUvKuI2yi8IUMqIN2FN5CrsJKpnEH5pLpz0rufEYU,3999
158
+ mxcubecore/HardwareObjects/ESRF/ID30BBeamDefiner.py,sha256=uZJ0szJFdGysZsgiaxxUYKq1nPVYwK4jZ3xMX74cwqU,5046
158
159
  mxcubecore/HardwareObjects/ESRF/MD2MultiCollect.py,sha256=vJwZvNPu0MDUdN0NK_JrDBDChIcEUVmsoIOkwTqn7RQ,7980
159
160
  mxcubecore/HardwareObjects/ESRF/OxfordCryostream.py,sha256=JA6Gkz3AChV3H5hlW6o-oTw9rllFN6VCq6_5QOKItdc,7339
160
161
  mxcubecore/HardwareObjects/ESRF/SSXICATLIMS.py,sha256=wM7_CAQUwyICrffQPG8FeYi-8zczi5zGGtF6XkfwqeI,3063
@@ -392,7 +393,7 @@ mxcubecore/HardwareObjects/mockup/DoorInterlockMockup.py,sha256=Ug8oiP3ly70fhnrv
392
393
  mxcubecore/HardwareObjects/mockup/EDNACharacterisationMockup.py,sha256=agywWmr6dqNJeLymq83UOBdNGpr6436LrypgWu5x-Zg,1986
393
394
  mxcubecore/HardwareObjects/mockup/EnergyMockup.py,sha256=Qrhkvc2SS84GIIsVbsdST48dUAscuJa3pDmErWdKbmU,2087
394
395
  mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py,sha256=CR0JZ-Pvmrj_ys2okggS_x1raCcit_h4bj6AaIFD8q8,14233
395
- mxcubecore/HardwareObjects/mockup/ExporterNStateMockup.py,sha256=9BpABOmdA4VHMV5w1TLG5_uLV0WIYn-8Zmqam3OF5Dw,3657
396
+ mxcubecore/HardwareObjects/mockup/ExporterNStateMockup.py,sha256=iNeRKpdpl8NdBSsuVhF45-mMUeqJajiD8p98EkFpMus,3654
396
397
  mxcubecore/HardwareObjects/mockup/FluxMockup.py,sha256=3MW657zojJUIh9a7qwfz7Fq8xXH0SJbv2837vcMBBBQ,3037
397
398
  mxcubecore/HardwareObjects/mockup/HarvesterMockup.py,sha256=4mfnzx2cD8x3tORaRsLvS5XALJd9QpSyRN30JYnl61k,15880
398
399
  mxcubecore/HardwareObjects/mockup/ISPyBClientMockup.py,sha256=XPL0fu7-vI1Gxzhs7fEerU9aO_FF78ZpUG6tUVfENkk,17506
@@ -466,8 +467,8 @@ mxcubecore/utils/conversion.py,sha256=G1bk2Mi2ZwGbZa5pEeiFaKWxhSVXVGqu1L9_SioyUO
466
467
  mxcubecore/utils/qt_import.py,sha256=0lPmqok_oYQZ059kJCq7RWdg490T8YKyRvoZGyWDy4M,14486
467
468
  mxcubecore/utils/tango.py,sha256=lAl7Su_GgyXFEEKZ1yu_2gU18wXHVaBbGR8RYcIOVYk,2100
468
469
  mxcubecore/utils/units.py,sha256=2D1QlTwe8eSs2UYRm4VVxSTosZZHeM-Pfw9KlcLbDAg,1251
469
- mxcubecore-1.363.0.dist-info/COPYING,sha256=u-Mc8zCecwyo4YoP8UulmzCiZZ_MmCLROd_NBtOcRj0,35148
470
- mxcubecore-1.363.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
471
- mxcubecore-1.363.0.dist-info/METADATA,sha256=dqzXB7A_z-AuuJ12mXQCwwaJfhj6FMzH13j7HAjv3sE,4259
472
- mxcubecore-1.363.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
473
- mxcubecore-1.363.0.dist-info/RECORD,,
470
+ mxcubecore-1.365.0.dist-info/COPYING,sha256=u-Mc8zCecwyo4YoP8UulmzCiZZ_MmCLROd_NBtOcRj0,35148
471
+ mxcubecore-1.365.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
472
+ mxcubecore-1.365.0.dist-info/METADATA,sha256=ApF1Q_OBKglCVQhHmLMuRVW2HhyT9FtX84IyopdHnDo,4259
473
+ mxcubecore-1.365.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
474
+ mxcubecore-1.365.0.dist-info/RECORD,,