pyForceDAQ 2.0.1.dev1__py3-none-any.whl → 2.0.1.dev2__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.
- pyforcedaq/_lib/types.py +7 -6
- pyforcedaq/daq/_mock_sensor.py +1 -1
- pyforcedaq/force/sensor.py +14 -15
- pyforcedaq/force/sensor_process.py +10 -5
- pyforcedaq/gui/_run.py +3 -3
- pyforcedaq/gui/_settings.py +2 -12
- {pyforcedaq-2.0.1.dev1.dist-info → pyforcedaq-2.0.1.dev2.dist-info}/METADATA +1 -1
- {pyforcedaq-2.0.1.dev1.dist-info → pyforcedaq-2.0.1.dev2.dist-info}/RECORD +10 -10
- {pyforcedaq-2.0.1.dev1.dist-info → pyforcedaq-2.0.1.dev2.dist-info}/WHEEL +0 -0
- {pyforcedaq-2.0.1.dev1.dist-info → pyforcedaq-2.0.1.dev2.dist-info}/entry_points.txt +0 -0
pyforcedaq/_lib/types.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
__author__ = 'Oliver Lindemann'
|
|
2
2
|
|
|
3
3
|
import ctypes as ct
|
|
4
|
-
from typing import List
|
|
4
|
+
from typing import Iterator, List, Tuple
|
|
5
5
|
|
|
6
6
|
from .misc import MinMaxDetector as _MinMaxDetector
|
|
7
7
|
|
|
@@ -160,12 +160,13 @@ class ForceSensorData(object):
|
|
|
160
160
|
self.force = struct.forces
|
|
161
161
|
self.trigger = struct.trigger
|
|
162
162
|
|
|
163
|
-
def selected_forces(self, select: List[bool]):
|
|
164
|
-
"""Return
|
|
165
|
-
return
|
|
163
|
+
def selected_forces(self, select: List[bool]) -> List[float]:
|
|
164
|
+
"""Return list of selected force values."""
|
|
165
|
+
return [force for i, force in enumerate(self.forces) if select[i]] # FIXME simplify not all force have to save in ForceClass
|
|
166
166
|
|
|
167
|
-
def selected_trigger(self, select: List[bool]):
|
|
168
|
-
|
|
167
|
+
def selected_trigger(self, select: List[bool]) -> List[float]:
|
|
168
|
+
"""Return list of selected trigger values."""
|
|
169
|
+
return [trigger for i, trigger in enumerate(self.trigger) if select[i]]
|
|
169
170
|
|
|
170
171
|
|
|
171
172
|
class UDPData(object):
|
pyforcedaq/daq/_mock_sensor.py
CHANGED
|
@@ -75,6 +75,6 @@ class DAQReadAnalog(object):
|
|
|
75
75
|
n_new_samples = self._simulation_timer.time - self._sample_cnt
|
|
76
76
|
|
|
77
77
|
self._sample_cnt += 1
|
|
78
|
-
x = self._sample_cnt /
|
|
78
|
+
x = self._sample_cnt / 1000
|
|
79
79
|
y = 10 + np.array((np.sin(x/2), np.cos(x/5), np.sin(x)))*10
|
|
80
80
|
return np.append(y, np.array((0, 0 , 0, 0, 0))), 1
|
pyforcedaq/force/sensor.py
CHANGED
|
@@ -8,11 +8,10 @@ __author__ = 'Oliver Lindemann'
|
|
|
8
8
|
import ctypes as ct
|
|
9
9
|
from copy import copy
|
|
10
10
|
from pathlib import Path
|
|
11
|
+
from typing import List, Tuple
|
|
11
12
|
|
|
12
13
|
import numpy as np
|
|
13
|
-
from icecream import ic
|
|
14
14
|
|
|
15
|
-
#from .._lib import lsl
|
|
16
15
|
from .._lib.timer import Timer, app_clock
|
|
17
16
|
from .._lib.types import ForceSensorData
|
|
18
17
|
from ..daq import ATI_CDLL, DAQConfiguration, DAQReadAnalog
|
|
@@ -27,11 +26,11 @@ class SensorSettings(DAQConfiguration):
|
|
|
27
26
|
channels="ai0:7",
|
|
28
27
|
device_name_prefix = "Dev",
|
|
29
28
|
rate:int=1000,
|
|
30
|
-
minVal=-10,
|
|
31
|
-
maxVal=10,
|
|
32
|
-
reverse_parameter_names=
|
|
29
|
+
minVal:float=-10,
|
|
30
|
+
maxVal:float=10,
|
|
31
|
+
reverse_parameter_names: str | Tuple[str] | List[str] | None = None,
|
|
33
32
|
convert_to_FT:bool=True,
|
|
34
|
-
|
|
33
|
+
lsl_stream:bool=False,
|
|
35
34
|
write_Fx:bool=True,
|
|
36
35
|
write_Fy:bool=True,
|
|
37
36
|
write_Fz:bool=True,
|
|
@@ -54,7 +53,7 @@ class SensorSettings(DAQConfiguration):
|
|
|
54
53
|
self.device_id = device_id
|
|
55
54
|
self.sensor_name = sensor_name
|
|
56
55
|
self.convert_to_FT = convert_to_FT
|
|
57
|
-
self.
|
|
56
|
+
self.lsl_stream = lsl_stream
|
|
58
57
|
self.write_Fx = write_Fx
|
|
59
58
|
self.write_Fy = write_Fy
|
|
60
59
|
self.write_Fz = write_Fz
|
|
@@ -66,13 +65,14 @@ class SensorSettings(DAQConfiguration):
|
|
|
66
65
|
self.calibration_file = calibration_file
|
|
67
66
|
|
|
68
67
|
self.reverse_parameters = []
|
|
69
|
-
if
|
|
70
|
-
reverse_parameter_names
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
if reverse_parameter_names is not None:
|
|
69
|
+
if isinstance(reverse_parameter_names, str):
|
|
70
|
+
reverse_parameter_names = [reverse_parameter_names]
|
|
71
|
+
for para in reverse_parameter_names:
|
|
72
|
+
try:
|
|
73
|
+
self.reverse_parameters.append(ForceSensorData.forces_names.index(para))
|
|
74
|
+
except Exception:
|
|
75
|
+
pass
|
|
76
76
|
|
|
77
77
|
def array_write_forces(self):
|
|
78
78
|
return [self.write_Fx, self.write_Fy, self.write_Fz, self.write_Tx, self.write_Ty, self.write_Tz]
|
|
@@ -100,7 +100,6 @@ class Sensor(DAQReadAnalog):
|
|
|
100
100
|
self.name = settings.sensor_name
|
|
101
101
|
self.convert_to_FT = settings.convert_to_FT
|
|
102
102
|
self.timer = Timer(sync_timer=app_clock) # own timer, because this class is used in own process
|
|
103
|
-
ic(self.DAQ_TYPE)
|
|
104
103
|
if self.DAQ_TYPE == "mock_sensor":
|
|
105
104
|
self._atidaq = None
|
|
106
105
|
self.convert_to_FT = False
|
|
@@ -157,19 +157,21 @@ class SensorProcess(Process):
|
|
|
157
157
|
## create init LSL
|
|
158
158
|
lsl_data_steam = None
|
|
159
159
|
lsl_hardware_trigger_stream = None
|
|
160
|
-
if self.sensor_settings.
|
|
160
|
+
if self.sensor_settings.lsl_stream:
|
|
161
161
|
lsl_data_steam = lsl.init(
|
|
162
|
-
name=f"
|
|
162
|
+
name=f"Force_{self.sensor_settings.device_name}",
|
|
163
163
|
n_channels=sum(stream_forces),
|
|
164
164
|
stream_id=f"RF_{self.sensor_settings.device_name}",
|
|
165
165
|
freq=self.sensor_settings.rate,
|
|
166
|
+
channel_format= lsl.cf_float32,
|
|
166
167
|
metadata={"sensor_name": self.sensor_settings.sensor_name})
|
|
167
168
|
n_hardware_trigger = sum(stream_trigger)
|
|
168
169
|
if n_hardware_trigger > 0:
|
|
169
170
|
lsl_hardware_trigger_stream = lsl.init(
|
|
170
|
-
name=f"
|
|
171
|
+
name=f"Trigger_{self.sensor_settings.device_name}",
|
|
171
172
|
n_channels=n_hardware_trigger,
|
|
172
173
|
stream_id=f"Tr_{self.sensor_settings.device_name}",
|
|
174
|
+
channel_format=lsl.cf_float32,
|
|
173
175
|
freq=self.sensor_settings.rate)
|
|
174
176
|
|
|
175
177
|
|
|
@@ -189,9 +191,12 @@ class SensorProcess(Process):
|
|
|
189
191
|
d = sensor.poll_data()
|
|
190
192
|
## LSL
|
|
191
193
|
if lsl_data_steam is not None:
|
|
192
|
-
lsl_data_steam.push_sample(
|
|
194
|
+
lsl_data_steam.push_sample(d.selected_forces(stream_forces)) # steam only select forces
|
|
195
|
+
|
|
193
196
|
if lsl_hardware_trigger_stream is not None:
|
|
194
|
-
|
|
197
|
+
tr = d.selected_trigger(stream_trigger)
|
|
198
|
+
if any(tr): # only stream if at least one trigger is active
|
|
199
|
+
lsl_hardware_trigger_stream.push_sample(tr)
|
|
195
200
|
|
|
196
201
|
ptp.update(d.time) # needed? TODO
|
|
197
202
|
self._last_Fx.value, self._last_Fy.value, self._last_Fz.value, \
|
pyforcedaq/gui/_run.py
CHANGED
|
@@ -367,7 +367,7 @@ def run_settings(settings_file: str | None = None):
|
|
|
367
367
|
zip_data=settings.recording.zip_data,
|
|
368
368
|
reverse_scaling = settings.recording.reverse_scaling,
|
|
369
369
|
convert_to_forces=settings.recording.convert_to_forces,
|
|
370
|
-
|
|
370
|
+
lsl_stream=settings.recording.lsl_stream,
|
|
371
371
|
polling_priority=settings.recording.priority)
|
|
372
372
|
|
|
373
373
|
def run(remote_control,
|
|
@@ -387,7 +387,7 @@ def run(remote_control,
|
|
|
387
387
|
zip_data: bool = False,
|
|
388
388
|
reverse_scaling: dict | None = None,
|
|
389
389
|
convert_to_forces: bool = True,
|
|
390
|
-
|
|
390
|
+
lsl_stream: bool = False,
|
|
391
391
|
polling_priority: str | None = None):
|
|
392
392
|
|
|
393
393
|
"""start gui
|
|
@@ -430,7 +430,7 @@ def run(remote_control,
|
|
|
430
430
|
reverse_parameter_names=reverse_parameter_names,
|
|
431
431
|
rate = settings.gui.sampling_rate,
|
|
432
432
|
convert_to_FT=convert_to_forces,
|
|
433
|
-
|
|
433
|
+
lsl_stream=lsl_stream,
|
|
434
434
|
write_Fx = write_Fx,
|
|
435
435
|
write_Fy = write_Fy,
|
|
436
436
|
write_Fz = write_Fz,
|
pyforcedaq/gui/_settings.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
|
-
from copy import deepcopy
|
|
4
3
|
from dataclasses import dataclass, field
|
|
5
4
|
from typing import List
|
|
6
5
|
|
|
@@ -29,10 +28,6 @@ class _GUISettings:
|
|
|
29
28
|
plot_data_plotter_for_two_sensors: list = field(
|
|
30
29
|
default_factory=lambda: [(0, 2), (1, 2)])
|
|
31
30
|
|
|
32
|
-
def update_from_dict(self, d):
|
|
33
|
-
for key, value in d.items():
|
|
34
|
-
setattr(self, key, value)
|
|
35
|
-
|
|
36
31
|
@dataclass
|
|
37
32
|
class _RecordingSetting:
|
|
38
33
|
device_name_prefix: str = "Dev"
|
|
@@ -48,9 +43,9 @@ class _RecordingSetting:
|
|
|
48
43
|
write_Tx: bool = False
|
|
49
44
|
write_Ty: bool = False
|
|
50
45
|
write_Tz: bool = False
|
|
51
|
-
write_trigger1: bool =
|
|
46
|
+
write_trigger1: bool = False
|
|
52
47
|
write_trigger2: bool = False
|
|
53
|
-
|
|
48
|
+
lsl_stream: bool = False
|
|
54
49
|
reverse_scaling: dict = field(default_factory=lambda: {"1": ["Fz"], "2": ["Fz"]})
|
|
55
50
|
convert_to_forces: bool = True
|
|
56
51
|
priority: str = "normal"
|
|
@@ -61,11 +56,6 @@ class _RecordingSetting:
|
|
|
61
56
|
if isinstance(self.calibration_files, str):
|
|
62
57
|
self.calibration_files = [self.calibration_files]
|
|
63
58
|
|
|
64
|
-
def update_from_dict(self, d):
|
|
65
|
-
for key, value in d.items():
|
|
66
|
-
ic(key, value)
|
|
67
|
-
setattr(self, key, value)
|
|
68
|
-
|
|
69
59
|
|
|
70
60
|
class GUISettings(object):
|
|
71
61
|
|
|
@@ -6,10 +6,10 @@ pyforcedaq/_lib/misc.py,sha256=YiG2fTac9YFYgWZac4iQ1j7BBhFo-y80-231xk1Gzds,4622
|
|
|
6
6
|
pyforcedaq/_lib/polling_time_profile.py,sha256=5EHSWMVii-bEKk6dkuClH6OZnbSSJjrvW6hIfizS988,1487
|
|
7
7
|
pyforcedaq/_lib/process_priority_manager.py,sha256=3povqR0hT54K9TRQtxk-rc8JPakT3K6PH4Np8pNgydo,4196
|
|
8
8
|
pyforcedaq/_lib/timer.py,sha256=MN192NvqxezW-C5-znse9p-sv0DdoPV6jVN3X8d6CYY,1111
|
|
9
|
-
pyforcedaq/_lib/types.py,sha256=
|
|
9
|
+
pyforcedaq/_lib/types.py,sha256=m2lWFEiBz5fb7gZG3PbBjJIDwZv4dGErSvC3JE4Fu1o,12128
|
|
10
10
|
pyforcedaq/_lib/udp_connection.py,sha256=k6Ww8n9r7PdOzC0AJmzs-sC9eW8Jnij3EyUR0ASJHas,10254
|
|
11
11
|
pyforcedaq/daq/__init__.py,sha256=ZrRK8xFcoi523Rk9I7DQcY-LyCm21hFcmQOXP7VwwYw,716
|
|
12
|
-
pyforcedaq/daq/_mock_sensor.py,sha256=
|
|
12
|
+
pyforcedaq/daq/_mock_sensor.py,sha256=msqRH36LlJM_numwjmYu5J5oYmz2DLSX364bOcXSCsY,2076
|
|
13
13
|
pyforcedaq/daq/_pyATIDAQ.py,sha256=IqTdz2nAxEC8ea_u9OQvvCmT-fbOwkP85FBHV3gyIfQ,11142
|
|
14
14
|
pyforcedaq/daq/_use_nidaqmx.py,sha256=MHUC83UnKbHYAlNWr5iuTFoGYJpSfB21cxkm41qS_Vg,2459
|
|
15
15
|
pyforcedaq/daq/_use_pydaqmx.py,sha256=0jtLoY82CBq1UxoOQMaCylKAOs_AzpK6mL2UUIdkhsw,3568
|
|
@@ -23,20 +23,20 @@ pyforcedaq/extras/remote_control.py,sha256=2Ka9Y6edTAnsIY-P46rzyLDj9ddOc51n4cJ2M
|
|
|
23
23
|
pyforcedaq/force/__init__.py,sha256=h9pQxFkwt_xOs1hrTYCiEPFr1Cg2XblxwyKEDuKH8rs,346
|
|
24
24
|
pyforcedaq/force/_log.py,sha256=h2JbbLLJsrrh1U9HwEbY7iFdRW7FYxDbiZuIq5Z3sE0,541
|
|
25
25
|
pyforcedaq/force/data_recorder.py,sha256=7hWM7WKD94uEv57_R1RydJwf7HAQBRyNN3gDRcN9cRc,12939
|
|
26
|
-
pyforcedaq/force/sensor.py,sha256=
|
|
27
|
-
pyforcedaq/force/sensor_process.py,sha256=
|
|
26
|
+
pyforcedaq/force/sensor.py,sha256=hVLNVtAm9mElNHXCDLkeZE76liiiC5oX98KelSgj8Ug,6870
|
|
27
|
+
pyforcedaq/force/sensor_process.py,sha256=vkvWWN5QkpKlk2yW33dl9zx53yvTkIETENad7uom6JU,9496
|
|
28
28
|
pyforcedaq/gui/__init__.py,sha256=bB1kI51Oi3fK-x_J7ncaN8yZpvai-5-3sp7UHqDr-GY,147
|
|
29
29
|
pyforcedaq/gui/_gui_status.py,sha256=0YJcxVX2G8VtbgRn0H9avZi1wY4R-1A8re3cJjojkl0,13987
|
|
30
30
|
pyforcedaq/gui/_layout.py,sha256=obptKZgw9CgygiqDCDgbXu4Esyfb8btOZgxxdNzgXiE,4616
|
|
31
31
|
pyforcedaq/gui/_level_indicator.py,sha256=cBB-5DOlvdc95rQQ12Gt5dvhNxSYQTbaq19FSdz4YnQ,1905
|
|
32
32
|
pyforcedaq/gui/_pg_surface.py,sha256=TD4rQJsBMMiKoQDZTon35LvsEmyayCWfklJbm0iRl6c,2902
|
|
33
33
|
pyforcedaq/gui/_plotter.py,sha256=KvSxg3M3mDRj0_oNtn6mll8D2LBrBoboNoUs9hJJSUs,8451
|
|
34
|
-
pyforcedaq/gui/_run.py,sha256=
|
|
34
|
+
pyforcedaq/gui/_run.py,sha256=YF1-5vzkJN54i8_4L0CGxRspTQW0f8ey7fMQhtB1IEc,23348
|
|
35
35
|
pyforcedaq/gui/_scaling.py,sha256=XgdB7CXqzrBXNFT1Kul8t7mebqO9gojNxGzNIppj4Bg,1905
|
|
36
|
-
pyforcedaq/gui/_settings.py,sha256=
|
|
36
|
+
pyforcedaq/gui/_settings.py,sha256=v2ROOYBaF6LTJwhHJI3Gv4pSA5Wh6hmDBDRDuFhDuWM,3494
|
|
37
37
|
pyforcedaq/gui/forceDAQ_logo.png,sha256=-bn6ZQQjKf2Pxd9mJ4r-wulibtjuv_bEkhG567GR1vc,15624
|
|
38
38
|
pyforcedaq/gui/launcher.py,sha256=5IjHTCU65bsoctr52k-w9L6MBTJOW4gN6Wm0PItUwX0,8753
|
|
39
|
-
pyforcedaq-2.0.1.
|
|
40
|
-
pyforcedaq-2.0.1.
|
|
41
|
-
pyforcedaq-2.0.1.
|
|
42
|
-
pyforcedaq-2.0.1.
|
|
39
|
+
pyforcedaq-2.0.1.dev2.dist-info/WHEEL,sha256=i9aSRDivn5iP9LaR1BLQX2GNAuriQWPsFwbbWygTX2k,81
|
|
40
|
+
pyforcedaq-2.0.1.dev2.dist-info/entry_points.txt,sha256=0VDGqAldPs3uUCun3y9v4ue8Uae8n-D6-R5YpamgJwQ,56
|
|
41
|
+
pyforcedaq-2.0.1.dev2.dist-info/METADATA,sha256=vxeDyoldPgxOL1zqZE1IElyeNmhe8lAyGGk5QFQV3VE,601
|
|
42
|
+
pyforcedaq-2.0.1.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|