biosignal-device-interface 0.1.32a1__py3-none-any.whl → 0.2.1__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.
- biosignal_device_interface/constants/devices/__init__.py +3 -3
- biosignal_device_interface/constants/devices/core/base_device_constants.py +61 -61
- biosignal_device_interface/constants/devices/otb/otb_muovi_constants.py +129 -129
- biosignal_device_interface/constants/devices/otb/otb_quattrocento_constants.py +313 -313
- biosignal_device_interface/constants/devices/otb/otb_quattrocento_light_constants.py +59 -59
- biosignal_device_interface/constants/devices/otb/otb_syncstation_constants.py +233 -233
- biosignal_device_interface/constants/plots/color_palette.py +59 -59
- biosignal_device_interface/devices/__init__.py +17 -17
- biosignal_device_interface/devices/core/base_device.py +424 -412
- biosignal_device_interface/devices/otb/__init__.py +29 -29
- biosignal_device_interface/devices/otb/otb_muovi.py +290 -290
- biosignal_device_interface/devices/otb/otb_quattrocento.py +332 -332
- biosignal_device_interface/devices/otb/otb_quattrocento_light.py +210 -210
- biosignal_device_interface/devices/otb/otb_syncstation.py +407 -407
- biosignal_device_interface/gui/device_template_widgets/all_devices_widget.py +51 -51
- biosignal_device_interface/gui/device_template_widgets/core/base_device_widget.py +130 -130
- biosignal_device_interface/gui/device_template_widgets/core/base_multiple_devices_widget.py +108 -108
- biosignal_device_interface/gui/device_template_widgets/otb/otb_devices_widget.py +44 -44
- biosignal_device_interface/gui/device_template_widgets/otb/otb_muovi_plus_widget.py +158 -158
- biosignal_device_interface/gui/device_template_widgets/otb/otb_muovi_widget.py +158 -158
- biosignal_device_interface/gui/device_template_widgets/otb/otb_quattrocento_light_widget.py +174 -174
- biosignal_device_interface/gui/device_template_widgets/otb/otb_quattrocento_widget.py +260 -260
- biosignal_device_interface/gui/device_template_widgets/otb/otb_syncstation_widget.py +262 -262
- biosignal_device_interface/gui/plot_widgets/biosignal_plot_widget.py +500 -501
- biosignal_device_interface/gui/ui/devices_template_widget.ui +38 -38
- biosignal_device_interface/gui/ui/otb_muovi_plus_template_widget.ui +171 -171
- biosignal_device_interface/gui/ui/otb_muovi_template_widget.ui +171 -171
- biosignal_device_interface/gui/ui/otb_quattrocento_light_template_widget.ui +266 -266
- biosignal_device_interface/gui/ui/otb_quattrocento_template_widget.ui +415 -415
- biosignal_device_interface/gui/ui/otb_syncstation_template_widget.ui +732 -732
- biosignal_device_interface/gui/ui_compiled/devices_template_widget.py +56 -56
- biosignal_device_interface/gui/ui_compiled/otb_muovi_plus_template_widget.py +153 -153
- biosignal_device_interface/gui/ui_compiled/otb_muovi_template_widget.py +153 -153
- biosignal_device_interface/gui/ui_compiled/otb_quattrocento_light_template_widget.py +217 -217
- biosignal_device_interface/gui/ui_compiled/otb_quattrocento_template_widget.py +318 -318
- biosignal_device_interface/gui/ui_compiled/otb_syncstation_template_widget.py +495 -495
- {biosignal_device_interface-0.1.32a1.dist-info → biosignal_device_interface-0.2.1.dist-info}/LICENSE +675 -675
- {biosignal_device_interface-0.1.32a1.dist-info → biosignal_device_interface-0.2.1.dist-info}/METADATA +2 -2
- biosignal_device_interface-0.2.1.dist-info/RECORD +46 -0
- {biosignal_device_interface-0.1.32a1.dist-info → biosignal_device_interface-0.2.1.dist-info}/WHEEL +1 -1
- biosignal_device_interface-0.1.32a1.dist-info/RECORD +0 -46
|
@@ -1,313 +1,313 @@
|
|
|
1
|
-
from aenum import Enum, auto
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Quattrocento constants.
|
|
5
|
-
|
|
6
|
-
Developer: Dominik I. Braun
|
|
7
|
-
Contact: dome.braun@fau.de
|
|
8
|
-
Last Update: 2025-01-14
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# ------- Command Byte Sequences --------
|
|
13
|
-
class QuattrocentoCommandSequence(Enum):
|
|
14
|
-
"""
|
|
15
|
-
Enum class for the different kind of command sequences.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
_init_ = "value __doc__"
|
|
19
|
-
|
|
20
|
-
NONE = auto(), "None"
|
|
21
|
-
ACQ_SETT = auto(), "Acquisition settings command sequence"
|
|
22
|
-
AN_OUT_IN_SEL = auto(), "Select input source and gain for the analog output"
|
|
23
|
-
AN_OUT_CH_SEL = auto(), "Select the channel for the analog output source"
|
|
24
|
-
IN_CONF = auto(), (
|
|
25
|
-
"Configuration command sequence for the eight IN inputs or",
|
|
26
|
-
"configuration for the four MULTIPLE IN inputs",
|
|
27
|
-
)
|
|
28
|
-
CRC = auto(), "Configuration command sequence byte (8 bits)"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# ------------ ACQ_SETT BYTE ------------
|
|
32
|
-
# Bit 7 is fixed to 1.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class QuattrocentoDecimMode(Enum):
|
|
36
|
-
"""
|
|
37
|
-
Enum class for the decimation bit of the Quattrocento device.
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
_init_ = "value __doc__"
|
|
41
|
-
|
|
42
|
-
INACTIVE = auto(), (
|
|
43
|
-
"Inactive. No decimation. The required sampling",
|
|
44
|
-
"frequency is obtained by sampling the signals",
|
|
45
|
-
"directly at the desired sampling frequency ",
|
|
46
|
-
)
|
|
47
|
-
ACTIVE = auto(), (
|
|
48
|
-
"Active. Decimation active.",
|
|
49
|
-
"The required sampling frequency is obtained by",
|
|
50
|
-
"sampling all the signals at 10240 Hz and then",
|
|
51
|
-
"sending one sample out of 2, 5 or 20, to obtain",
|
|
52
|
-
"the desired number of sample per second.",
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class QuattrocentoRecordingMode(Enum):
|
|
57
|
-
"""
|
|
58
|
-
Enum class for the recording bit.
|
|
59
|
-
|
|
60
|
-
If the Trigger OUT has to be used to synchronize the acquisition with
|
|
61
|
-
other instruments, the recording has to be started when the trigger
|
|
62
|
-
channel has a transition. In other words it is the quattrocento that
|
|
63
|
-
generate a signal indicating to the computer when the data has to be
|
|
64
|
-
recorded.
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
_init_ = "value __doc__"
|
|
68
|
-
|
|
69
|
-
STOP = auto(), "Stop"
|
|
70
|
-
START = auto(), "Start"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class QuattrocentoSamplingFrequencyMode(Enum):
|
|
74
|
-
"""
|
|
75
|
-
Enum class for the sampling frequencies of the Quattrocento device (2 bits).
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
_init_ = "value __doc__"
|
|
79
|
-
|
|
80
|
-
LOW = auto(), "512 Hz"
|
|
81
|
-
MEDIUM = auto(), "2048 Hz"
|
|
82
|
-
HIGH = auto(), "5120 Hz"
|
|
83
|
-
ULTRA = auto(), "10240 Hz"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class QuattrocentoNumberOfChannelsMode(Enum):
|
|
87
|
-
"""
|
|
88
|
-
Enum class for the number of channels of the Quattrocento device (2 bits).
|
|
89
|
-
"""
|
|
90
|
-
|
|
91
|
-
_init_ = "value __doc__"
|
|
92
|
-
|
|
93
|
-
LOW = auto(), "IN1, IN2 and MULTIPLE_IN1 are active."
|
|
94
|
-
MEDIUM = auto(), "IN1-IN4, MULTIPLE_IN1, MULTIPLE_IN2 are active."
|
|
95
|
-
HIGH = auto(), "IN1-IN6, MULTIPLE_IN1-MULTIPLE_IN2 are active."
|
|
96
|
-
ULTRA = auto(), "IN1-IN8, MULTIPLE_IN1-MULTIPLE_IN4 are active."
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
class QuattrocentoAcquisitionMode(Enum):
|
|
100
|
-
"""
|
|
101
|
-
Enum class for the acquisition bit.
|
|
102
|
-
"""
|
|
103
|
-
|
|
104
|
-
_init_ = "value __doc__"
|
|
105
|
-
|
|
106
|
-
INACTIVE = auto(), "Inactive. Data sampling and transfer is not active"
|
|
107
|
-
ACTIVE = auto(), "Active. Data sampling and transfer is active"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
class QuattrocentoAcqSettByte:
|
|
111
|
-
"""
|
|
112
|
-
Class for the acquisition settings byte of the Quattrocento device.
|
|
113
|
-
"""
|
|
114
|
-
|
|
115
|
-
def __init__(self):
|
|
116
|
-
self._decimation_mode: QuattrocentoDecimMode = None
|
|
117
|
-
self._recording_mode: QuattrocentoRecordingMode = None
|
|
118
|
-
self._sampling_frequency_mode: QuattrocentoSamplingFrequencyMode = None
|
|
119
|
-
self._sampling_frequency: int = None
|
|
120
|
-
self._number_of_channels_mode: QuattrocentoNumberOfChannelsMode = None
|
|
121
|
-
self._number_of_channels: int = None
|
|
122
|
-
self._acquisition_mode: QuattrocentoAcquisitionMode = (
|
|
123
|
-
QuattrocentoAcquisitionMode
|
|
124
|
-
).INACTIVE
|
|
125
|
-
|
|
126
|
-
def update(
|
|
127
|
-
self,
|
|
128
|
-
decimation_mode: QuattrocentoDecimMode,
|
|
129
|
-
recording_mode: QuattrocentoRecordingMode,
|
|
130
|
-
sampling_frequency_mode: QuattrocentoSamplingFrequencyMode,
|
|
131
|
-
number_of_channels_mode: QuattrocentoNumberOfChannelsMode,
|
|
132
|
-
):
|
|
133
|
-
self._decimation_mode = decimation_mode
|
|
134
|
-
self._recording_mode = recording_mode
|
|
135
|
-
self._sampling_frequency_mode = sampling_frequency_mode
|
|
136
|
-
self._number_of_channels_mode = number_of_channels_mode
|
|
137
|
-
|
|
138
|
-
self._configure()
|
|
139
|
-
|
|
140
|
-
def _configure(self):
|
|
141
|
-
self._set_sampling_frequency()
|
|
142
|
-
self._set_number_of_channels()
|
|
143
|
-
|
|
144
|
-
def _set_sampling_frequency(self) -> None:
|
|
145
|
-
mode = self._sampling_frequency_mode
|
|
146
|
-
match mode:
|
|
147
|
-
case QuattrocentoSamplingFrequencyMode.LOW:
|
|
148
|
-
self._sampling_frequency = 512
|
|
149
|
-
case QuattrocentoSamplingFrequencyMode.MEDIUM:
|
|
150
|
-
self._sampling_frequency = 2048
|
|
151
|
-
case QuattrocentoSamplingFrequencyMode.HIGH:
|
|
152
|
-
self._sampling_frequency = 5120
|
|
153
|
-
case QuattrocentoSamplingFrequencyMode.ULTRA:
|
|
154
|
-
self._sampling_frequency = 10240
|
|
155
|
-
case _:
|
|
156
|
-
raise ValueError("Invalid sampling frequency mode.")
|
|
157
|
-
|
|
158
|
-
def _set_number_of_channels(self) -> None:
|
|
159
|
-
mode = self._number_of_channels_mode
|
|
160
|
-
match mode:
|
|
161
|
-
case QuattrocentoNumberOfChannelsMode.LOW:
|
|
162
|
-
self._number_of_channels = 120
|
|
163
|
-
case QuattrocentoNumberOfChannelsMode.MEDIUM:
|
|
164
|
-
self._number_of_channels = 216
|
|
165
|
-
case QuattrocentoNumberOfChannelsMode.HIGH:
|
|
166
|
-
self._number_of_channels = 312
|
|
167
|
-
case QuattrocentoNumberOfChannelsMode.ULTRA:
|
|
168
|
-
self._number_of_channels = 408
|
|
169
|
-
case _:
|
|
170
|
-
raise ValueError("Invalid number of channels mode.")
|
|
171
|
-
|
|
172
|
-
def get_sampling_frequency(self) -> int:
|
|
173
|
-
return self._sampling_frequency
|
|
174
|
-
|
|
175
|
-
def get_number_of_channels(self) -> int:
|
|
176
|
-
return self._number_of_channels
|
|
177
|
-
|
|
178
|
-
def __int__(self):
|
|
179
|
-
acq_sett_byte = 1 << 7
|
|
180
|
-
acq_sett_byte += (self._decimation_mode.value - 1) << 6
|
|
181
|
-
acq_sett_byte += (self._recording_mode.value - 1) << 5
|
|
182
|
-
acq_sett_byte += (self._sampling_frequency_mode.value - 1) << 3
|
|
183
|
-
acq_sett_byte += (self._number_of_channels_mode.value - 1) << 1
|
|
184
|
-
acq_sett_byte += self._acquisition_mode.value - 1
|
|
185
|
-
|
|
186
|
-
return int(acq_sett_byte)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
# ---------- AN_OUT_IN_SEL BYTE ----------
|
|
190
|
-
# Bit 7 and bit 6 are fixed to 0.
|
|
191
|
-
# TODO:
|
|
192
|
-
|
|
193
|
-
# ---------- AN_OUT_CH_SEL BYTE ----------
|
|
194
|
-
# Bit 7 and bit 6 are fixed to 0.
|
|
195
|
-
# TODO:
|
|
196
|
-
|
|
197
|
-
# -- INX_CONF0 and MULTIPLE_INX_CONF0 BYTE --
|
|
198
|
-
# Bit 7 is fixed to 0.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
class QuattrocentoMuscleSelectionMode(Enum):
|
|
202
|
-
"""
|
|
203
|
-
Enum class for the muscle selection mode of the
|
|
204
|
-
Quattrocento device (5 bits).
|
|
205
|
-
"""
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
class QuattrocentoSensorSelectionMode(Enum):
|
|
209
|
-
"""
|
|
210
|
-
Enum class for the sensor selection mode of the
|
|
211
|
-
Quattrocento device (5 bits).
|
|
212
|
-
"""
|
|
213
|
-
|
|
214
|
-
# TODO: "Implement"
|
|
215
|
-
...
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
class QuattrocentoSideMode(Enum):
|
|
219
|
-
""""""
|
|
220
|
-
|
|
221
|
-
_init_ = "value __doc__"
|
|
222
|
-
UNDEFINED = auto(), "Undefined"
|
|
223
|
-
LEFT = auto(), "Left"
|
|
224
|
-
RIGHT = auto(), "Right"
|
|
225
|
-
NONE = auto(), "None"
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
# ---------- INX_CONF2 BYTE ----------
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
class QuattrocentoHighPassFilterMode(Enum):
|
|
232
|
-
"""
|
|
233
|
-
Enum class for the high-pass filter of INPUT INX or MULTIPLE INX (2 bits).
|
|
234
|
-
"""
|
|
235
|
-
|
|
236
|
-
_init_ = "value __doc__"
|
|
237
|
-
|
|
238
|
-
NONE = auto(), "No high-pass filter"
|
|
239
|
-
LOW = auto(), "High-pass filter at 0.7 Hz"
|
|
240
|
-
MEDIUM = auto(), "High-pass filter at 10 Hz"
|
|
241
|
-
HIGH = auto(), "High-pass filter at 100 Hz"
|
|
242
|
-
ULTRA = auto(), "High-pass filter at 200 Hz"
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
class QuattrocentoLowPassFilterMode(Enum):
|
|
246
|
-
"""
|
|
247
|
-
Enum class for the low-pass filter of INPUT INX or MULTIPLE INX (2 bits).
|
|
248
|
-
0 -> LOW: 130 Hz
|
|
249
|
-
1 -> MEDIUM: 500 Hz
|
|
250
|
-
2 -> HIGH: 900 Hz
|
|
251
|
-
3 -> ULTRA: 4400 Hz
|
|
252
|
-
"""
|
|
253
|
-
|
|
254
|
-
_init_ = "value __doc__"
|
|
255
|
-
|
|
256
|
-
LOW = auto(), "Low-pass filter at 130 Hz"
|
|
257
|
-
MEDIUM = auto(), "Low-pass filter at 500 Hz"
|
|
258
|
-
HIGH = auto(), "Low-pass filter at 900 Hz"
|
|
259
|
-
ULTRA = auto(), "Low-pass filter at 4400 Hz"
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
class QuattrocentoDetectionMode(Enum):
|
|
263
|
-
"""
|
|
264
|
-
Enum class for the detection mode of the Quattrocento device (2 bits).
|
|
265
|
-
"""
|
|
266
|
-
|
|
267
|
-
_init_ = "value __doc_"
|
|
268
|
-
|
|
269
|
-
NONE = auto(), "No detection"
|
|
270
|
-
MONOPOLAR = auto(), "Monopolar detection"
|
|
271
|
-
BIPOLAR = auto(), "Bipolar detection"
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
class QuattrocentoINXConf2Byte:
|
|
275
|
-
"""
|
|
276
|
-
Class for the INX_CONF2 byte of the Quattrocento device.
|
|
277
|
-
"""
|
|
278
|
-
|
|
279
|
-
def __init__(self):
|
|
280
|
-
self._muscle_selection_mode: QuattrocentoMuscleSelectionMode = None
|
|
281
|
-
self._sensor_selection_mode: QuattrocentoSensorSelectionMode = None
|
|
282
|
-
self._side_mode: QuattrocentoSideMode = QuattrocentoSideMode.UNDEFINED
|
|
283
|
-
self._high_pass_filter: QuattrocentoHighPassFilterMode = None
|
|
284
|
-
self._low_pass_filter: QuattrocentoLowPassFilterMode = None
|
|
285
|
-
self._detection_mode: QuattrocentoDetectionMode = None
|
|
286
|
-
|
|
287
|
-
def update(
|
|
288
|
-
self,
|
|
289
|
-
high_pass_filter: QuattrocentoHighPassFilterMode,
|
|
290
|
-
low_pass_filter: QuattrocentoLowPassFilterMode,
|
|
291
|
-
detection_mode: QuattrocentoDetectionMode,
|
|
292
|
-
):
|
|
293
|
-
self._high_pass_filter = high_pass_filter
|
|
294
|
-
self._low_pass_filter = low_pass_filter
|
|
295
|
-
self._detection_mode = detection_mode
|
|
296
|
-
|
|
297
|
-
def __int__(self):
|
|
298
|
-
input_conf_byte_1 = 0 # TODO: Muscle
|
|
299
|
-
input_conf_byte_2 = 0 # TODO: Sensor + Adapter
|
|
300
|
-
input_conf_byte_3 = (self._side_mode.value - 1) << 6
|
|
301
|
-
input_conf_byte_3 += (self._high_pass_filter.value - 1) << 4
|
|
302
|
-
input_conf_byte_3 += (self._low_pass_filter.value - 1) << 2
|
|
303
|
-
input_conf_byte_3 += self._detection_mode.value - 1
|
|
304
|
-
|
|
305
|
-
return int(
|
|
306
|
-
(input_conf_byte_1 << 16) + (input_conf_byte_2 << 8) + input_conf_byte_3
|
|
307
|
-
)
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
QUATTROCENTO_AUXILIARY_CHANNELS: int = 16
|
|
311
|
-
QUATTROCENTO_SUPPLEMENTARY_CHANNELS: int = 8
|
|
312
|
-
QUATTROCENTO_SAMPLES_PER_FRAME: int = 64
|
|
313
|
-
QUATTROCENTO_BYTES_PER_SAMPLE: int = 2
|
|
1
|
+
from aenum import Enum, auto
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Quattrocento constants.
|
|
5
|
+
|
|
6
|
+
Developer: Dominik I. Braun
|
|
7
|
+
Contact: dome.braun@fau.de
|
|
8
|
+
Last Update: 2025-01-14
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# ------- Command Byte Sequences --------
|
|
13
|
+
class QuattrocentoCommandSequence(Enum):
|
|
14
|
+
"""
|
|
15
|
+
Enum class for the different kind of command sequences.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
_init_ = "value __doc__"
|
|
19
|
+
|
|
20
|
+
NONE = auto(), "None"
|
|
21
|
+
ACQ_SETT = auto(), "Acquisition settings command sequence"
|
|
22
|
+
AN_OUT_IN_SEL = auto(), "Select input source and gain for the analog output"
|
|
23
|
+
AN_OUT_CH_SEL = auto(), "Select the channel for the analog output source"
|
|
24
|
+
IN_CONF = auto(), (
|
|
25
|
+
"Configuration command sequence for the eight IN inputs or",
|
|
26
|
+
"configuration for the four MULTIPLE IN inputs",
|
|
27
|
+
)
|
|
28
|
+
CRC = auto(), "Configuration command sequence byte (8 bits)"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# ------------ ACQ_SETT BYTE ------------
|
|
32
|
+
# Bit 7 is fixed to 1.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class QuattrocentoDecimMode(Enum):
|
|
36
|
+
"""
|
|
37
|
+
Enum class for the decimation bit of the Quattrocento device.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
_init_ = "value __doc__"
|
|
41
|
+
|
|
42
|
+
INACTIVE = auto(), (
|
|
43
|
+
"Inactive. No decimation. The required sampling",
|
|
44
|
+
"frequency is obtained by sampling the signals",
|
|
45
|
+
"directly at the desired sampling frequency ",
|
|
46
|
+
)
|
|
47
|
+
ACTIVE = auto(), (
|
|
48
|
+
"Active. Decimation active.",
|
|
49
|
+
"The required sampling frequency is obtained by",
|
|
50
|
+
"sampling all the signals at 10240 Hz and then",
|
|
51
|
+
"sending one sample out of 2, 5 or 20, to obtain",
|
|
52
|
+
"the desired number of sample per second.",
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class QuattrocentoRecordingMode(Enum):
|
|
57
|
+
"""
|
|
58
|
+
Enum class for the recording bit.
|
|
59
|
+
|
|
60
|
+
If the Trigger OUT has to be used to synchronize the acquisition with
|
|
61
|
+
other instruments, the recording has to be started when the trigger
|
|
62
|
+
channel has a transition. In other words it is the quattrocento that
|
|
63
|
+
generate a signal indicating to the computer when the data has to be
|
|
64
|
+
recorded.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
_init_ = "value __doc__"
|
|
68
|
+
|
|
69
|
+
STOP = auto(), "Stop"
|
|
70
|
+
START = auto(), "Start"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class QuattrocentoSamplingFrequencyMode(Enum):
|
|
74
|
+
"""
|
|
75
|
+
Enum class for the sampling frequencies of the Quattrocento device (2 bits).
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
_init_ = "value __doc__"
|
|
79
|
+
|
|
80
|
+
LOW = auto(), "512 Hz"
|
|
81
|
+
MEDIUM = auto(), "2048 Hz"
|
|
82
|
+
HIGH = auto(), "5120 Hz"
|
|
83
|
+
ULTRA = auto(), "10240 Hz"
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class QuattrocentoNumberOfChannelsMode(Enum):
|
|
87
|
+
"""
|
|
88
|
+
Enum class for the number of channels of the Quattrocento device (2 bits).
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
_init_ = "value __doc__"
|
|
92
|
+
|
|
93
|
+
LOW = auto(), "IN1, IN2 and MULTIPLE_IN1 are active."
|
|
94
|
+
MEDIUM = auto(), "IN1-IN4, MULTIPLE_IN1, MULTIPLE_IN2 are active."
|
|
95
|
+
HIGH = auto(), "IN1-IN6, MULTIPLE_IN1-MULTIPLE_IN2 are active."
|
|
96
|
+
ULTRA = auto(), "IN1-IN8, MULTIPLE_IN1-MULTIPLE_IN4 are active."
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class QuattrocentoAcquisitionMode(Enum):
|
|
100
|
+
"""
|
|
101
|
+
Enum class for the acquisition bit.
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
_init_ = "value __doc__"
|
|
105
|
+
|
|
106
|
+
INACTIVE = auto(), "Inactive. Data sampling and transfer is not active"
|
|
107
|
+
ACTIVE = auto(), "Active. Data sampling and transfer is active"
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class QuattrocentoAcqSettByte:
|
|
111
|
+
"""
|
|
112
|
+
Class for the acquisition settings byte of the Quattrocento device.
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
def __init__(self):
|
|
116
|
+
self._decimation_mode: QuattrocentoDecimMode = None
|
|
117
|
+
self._recording_mode: QuattrocentoRecordingMode = None
|
|
118
|
+
self._sampling_frequency_mode: QuattrocentoSamplingFrequencyMode = None
|
|
119
|
+
self._sampling_frequency: int = None
|
|
120
|
+
self._number_of_channels_mode: QuattrocentoNumberOfChannelsMode = None
|
|
121
|
+
self._number_of_channels: int = None
|
|
122
|
+
self._acquisition_mode: QuattrocentoAcquisitionMode = (
|
|
123
|
+
QuattrocentoAcquisitionMode
|
|
124
|
+
).INACTIVE
|
|
125
|
+
|
|
126
|
+
def update(
|
|
127
|
+
self,
|
|
128
|
+
decimation_mode: QuattrocentoDecimMode,
|
|
129
|
+
recording_mode: QuattrocentoRecordingMode,
|
|
130
|
+
sampling_frequency_mode: QuattrocentoSamplingFrequencyMode,
|
|
131
|
+
number_of_channels_mode: QuattrocentoNumberOfChannelsMode,
|
|
132
|
+
):
|
|
133
|
+
self._decimation_mode = decimation_mode
|
|
134
|
+
self._recording_mode = recording_mode
|
|
135
|
+
self._sampling_frequency_mode = sampling_frequency_mode
|
|
136
|
+
self._number_of_channels_mode = number_of_channels_mode
|
|
137
|
+
|
|
138
|
+
self._configure()
|
|
139
|
+
|
|
140
|
+
def _configure(self):
|
|
141
|
+
self._set_sampling_frequency()
|
|
142
|
+
self._set_number_of_channels()
|
|
143
|
+
|
|
144
|
+
def _set_sampling_frequency(self) -> None:
|
|
145
|
+
mode = self._sampling_frequency_mode
|
|
146
|
+
match mode:
|
|
147
|
+
case QuattrocentoSamplingFrequencyMode.LOW:
|
|
148
|
+
self._sampling_frequency = 512
|
|
149
|
+
case QuattrocentoSamplingFrequencyMode.MEDIUM:
|
|
150
|
+
self._sampling_frequency = 2048
|
|
151
|
+
case QuattrocentoSamplingFrequencyMode.HIGH:
|
|
152
|
+
self._sampling_frequency = 5120
|
|
153
|
+
case QuattrocentoSamplingFrequencyMode.ULTRA:
|
|
154
|
+
self._sampling_frequency = 10240
|
|
155
|
+
case _:
|
|
156
|
+
raise ValueError("Invalid sampling frequency mode.")
|
|
157
|
+
|
|
158
|
+
def _set_number_of_channels(self) -> None:
|
|
159
|
+
mode = self._number_of_channels_mode
|
|
160
|
+
match mode:
|
|
161
|
+
case QuattrocentoNumberOfChannelsMode.LOW:
|
|
162
|
+
self._number_of_channels = 120
|
|
163
|
+
case QuattrocentoNumberOfChannelsMode.MEDIUM:
|
|
164
|
+
self._number_of_channels = 216
|
|
165
|
+
case QuattrocentoNumberOfChannelsMode.HIGH:
|
|
166
|
+
self._number_of_channels = 312
|
|
167
|
+
case QuattrocentoNumberOfChannelsMode.ULTRA:
|
|
168
|
+
self._number_of_channels = 408
|
|
169
|
+
case _:
|
|
170
|
+
raise ValueError("Invalid number of channels mode.")
|
|
171
|
+
|
|
172
|
+
def get_sampling_frequency(self) -> int:
|
|
173
|
+
return self._sampling_frequency
|
|
174
|
+
|
|
175
|
+
def get_number_of_channels(self) -> int:
|
|
176
|
+
return self._number_of_channels
|
|
177
|
+
|
|
178
|
+
def __int__(self):
|
|
179
|
+
acq_sett_byte = 1 << 7
|
|
180
|
+
acq_sett_byte += (self._decimation_mode.value - 1) << 6
|
|
181
|
+
acq_sett_byte += (self._recording_mode.value - 1) << 5
|
|
182
|
+
acq_sett_byte += (self._sampling_frequency_mode.value - 1) << 3
|
|
183
|
+
acq_sett_byte += (self._number_of_channels_mode.value - 1) << 1
|
|
184
|
+
acq_sett_byte += self._acquisition_mode.value - 1
|
|
185
|
+
|
|
186
|
+
return int(acq_sett_byte)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
# ---------- AN_OUT_IN_SEL BYTE ----------
|
|
190
|
+
# Bit 7 and bit 6 are fixed to 0.
|
|
191
|
+
# TODO:
|
|
192
|
+
|
|
193
|
+
# ---------- AN_OUT_CH_SEL BYTE ----------
|
|
194
|
+
# Bit 7 and bit 6 are fixed to 0.
|
|
195
|
+
# TODO:
|
|
196
|
+
|
|
197
|
+
# -- INX_CONF0 and MULTIPLE_INX_CONF0 BYTE --
|
|
198
|
+
# Bit 7 is fixed to 0.
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class QuattrocentoMuscleSelectionMode(Enum):
|
|
202
|
+
"""
|
|
203
|
+
Enum class for the muscle selection mode of the
|
|
204
|
+
Quattrocento device (5 bits).
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class QuattrocentoSensorSelectionMode(Enum):
|
|
209
|
+
"""
|
|
210
|
+
Enum class for the sensor selection mode of the
|
|
211
|
+
Quattrocento device (5 bits).
|
|
212
|
+
"""
|
|
213
|
+
|
|
214
|
+
# TODO: "Implement"
|
|
215
|
+
...
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class QuattrocentoSideMode(Enum):
|
|
219
|
+
""""""
|
|
220
|
+
|
|
221
|
+
_init_ = "value __doc__"
|
|
222
|
+
UNDEFINED = auto(), "Undefined"
|
|
223
|
+
LEFT = auto(), "Left"
|
|
224
|
+
RIGHT = auto(), "Right"
|
|
225
|
+
NONE = auto(), "None"
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
# ---------- INX_CONF2 BYTE ----------
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
class QuattrocentoHighPassFilterMode(Enum):
|
|
232
|
+
"""
|
|
233
|
+
Enum class for the high-pass filter of INPUT INX or MULTIPLE INX (2 bits).
|
|
234
|
+
"""
|
|
235
|
+
|
|
236
|
+
_init_ = "value __doc__"
|
|
237
|
+
|
|
238
|
+
NONE = auto(), "No high-pass filter"
|
|
239
|
+
LOW = auto(), "High-pass filter at 0.7 Hz"
|
|
240
|
+
MEDIUM = auto(), "High-pass filter at 10 Hz"
|
|
241
|
+
HIGH = auto(), "High-pass filter at 100 Hz"
|
|
242
|
+
ULTRA = auto(), "High-pass filter at 200 Hz"
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
class QuattrocentoLowPassFilterMode(Enum):
|
|
246
|
+
"""
|
|
247
|
+
Enum class for the low-pass filter of INPUT INX or MULTIPLE INX (2 bits).
|
|
248
|
+
0 -> LOW: 130 Hz
|
|
249
|
+
1 -> MEDIUM: 500 Hz
|
|
250
|
+
2 -> HIGH: 900 Hz
|
|
251
|
+
3 -> ULTRA: 4400 Hz
|
|
252
|
+
"""
|
|
253
|
+
|
|
254
|
+
_init_ = "value __doc__"
|
|
255
|
+
|
|
256
|
+
LOW = auto(), "Low-pass filter at 130 Hz"
|
|
257
|
+
MEDIUM = auto(), "Low-pass filter at 500 Hz"
|
|
258
|
+
HIGH = auto(), "Low-pass filter at 900 Hz"
|
|
259
|
+
ULTRA = auto(), "Low-pass filter at 4400 Hz"
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class QuattrocentoDetectionMode(Enum):
|
|
263
|
+
"""
|
|
264
|
+
Enum class for the detection mode of the Quattrocento device (2 bits).
|
|
265
|
+
"""
|
|
266
|
+
|
|
267
|
+
_init_ = "value __doc_"
|
|
268
|
+
|
|
269
|
+
NONE = auto(), "No detection"
|
|
270
|
+
MONOPOLAR = auto(), "Monopolar detection"
|
|
271
|
+
BIPOLAR = auto(), "Bipolar detection"
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class QuattrocentoINXConf2Byte:
|
|
275
|
+
"""
|
|
276
|
+
Class for the INX_CONF2 byte of the Quattrocento device.
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
def __init__(self):
|
|
280
|
+
self._muscle_selection_mode: QuattrocentoMuscleSelectionMode = None
|
|
281
|
+
self._sensor_selection_mode: QuattrocentoSensorSelectionMode = None
|
|
282
|
+
self._side_mode: QuattrocentoSideMode = QuattrocentoSideMode.UNDEFINED
|
|
283
|
+
self._high_pass_filter: QuattrocentoHighPassFilterMode = None
|
|
284
|
+
self._low_pass_filter: QuattrocentoLowPassFilterMode = None
|
|
285
|
+
self._detection_mode: QuattrocentoDetectionMode = None
|
|
286
|
+
|
|
287
|
+
def update(
|
|
288
|
+
self,
|
|
289
|
+
high_pass_filter: QuattrocentoHighPassFilterMode,
|
|
290
|
+
low_pass_filter: QuattrocentoLowPassFilterMode,
|
|
291
|
+
detection_mode: QuattrocentoDetectionMode,
|
|
292
|
+
):
|
|
293
|
+
self._high_pass_filter = high_pass_filter
|
|
294
|
+
self._low_pass_filter = low_pass_filter
|
|
295
|
+
self._detection_mode = detection_mode
|
|
296
|
+
|
|
297
|
+
def __int__(self):
|
|
298
|
+
input_conf_byte_1 = 0 # TODO: Muscle
|
|
299
|
+
input_conf_byte_2 = 0 # TODO: Sensor + Adapter
|
|
300
|
+
input_conf_byte_3 = (self._side_mode.value - 1) << 6
|
|
301
|
+
input_conf_byte_3 += (self._high_pass_filter.value - 1) << 4
|
|
302
|
+
input_conf_byte_3 += (self._low_pass_filter.value - 1) << 2
|
|
303
|
+
input_conf_byte_3 += self._detection_mode.value - 1
|
|
304
|
+
|
|
305
|
+
return int(
|
|
306
|
+
(input_conf_byte_1 << 16) + (input_conf_byte_2 << 8) + input_conf_byte_3
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
QUATTROCENTO_AUXILIARY_CHANNELS: int = 16
|
|
311
|
+
QUATTROCENTO_SUPPLEMENTARY_CHANNELS: int = 8
|
|
312
|
+
QUATTROCENTO_SAMPLES_PER_FRAME: int = 64
|
|
313
|
+
QUATTROCENTO_BYTES_PER_SAMPLE: int = 2
|