From ebe385b9dbc45360c569dd013a766305ffb6e956 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Mon, 10 Oct 2022 19:29:24 +0200 Subject: [PATCH] Cleaned up example code --- examples/test_SLM.ipynb | 199 ++++----------- examples/test_input.ipynb | 77 +++--- examples/test_ppm.ipynb | 490 ++----------------------------------- examples/test_record.ipynb | 405 ++---------------------------- test/filterbank_test.py | 36 --- test/sosfilterbank_test.py | 26 -- 6 files changed, 140 insertions(+), 1093 deletions(-) delete mode 100644 test/filterbank_test.py delete mode 100644 test/sosfilterbank_test.py diff --git a/examples/test_SLM.ipynb b/examples/test_SLM.ipynb index 3c62b5d..b392233 100644 --- a/examples/test_SLM.ipynb +++ b/examples/test_SLM.ipynb @@ -1,84 +1,10 @@ { "cells": [ { - "cell_type": "code", - "execution_count": 1, + "cell_type": "markdown", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "%pylab is deprecated, use %matplotlib inline and import the required libraries.\n", - "Populating the interactive namespace from numpy and matplotlib\n" - ] - } - ], "source": [ - "from lasp import SLM\n", - "import numpy as np\n", - "%pylab inline" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-03 17:21:56+0200 DebugTrace-cpp 2.0.0a2 (g++ 12.2.0)\n", - "2022-09-03 17:21:56+0200 \n", - "2022-09-03 17:21:56+0200 Enter SeriesBiquad (lasp_biquadbank.cpp: 12)\n", - "2022-09-03 17:21:56+0200 Leave SeriesBiquad (lasp_biquadbank.cpp)\n", - "2022-09-03 17:21:56+0200 \n", - "2022-09-03 17:21:56+0200 Enter SeriesBiquad (lasp_biquadbank.cpp: 12)\n", - "2022-09-03 17:21:56+0200 Leave SeriesBiquad (lasp_biquadbank.cpp)\n" - ] - } - ], - "source": [ - "fs = 44100.\n", - "Lref = 1\n", - "ds = 1\n", - "tau = 1/8\n", - "\n", - "bp_coefs = np.zeros((6,2), order='F')\n", - "bp_coefs[0,:] = 1\n", - "bp_coefs[3,:] = 1\n", - "\n", - "slm = SLM.fromBiquads(\n", - " fs, \n", - " Lref,\n", - " ds, tau, bp_coefs\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[1., 1.],\n", - " [0., 0.],\n", - " [0., 0.],\n", - " [1., 1.],\n", - " [0., 0.],\n", - " [0., 0.]])" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "bp_coefs" + "# Test SLM (Sound Level Meter)" ] }, { @@ -87,7 +13,38 @@ "metadata": {}, "outputs": [], "source": [ - "x = np.zeros(20100, dtype=float)\n", + "from lasp import SLM as SLM\n", + "from lasp import TimeWeighting, FreqWeighting\n", + "from lasp.filter import ThirdOctaveBankDesigner\n", + "import numpy as np\n", + "# %pylab inline" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fs = 48000.\n", + "Lref = 1\n", + "ds = 1\n", + "tau = 1/8\n", + "\n", + "designer = ThirdOctaveBankDesigner(fs)\n", + "slm = SLM(fs,\n", + " designer,\n", + " level_ref_value=1\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "x = np.zeros((20100,1), dtype=float)\n", "x[:] = 1\n", "\n", "res = slm.run(x)\n", @@ -96,76 +53,11 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[,\n", - " ]" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - }, - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD6CAYAAACvZ4z8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGli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Yze9PMPj9i3V4ze8PMNpvZxmzyFTN7ruNPRi4zuyyT59TlpJl9IZ+8xchlZo+aWZeZbc1mu/lkySfjWLnyea0VM9cEj1XRnrciPlY5v86K/FhN9FyV9bWFu0/5CxAF3gE+AFQBW4AVJRxvAXBN5vdG4K1T4wF7gTnZ5it29lzGn8xcZ2U5RPrj2mV5vICbgGuAraV4jPLNOE6unF5rxc41VqZiPm/FfKxyfZ2V4LEa87mqhNdWWPboVwO73H23uw8BbcBdpRrM3Q+6+6bM7z3AduCCPPNNRvbxxihHrn8DvOPuE53LqKS53H0DcCzLMfPJklfGsXLl8Voraq5xHqtcxy1qpixzZfM6K2quCZ6rsr+2wlL0FwD7Rlzfz7n/YygKM1sKXA28nFnkwC/NrMPM1mWRr9jZcxl/MnOdcg/wwzzzljJXMR+jkmTM8rU2WbmK9byV83VWslxnPVdlf23Fsg0uo5lZA/A48AV3P5lZfKO7d5rZPOBZM9sxybHKPf64zKwK+Djw5RGLKzZvJcn2tZbZ050MFfu8Zfs6K9VjdfZzZWalGCYnYdmj7wQWj7i+KLOsZMwsTvrJfMzdf3Jqubt3Zn52AU+Q/l+tifIVNXuO409arow7gE3ufjjPvKXKNdF288lS1Iw5vtYmJVcRn7dyvs6Knmuc56r8r61zTeJPhQvp/zPZDSzjt29QXF7C8Qz4J+DrZy2vBxpH/P4isGaifMXMnuv4k5VrRL424I8q4fEClnLmm55Fe4wKyThGrpxea6XINUamoj1vxXyscn2dFTvXBM9V2V9bJSnCclyAO0m/y/0O8ECJx7qR9Jzf68DmzOVO0u+Eb8lc3hyZY6J8xcqez/iTkSuzrXrgfWB6IXmLkYv03O1BYJj0HOeni/0Y5ZNxrFz5vNaKmWucTEV93or1WOXzOivyYzXmc1UJry2d1ExEJOTCMkcvIiLjUNGLiIScil5EJORU9CIiIaeiFxEJORW9iEjIqehFRELu/wPGJjOfGNP05wAAAABJRU5ErkJggg==\n", - "text/plain": [ - "
" - ] - }, - "metadata": { - "needs_background": "light" - }, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "plot(res)" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[1.],\n", - " [1.]])" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "slm.Pm" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array([-0.11480531, -0.11480531])" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res[-1,:]" + "res" ] }, { @@ -173,12 +65,23 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "slm.Pm" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "res[-1,:]" + ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -192,7 +95,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/examples/test_input.ipynb b/examples/test_input.ipynb index ffeab5b..a456fc4 100644 --- a/examples/test_input.ipynb +++ b/examples/test_input.ipynb @@ -10,39 +10,12 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "ac06df04", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "make: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[1]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_dsp_lib\u001b[0m\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[ 42%] Built target lasp_dsp_lib\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_device_lib\u001b[0m\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[ 67%] Built target lasp_device_lib\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_cpp\u001b[0m\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "[ 71%] \u001b[32mBuilding CXX object src/lasp/CMakeFiles/lasp_cpp.dir/pybind11/lasp_dsp_pybind.cpp.o\u001b[0m\n", - "[ 75%] \u001b[32m\u001b[1mLinking CXX shared module lasp_cpp.cpython-310-x86_64-linux-gnu.so\u001b[0m\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[100%] Built target lasp_cpp\n", - "make[1]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "make: Leaving directory '/home/anne/wip/mycode/lasp'\n" - ] - } - ], + "outputs": [], "source": [ - "# !make -j -C ~/wip/mycode/lasp" + "!make -j -C ~/wip/mycode/lasp" ] }, { @@ -57,6 +30,16 @@ "mgr = lasp.StreamMgr.getInstance()" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "9ad46772-a969-4693-b4e6-d78a67183787", + "metadata": {}, + "outputs": [], + "source": [ + "mgr.rescanDAQDevices()" + ] + }, { "cell_type": "code", "execution_count": null, @@ -129,14 +112,28 @@ "# Start a stream with a configuration\n", "mgr.startStream(config)\n", "\n", + "def reset_cb():\n", + " print('Reset called')\n", + "\n", "def cb(data):\n", - " # raise RuntimeError('hh')\n", + " # Print something on callback\n", " print(data.shape)\n", - "i = lasp.InDataHandler(mgr, cb)\n", + "\n", "import time\n", "#time.sleep(4)" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "dc751e51-3d09-41c8-a2dd-02d9568181da", + "metadata": {}, + "outputs": [], + "source": [ + "# Attach the indata handler to the stream\n", + "i = lasp.InDataHandler(mgr, cb, reset_cb)" + ] + }, { "cell_type": "code", "execution_count": null, @@ -158,6 +155,22 @@ "source": [ "del i" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "99342a4d-16ff-4b0c-8994-4c7e6b3f97b8", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5bd21b65-5bfd-4f83-b420-8491ca3ade57", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/examples/test_ppm.ipynb b/examples/test_ppm.ipynb index 4cef664..9bcf3ae 100644 --- a/examples/test_ppm.ipynb +++ b/examples/test_ppm.ipynb @@ -10,59 +10,20 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "ac06df04", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "make: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[1]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[ 44%] Built target lasp_dsp_lib\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[ 68%] Built target lasp_device_lib\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[100%] Built target lasp_cpp\n", - "make[1]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "make: Leaving directory '/home/anne/wip/mycode/lasp'\n" - ] - } - ], + "outputs": [], "source": [ - "!make -j -C ~/wip/mycode/lasp" + "#!make -j -C ~/wip/mycode/lasp" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ce0dd691", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-10-03 13:39:03+0200 DebugTrace-cpp 2.0.0a2 (g++ 9.4.0)\n", - "2022-10-03 13:39:03+0200 \n", - "2022-10-03 13:39:03+0200 Enter getInstance (lasp_streammgr.cpp: 40)\n", - "2022-10-03 13:39:03+0200 | Enter StreamMgr (lasp_streammgr.cpp: 45)\n", - "2022-10-03 13:39:03+0200 | | Enter rescanDAQDevices (lasp_streammgr.cpp: 60)\n", - "2022-10-03 13:39:03+0200 | | | Enter rescanDAQDevices_impl (lasp_streammgr.cpp: 80)\n", - "2022-10-03 13:39:04+0200 | | | | Enter fillRtAudioDeviceInfo (lasp_rtaudiodaq.cpp: 20)\n", - "2022-10-03 13:39:04+0200 | | | | Leave fillRtAudioDeviceInfo (lasp_rtaudiodaq.cpp)\n", - "2022-10-03 13:39:04+0200 | | | Leave rescanDAQDevices_impl (lasp_streammgr.cpp)\n", - "2022-10-03 13:39:04+0200 | | Leave rescanDAQDevices (lasp_streammgr.cpp)\n", - "2022-10-03 13:39:04+0200 | Leave StreamMgr (lasp_streammgr.cpp)\n", - "2022-10-03 13:39:04+0200 Leave getInstance (lasp_streammgr.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "import lasp\n", "# Get handle to stream manager\n", @@ -71,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "3cd242a8", "metadata": {}, "outputs": [], @@ -81,21 +42,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "a5d878e9", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0: Monitor of Starship/Matisse HD Audio Controller Analog Stereo\n", - "1: Starship/Matisse HD Audio Controller Analog Stereo\n", - "2: Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X] Digital Stereo (HDMI)\n", - "3: Monitor of Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X] Digital Stereo (HDMI)\n" - ] - } - ], + "outputs": [], "source": [ "# Search for a device\n", "for i, d in enumerate(ds):\n", @@ -105,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "6d5b281e", "metadata": {}, "outputs": [], @@ -120,19 +70,10 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "1ead3995", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Out channels: 0\n", - "In channels: 2\n" - ] - } - ], + "outputs": [], "source": [ "print('Out channels:',d.noutchannels)\n", "print('In channels:',d.ninchannels)" @@ -140,36 +81,12 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "12db8306", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-10-03 13:39:06+0200 \n", - "2022-10-03 13:39:06+0200 Enter startStream (lasp_streammgr.cpp: 209)\n", - "2022-10-03 13:39:06+0200 | Enter createDaq (lasp_daq.cpp: 18)\n", - "2022-10-03 13:39:06+0200 | | Enter Daq (lasp_daq.cpp: 37)\n", - "2022-10-03 13:39:06+0200 | | Leave Daq (lasp_daq.cpp)\n", - "2022-10-03 13:39:06+0200 | | \n", - "2022-10-03 13:39:06+0200 | | Enter RtAudioDaq (lasp_rtaudiodaq.cpp: 135)\n", - "2022-10-03 13:39:06+0200 | | | Enter samplerate (lasp_daq.cpp: 58)\n", - "2022-10-03 13:39:06+0200 | | | Leave samplerate (lasp_daq.cpp)\n", - "2022-10-03 13:39:07+0200 | | Leave RtAudioDaq (lasp_rtaudiodaq.cpp)\n", - "2022-10-03 13:39:07+0200 | Leave createDaq (lasp_daq.cpp)\n", - "2022-10-03 13:39:07+0200 | isInput = true\n", - "2022-10-03 13:39:07+0200 | isOutput = false\n", - "2022-10-03 13:39:07+0200 | \n", - "2022-10-03 13:39:07+0200 | Enter start (lasp_rtaudiodaq.cpp: 215)\n", - "2022-10-03 13:39:07+0200 | Leave start (lasp_rtaudiodaq.cpp)\n", - "2022-10-03 13:39:07+0200 Leave startStream (lasp_streammgr.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "# Start a stream with a configuration\n", "mgr.startStream(config)" @@ -177,183 +94,20 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "5323356f-4239-4f0b-ad58-0025501bf7a3", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-10-03 13:39:09+0200 \n", - "2022-10-03 13:39:09+0200 Enter InDataHandler (lasp_streammgr.cpp: 14)\n", - "2022-10-03 13:39:09+0200 Leave InDataHandler (lasp_streammgr.cpp)\n", - "2022-10-03 13:39:09+0200 \n", - "2022-10-03 13:39:09+0200 Enter ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 13)\n", - "2022-10-03 13:39:09+0200 Leave ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n", - "2022-10-03 13:39:09+0200 \n", - "2022-10-03 13:39:09+0200 Enter PPMHandler (lasp_ppm.cpp: 14)\n", - "2022-10-03 13:39:09+0200 | Enter start (lasp_streammgr.cpp: 16)\n", - "2022-10-03 13:39:09+0200 | | Enter reset (lasp_ppm.cpp: 65)\n", - "2022-10-03 13:39:09+0200 | | | Enter samplerate (lasp_daq.cpp: 58)\n", - "2022-10-03 13:39:09+0200 | | | Leave samplerate (lasp_daq.cpp)\n", - "2022-10-03 13:39:09+0200 | | | fs = 44100.000000\n", - "2022-10-03 13:39:09+0200 | | Leave reset (lasp_ppm.cpp)\n", - "2022-10-03 13:39:09+0200 | Leave start (lasp_streammgr.cpp)\n", - "2022-10-03 13:39:09+0200 Leave PPMHandler (lasp_ppm.cpp)\n", - "2022-10-03 13:39:09+0200 \n", - "2022-10-03 13:39:09+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:09+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:09+0200 \n", - "2022-10-03 13:39:09+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:09+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:09+0200 \n", - "2022-10-03 13:39:09+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:09+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:10+0200 \n", - "2022-10-03 13:39:10+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:10+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:10+0200 \n", - "2022-10-03 13:39:10+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:10+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:10+0200 \n", - "2022-10-03 13:39:10+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:10+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:10+0200 \n", - "2022-10-03 13:39:10+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:10+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:11+0200 \n", - "2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:11+0200 \n", - "2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:11+0200 \n", - "2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:11+0200 \n", - "2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:11+0200 \n", - "2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:12+0200 \n", - "2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:12+0200 \n", - "2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:12+0200 \n", - "2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:12+0200 \n", - "2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:12+0200 \n", - "2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:13+0200 \n", - "2022-10-03 13:39:13+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:13+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:13+0200 \n", - "2022-10-03 13:39:13+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:13+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:13+0200 \n", - "2022-10-03 13:39:13+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:13+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:13+0200 \n", - "2022-10-03 13:39:13+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:13+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:14+0200 \n", - "2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:14+0200 \n", - "2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:14+0200 \n", - "2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:14+0200 \n", - "2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:14+0200 \n", - "2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:15+0200 \n", - "2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:15+0200 \n", - "2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "ppm = lasp.PPMHandler(mgr)" ] }, - { - "cell_type": "code", - "execution_count": 9, - "id": "169c52c4-687f-4371-af04-19a414feb73d", - "metadata": {}, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'a' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_24491/2167009006.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mNameError\u001b[0m: name 'a' is not defined" - ] - } - ], - "source": [ - "a" - ] - }, { "cell_type": "code", "execution_count": null, - "id": "688d41ae-a3b1-4a31-b1e3-278bb4eaae4c", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 12, "id": "4d9f0103", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Monitor of Starship/Matisse HD Audio Controller Analog Stereo\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-10-03 13:39:15+0200 \n", - "2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:15+0200 \n", - "2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:15+0200 \n", - "2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:16+0200 \n", - "2022-10-03 13:39:16+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:16+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "daq = mgr.getDaq(lasp.StreamMgr.StreamType.input)\n", "print(daq)" @@ -361,227 +115,27 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "26277ef0-3389-4581-9cc5-2c500e789dfa", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-10-03 13:39:16+0200 \n", - "2022-10-03 13:39:16+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:16+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n" - ] - }, - { - "ename": "RuntimeError", - "evalue": "Mat::init(): requested size is not compatible with column vector layout", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_24664/1896157402.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0.1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mt\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0;36m0.1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mclip\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mppm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetCurrentValue\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\u001b[1;32m 7\u001b[0m \u001b[0;31m#print('\\r {\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mRuntimeError\u001b[0m: Mat::init(): requested size is not compatible with column vector layout" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-10-03 13:39:16+0200 \n", - "2022-10-03 13:39:16+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:16+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:17+0200 \n", - "2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:17+0200 \n", - "2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:17+0200 \n", - "2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:17+0200 \n", - "2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:17+0200 \n", - "2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:18+0200 \n", - "2022-10-03 13:39:18+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:18+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:18+0200 \n", - "2022-10-03 13:39:18+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:18+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:18+0200 \n", - "2022-10-03 13:39:18+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:18+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:18+0200 \n", - "2022-10-03 13:39:18+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:18+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:19+0200 \n", - "2022-10-03 13:39:19+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:19+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:19+0200 \n", - "2022-10-03 13:39:19+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:19+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:19+0200 \n", - "2022-10-03 13:39:19+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:19+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:19+0200 \n", - "2022-10-03 13:39:19+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:19+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:20+0200 \n", - "2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:20+0200 \n", - "2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:20+0200 \n", - "2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:20+0200 \n", - "2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:20+0200 \n", - "2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:20+0200 \n", - "2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:21+0200 \n", - "2022-10-03 13:39:21+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:21+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:21+0200 \n", - "2022-10-03 13:39:21+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:21+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:21+0200 \n", - "2022-10-03 13:39:21+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:21+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:21+0200 \n", - "2022-10-03 13:39:21+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:21+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:22+0200 \n", - "2022-10-03 13:39:22+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:22+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:22+0200 \n", - "2022-10-03 13:39:22+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:22+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:22+0200 \n", - "2022-10-03 13:39:22+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:22+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:22+0200 \n", - "2022-10-03 13:39:22+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:22+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:23+0200 \n", - "2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:23+0200 \n", - "2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:23+0200 \n", - "2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:23+0200 \n", - "2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:23+0200 \n", - "2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:23+0200 \n", - "2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:24+0200 \n", - "2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:24+0200 \n", - "2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:24+0200 \n", - "2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:24+0200 \n", - "2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:24+0200 \n", - "2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:25+0200 \n", - "2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:25+0200 \n", - "2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:25+0200 \n", - "2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:25+0200 \n", - "2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:25+0200 \n", - "2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:26+0200 \n", - "2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:26+0200 \n", - "2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:26+0200 \n", - "2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:26+0200 \n", - "2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:26+0200 \n", - "2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:26+0200 \n", - "2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:27+0200 \n", - "2022-10-03 13:39:27+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:27+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:27+0200 \n", - "2022-10-03 13:39:27+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:27+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:27+0200 \n", - "2022-10-03 13:39:27+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:27+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n", - "2022-10-03 13:39:27+0200 \n", - "2022-10-03 13:39:27+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n", - "2022-10-03 13:39:27+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n" - ] - } - ], + "outputs": [], "source": [ + "ppm.start()\n", "import time\n", "t=0\n", "while t < 1:\n", " time.sleep(0.1)\n", " t += 0.1\n", " level, clip = ppm.getCurrentValue()\n", - " #print('\\r {" + " print(f'\\r {levels[0]:.1f}')" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "30b77ce0-40ee-4b88-89fa-83b7a62e493c", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-10-03 13:39:27+0200 \n", - "2022-10-03 13:39:27+0200 Enter stopAllStreams (lasp_streammgr.cpp: 202)\n", - "2022-10-03 13:39:27+0200 | Enter ~Daq (lasp_daq.cpp: 14)\n", - "2022-10-03 13:39:27+0200 | Leave ~Daq (lasp_daq.cpp)\n", - "2022-10-03 13:39:27+0200 Leave stopAllStreams (lasp_streammgr.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "mgr.stopAllStreams()" ] diff --git a/examples/test_record.ipynb b/examples/test_record.ipynb index ad545a5..1451b2f 100644 --- a/examples/test_record.ipynb +++ b/examples/test_record.ipynb @@ -10,62 +10,20 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "e3d3280f", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "make: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[1]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[ 42%] Built target lasp_dsp_lib\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[ 67%] Built target lasp_device_lib\n", - "make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n", - "make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "[100%] Built target lasp_cpp\n", - "make[1]: Leaving directory '/home/anne/wip/mycode/lasp'\n", - "make: Leaving directory '/home/anne/wip/mycode/lasp'\n" - ] - } - ], + "outputs": [], "source": [ - " !make -j -C ~/wip/mycode/lasp" + "# !make -j -C ~/wip/mycode/lasp" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "d12f103c", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:01+0200 DebugTrace-cpp 2.0.0a2 (g++ 12.2.0)\n", - "2022-09-27 22:08:01+0200 \n", - "2022-09-27 22:08:01+0200 Enter getInstance (lasp_streammgr.cpp: 40)\n", - "2022-09-27 22:08:01+0200 | Enter StreamMgr (lasp_streammgr.cpp: 45)\n", - "2022-09-27 22:08:01+0200 | | Enter rescanDAQDevices (lasp_streammgr.cpp: 60)\n", - "2022-09-27 22:08:01+0200 | | | Enter rescanDAQDevices_impl (lasp_streammgr.cpp: 80)\n", - "2022-09-27 22:08:01+0200 | | | | Enter fillRtAudioDeviceInfo (lasp_rtaudiodaq.cpp: 20)\n", - "\n", - "RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (hw:1,0), Device or resource busy.\n", - "\n", - "2022-09-27 22:08:01+0200 | | | | Leave fillRtAudioDeviceInfo (lasp_rtaudiodaq.cpp)\n", - "2022-09-27 22:08:01+0200 | | | Leave rescanDAQDevices_impl (lasp_streammgr.cpp)\n", - "2022-09-27 22:08:01+0200 | | Leave rescanDAQDevices (lasp_streammgr.cpp)\n", - "2022-09-27 22:08:01+0200 | Leave StreamMgr (lasp_streammgr.cpp)\n", - "2022-09-27 22:08:01+0200 Leave getInstance (lasp_streammgr.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "import lasp\n", "# Get handle to stream manager\n", @@ -74,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f44b1946", "metadata": {}, "outputs": [], @@ -84,30 +42,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "db0f3bb7", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0: Monitor of Starship/Matisse HD Audio Controller Analog Stereo\n", - "1: Starship/Matisse HD Audio Controller Analog Stereo\n", - "2: GP108 High Definition Audio Controller Digital Stereo (HDMI)\n", - "3: Monitor of GP108 High Definition Audio Controller Digital Stereo (HDMI)\n", - "4: default\n", - "5: hw:HDA NVidia,3\n", - "6: hw:HDA NVidia,7\n", - "7: hw:HDA NVidia,8\n", - "8: hw:HDA NVidia,9\n", - "9: hw:HDA NVidia,10\n", - "10: hw:HD-Audio Generic,0\n", - "11: hw:HD-Audio Generic,1\n", - "12: hw:HD-Audio Generic,2\n" - ] - } - ], + "outputs": [], "source": [ "# Search for a device\n", "for i, d in enumerate(ds):\n", @@ -117,29 +55,7 @@ }, { "cell_type": "code", - "execution_count": 5, - "id": "f97c13d5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[512, 1024, 2048, 4096, 8192]" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# Check the available block sizes\n", - "d.availableFramesPerBlock" - ] - }, - { - "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "5c84d454", "metadata": {}, "outputs": [], @@ -154,19 +70,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "a020f86f", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Out channels: 0\n", - "In channels: 2\n" - ] - } - ], + "outputs": [], "source": [ "print('Out channels:',d.noutchannels)\n", "print('In channels:',d.ninchannels)" @@ -174,34 +81,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "034b5f5e", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:02+0200 \n", - "2022-09-27 22:08:02+0200 Enter startStream (lasp_streammgr.cpp: 209)\n", - "2022-09-27 22:08:02+0200 | Enter createDaq (lasp_daq.cpp: 18)\n", - "2022-09-27 22:08:02+0200 | | Enter Daq (lasp_daq.cpp: 37)\n", - "2022-09-27 22:08:02+0200 | | Leave Daq (lasp_daq.cpp)\n", - "2022-09-27 22:08:02+0200 | | \n", - "2022-09-27 22:08:02+0200 | | Enter RtAudioDaq (lasp_rtaudiodaq.cpp: 135)\n", - "2022-09-27 22:08:02+0200 | | | Enter samplerate (lasp_daq.cpp: 58)\n", - "2022-09-27 22:08:02+0200 | | | Leave samplerate (lasp_daq.cpp)\n", - "2022-09-27 22:08:02+0200 | | Leave RtAudioDaq (lasp_rtaudiodaq.cpp)\n", - "2022-09-27 22:08:02+0200 | Leave createDaq (lasp_daq.cpp)\n", - "2022-09-27 22:08:02+0200 | isInput = true\n", - "2022-09-27 22:08:02+0200 | isOutput = false\n", - "2022-09-27 22:08:02+0200 | \n", - "2022-09-27 22:08:02+0200 | Enter start (lasp_rtaudiodaq.cpp: 215)\n", - "2022-09-27 22:08:02+0200 | Leave start (lasp_rtaudiodaq.cpp)\n", - "2022-09-27 22:08:02+0200 Leave startStream (lasp_streammgr.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "# Start a stream with a configuration\n", "mgr.startStream(config)" @@ -209,282 +92,38 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "59326eda-f249-4a9b-9191-a784b01694b9", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:02+0200 \n", - "2022-09-27 22:08:02+0200 Enter InDataHandler (lasp_streammgr.cpp: 14)\n", - "2022-09-27 22:08:02+0200 Leave InDataHandler (lasp_streammgr.cpp)\n", - "2022-09-27 22:08:02+0200 \n", - "2022-09-27 22:08:02+0200 Enter ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 13)\n", - "2022-09-27 22:08:02+0200 Leave ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n", - "2022-09-27 22:08:02+0200 \n", - "2022-09-27 22:08:02+0200 Enter PyIndataHandler (lasp_pyindatahandler.cpp: 78)\n", - "2022-09-27 22:08:02+0200 | Enter start (lasp_streammgr.cpp: 16)\n", - "2022-09-27 22:08:02+0200 | Leave start (lasp_streammgr.cpp)\n", - "2022-09-27 22:08:02+0200 Leave PyIndataHandler (lasp_pyindatahandler.cpp)\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "." - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:02+0200 \n", - "2022-09-27 22:08:02+0200 Enter samplerate (lasp_daq.cpp: 58)\n", - "2022-09-27 22:08:02+0200 Leave samplerate (lasp_daq.cpp)\n", - "2022-09-27 22:08:02+0200 \n", - "2022-09-27 22:08:02+0200 Enter samplerate (lasp_daq.cpp: 58)\n", - "2022-09-27 22:08:02+0200 Leave samplerate (lasp_daq.cpp)\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - ".....1....2.....3....4....5.....6....7.....8....9....10" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter ~PyIndataHandler (lasp_pyindatahandler.cpp: 87)\n", - "2022-09-27 22:08:12+0200 Leave ~PyIndataHandler (lasp_pyindatahandler.cpp)\n", - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter ~ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 38)\n", - "2022-09-27 22:08:12+0200 Leave ~ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n", - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter ~InDataHandler (lasp_streammgr.cpp: 27)\n", - "2022-09-27 22:08:12+0200 Leave ~InDataHandler (lasp_streammgr.cpp)\n" - ] - } - ], + "outputs": [], "source": [ - "rec = lasp.Recording('test', mgr, 10.0)" + "rec = lasp.Recording('test', mgr, 1.0)" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "5defa804", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter stopStream (lasp_streammgr.cpp: 287)\n", - "2022-09-27 22:08:12+0200 | Enter ~Daq (lasp_daq.cpp: 14)\n", - "2022-09-27 22:08:12+0200 | Leave ~Daq (lasp_daq.cpp)\n", - "2022-09-27 22:08:12+0200 Leave stopStream (lasp_streammgr.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "mgr.stopStream(lasp.StreamMgr.StreamType.input)" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "d12f8c4a", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter stopAllStreams (lasp_streammgr.cpp: 202)\n", - "2022-09-27 22:08:12+0200 Leave stopAllStreams (lasp_streammgr.cpp)\n" - ] - } - ], + "outputs": [], "source": [ "mgr.stopAllStreams()" ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "83b1713b", - "metadata": {}, - "outputs": [], - "source": [ - "def cb(data):\n", - " # raise RuntimeError('hh')\n", - " print(data.shape)" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "ff7c1e03", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter InDataHandler (lasp_streammgr.cpp: 14)\n", - "2022-09-27 22:08:12+0200 Leave InDataHandler (lasp_streammgr.cpp)\n", - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 13)\n", - "2022-09-27 22:08:12+0200 Leave ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n", - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter PyIndataHandler (lasp_pyindatahandler.cpp: 78)\n", - "2022-09-27 22:08:12+0200 | Enter start (lasp_streammgr.cpp: 16)\n", - "2022-09-27 22:08:12+0200 | Leave start (lasp_streammgr.cpp)\n", - "2022-09-27 22:08:12+0200 Leave PyIndataHandler (lasp_pyindatahandler.cpp)\n" - ] - } - ], - "source": [ - "i = lasp.InDataHandler(mgr, cb)\n", - "import time\n", - "#time.sleep(4)" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "9ba54238", - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter ~PyIndataHandler (lasp_pyindatahandler.cpp: 87)\n", - "2022-09-27 22:08:12+0200 Leave ~PyIndataHandler (lasp_pyindatahandler.cpp)\n", - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter ~ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 38)\n", - "2022-09-27 22:08:12+0200 Leave ~ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n", - "2022-09-27 22:08:12+0200 \n", - "2022-09-27 22:08:12+0200 Enter ~InDataHandler (lasp_streammgr.cpp: 27)\n", - "2022-09-27 22:08:12+0200 Leave ~InDataHandler (lasp_streammgr.cpp)\n" - ] - } - ], - "source": [ - "del i" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "0f0edc36", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "numpy.ndarray" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import numpy as np\n", - "a = np.array([1,2,3])\n", - "type(a)" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "ee546114-a879-4ebe-a6eb-e2354b2247fd", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "dtype('int64')" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "a.dtype" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "5d033d6d-3052-42ce-9441-faa917ece6a9", - "metadata": {}, - "outputs": [], - "source": [ - "from lasp import DaqChannel" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "bb99ec99-b921-4fb2-bd79-87db8dfcdb03", - "metadata": {}, - "outputs": [], - "source": [ - "d = DaqChannel()" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "ad67d273-45aa-4358-9405-de5924f087a2", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "0" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "d.qty.value" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "53ab5c8f-f904-4f9f-b591-6a5dd1581ddd", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -498,7 +137,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.7" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/test/filterbank_test.py b/test/filterbank_test.py deleted file mode 100644 index 80e6908..0000000 --- a/test/filterbank_test.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Mon Jan 15 19:45:33 2018 - -@author: anne -""" -import numpy as np -from lasp import FilterBank, cls -cls() - -nfft=50 -P = 4 -L = nfft-P+2 -nfilters = 1 -print('nfft:',nfft) - -h = np.zeros((P,nfilters),order='F') -h[P-1,0] = 1. -#h[0,1] = 1. - -fb = FilterBank(h,nfft) -# %% -#data = np.zeros(nfft//2,order = 'F') -data = np.zeros(L,order = 'F') -data[:] = 1 -#data[:] = 1. -#data[1] = 1. -#data[2] = 1. - -res = fb.filter_(data) -print('res shape %i:\n' %res.shape[0]) -print(res) -#for i in range(4): -# res = fb.filter_(data) -# print('res:\n',res) diff --git a/test/sosfilterbank_test.py b/test/sosfilterbank_test.py deleted file mode 100644 index f037809..0000000 --- a/test/sosfilterbank_test.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Mon Jan 15 19:45:33 2018 - -@author: anne -""" -import numpy as np -from lasp.wrappers import SosFilterBank - -fb = SosFilterBank(1, 2) - -newfilter1 = np.array([0,1.,0.,1.,0.,0.])[:,np.newaxis] # Unit sample delay -newfilter2 = np.array([0,1.,0.,1.,0.,0.])[:,np.newaxis] # Unit sample delay -newfilter = np.vstack((newfilter1, newfilter2)) - -fb.setFilter(0, newfilter) -x = np.zeros(10) -x[5]=1 -x[8] = 3 -x = x[:,np.newaxis] -y = fb.filter_(x) -print(x) -print(y) -y = fb.filter_(x) -print(y)