lima2.client 3.1.0__tar.gz → 3.1a0__tar.gz
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.
- {lima2_client-3.1.0/src/lima2_client.egg-info → lima2_client-3.1a0}/PKG-INFO +2 -2
- {lima2_client-3.1.0 → lima2_client-3.1a0}/pyproject.toml +1 -1
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/client.py +0 -26
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/detector.py +2 -16
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/state_machine.py +0 -3
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/master_file/generate.py +1 -48
- {lima2_client-3.1.0 → lima2_client-3.1a0/src/lima2_client.egg-info}/PKG-INFO +2 -2
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2_client.egg-info/requires.txt +1 -1
- {lima2_client-3.1.0 → lima2_client-3.1a0}/LICENSE +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/README.md +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/setup.cfg +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/__init__.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/draw_state_diagram.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/__init__.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/async_github_pull_request.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/async_turnstile.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/boolean_field.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/github_pull_request.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/turnstile.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/exceptions.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/state_machine.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/__init__.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/convert.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/devencoded/__init__.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/devencoded/dense_frame.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/devencoded/exception.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/devencoded/smx_sparse_frame.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/devencoded/sparse_frame.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/devencoded/structured_array.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/pipeline.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/pipelines/__init__.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/pipelines/failing.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/pipelines/legacy.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/pipelines/smx.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/pipelines/xpcs.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/progress_counter.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/py.typed +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/shell.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/topology.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/client/utils.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/master_file/py.typed +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/server/__init__.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/server/control.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/server/receiver.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2/server/timer.py +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2_client.egg-info/SOURCES.txt +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2_client.egg-info/dependency_links.txt +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2_client.egg-info/entry_points.txt +0 -0
- {lima2_client-3.1.0 → lima2_client-3.1a0}/src/lima2_client.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lima2-client
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.1a0
|
|
4
4
|
Summary: Python client library for Lima2 detector
|
|
5
5
|
Author: BCU (ESRF)
|
|
6
6
|
License: Copyright (c) 2020-2024 Beamline Control Unit, ESRF
|
|
@@ -24,7 +24,7 @@ Requires-Dist: gevent
|
|
|
24
24
|
Requires-Dist: jsonschema
|
|
25
25
|
Requires-Dist: jsonschema-default
|
|
26
26
|
Requires-Dist: beartype
|
|
27
|
-
Requires-Dist: numpy
|
|
27
|
+
Requires-Dist: numpy
|
|
28
28
|
Requires-Dist: pyyaml
|
|
29
29
|
Requires-Dist: typing-extensions
|
|
30
30
|
Requires-Dist: h5py
|
|
@@ -89,22 +89,6 @@ class Client:
|
|
|
89
89
|
{saving channel name: list of tasks}.
|
|
90
90
|
"""
|
|
91
91
|
|
|
92
|
-
def cleanup(self):
|
|
93
|
-
"""Unregister all state loggers and tango event handlers.
|
|
94
|
-
|
|
95
|
-
This method serves only in specific cases where event handlers must for
|
|
96
|
-
some reason be unregistered. In a normal use case, a Client is
|
|
97
|
-
instantiated once per Lima2 instance, and no cleanup is necessary.
|
|
98
|
-
|
|
99
|
-
NOTE: After this call, the Client instance should no longer be used.
|
|
100
|
-
"""
|
|
101
|
-
self._detector.unregister_events()
|
|
102
|
-
self._detector = None
|
|
103
|
-
|
|
104
|
-
for pipeline in self.__pipelines.values():
|
|
105
|
-
pipeline.unregister_events()
|
|
106
|
-
self.__pipelines.clear()
|
|
107
|
-
|
|
108
92
|
@classmethod
|
|
109
93
|
def from_yaml(
|
|
110
94
|
cls,
|
|
@@ -183,15 +167,6 @@ class Client:
|
|
|
183
167
|
) -> None:
|
|
184
168
|
"""Prepare acquisition with a given uuid and set of params."""
|
|
185
169
|
|
|
186
|
-
# Check parameters required for master file generation
|
|
187
|
-
checked_params = mfg.check_generation(
|
|
188
|
-
ctrl_params=ctrl_params,
|
|
189
|
-
recv_params=acq_params,
|
|
190
|
-
proc_params=proc_params,
|
|
191
|
-
topology_kind=self.topology_kind,
|
|
192
|
-
)
|
|
193
|
-
ctrl_params, acq_params, proc_params = checked_params
|
|
194
|
-
|
|
195
170
|
# Adjust params for distributed acquisition
|
|
196
171
|
ctl, acq, proc = topology.distribute_acq(
|
|
197
172
|
ctl_params=ctrl_params,
|
|
@@ -234,7 +209,6 @@ class Client:
|
|
|
234
209
|
ctrl_params=ctl,
|
|
235
210
|
recv_params=acq[0],
|
|
236
211
|
proc_params=proc[0],
|
|
237
|
-
topology_kind=self.topology_kind,
|
|
238
212
|
)
|
|
239
213
|
|
|
240
214
|
@docstring_from(Detector.start_acq)
|
|
@@ -73,7 +73,6 @@ class Detector:
|
|
|
73
73
|
|
|
74
74
|
self.__ctrl = ctrl_dev
|
|
75
75
|
self.__recvs = list(recv_devs)
|
|
76
|
-
self._state_event_ids: dict[tango.DeviceProxy, int] = {}
|
|
77
76
|
|
|
78
77
|
self.ping()
|
|
79
78
|
|
|
@@ -101,17 +100,6 @@ class Detector:
|
|
|
101
100
|
d.set_green_mode(tango.GreenMode.Gevent)
|
|
102
101
|
d.set_timeout_millis(timeout * 1000)
|
|
103
102
|
|
|
104
|
-
def unregister_events(self):
|
|
105
|
-
"""Unregister all state loggers and tango event handlers.
|
|
106
|
-
|
|
107
|
-
This method serves only in specific cases where event handlers must for
|
|
108
|
-
some reason be unregistered. In a normal use case, a Client is
|
|
109
|
-
instantiated once per Lima2 instance, and no cleanup is necessary.
|
|
110
|
-
"""
|
|
111
|
-
for device, event_id in self._state_event_ids.items():
|
|
112
|
-
device.unsubscribe_event(event_id)
|
|
113
|
-
self._state_event_ids.clear()
|
|
114
|
-
|
|
115
103
|
@contextlib.contextmanager
|
|
116
104
|
def _locked_fsm(self) -> Iterator[fsm.StateMachine]:
|
|
117
105
|
self.__fsm_lock.acquire()
|
|
@@ -645,14 +633,12 @@ class Detector:
|
|
|
645
633
|
finally:
|
|
646
634
|
_logger.info(f"Current state: {fsm.state}")
|
|
647
635
|
|
|
648
|
-
self.
|
|
649
|
-
dev
|
|
636
|
+
for dev in self.devs:
|
|
637
|
+
dev.subscribe_event(
|
|
650
638
|
"acq_state",
|
|
651
639
|
tango.EventType.CHANGE_EVENT,
|
|
652
640
|
on_acq_state_change,
|
|
653
641
|
)
|
|
654
|
-
for dev in self.devs
|
|
655
|
-
}
|
|
656
642
|
|
|
657
643
|
def _register_on_end_acq_handlers(self):
|
|
658
644
|
"""Register an "end of acquisition" callback on each receiver.
|
|
@@ -239,9 +239,6 @@ class StateMachine(fsm.StateMachine):
|
|
|
239
239
|
if logger in self.__loggers:
|
|
240
240
|
self.__loggers.remove(logger)
|
|
241
241
|
|
|
242
|
-
def clear_transition_loggers(self):
|
|
243
|
-
self.__loggers.clear()
|
|
244
|
-
|
|
245
242
|
def on_state_change(self, state):
|
|
246
243
|
_logger.debug(f"on_state_change {state}")
|
|
247
244
|
futures = []
|
|
@@ -27,7 +27,6 @@ import gevent
|
|
|
27
27
|
import gevent.event
|
|
28
28
|
|
|
29
29
|
from lima2.client.pipeline import FrameType, Pipeline
|
|
30
|
-
from lima2.client.topology import TopologyKind
|
|
31
30
|
|
|
32
31
|
logger = logging.getLogger(__name__)
|
|
33
32
|
|
|
@@ -67,54 +66,12 @@ class MasterFileTask:
|
|
|
67
66
|
self.task.join()
|
|
68
67
|
|
|
69
68
|
|
|
70
|
-
def check_generation(
|
|
71
|
-
ctrl_params: dict,
|
|
72
|
-
recv_params: dict,
|
|
73
|
-
proc_params: dict,
|
|
74
|
-
topology_kind: TopologyKind,
|
|
75
|
-
) -> list[dict]:
|
|
76
|
-
"""Check the parameters to be sent to prepare to ensure master file info"""
|
|
77
|
-
|
|
78
|
-
# group all active saving subsystems
|
|
79
|
-
active_saving_params: list[dict] = []
|
|
80
|
-
|
|
81
|
-
# first check receiver raw saving or SDK saving
|
|
82
|
-
for params in [recv_params, ctrl_params]:
|
|
83
|
-
if "saving" in params and params["saving"]["enabled"]:
|
|
84
|
-
active_saving_params.append(params["saving"])
|
|
85
|
-
break
|
|
86
|
-
|
|
87
|
-
# then check the saving streams of the current pipeline
|
|
88
|
-
for source, params in proc_params.items():
|
|
89
|
-
# Skip other subsystems
|
|
90
|
-
if not source.startswith("saving"):
|
|
91
|
-
continue
|
|
92
|
-
# Skip source if channel is disabled
|
|
93
|
-
if params["enabled"]:
|
|
94
|
-
active_saving_params.append(params)
|
|
95
|
-
|
|
96
|
-
need_frame_lut = topology_kind == TopologyKind.UNEVEN
|
|
97
|
-
|
|
98
|
-
# include detector frame_idx dataset in HDF5 files
|
|
99
|
-
for saving_params in active_saving_params:
|
|
100
|
-
if need_frame_lut and "include_frame_idx" in saving_params:
|
|
101
|
-
saving_params["include_frame_idx"] = True
|
|
102
|
-
|
|
103
|
-
# allow retreiving recv-det-frame-idx mapping
|
|
104
|
-
if need_frame_lut and "frame_idx_enabled" in proc_params:
|
|
105
|
-
logger.debug("Enabling frame_idx generation")
|
|
106
|
-
proc_params["frame_idx_enabled"] = True
|
|
107
|
-
|
|
108
|
-
return ctrl_params, recv_params, proc_params
|
|
109
|
-
|
|
110
|
-
|
|
111
69
|
def enable_generation(
|
|
112
70
|
pipeline: Pipeline,
|
|
113
71
|
num_frames: int,
|
|
114
72
|
ctrl_params: dict,
|
|
115
73
|
recv_params: dict,
|
|
116
74
|
proc_params: dict,
|
|
117
|
-
topology_kind: TopologyKind,
|
|
118
75
|
rr_offset: int = 0,
|
|
119
76
|
lut_source: LUTSource = LUTSource.AUTO,
|
|
120
77
|
) -> dict[str, MasterFileTask]:
|
|
@@ -187,8 +144,6 @@ def enable_generation(
|
|
|
187
144
|
proc_params=proc_params,
|
|
188
145
|
)
|
|
189
146
|
|
|
190
|
-
need_frame_lut = topology_kind == TopologyKind.UNEVEN
|
|
191
|
-
|
|
192
147
|
for source, frame_info, saving_params, cnt_name in active_saving_params:
|
|
193
148
|
base_path = saving_params["base_path"]
|
|
194
149
|
filename_prefix = saving_params["filename_prefix"]
|
|
@@ -216,12 +171,10 @@ def enable_generation(
|
|
|
216
171
|
this_lut_source = LUTSource.ROUND_ROBIN
|
|
217
172
|
if this_lut_source is None:
|
|
218
173
|
raise ValueError(f"Cannot satisfy {lut_source=}: {file_lut=}, {recv_lut=}")
|
|
219
|
-
elif this_lut_source == LUTSource.ROUND_ROBIN and need_frame_lut:
|
|
220
|
-
raise ValueError(f"Cannot use {this_lut_source} with {topology_kind}")
|
|
221
174
|
|
|
222
175
|
logger.info(
|
|
223
176
|
f"Master file (channel={source}) will be generated "
|
|
224
|
-
f"at {master_file_path}
|
|
177
|
+
f"at {master_file_path}..."
|
|
225
178
|
)
|
|
226
179
|
|
|
227
180
|
if frame_info is not None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lima2-client
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.1a0
|
|
4
4
|
Summary: Python client library for Lima2 detector
|
|
5
5
|
Author: BCU (ESRF)
|
|
6
6
|
License: Copyright (c) 2020-2024 Beamline Control Unit, ESRF
|
|
@@ -24,7 +24,7 @@ Requires-Dist: gevent
|
|
|
24
24
|
Requires-Dist: jsonschema
|
|
25
25
|
Requires-Dist: jsonschema-default
|
|
26
26
|
Requires-Dist: beartype
|
|
27
|
-
Requires-Dist: numpy
|
|
27
|
+
Requires-Dist: numpy
|
|
28
28
|
Requires-Dist: pyyaml
|
|
29
29
|
Requires-Dist: typing-extensions
|
|
30
30
|
Requires-Dist: h5py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/async_turnstile.py
RENAMED
|
File without changes
|
{lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/boolean_field.py
RENAMED
|
File without changes
|
{lima2_client-3.1.0 → lima2_client-3.1a0}/src/finite_state_machine/examples/github_pull_request.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|