biosignal-device-interface 0.1.1a0__py3-none-any.whl → 0.1.4a1__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.
Files changed (37) hide show
  1. biosignal_device_interface/__init__.py +0 -4
  2. biosignal_device_interface/constants/devices/__init__.py +3 -0
  3. biosignal_device_interface/constants/devices/core/base_device_constants.py +10 -0
  4. biosignal_device_interface/constants/devices/otb/otb_constants.py +0 -0
  5. biosignal_device_interface/constants/devices/otb/otb_muovi_constants.py +3 -3
  6. biosignal_device_interface/constants/devices/otb/otb_quattrocento_constants.py +289 -35
  7. biosignal_device_interface/constants/devices/otb/otb_quattrocento_light_constants.py +59 -0
  8. biosignal_device_interface/constants/devices/otb/otb_syncstation_constants.py +233 -0
  9. biosignal_device_interface/devices/__init__.py +11 -3
  10. biosignal_device_interface/devices/core/base_device.py +8 -9
  11. biosignal_device_interface/devices/otb/__init__.py +27 -7
  12. biosignal_device_interface/devices/otb/otb_muovi.py +9 -10
  13. biosignal_device_interface/devices/otb/otb_quattrocento.py +215 -118
  14. biosignal_device_interface/devices/otb/otb_quattrocento_light.py +210 -0
  15. biosignal_device_interface/devices/otb/otb_syncstation.py +407 -0
  16. biosignal_device_interface/gui/device_template_widgets/__init__.py +0 -6
  17. biosignal_device_interface/gui/device_template_widgets/all_devices_widget.py +19 -7
  18. biosignal_device_interface/gui/device_template_widgets/core/base_device_widget.py +17 -8
  19. biosignal_device_interface/gui/device_template_widgets/core/base_multiple_devices_widget.py +7 -4
  20. biosignal_device_interface/gui/device_template_widgets/otb/__init__.py +0 -10
  21. biosignal_device_interface/gui/device_template_widgets/otb/otb_devices_widget.py +20 -8
  22. biosignal_device_interface/gui/device_template_widgets/otb/otb_muovi_plus_widget.py +12 -12
  23. biosignal_device_interface/gui/device_template_widgets/otb/otb_muovi_widget.py +12 -12
  24. biosignal_device_interface/gui/device_template_widgets/otb/otb_quattrocento_light_widget.py +61 -57
  25. biosignal_device_interface/gui/device_template_widgets/otb/otb_quattrocento_widget.py +260 -0
  26. biosignal_device_interface/gui/device_template_widgets/otb/otb_syncstation_widget.py +262 -0
  27. biosignal_device_interface/gui/plot_widgets/biosignal_plot_widget.py +9 -4
  28. biosignal_device_interface/gui/ui/otb_quattrocento_template_widget.ui +415 -0
  29. biosignal_device_interface/gui/ui/otb_syncstation_template_widget.ui +732 -0
  30. biosignal_device_interface/gui/ui_compiled/otb_quattrocento_template_widget.py +318 -0
  31. biosignal_device_interface/gui/ui_compiled/otb_syncstation_template_widget.py +495 -0
  32. biosignal_device_interface-0.1.4a1.dist-info/LICENSE +675 -0
  33. {biosignal_device_interface-0.1.1a0.dist-info → biosignal_device_interface-0.1.4a1.dist-info}/METADATA +7 -17
  34. biosignal_device_interface-0.1.4a1.dist-info/RECORD +46 -0
  35. biosignal_device_interface-0.1.1a0.dist-info/LICENSE +0 -395
  36. biosignal_device_interface-0.1.1a0.dist-info/RECORD +0 -35
  37. {biosignal_device_interface-0.1.1a0.dist-info → biosignal_device_interface-0.1.4a1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,233 @@
1
+ """
2
+ Device class for real-time interfacing the OTB Syncstation device.
3
+ Developer: Dominik I. Braun
4
+ Contact: dome.braun@fau.de
5
+ Last Update: 2025-01-09
6
+ """
7
+
8
+ from typing import Dict, Union
9
+ from aenum import Enum, auto
10
+ from biosignal_device_interface.constants.devices.core.base_device_constants import (
11
+ DeviceType,
12
+ DeviceChannelTypes,
13
+ )
14
+ from biosignal_device_interface.constants.devices.otb.otb_muovi_constants import (
15
+ MUOVI_AVAILABLE_CHANNELS_DICT,
16
+ )
17
+
18
+
19
+ class SyncStationRecOnMode(Enum):
20
+ """
21
+ Enum class for the recording on mode of the SyncStation device.
22
+ """
23
+
24
+ _init_ = "value __doc__"
25
+
26
+ OFF = auto(), (
27
+ "The PC is not recording the received signals from SyncStation."
28
+ "If the Timestapms.log is closed if it was previously opened."
29
+ )
30
+ ON = auto(), (
31
+ "The PC is recording the signals received by the SyncStation."
32
+ "When triggered, this bit reset the internal timer for the"
33
+ "ramp counter sent on the Accessory Ch2 and start the log of"
34
+ "the timestamps on the internal timestamps.log file"
35
+ )
36
+
37
+
38
+ class SyncStationWorkingMode(Enum):
39
+ """
40
+ Enum class for the sampling frequency mode of the SyncStation device.
41
+ """
42
+
43
+ _init_ = "value __doc__"
44
+
45
+ NONE = 0, "No working mode set."
46
+ EEG = auto(), "EEG Mode Fsamp 500 Hz, DC coupled, 24 bit resolution."
47
+ EMG = (
48
+ auto(),
49
+ "EMG Mode Fsamp 2000 Hz, high pass filter at 10 Hz*, 16 bit resolution",
50
+ )
51
+
52
+
53
+ class SyncStationDetectionMode(Enum):
54
+ """
55
+ Enum class for the detection mode of the SyncStation device.
56
+ """
57
+
58
+ _init_ = "value __doc__"
59
+
60
+ NONE = 0, "No detection mode set."
61
+ MONOPOLAR_GAIN_HIGH = auto(), (
62
+ "Monopolar Mode. High gain. 32 monopolar bioelectrical signals + 6 accessory signals. "
63
+ "Resolution is 286.1 nV and range +/-9.375 mV."
64
+ )
65
+ MONOPOLAR_GAIN_LOW = auto(), (
66
+ "Monopolar Mode. Low gain. 32 monopolar bioelectrical signals + 6 accessory signals. "
67
+ "Resolution is 572.2nV and range +/-18.75 mV."
68
+ )
69
+ IMPEDANCE_CHECK = auto(), "Impedance Check on all 32 + 6 channels."
70
+ TEST = auto(), "Ramps on all 32 + 6 channels."
71
+
72
+
73
+ class SyncStationProbeConfigMode(Enum):
74
+ """
75
+ Enum class for the probe configuration mode of the SyncStation device.
76
+ """
77
+
78
+ _init_ = "value __doc__"
79
+
80
+ NONE = 0, "No probe configuration mode set."
81
+ MUOVI_PROBE_ONE = auto(), "Probe configuration mode for Muovi probe one."
82
+ MUOVI_PROBE_TWO = auto(), "Probe configuration mode for Muovi probe two."
83
+ MUOVI_PROBE_THREE = auto(), "Probe configuration mode for Muovi probe three."
84
+ MUOVI_PROBE_FOUR = auto(), "Probe configuration mode for Muovi probe four."
85
+ MUOVI_PLUS_PROBE_ONE = auto(), "Probe configuration mode for Muovi Plus probe one."
86
+ MUOVI_PLUS_PROBE_TWO = auto(), "Probe configuration mode for Muovi Plus probe two."
87
+ DUE_PLUS_PROBE_ONE = (
88
+ auto(),
89
+ "Probe configuration mode for Due Plus probe one.",
90
+ )
91
+ DUE_PLUS_PROBE_TWO = (
92
+ auto(),
93
+ "Probe configuration mode for Due Plus probe two.",
94
+ )
95
+ DUE_PLUS_PROBE_THREE = (
96
+ auto(),
97
+ "Probe configuration mode for Due Plus probe three.",
98
+ )
99
+ DUE_PLUS_PROBE_FOUR = (
100
+ auto(),
101
+ "Probe configuration mode for Due Plus probe four.",
102
+ )
103
+ DUE_PLUS_PROBE_FIVE = (
104
+ auto(),
105
+ "Probe configuration mode for Due Plus probe five.",
106
+ )
107
+ DUE_PLUS_PROBE_SIX = (
108
+ auto(),
109
+ "Probe configuration mode for Due Plus probe six.",
110
+ )
111
+ DUE_PLUS_PROBE_SEVEN = (
112
+ auto(),
113
+ "Probe configuration mode for Due Plus probe seven.",
114
+ )
115
+ DUE_PLUS_PROBE_EIGHT = (
116
+ auto(),
117
+ "Probe configuration mode for Due Plus probe eight.",
118
+ )
119
+ DUE_PLUS_PROBE_NINE = (
120
+ auto(),
121
+ "Probe configuration mode for Due Plus probe nine.",
122
+ )
123
+ DUE_PLUS_PROBE_TEN = (
124
+ auto(),
125
+ "Probe configuration mode for Due Plus probe ten.",
126
+ )
127
+
128
+
129
+ # DICTS
130
+
131
+ SYNCSTATION_CHARACTERISTICS_DICT: Dict[str, int] = {
132
+ DeviceChannelTypes.ALL: 6,
133
+ "bytes_per_sample": 2,
134
+ "channel_information": {
135
+ SyncStationWorkingMode.EEG: {
136
+ "sampling_frequency": 500,
137
+ "bytes_per_sample": 3,
138
+ "frame_size": 5,
139
+ },
140
+ SyncStationWorkingMode.EMG: {
141
+ "sampling_frequency": 2000,
142
+ "bytes_per_sample": 2,
143
+ "frame_size": 10,
144
+ },
145
+ },
146
+ "number_of_packages": 32,
147
+ "package_size": 1460,
148
+ "FPS": 50,
149
+ }
150
+
151
+ # TODO: Load information from Device Constants directly!
152
+ PROBE_CHARACTERISTICS_DICT: Dict[
153
+ SyncStationProbeConfigMode, Dict[str, Union[str, int]]
154
+ ] = {
155
+ SyncStationProbeConfigMode.MUOVI_PROBE_ONE: MUOVI_AVAILABLE_CHANNELS_DICT[
156
+ DeviceType.OTB_MUOVI
157
+ ],
158
+ SyncStationProbeConfigMode.MUOVI_PROBE_TWO: MUOVI_AVAILABLE_CHANNELS_DICT[
159
+ DeviceType.OTB_MUOVI
160
+ ],
161
+ SyncStationProbeConfigMode.MUOVI_PROBE_THREE: MUOVI_AVAILABLE_CHANNELS_DICT[
162
+ DeviceType.OTB_MUOVI
163
+ ],
164
+ SyncStationProbeConfigMode.MUOVI_PROBE_FOUR: MUOVI_AVAILABLE_CHANNELS_DICT[
165
+ DeviceType.OTB_MUOVI
166
+ ],
167
+ SyncStationProbeConfigMode.MUOVI_PLUS_PROBE_ONE: MUOVI_AVAILABLE_CHANNELS_DICT[
168
+ DeviceType.OTB_MUOVI_PLUS
169
+ ],
170
+ SyncStationProbeConfigMode.MUOVI_PLUS_PROBE_TWO: MUOVI_AVAILABLE_CHANNELS_DICT[
171
+ DeviceType.OTB_MUOVI_PLUS
172
+ ],
173
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_ONE: {
174
+ DeviceChannelTypes.ALL: 8,
175
+ DeviceChannelTypes.BIOSIGNAL: 2,
176
+ DeviceChannelTypes.AUXILIARY: 6,
177
+ },
178
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_TWO: {
179
+ DeviceChannelTypes.ALL: 8,
180
+ DeviceChannelTypes.BIOSIGNAL: 2,
181
+ DeviceChannelTypes.AUXILIARY: 6,
182
+ },
183
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_THREE: {
184
+ DeviceChannelTypes.ALL: 8,
185
+ DeviceChannelTypes.BIOSIGNAL: 2,
186
+ DeviceChannelTypes.AUXILIARY: 6,
187
+ },
188
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_FOUR: {
189
+ DeviceChannelTypes.ALL: 8,
190
+ DeviceChannelTypes.BIOSIGNAL: 2,
191
+ DeviceChannelTypes.AUXILIARY: 6,
192
+ },
193
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_FIVE: {
194
+ DeviceChannelTypes.ALL: 8,
195
+ DeviceChannelTypes.BIOSIGNAL: 2,
196
+ DeviceChannelTypes.AUXILIARY: 6,
197
+ },
198
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_SIX: {
199
+ DeviceChannelTypes.ALL: 8,
200
+ DeviceChannelTypes.BIOSIGNAL: 2,
201
+ DeviceChannelTypes.AUXILIARY: 6,
202
+ },
203
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_SEVEN: {
204
+ DeviceChannelTypes.ALL: 8,
205
+ DeviceChannelTypes.BIOSIGNAL: 2,
206
+ DeviceChannelTypes.AUXILIARY: 6,
207
+ },
208
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_EIGHT: {
209
+ DeviceChannelTypes.ALL: 8,
210
+ DeviceChannelTypes.BIOSIGNAL: 2,
211
+ DeviceChannelTypes.AUXILIARY: 6,
212
+ },
213
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_NINE: {
214
+ DeviceChannelTypes.ALL: 8,
215
+ DeviceChannelTypes.BIOSIGNAL: 2,
216
+ DeviceChannelTypes.AUXILIARY: 6,
217
+ },
218
+ SyncStationProbeConfigMode.DUE_PLUS_PROBE_TEN: {
219
+ DeviceChannelTypes.ALL: 8,
220
+ DeviceChannelTypes.BIOSIGNAL: 2,
221
+ DeviceChannelTypes.AUXILIARY: 6,
222
+ },
223
+ }
224
+
225
+ SYNCSTATION_CONVERSION_FACTOR_DICT: dict[SyncStationDetectionMode, int] = {
226
+ SyncStationDetectionMode.MONOPOLAR_GAIN_HIGH: 572.2e-6,
227
+ SyncStationDetectionMode.MONOPOLAR_GAIN_LOW: 286.1e-6,
228
+ }
229
+ """
230
+ Dictionary to get the gain of the Muovi detection mode. \\
231
+ The keys are the detection modes of the Muovi device. \\
232
+ The values are the gain of the detection mode in V.
233
+ """
@@ -1,9 +1,17 @@
1
1
  # Import Devices to be used from biosignal_device_interface.devices
2
2
  # import Muovi, MindRoveBracelet, Quattrocento, QuattrocentoLight, ...
3
3
 
4
- # OTB Devices
5
- from biosignal_device_interface.devices.otb.otb_quattrocento import (
4
+ from biosignal_device_interface.devices.otb import (
5
+ OTBMuoviWidget,
6
+ OTBMuoviPlusWidget,
7
+ OTBQuattrocentoLightWidget,
8
+ OTBMuovi,
6
9
  OTBQuattrocento,
7
10
  OTBQuattrocentoLight,
11
+ OTBSyncStationWidget,
12
+ OTBDevicesWidget,
13
+ )
14
+
15
+ from biosignal_device_interface.gui.device_template_widgets.all_devices_widget import (
16
+ AllDevicesWidget,
8
17
  )
9
- from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi
@@ -73,7 +73,7 @@ class BaseDevice(QObject):
73
73
  self._connection_timeout_timer.setInterval(1000)
74
74
 
75
75
  # Device Status
76
- self._is_connected: bool = False
76
+ self.is_connected: bool = False
77
77
  self._is_configured: bool = False
78
78
  self._is_streaming: bool = False
79
79
 
@@ -114,7 +114,7 @@ class BaseDevice(QObject):
114
114
  bool:
115
115
  Success of the disconnection attempt.
116
116
  """
117
- self._is_connected = False
117
+ self.is_connected = False
118
118
  self.connect_toggled.emit(False)
119
119
  self._is_configured = False
120
120
  self.configure_toggled.emit(False)
@@ -247,13 +247,10 @@ class BaseDevice(QObject):
247
247
  np.ndarray:
248
248
  Extracted biosignal channels.
249
249
  """
250
-
250
+ biosignal_data = data[self._biosignal_channel_indices]
251
251
  if milli_volts:
252
- return (
253
- data[self._biosignal_channel_indices]
254
- * self._conversion_factor_biosignal
255
- )
256
- return data[self._biosignal_channel_indices]
252
+ return biosignal_data * self._conversion_factor_biosignal
253
+ return biosignal_data
257
254
 
258
255
  def _extract_auxiliary_data(
259
256
  self, data: np.ndarray, milli_volts: bool = True
@@ -302,7 +299,7 @@ class BaseDevice(QObject):
302
299
  """
303
300
  self._connection_settings = settings
304
301
 
305
- if self._is_connected:
302
+ if self.is_connected:
306
303
  if self._is_streaming:
307
304
  self.toggle_streaming()
308
305
 
@@ -398,6 +395,8 @@ class BaseDevice(QObject):
398
395
  or "wifi" in interface.lower()
399
396
  or "wireless" in interface.lower()
400
397
  or "en0" in interface.lower()
398
+ or "wlp" in interface.lower()
399
+ or "wln" in interface.lower()
401
400
  ):
402
401
  for address in addresses:
403
402
  # Check if the address is an IPv4 address and not a loopback or virtual address
@@ -1,9 +1,29 @@
1
- # Import OTB Devices to be used from biosignal_device_interface.devices
2
- # import Muovi, Quattrocento, QuattrocentoLight, ...
1
+ from biosignal_device_interface.devices.otb.otb_quattrocento import OTBQuattrocento
2
+ from biosignal_device_interface.devices.otb.otb_quattrocento_light import (
3
+ OTBQuattrocentoLight,
4
+ )
5
+ from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi
6
+ from biosignal_device_interface.devices.otb.otb_syncstation import OTBSyncStation
7
+
8
+ # Widgets
9
+ # All OTB Devices Widget
10
+ from biosignal_device_interface.gui.device_template_widgets.otb.otb_devices_widget import (
11
+ OTBDevicesWidget,
12
+ )
3
13
 
4
- # OTB Devices
5
- from biosignal_device_interface.devices.otb.otb_quattrocento import (
6
- OTBQuattrocento as Quattrocento,
7
- OTBQuattrocentoLight as QuattrocentoLight,
14
+ # Individual OTB Device Widgets
15
+ from biosignal_device_interface.gui.device_template_widgets.otb.otb_muovi_widget import (
16
+ OTBMuoviWidget,
17
+ )
18
+ from biosignal_device_interface.gui.device_template_widgets.otb.otb_muovi_plus_widget import (
19
+ OTBMuoviPlusWidget,
20
+ )
21
+ from biosignal_device_interface.gui.device_template_widgets.otb.otb_quattrocento_widget import (
22
+ OTBQuattrocentoWidget,
23
+ )
24
+ from biosignal_device_interface.gui.device_template_widgets.otb.otb_quattrocento_light_widget import (
25
+ OTBQuattrocentoLightWidget,
26
+ )
27
+ from biosignal_device_interface.gui.device_template_widgets.otb.otb_syncstation_widget import (
28
+ OTBSyncStationWidget,
8
29
  )
9
- from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi as Muovi
@@ -1,4 +1,3 @@
1
- # Python Libraries
2
1
  """
3
2
  Device class for real-time interfacing the Muovi device.
4
3
  Developer: Dominik I. Braun
@@ -101,9 +100,9 @@ class OTBMuovi(BaseDevice):
101
100
 
102
101
  self._client_socket.readyRead.connect(self._read_data)
103
102
 
104
- if not self._is_connected:
105
- self._is_connected = True
106
- self.connect_toggled.emit(self._is_connected)
103
+ if not self.is_connected:
104
+ self.is_connected = True
105
+ self.connect_toggled.emit(self.is_connected)
107
106
  self._connection_timeout_timer.stop()
108
107
  return True
109
108
 
@@ -126,11 +125,11 @@ class OTBMuovi(BaseDevice):
126
125
  return True
127
126
 
128
127
  def configure_device(
129
- self, settings: Dict[str, Union[Enum, Dict[str, Enum]]] # type: ignore
128
+ self, params: Dict[str, Union[Enum, Dict[str, Enum]]] # type: ignore
130
129
  ) -> None:
131
- super().configure_device(settings)
130
+ super().configure_device(params)
132
131
 
133
- if not self._is_connected or self._client_socket is None:
132
+ if not self.is_connected or self._client_socket is None:
134
133
  return
135
134
 
136
135
  # Check if detection mode is valid for working mode (Case EEG -> MONOPOLAR_GAIN_4 => MONOPOLAR_GAIN_8)
@@ -233,10 +232,10 @@ class OTBMuovi(BaseDevice):
233
232
  self._process_data(data_to_process)
234
233
  self._received_bytes = self._received_bytes[self._buffer_size :]
235
234
 
236
- def _process_data(self, data: bytearray) -> None:
237
- super()._process_data(data)
235
+ def _process_data(self, input: bytearray) -> None:
236
+ super()._process_data(input)
238
237
 
239
- decoded_data = self._bytes_to_integers(data)
238
+ decoded_data = self._bytes_to_integers(input)
240
239
 
241
240
  processed_data = decoded_data.reshape(
242
241
  self._number_of_channels, -1, order="F"