mosca 2.0.2__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.
- mosca/__init__.py +11 -0
- mosca/common/__init__.py +9 -0
- mosca/common/enums.py +79 -0
- mosca/common/logger.py +139 -0
- mosca/common/threads.py +199 -0
- mosca/common/utils.py +70 -0
- mosca/control/__init__.py +4 -0
- mosca/control/buffer.py +526 -0
- mosca/control/controller.py +278 -0
- mosca/control/datahandler.py +261 -0
- mosca/control/detectors.py +116 -0
- mosca/control/mosca.py +693 -0
- mosca/control/spectra.py +36 -0
- mosca/control/stats.py +43 -0
- mosca/control/tasks/__init__.py +3 -0
- mosca/control/tasks/background.py +118 -0
- mosca/control/tasks/rois.py +466 -0
- mosca/control/tasks/saving.py +391 -0
- mosca/control/tasks/spectrasums.py +185 -0
- mosca/control/tasks/task.py +201 -0
- mosca/control/tasks/taskmanager.py +133 -0
- mosca/devices/__init__.py +28 -0
- mosca/devices/hamamatsu/__init__.py +0 -0
- mosca/devices/hamamatsu/hamamatsu.py +88 -0
- mosca/devices/hamamatsu/hamamatsuhw.py +1298 -0
- mosca/devices/oceanoptics/__init__.py +0 -0
- mosca/devices/oceanoptics/oceanoptics.py +59 -0
- mosca/devices/oceanoptics/oceanopticshw.py +379 -0
- mosca/devices/simulation/__init__.py +0 -0
- mosca/devices/simulation/dante/__init__.py +1 -0
- mosca/devices/simulation/dante/simdante.py +33 -0
- mosca/devices/simulation/dante/simdantehw.py +506 -0
- mosca/devices/simulation/dummy/__init__.py +1 -0
- mosca/devices/simulation/dummy/dummy.py +299 -0
- mosca/devices/simulation/generator.py +607 -0
- mosca/devices/simulation/xia/__init__.py +1 -0
- mosca/devices/simulation/xia/iniparser.py +99 -0
- mosca/devices/simulation/xia/simfalconx.py +26 -0
- mosca/devices/simulation/xia/simfalconxhw.py +599 -0
- mosca/devices/xglab/__init__.py +0 -0
- mosca/devices/xglab/dante.py +126 -0
- mosca/devices/xglab/dantehw.py +1178 -0
- mosca/devices/xia/__init__.py +0 -0
- mosca/devices/xia/falconx.py +232 -0
- mosca/devices/xia/handel/__init__.py +14 -0
- mosca/devices/xia/handel/_cffi.py +62 -0
- mosca/devices/xia/handel/error.py +272 -0
- mosca/devices/xia/handel/handel_inc/handel_constants.h +127 -0
- mosca/devices/xia/handel/handel_inc/handel_errors.h +254 -0
- mosca/devices/xia/handel/handel_inc/handel_generic.h +66 -0
- mosca/devices/xia/handel/interface.py +1025 -0
- mosca/devices/xia/handel/mapping.py +107 -0
- mosca/devices/xia/handel/parser.py +62 -0
- mosca/devices/xia/handel/stats.py +85 -0
- mosca/devices/xia/mercury.py +160 -0
- mosca/devices/xia/utils.py +47 -0
- mosca/devices/xia/xia.py +575 -0
- mosca/devices/xia/xiads.py +161 -0
- mosca/mosca.py +0 -0
- mosca/tango/__init__.py +2 -0
- mosca/tango/controller.py +80 -0
- mosca/tango/main.py +163 -0
- mosca/tango/mosca.py +513 -0
- mosca/tango/moscav1.py +408 -0
- mosca/tango/shared.py +23 -0
- mosca/tango/tasks/__init__.py +0 -0
- mosca/tango/tasks/background.py +55 -0
- mosca/tango/utils.py +109 -0
- mosca-2.0.2.dist-info/METADATA +32 -0
- mosca-2.0.2.dist-info/RECORD +73 -0
- mosca-2.0.2.dist-info/WHEEL +4 -0
- mosca-2.0.2.dist-info/entry_points.txt +2 -0
- mosca-2.0.2.dist-info/licenses/LICENSE +166 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
logger = logging.getLogger(__name__)
|
|
3
|
+
|
|
4
|
+
import enum
|
|
5
|
+
|
|
6
|
+
from ..buffer import CircularBuffer, AccumulationBuffer
|
|
7
|
+
from ...common.utils import Blocker
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TaskType(enum.Enum):
|
|
11
|
+
SINK = enum.auto()
|
|
12
|
+
LINK = enum.auto()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Task:
|
|
16
|
+
task_type = property(lambda self: self._task_type)
|
|
17
|
+
|
|
18
|
+
detectors = property(lambda self: self._detectors)
|
|
19
|
+
""" Detectors enabled on the detector. These are their IDs,
|
|
20
|
+
not their indices in the spectra buffer. (i.e: chan 7 spectra
|
|
21
|
+
would be found at index 6 in the spectra buffer if detector 3
|
|
22
|
+
is disabled). """
|
|
23
|
+
|
|
24
|
+
spectrum_size = property(lambda self: self._spectrum_size)
|
|
25
|
+
stats_names = property(lambda self: self._stats_names)
|
|
26
|
+
|
|
27
|
+
name = property(lambda self: self._name)
|
|
28
|
+
|
|
29
|
+
def __init__(self, task_type: TaskType, name=None):
|
|
30
|
+
self._task_type = task_type
|
|
31
|
+
if name is None:
|
|
32
|
+
name = id(f"{self.__class__.__name__}_{id(self)}")
|
|
33
|
+
self._name = name
|
|
34
|
+
self._detectors = tuple()
|
|
35
|
+
self._spectrum_size = 0
|
|
36
|
+
self._stats_names = tuple()
|
|
37
|
+
self._blocker = Blocker(self.reconfig)
|
|
38
|
+
|
|
39
|
+
def reconfig(self):
|
|
40
|
+
self._reconfig()
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def delayed_reconfig(self):
|
|
44
|
+
return self._blocker
|
|
45
|
+
|
|
46
|
+
def set_detectors(self, detectors):
|
|
47
|
+
# important, this needs to stay a tuple.
|
|
48
|
+
newchans = tuple(detectors)
|
|
49
|
+
if newchans != self.detectors:
|
|
50
|
+
self.clear()
|
|
51
|
+
self._detectors = newchans
|
|
52
|
+
|
|
53
|
+
def set_spectrum_size(self, spectrum_size):
|
|
54
|
+
if spectrum_size != self.spectrum_size:
|
|
55
|
+
self.clear()
|
|
56
|
+
self._spectrum_size = spectrum_size
|
|
57
|
+
|
|
58
|
+
def set_stats_names(self, stats_names):
|
|
59
|
+
newstats = tuple(stats_names)
|
|
60
|
+
if newstats != self.stats_names:
|
|
61
|
+
self.clear()
|
|
62
|
+
self._stats_names = newstats
|
|
63
|
+
|
|
64
|
+
def clear(self):
|
|
65
|
+
self._clear()
|
|
66
|
+
|
|
67
|
+
def prepare(self, *args, detectors=None, spectrum_size=None, stats_names=None, **kwargs):
|
|
68
|
+
if detectors is not None:
|
|
69
|
+
self._detectors = detectors
|
|
70
|
+
if spectrum_size is not None:
|
|
71
|
+
self._spectrum_size = spectrum_size
|
|
72
|
+
if stats_names is not None:
|
|
73
|
+
self._stats_names = stats_names
|
|
74
|
+
self.clear()
|
|
75
|
+
self._prepare(*args, **kwargs)
|
|
76
|
+
|
|
77
|
+
def notify_start(self):
|
|
78
|
+
self._notify_start()
|
|
79
|
+
|
|
80
|
+
def notify_end(self):
|
|
81
|
+
self._notify_end()
|
|
82
|
+
|
|
83
|
+
def new_data(self, spectra, stats):
|
|
84
|
+
return self._new_data(spectra, stats)
|
|
85
|
+
|
|
86
|
+
# ======================================
|
|
87
|
+
# Those need to be overloaded by the child class
|
|
88
|
+
# ======================================
|
|
89
|
+
|
|
90
|
+
def _reconfig(self):
|
|
91
|
+
self.prepare()
|
|
92
|
+
|
|
93
|
+
def metadata(self):
|
|
94
|
+
return {}
|
|
95
|
+
|
|
96
|
+
def is_active(self):
|
|
97
|
+
raise NotImplementedError()
|
|
98
|
+
|
|
99
|
+
def is_running(self):
|
|
100
|
+
return self.is_active()
|
|
101
|
+
|
|
102
|
+
def _clear(self):
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
def _new_data(self, spectra, stats):
|
|
106
|
+
raise NotImplementedError
|
|
107
|
+
|
|
108
|
+
def _notify_start(self):
|
|
109
|
+
pass
|
|
110
|
+
|
|
111
|
+
def _notify_end(self):
|
|
112
|
+
pass
|
|
113
|
+
|
|
114
|
+
def _prepare(self,
|
|
115
|
+
*args,
|
|
116
|
+
**kwargs):
|
|
117
|
+
raise NotImplementedError
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class LinkTask(Task):
|
|
121
|
+
n_points = property(lambda self: self._n_points)
|
|
122
|
+
|
|
123
|
+
def __init__(self, name=None):
|
|
124
|
+
super().__init__(task_type=TaskType.LINK, name=name)
|
|
125
|
+
self._n_points = 0
|
|
126
|
+
|
|
127
|
+
# def prepare(self, *args, **kwargs):
|
|
128
|
+
# self.clear()
|
|
129
|
+
# super().prepare(*args, **kwargs)
|
|
130
|
+
|
|
131
|
+
def new_data(self, spectra, stats):
|
|
132
|
+
result = super().new_data(spectra, stats)
|
|
133
|
+
self._n_points += spectra.shape[1]
|
|
134
|
+
return result
|
|
135
|
+
|
|
136
|
+
def clear(self):
|
|
137
|
+
self._n_points = 0
|
|
138
|
+
super().clear()
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class SinkTask(Task):
|
|
142
|
+
task_type = TaskType.SINK
|
|
143
|
+
|
|
144
|
+
n_points = property(lambda self: self._data.n_points)
|
|
145
|
+
""" Number of points processed. """
|
|
146
|
+
|
|
147
|
+
n_items = property(lambda self: self._n_items())
|
|
148
|
+
""" number of values computers per data points.
|
|
149
|
+
e.g: number of rois, number of sums, ...
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
data_size = property(lambda self: self._data_size())
|
|
153
|
+
""" Size of the generated data, per data point, per detector.
|
|
154
|
+
e.g:
|
|
155
|
+
- a task summing spectras for X detectors would return spectrum_size
|
|
156
|
+
=> buffer will have a shape of (<num detectors>, <num points (buffer size)>, spectrum_size)
|
|
157
|
+
- a task computing a roi would return 1
|
|
158
|
+
=> buffer will have a shape of (<num rois>, <num points>, 1)
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
dtype = property(lambda self: self._data.dtype)
|
|
162
|
+
|
|
163
|
+
__getitem__ = property(lambda self: self._data.__getitem__)
|
|
164
|
+
flatten = property(lambda self: self._data.flatten)
|
|
165
|
+
|
|
166
|
+
locked = property(lambda self: self._data.locked)
|
|
167
|
+
lock = property(lambda self: self._data.lock)
|
|
168
|
+
unlock = property(lambda self: self._data.unlock)
|
|
169
|
+
|
|
170
|
+
buffer = property(lambda self: self._data)
|
|
171
|
+
|
|
172
|
+
def __init__(self, buffer_size=25000, dtype=None, name=None):
|
|
173
|
+
super().__init__(task_type=TaskType.SINK, name=name)
|
|
174
|
+
self._data = CircularBuffer(buffer_size=buffer_size, dtype=dtype)
|
|
175
|
+
|
|
176
|
+
def get_data(self, *args, **kwargs):
|
|
177
|
+
return self._data.get_data(*args, **kwargs)
|
|
178
|
+
|
|
179
|
+
def clear(self):
|
|
180
|
+
self._data.clear()
|
|
181
|
+
super().clear()
|
|
182
|
+
|
|
183
|
+
def prepare(self, *args, **kwargs):
|
|
184
|
+
super().prepare(*args, **kwargs)
|
|
185
|
+
self._prepare_data()
|
|
186
|
+
|
|
187
|
+
def _prepare_data(self):
|
|
188
|
+
self._data.prepare(n_items=self.n_items, data_size=self.data_size)
|
|
189
|
+
|
|
190
|
+
def _n_items(self):
|
|
191
|
+
""" Size of the generated data, per point, per detector.
|
|
192
|
+
e.g:
|
|
193
|
+
- a task summing spectras for X detectors would return spectrum_size
|
|
194
|
+
=> buffer will have a shape of (<num detectors>, <num points (buffer size)>, spectrum_size)
|
|
195
|
+
- a task computing a roi would return 1
|
|
196
|
+
=> buffer will have a shape of (<num rois>, <num points>, 1)
|
|
197
|
+
"""
|
|
198
|
+
raise NotImplementedError
|
|
199
|
+
|
|
200
|
+
def _data_size(self):
|
|
201
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import copy
|
|
2
|
+
import logging
|
|
3
|
+
logger = logging.getLogger(__name__)
|
|
4
|
+
|
|
5
|
+
from ..detectors import Detectors
|
|
6
|
+
from .task import TaskType
|
|
7
|
+
from .rois import Rois
|
|
8
|
+
# from .spectrasums import SpectraSums
|
|
9
|
+
from .background import Background
|
|
10
|
+
from .saving import Saving
|
|
11
|
+
from ...common.utils import Blocker
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TaskManager:
|
|
15
|
+
detectors = property(lambda self: self._detectors)
|
|
16
|
+
spectrum_size = property(lambda self: self._spectrum_size)
|
|
17
|
+
stats_names = property(lambda self: self._stats_names)
|
|
18
|
+
task_names = property(lambda self: list(self._tasks.keys()))
|
|
19
|
+
|
|
20
|
+
def __init__(self, buffer_size, spectra_dtype):
|
|
21
|
+
self._detectors = Detectors()
|
|
22
|
+
self._spectrum_size = 0
|
|
23
|
+
self._stats_names = tuple()
|
|
24
|
+
|
|
25
|
+
# as of python 3.7 dictionaries are sorted
|
|
26
|
+
self._tasks = {"background": Background(),
|
|
27
|
+
"rois": Rois(buffer_size=buffer_size),
|
|
28
|
+
# "spectrasums": SpectraSums(buffer_size=buffer_size,
|
|
29
|
+
# dtype=int),
|
|
30
|
+
"saving": Saving(buffer_size=0,
|
|
31
|
+
dtype=spectra_dtype)}
|
|
32
|
+
|
|
33
|
+
self._blocker = Blocker(self.reconfig)
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def delayed_reconfig(self):
|
|
37
|
+
return self._blocker
|
|
38
|
+
|
|
39
|
+
def clear(self):
|
|
40
|
+
for task in self._tasks.values():
|
|
41
|
+
task.clear()
|
|
42
|
+
|
|
43
|
+
def reconfig(self):
|
|
44
|
+
for task in self._tasks.values():
|
|
45
|
+
task.set_detectors(tuple(self.detectors.detectors))
|
|
46
|
+
task.set_spectrum_size(self.spectrum_size)
|
|
47
|
+
task.set_stats_names(self.stats_names)
|
|
48
|
+
|
|
49
|
+
@property
|
|
50
|
+
def n_points(self):
|
|
51
|
+
""" Returns the number of processed points available
|
|
52
|
+
for reading. This corresponds to the min number of
|
|
53
|
+
processed points for all is_running tasks.
|
|
54
|
+
Returns None if no tasks are is_running. """
|
|
55
|
+
points = [task.n_points
|
|
56
|
+
for name, task in self._tasks.items()
|
|
57
|
+
if task.is_running() and name != "saving"]
|
|
58
|
+
if points:
|
|
59
|
+
return min(points)
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
def get_task(self, task_name):
|
|
63
|
+
return self._tasks[task_name]
|
|
64
|
+
|
|
65
|
+
def set_spectrum_size(self, spectrum_size):
|
|
66
|
+
self._spectrum_size = spectrum_size
|
|
67
|
+
|
|
68
|
+
def set_detectors(self, detectors: Detectors):
|
|
69
|
+
self._detectors = copy.deepcopy(detectors)
|
|
70
|
+
for task in self._tasks.values():
|
|
71
|
+
task.set_detectors(detectors.detectors)
|
|
72
|
+
|
|
73
|
+
def set_stats_names(self, stats_names):
|
|
74
|
+
self._stats_names = stats_names
|
|
75
|
+
|
|
76
|
+
def new_spectra(self, spectra, stats=None):
|
|
77
|
+
for task in self._tasks.values():
|
|
78
|
+
if task.is_running():
|
|
79
|
+
if task.task_type == TaskType.LINK:
|
|
80
|
+
spectra, stats = task.new_data(spectra, stats)
|
|
81
|
+
else:
|
|
82
|
+
task.new_data(spectra, stats)
|
|
83
|
+
return spectra, stats
|
|
84
|
+
|
|
85
|
+
def insert_task(self, task, index=None):
|
|
86
|
+
# reminder: dictionnaries are sorted since python 3.7
|
|
87
|
+
|
|
88
|
+
tasks = self._tasks
|
|
89
|
+
task_names = self.task_names
|
|
90
|
+
|
|
91
|
+
try:
|
|
92
|
+
task_index = task_names.index(task.name)
|
|
93
|
+
if index is None:
|
|
94
|
+
logger.warning("Task %s is already enabled at position %s.",
|
|
95
|
+
task.name, task_index)
|
|
96
|
+
return
|
|
97
|
+
if index != task_index:
|
|
98
|
+
logger.warning("Moving task %s from position %s to %s.",
|
|
99
|
+
task.name, task_index, index)
|
|
100
|
+
task_names.remove(task.name)
|
|
101
|
+
task_names.insert(index, task.name)
|
|
102
|
+
self._tasks = {name:tasks[name] for name in task_names}
|
|
103
|
+
except ValueError:
|
|
104
|
+
tasks[task.name] = task
|
|
105
|
+
|
|
106
|
+
def lock(self):
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
def unlock(self):
|
|
110
|
+
pass
|
|
111
|
+
|
|
112
|
+
def prepare(self, detectors: Detectors=None, spectrum_size=None, stats_names=None):
|
|
113
|
+
if detectors is not None:
|
|
114
|
+
self.set_detectors(detectors)
|
|
115
|
+
if spectrum_size is not None:
|
|
116
|
+
self.set_spectrum_size(spectrum_size)
|
|
117
|
+
if stats_names is not None:
|
|
118
|
+
self.set_stats_names(stats_names)
|
|
119
|
+
|
|
120
|
+
for task in self._tasks.values():
|
|
121
|
+
task.prepare()
|
|
122
|
+
|
|
123
|
+
def notify_start(self):
|
|
124
|
+
for task in self._tasks.values():
|
|
125
|
+
task.notify_start()
|
|
126
|
+
|
|
127
|
+
def notify_end(self):
|
|
128
|
+
""" Notify the task manager that the acquisition is done and
|
|
129
|
+
all tasks should terminate.
|
|
130
|
+
This method may be called more than once. """
|
|
131
|
+
for task in self._tasks.values():
|
|
132
|
+
if task.is_running():
|
|
133
|
+
task.notify_end()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
def get_tango_classinfo(mca_type):
|
|
2
|
+
mca_type = mca_type.lower()
|
|
3
|
+
if mca_type == "falconx":
|
|
4
|
+
from .xia.falconx import FALCONX_DEVINFO
|
|
5
|
+
return FALCONX_DEVINFO
|
|
6
|
+
if mca_type == "mercury":
|
|
7
|
+
from .xia.mercury import MERCURY_DEVINFO
|
|
8
|
+
return MERCURY_DEVINFO
|
|
9
|
+
elif mca_type == "dante":
|
|
10
|
+
from .xglab.dante import DANTE_DEVINFO
|
|
11
|
+
return DANTE_DEVINFO
|
|
12
|
+
elif mca_type == "oceanoptics":
|
|
13
|
+
from .oceanoptics.oceanoptics import OCEANOPTICS_DEVINFO
|
|
14
|
+
return OCEANOPTICS_DEVINFO
|
|
15
|
+
elif mca_type == "hamamatsu":
|
|
16
|
+
from .hamamatsu.hamamatsu import HAMAMATSU_DEVINFO
|
|
17
|
+
return HAMAMATSU_DEVINFO
|
|
18
|
+
elif mca_type == "simdante":
|
|
19
|
+
from .simulation.dante import SIMDANTE_DEVINFO
|
|
20
|
+
return SIMDANTE_DEVINFO
|
|
21
|
+
elif mca_type == "simfalconx":
|
|
22
|
+
from .simulation.xia import SIMFALCONX_DEVINFO
|
|
23
|
+
return SIMFALCONX_DEVINFO
|
|
24
|
+
elif mca_type == "dummy":
|
|
25
|
+
from .simulation.dummy import DUMMY_DEVINFO
|
|
26
|
+
return DUMMY_DEVINFO
|
|
27
|
+
else:
|
|
28
|
+
raise ValueError(f"Unknown mca type: {mca_type}.")
|
|
File without changes
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
logger = logging.getLogger(__name__)
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
import pathlib
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
import tango
|
|
10
|
+
from tango.server import Device, DeviceMeta, device_property, attribute, command #, GreenMode
|
|
11
|
+
|
|
12
|
+
from ...tango import TangoDevInfo, ControllerDS
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Hamamatsu(ControllerDS):
|
|
16
|
+
module_id = device_property(dtype=int, mandatory=False, default_value=0)
|
|
17
|
+
default_readout_us = device_property(dtype=float, mandatory=False, default_value=0)
|
|
18
|
+
lib_dir = device_property(dtype=str, mandatory=True)
|
|
19
|
+
|
|
20
|
+
exposure_time_us = attribute(lambda self: self.control.exposure_time(), dtype=float)
|
|
21
|
+
exposure_cycle_us = attribute(lambda self: self.control.exposure_cycle(), dtype=float)
|
|
22
|
+
readout_time_us = attribute(lambda self: self.control.readout_time(), dtype=float)
|
|
23
|
+
n_points = attribute(lambda self: self.control.n_points(), dtype=int)
|
|
24
|
+
data_count = attribute(lambda self: self.control.data_count(), dtype=int)
|
|
25
|
+
data_transmit = attribute(lambda self: self.control.data_transmit(), dtype=int)
|
|
26
|
+
trigger_mode = attribute(lambda self: self.control.trigger_mode().name, dtype=str)
|
|
27
|
+
capture_mode = attribute(lambda self: self.control.capture_mode().name, dtype=str)
|
|
28
|
+
trigger_polarity = attribute(lambda self: self.control.trigger_polarity().name, dtype=str)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def init_device(self):
|
|
32
|
+
super().init_device()
|
|
33
|
+
|
|
34
|
+
def _create_control(self):
|
|
35
|
+
sys.path.append(self.lib_dir)
|
|
36
|
+
from .hamamatsuhw import HamamatsuHW
|
|
37
|
+
logger.info("Initializing controller: module_id=%s, "
|
|
38
|
+
"default_readout=%s (us)", self.module_id, self.default_readout_us)
|
|
39
|
+
readout = self.default_readout_us or -1
|
|
40
|
+
if readout <= 0:
|
|
41
|
+
readout = None
|
|
42
|
+
return HamamatsuHW(
|
|
43
|
+
self.module_id,
|
|
44
|
+
readout_time=readout
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
@n_points.write
|
|
48
|
+
def n_points(self, n_points):
|
|
49
|
+
self.control.set_n_points(n_points)
|
|
50
|
+
|
|
51
|
+
@exposure_time_us.write
|
|
52
|
+
def exposure_time_us(self, exposure_time_us):
|
|
53
|
+
self.control.set_exposure_time(exposure_time_us)
|
|
54
|
+
|
|
55
|
+
@exposure_cycle_us.write
|
|
56
|
+
def exposure_cycle_us(self, exposure_cycle_us):
|
|
57
|
+
self.control.set_exposure_cycle(exposure_cycle_us)
|
|
58
|
+
|
|
59
|
+
@readout_time_us.write
|
|
60
|
+
def readout_time_us(self, readout_time_us):
|
|
61
|
+
self.control.set_readout_time(readout_time_us)
|
|
62
|
+
|
|
63
|
+
@data_count.write
|
|
64
|
+
def data_count(self, data_count):
|
|
65
|
+
self.control.set_data_count(data_count)
|
|
66
|
+
|
|
67
|
+
@data_transmit.write
|
|
68
|
+
def data_transmit(self, data_transmit):
|
|
69
|
+
self.control.set_data_transmit(data_transmit)
|
|
70
|
+
|
|
71
|
+
@trigger_mode.write
|
|
72
|
+
def trigger_mode(self, trigger_mode):
|
|
73
|
+
self.control.set_trigger_mode(trigger_mode)
|
|
74
|
+
|
|
75
|
+
@capture_mode.write
|
|
76
|
+
def capture_mode(self, capture_mode):
|
|
77
|
+
self.control.set_capture_mode(capture_mode)
|
|
78
|
+
|
|
79
|
+
@trigger_polarity.write
|
|
80
|
+
def trigger_polarity(self, trigger_polarity):
|
|
81
|
+
self.control.set_trigger_polarity(trigger_polarity)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
HAMAMATSU_DEVINFO = TangoDevInfo(
|
|
85
|
+
klass = Hamamatsu,
|
|
86
|
+
properties = {"module_id": 0,
|
|
87
|
+
"default_readout_us": -1,
|
|
88
|
+
"lib_dir": None})
|