From b489a1b12f2f574ed24237601b3797b58d302196 Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 27 Feb 2020 14:39:18 +0100 Subject: Add a bunch of deps --- lab-windows/grid_frequency_spectra.ipynb | 141 ++++++++++++++++++++----------- lab-windows/grid_scope.ipynb | 30 +++++-- 2 files changed, 118 insertions(+), 53 deletions(-) (limited to 'lab-windows') diff --git a/lab-windows/grid_frequency_spectra.ipynb b/lab-windows/grid_frequency_spectra.ipynb index 7b187f5..75d3cf9 100644 --- a/lab-windows/grid_frequency_spectra.ipynb +++ b/lab-windows/grid_frequency_spectra.ipynb @@ -33,13 +33,13 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "36f1f4d7970e41afa4737b6f63b7c449", + "model_id": "45cbf0c7c4314a3386adf52c261b1505", "version_major": 2, "version_minor": 0 }, @@ -53,10 +53,10 @@ { "data": { "text/plain": [ - "[]" + "[]" ] }, - "execution_count": 9, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -68,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -77,7 +77,7 @@ "0.02051102806199375" ] }, - "execution_count": 10, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -88,13 +88,13 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "d7fe0512f4254efeb15235a5617ef064", + "model_id": "125cd5cc3ac44df5885f2c82cfa80c11", "version_major": 2, "version_minor": 0 }, @@ -111,7 +111,7 @@ "(1e-06, 0.5)" ] }, - "execution_count": 16, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -141,21 +141,13 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 11, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":20: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).\n", - " fig, ax = plt.subplots()\n" - ] - }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "2991d932b113496a9135d569f9577abe", + "model_id": "65216e331e154ee980d16ae5de7fbfcd", "version_major": 2, "version_minor": 0 }, @@ -172,7 +164,7 @@ "(5e-07, 0.02)" ] }, - "execution_count": 72, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -214,25 +206,22 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "metadata": {}, "outputs": [ { - "ename": "TypeError", - "evalue": "object of type cannot be safely interpreted as an integer.", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m~/safety-reset/lab-windows/env/lib/python3.8/site-packages/numpy/core/function_base.py\u001b[0m in \u001b[0;36mlinspace\u001b[0;34m(start, stop, num, endpoint, retstep, dtype, axis)\u001b[0m\n\u001b[1;32m 116\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 117\u001b[0;31m \u001b[0mnum\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnum\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 118\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mTypeError\u001b[0m: 'float' object cannot be interpreted as an integer", - "\nDuring handling of the above exception, another exception occurred:\n", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mys\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconvolve\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mys\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mones\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'valid'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mxs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlinspace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1.0\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m2.0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m2\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 8\u001b[0m \u001b[0;31m#xs = np.linspace(len(data)/2, 1, len(data)/2)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m<__array_function__ internals>\u001b[0m in \u001b[0;36mlinspace\u001b[0;34m(*args, **kwargs)\u001b[0m\n", - "\u001b[0;32m~/safety-reset/lab-windows/env/lib/python3.8/site-packages/numpy/core/function_base.py\u001b[0m in \u001b[0;36mlinspace\u001b[0;34m(start, stop, num, endpoint, retstep, dtype, axis)\u001b[0m\n\u001b[1;32m 117\u001b[0m \u001b[0mnum\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnum\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 118\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 119\u001b[0;31m raise TypeError(\n\u001b[0m\u001b[1;32m 120\u001b[0m \u001b[0;34m\"object of type {} cannot be safely interpreted as an integer.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 121\u001b[0m .format(type(num)))\n", - "\u001b[0;31mTypeError\u001b[0m: object of type cannot be safely interpreted as an integer." - ] + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d5721ab27d01416fb7fce8449b5d2289", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -242,7 +231,7 @@ "\n", "ys = np.convolve(ys, np.ones((s,))/s, mode='valid')\n", "\n", - "xs = np.linspace(0, 1.0/2.0, len(data)/2)\n", + "xs = np.linspace(0, 1.0/2.0, len(data)//2)\n", "#xs = np.linspace(len(data)/2, 1, len(data)/2)\n", "\n", "fig, ax = plt.subplots()\n", @@ -253,9 +242,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c419327f1f4f43c1903d3817d4651241", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "ys = scipy.fftpack.fft(data[:,0])\n", "ys = 2.0/len(data) * np.abs(ys[:len(data)//2])\n", @@ -263,7 +267,7 @@ "\n", "ys = np.convolve(ys, np.ones((s,))/s, mode='valid')\n", "\n", - "xs = np.linspace(0, 1.0/2.0, len(data)/2)\n", + "xs = np.linspace(0, 1.0/2.0, len(data)//2)\n", "#xs = np.linspace(len(data)/2, 1, len(data)/2)\n", "\n", "fig, ax = plt.subplots()\n", @@ -274,9 +278,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "7c1941babb2e4d0c951d060fa9a4ba78", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "ys = scipy.fftpack.fft(data[:,0])\n", "ys = 2.0/len(data) * np.abs(ys[:len(data)//2])\n", @@ -284,7 +303,7 @@ "\n", "ys = np.convolve(ys, np.ones((s,))/s, mode='valid')\n", "\n", - "xs = np.linspace(0, 1.0/2.0, len(data)/2)\n", + "xs = np.linspace(0, 1.0/2.0, len(data)//2)\n", "\n", "ys *= 2*np.pi*xs\n", "#xs = np.linspace(len(data)/2, 1, len(data)/2)\n", @@ -297,9 +316,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6034b96d5f08488a84d94b82cf319047", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "ys = scipy.fftpack.fft(data[:,0])\n", "ys = 2.0/len(data) * np.abs(ys[:len(data)//2])\n", @@ -307,7 +341,7 @@ "\n", "ys = np.convolve(ys, np.ones((s,))/s, mode='valid')\n", "\n", - "xs = np.linspace(0, 1.0/2.0, len(data)/2)\n", + "xs = np.linspace(0, 1.0/2.0, len(data)//2)\n", "\n", "ys *= 2*np.pi*xs[s//2:-s//2+1]\n", "\n", @@ -322,9 +356,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "15.923566878980893" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "1/0.0628" ] diff --git a/lab-windows/grid_scope.ipynb b/lab-windows/grid_scope.ipynb index 6ce34fb..3b0b3bc 100644 --- a/lab-windows/grid_scope.ipynb +++ b/lab-windows/grid_scope.ipynb @@ -48,7 +48,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Run 000: 2020-01-31 18:05:24 - 2020-02-01 00:13:45 ( 6:08:21.589, 22126080sp)\n" + "Run 000: 2020-01-31 19:05:24 - 2020-02-01 01:13:45 ( 6:08:21.589, 22126080sp)\n" ] } ], @@ -100,7 +100,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "55690b4f59d54454b83deb5200c05f09", + "model_id": "e612fe37a7c34ceaa77e8bc587b8e065", "version_major": 2, "version_minor": 0 }, @@ -177,7 +177,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "cf5c2e35008740379508eaaedfcf3b31", + "model_id": "f8fa09f5053c4c52866ef240c789e741", "version_major": 2, "version_minor": 0 }, @@ -238,6 +238,26 @@ " nfft = window_len * nfft_factor)" ] }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(200.0, 800.0)" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "window_len, window_len * nfft_factor" + ] + }, { "cell_type": "code", "execution_count": 10, @@ -246,7 +266,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "efa9db02cdfc4f6c86d1eadd4769d097", + "model_id": "e8e8458ea5914a939c7188785efd286c", "version_major": 2, "version_minor": 0 }, @@ -279,7 +299,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "e4122530c1444f75aca410ad51d4a733", + "model_id": "875deca2c3d84e069dd0a5eaef4ea0aa", "version_major": 2, "version_minor": 0 }, -- cgit