Spaces:
Build error
Build error
ybouteiller
commited on
Commit
·
fcdf5ac
1
Parent(s):
c9c81f5
debug
Browse files- portiloop/capture.py +7 -7
- portiloop/notebooks/test_LSL.ipynb +2 -60
- portiloop/notebooks/tests.ipynb +2 -25
portiloop/capture.py
CHANGED
|
@@ -91,7 +91,7 @@ def to_ads_frequency(frequency):
|
|
| 91 |
possible_datarates = [250, 500, 1000, 2000, 4000, 8000, 16000]
|
| 92 |
dr = 16000
|
| 93 |
for i in possible_datarates:
|
| 94 |
-
if i >=
|
| 95 |
dr = i
|
| 96 |
break
|
| 97 |
return dr
|
|
@@ -912,12 +912,12 @@ class Capture:
|
|
| 912 |
fp = FilterPipeline(nb_channels=8,
|
| 913 |
sampling_rate=self.frequency,
|
| 914 |
power_line_fq=self.power_line,
|
| 915 |
-
use_custom_fir=
|
| 916 |
-
custom_fir_order=
|
| 917 |
-
custom_fir_cutoff=
|
| 918 |
-
alpha_avg=
|
| 919 |
-
alpha_std=
|
| 920 |
-
epsilon=
|
| 921 |
|
| 922 |
self._p_capture = mp.Process(target=_capture_process,
|
| 923 |
args=(p_data_o,
|
|
|
|
| 91 |
possible_datarates = [250, 500, 1000, 2000, 4000, 8000, 16000]
|
| 92 |
dr = 16000
|
| 93 |
for i in possible_datarates:
|
| 94 |
+
if i >= frequency:
|
| 95 |
dr = i
|
| 96 |
break
|
| 97 |
return dr
|
|
|
|
| 912 |
fp = FilterPipeline(nb_channels=8,
|
| 913 |
sampling_rate=self.frequency,
|
| 914 |
power_line_fq=self.power_line,
|
| 915 |
+
use_custom_fir=self.custom_fir,
|
| 916 |
+
custom_fir_order=self.custom_fir_order,
|
| 917 |
+
custom_fir_cutoff=self.custom_fir_cutoff,
|
| 918 |
+
alpha_avg=self.polyak_mean,
|
| 919 |
+
alpha_std=self.polyak_std,
|
| 920 |
+
epsilon=self.epsilon)
|
| 921 |
|
| 922 |
self._p_capture = mp.Process(target=_capture_process,
|
| 923 |
args=(p_data_o,
|
portiloop/notebooks/test_LSL.ipynb
CHANGED
|
@@ -2,60 +2,10 @@
|
|
| 2 |
"cells": [
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
-
"execution_count":
|
| 6 |
"id": "37a4d718",
|
| 7 |
"metadata": {},
|
| 8 |
-
"outputs": [
|
| 9 |
-
{
|
| 10 |
-
"name": "stderr",
|
| 11 |
-
"output_type": "stream",
|
| 12 |
-
"text": [
|
| 13 |
-
"2022-03-25 20:14:39.506 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'lo' (status: 0, multicast: 1, broadcast: 0)\n",
|
| 14 |
-
"2022-03-25 20:14:39.506 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'eth0' (status: 4096, multicast: 1, broadcast: 2)\n",
|
| 15 |
-
"2022-03-25 20:14:39.506 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'wlan0' (status: 4096, multicast: 1, broadcast: 2)\n",
|
| 16 |
-
"2022-03-25 20:14:39.506 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'p2p0' (status: 4096, multicast: 0, broadcast: 2)\n",
|
| 17 |
-
"2022-03-25 20:14:39.506 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'lo' (status: 0, multicast: 1, broadcast: 0)\n",
|
| 18 |
-
"2022-03-25 20:14:39.506 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'eth0' (status: 4096, multicast: 1, broadcast: 2)\n",
|
| 19 |
-
"2022-03-25 20:14:39.506 ( 0.018s) [python3 ] netinterfaces.cpp:102 INFO| \tIPv4 addr: c0a80172\n",
|
| 20 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'wlan0' (status: 4096, multicast: 1, broadcast: 2)\n",
|
| 21 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:102 INFO| \tIPv4 addr: c0a80001\n",
|
| 22 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'lo' (status: 0, multicast: 1, broadcast: 0)\n",
|
| 23 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'eth0' (status: 4096, multicast: 1, broadcast: 2)\n",
|
| 24 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:105 INFO| \tIPv6 addr: fd24:dec0:e89c::b8b\n",
|
| 25 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'eth0' (status: 4096, multicast: 1, broadcast: 2)\n",
|
| 26 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:105 INFO| \tIPv6 addr: fd24:dec0:e89c:0:57e3:6122:3c71:7ca4\n",
|
| 27 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'eth0' (status: 4096, multicast: 1, broadcast: 2)\n",
|
| 28 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:105 INFO| \tIPv6 addr: fe80::1d2b:5fd6:c05d:9642%eth0\n",
|
| 29 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:91 INFO| netif 'wlan0' (status: 4096, multicast: 1, broadcast: 2)\n",
|
| 30 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] netinterfaces.cpp:105 INFO| \tIPv6 addr: fe80::7ed9:5cff:feb2:5133%wlan0\n",
|
| 31 |
-
"2022-03-25 20:14:39.507 ( 0.018s) [python3 ] api_config.cpp:270 INFO| Loaded default config\n",
|
| 32 |
-
"2022-03-25 20:14:39.509 ( 0.020s) [python3 ] common.cpp:65 INFO| v1.15.2-108-g6cdcf74d\n",
|
| 33 |
-
"2022-03-25 20:14:39.509 ( 0.021s) [python3 ] udp_server.cpp:82 WARN| Could not bind multicast responder for ff02:113d:6fdd:2c17:a643:ffe2:1bd1:3cd2 to interface fd24:dec0:e89c:0:57e3:6122:3c71:7ca4 (Address already in use)\n",
|
| 34 |
-
"2022-03-25 20:14:39.509 ( 0.021s) [python3 ] udp_server.cpp:82 WARN| Could not bind multicast responder for ff02:113d:6fdd:2c17:a643:ffe2:1bd1:3cd2 to interface fe80::7ed9:5cff:feb2:5133%wlan0 (Address already in use)\n",
|
| 35 |
-
"2022-03-25 20:14:39.509 ( 0.021s) [python3 ] udp_server.cpp:82 WARN| Could not bind multicast responder for ff05:113d:6fdd:2c17:a643:ffe2:1bd1:3cd2 to interface fd24:dec0:e89c:0:57e3:6122:3c71:7ca4 (Address already in use)\n",
|
| 36 |
-
"2022-03-25 20:14:39.510 ( 0.021s) [python3 ] udp_server.cpp:82 WARN| Could not bind multicast responder for ff05:113d:6fdd:2c17:a643:ffe2:1bd1:3cd2 to interface fe80::7ed9:5cff:feb2:5133%wlan0 (Address already in use)\n"
|
| 37 |
-
]
|
| 38 |
-
},
|
| 39 |
-
{
|
| 40 |
-
"name": "stdout",
|
| 41 |
-
"output_type": "stream",
|
| 42 |
-
"text": [
|
| 43 |
-
"now sending data...\n"
|
| 44 |
-
]
|
| 45 |
-
},
|
| 46 |
-
{
|
| 47 |
-
"ename": "KeyboardInterrupt",
|
| 48 |
-
"evalue": "",
|
| 49 |
-
"output_type": "error",
|
| 50 |
-
"traceback": [
|
| 51 |
-
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
| 52 |
-
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
|
| 53 |
-
"\u001b[0;32m/tmp/ipykernel_3906/1992969341.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0.01\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 43\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 44\u001b[0;31m \u001b[0mmain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
| 54 |
-
"\u001b[0;32m/tmp/ipykernel_3906/1992969341.py\u001b[0m in \u001b[0;36mmain\u001b[0;34m()\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[0msent_samples\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0mrequired_samples\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0;31m# now send it and wait for a bit before trying again.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 42\u001b[0;31m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0.01\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 43\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[0mmain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
| 55 |
-
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
|
| 56 |
-
]
|
| 57 |
-
}
|
| 58 |
-
],
|
| 59 |
"source": [
|
| 60 |
"\"\"\"Example program to demonstrate how to send a multi-channel time series to\n",
|
| 61 |
"LSL.\"\"\"\n",
|
|
@@ -102,14 +52,6 @@
|
|
| 102 |
"\n",
|
| 103 |
"main()"
|
| 104 |
]
|
| 105 |
-
},
|
| 106 |
-
{
|
| 107 |
-
"cell_type": "code",
|
| 108 |
-
"execution_count": null,
|
| 109 |
-
"id": "e67e094c",
|
| 110 |
-
"metadata": {},
|
| 111 |
-
"outputs": [],
|
| 112 |
-
"source": []
|
| 113 |
}
|
| 114 |
],
|
| 115 |
"metadata": {
|
|
|
|
| 2 |
"cells": [
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
+
"execution_count": null,
|
| 6 |
"id": "37a4d718",
|
| 7 |
"metadata": {},
|
| 8 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"source": [
|
| 10 |
"\"\"\"Example program to demonstrate how to send a multi-channel time series to\n",
|
| 11 |
"LSL.\"\"\"\n",
|
|
|
|
| 52 |
"\n",
|
| 53 |
"main()"
|
| 54 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
}
|
| 56 |
],
|
| 57 |
"metadata": {
|
portiloop/notebooks/tests.ipynb
CHANGED
|
@@ -2,40 +2,17 @@
|
|
| 2 |
"cells": [
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
-
"execution_count":
|
| 6 |
"id": "7b2fc5da",
|
| 7 |
"metadata": {
|
| 8 |
"scrolled": false
|
| 9 |
},
|
| 10 |
-
"outputs": [
|
| 11 |
-
{
|
| 12 |
-
"data": {
|
| 13 |
-
"application/vnd.jupyter.widget-view+json": {
|
| 14 |
-
"model_id": "695e7a12068640caa478d92b47a6e76c",
|
| 15 |
-
"version_major": 2,
|
| 16 |
-
"version_minor": 0
|
| 17 |
-
},
|
| 18 |
-
"text/plain": [
|
| 19 |
-
"VBox(children=(Accordion(children=(GridBox(children=(Label(value='CH1'), Label(value='CH2'), Label(value='CH3'…"
|
| 20 |
-
]
|
| 21 |
-
},
|
| 22 |
-
"metadata": {},
|
| 23 |
-
"output_type": "display_data"
|
| 24 |
-
}
|
| 25 |
-
],
|
| 26 |
"source": [
|
| 27 |
"from portiloop.capture import Capture\n",
|
| 28 |
"\n",
|
| 29 |
"cap = Capture()"
|
| 30 |
]
|
| 31 |
-
},
|
| 32 |
-
{
|
| 33 |
-
"cell_type": "code",
|
| 34 |
-
"execution_count": null,
|
| 35 |
-
"id": "a34e9672",
|
| 36 |
-
"metadata": {},
|
| 37 |
-
"outputs": [],
|
| 38 |
-
"source": []
|
| 39 |
}
|
| 40 |
],
|
| 41 |
"metadata": {
|
|
|
|
| 2 |
"cells": [
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
+
"execution_count": null,
|
| 6 |
"id": "7b2fc5da",
|
| 7 |
"metadata": {
|
| 8 |
"scrolled": false
|
| 9 |
},
|
| 10 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
"source": [
|
| 12 |
"from portiloop.capture import Capture\n",
|
| 13 |
"\n",
|
| 14 |
"cap = Capture()"
|
| 15 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
],
|
| 18 |
"metadata": {
|