From 1bf7cf8a0b2e5f8281da0fe1fc7f9259a2e5fcff Mon Sep 17 00:00:00 2001 From: milo-sobral Date: Wed, 17 May 2023 18:15:25 +0000 Subject: [PATCH] Fixed LSL/XDF issue, changed Thread to Process, added testing sounds --- portiloop/notebooks/tests.ipynb | 9884 +---------------- .../15msPN_48kHz_norm_stereo_double.wav | 3 + portiloop/sounds/98HzTestSound_44kHz.wav | 3 + portiloop/sounds/98HzTestSound_48kHz.wav | 3 + portiloop/src/capture.py | 8 +- 5 files changed, 18 insertions(+), 9883 deletions(-) create mode 100644 portiloop/sounds/15msPN_48kHz_norm_stereo_double.wav create mode 100644 portiloop/sounds/98HzTestSound_44kHz.wav create mode 100644 portiloop/sounds/98HzTestSound_48kHz.wav diff --git a/portiloop/notebooks/tests.ipynb b/portiloop/notebooks/tests.ipynb index c404240..b7ae889 100644 --- a/portiloop/notebooks/tests.ipynb +++ b/portiloop/notebooks/tests.ipynb @@ -10,7 +10,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "4d371c81f5704591847081ab26ee6ffc", + "model_id": "e24b5e02465d4d10af827cceaa9eebf9", "version_major": 2, "version_minor": 0 }, @@ -26,9886 +26,10 @@ "output_type": "stream", "text": [ "['bias', 'disabled', 'disabled', 'disabled']\n", - "Reading from file /home/mendel/portiloop-software/portiloop/recordings/test_recording.csv\n", "indigo-bunny-portiloop\n", - "DEBUG:/home/mendel/portiloop-software/portiloop/sounds/stimulus.wav\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "window.appendLearningCurve([{\"x\": 11300.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.5172810100089436}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11301.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.31183926749698143}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11302.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.10347238499256509}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11303.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.05790086926483583}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11304.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.13844355347706916}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11305.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.13251631338254288}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11306.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.06085906481130561}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11307.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.04482592236730033}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11308.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.16673668022186144}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11309.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.3032329336785519}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11310.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.4599493088235531}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11311.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.6320399714916212}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11312.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.7979619934529923}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11313.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.9294471769869077}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11314.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.0202711103866604}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11315.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.0874930340013287}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11316.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.1589197218316762}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11317.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.2532175744499174}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11318.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.3761905583377188}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11319.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.5170963222976919}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11320.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.6589904628211143}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11321.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.788407315860954}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11322.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.8950689361208588}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11323.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.9589809502458573}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11324.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.946636022067265}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11325.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.8250875999618617}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11326.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.5896091450882675}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11327.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -1.2732346349453867}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11328.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.9324148623315344}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11329.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.6144663256971309}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11330.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.33826684978783306}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11331.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.09800814618351612}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11332.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.12171260100779803}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11333.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.3278214905214299}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11334.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.5104057130815607}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11335.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.6475254439196674}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11336.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.7283467588349912}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11337.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.7563330105969267}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11338.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.740062398128387}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11339.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.683584571454379}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11340.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.5934728554437033}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11341.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.4831592096666291}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11342.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.3753532902444526}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11343.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.28626828565442497}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11344.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.21707076514892615}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11345.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.14774281840081183}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11346.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": 0.046136267360767945}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11347.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.1146252150475453}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11348.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.32402330296047}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}, {\"x\": 11349.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.5277503152838109}, \"ch3\": {\"line-1\": 0.0}, \"ch4\": {\"line-1\": 0.0}}}]);" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Saving metadata to /home/mendel/workspace/edf_recording/recording_metadata.json\n", - "Sending marker DETECT_ON\n" + "DEBUG:/home/mendel/portiloop-software/portiloop/sounds/stimul_15ms.wav\n", + "PID capture: 4194. Kill this process if program crashes before end of execution.\n", + "Saving metadata to /home/mendel/workspace/edf_recording/recording_metadata.json\n" ] } ], diff --git a/portiloop/sounds/15msPN_48kHz_norm_stereo_double.wav b/portiloop/sounds/15msPN_48kHz_norm_stereo_double.wav new file mode 100644 index 0000000..4aff9fb --- /dev/null +++ b/portiloop/sounds/15msPN_48kHz_norm_stereo_double.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f78f21d0cf1ad6c05ff5c786fafdd81af1eb0a0a30aa345e2841cfe6690a2032 +size 5804 diff --git a/portiloop/sounds/98HzTestSound_44kHz.wav b/portiloop/sounds/98HzTestSound_44kHz.wav new file mode 100644 index 0000000..dffa575 --- /dev/null +++ b/portiloop/sounds/98HzTestSound_44kHz.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea09afe4893533833246cf10bfa0ce38b81862a51ad84ef5f4cfce89659ee369 +size 17684 diff --git a/portiloop/sounds/98HzTestSound_48kHz.wav b/portiloop/sounds/98HzTestSound_48kHz.wav new file mode 100644 index 0000000..3e5072c --- /dev/null +++ b/portiloop/sounds/98HzTestSound_48kHz.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fd9286d05a4b747d673442a7c351c762d452be7e7c6fa1d3b7ba15911974ca6 +size 19244 diff --git a/portiloop/src/capture.py b/portiloop/src/capture.py index 63156cd..2abe4bf 100644 --- a/portiloop/src/capture.py +++ b/portiloop/src/capture.py @@ -202,7 +202,7 @@ def start_capture( # Main capture loop while True: - + # First, we send all outgoing messages to the capture process try: msg = q_msg.get_nowait() @@ -667,6 +667,8 @@ def get_metadata(self): continue if isinstance(value, basic_types): output_dict[key] = value + + output_dict['filename'] = str(self.filename) # Make sure we dont have the filter settings in duplicates for key, value in output_dict['filter_settings'].items(): @@ -1011,9 +1013,9 @@ def on_b_test_impedance(self, b): def on_b_pause(self, value): val = value['new'] if val == 'Active': - self.pause_value = False + self.pause_value.value = False elif val == 'Paused': - self.pause_value = True + self.pause_value.value = True def on_b_delay(self, value): val = value['new']