{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import csv\n", "\n", "import numpy as np\n", "from matplotlib import pyplot as plt\n", "import scipy.fftpack" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%matplotlib widget" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "ename": "FileNotFoundError", "evalue": "data/Netzfrequenz_Sekundenwerte_2012_KW37.csv not found.", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", "Input \u001b[0;32mIn [3]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m data \u001b[38;5;241m=\u001b[39m \u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgenfromtxt\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mdata/Netzfrequenz_Sekundenwerte_2012_KW37.csv\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdelimiter\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m,\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m[\u001b[38;5;241m1\u001b[39m:,\u001b[38;5;241m1\u001b[39m:]\n", "File \u001b[0;32m/usr/lib/python3.10/site-packages/numpy/lib/npyio.py:1813\u001b[0m, in \u001b[0;36mgenfromtxt\u001b[0;34m(fname, dtype, comments, delimiter, skip_header, skip_footer, converters, missing_values, filling_values, usecols, names, excludelist, deletechars, replace_space, autostrip, case_sensitive, defaultfmt, unpack, usemask, loose, invalid_raise, max_rows, encoding, like)\u001b[0m\n\u001b[1;32m 1811\u001b[0m fname \u001b[38;5;241m=\u001b[39m os_fspath(fname)\n\u001b[1;32m 1812\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(fname, \u001b[38;5;28mstr\u001b[39m):\n\u001b[0;32m-> 1813\u001b[0m fid \u001b[38;5;241m=\u001b[39m \u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlib\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_datasource\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mrt\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoding\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1814\u001b[0m fid_ctx \u001b[38;5;241m=\u001b[39m contextlib\u001b[38;5;241m.\u001b[39mclosing(fid)\n\u001b[1;32m 1815\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", "File \u001b[0;32m/usr/lib/python3.10/site-packages/numpy/lib/_datasource.py:193\u001b[0m, in \u001b[0;36mopen\u001b[0;34m(path, mode, destpath, encoding, newline)\u001b[0m\n\u001b[1;32m 156\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 157\u001b[0m \u001b[38;5;124;03mOpen `path` with `mode` and return the file object.\u001b[39;00m\n\u001b[1;32m 158\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 189\u001b[0m \n\u001b[1;32m 190\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 192\u001b[0m ds \u001b[38;5;241m=\u001b[39m DataSource(destpath)\n\u001b[0;32m--> 193\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mds\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoding\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnewline\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnewline\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[0;32m/usr/lib/python3.10/site-packages/numpy/lib/_datasource.py:532\u001b[0m, in \u001b[0;36mDataSource.open\u001b[0;34m(self, path, mode, encoding, newline)\u001b[0m\n\u001b[1;32m 529\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _file_openers[ext](found, mode\u001b[38;5;241m=\u001b[39mmode,\n\u001b[1;32m 530\u001b[0m encoding\u001b[38;5;241m=\u001b[39mencoding, newline\u001b[38;5;241m=\u001b[39mnewline)\n\u001b[1;32m 531\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 532\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mpath\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m not found.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", "\u001b[0;31mFileNotFoundError\u001b[0m: data/Netzfrequenz_Sekundenwerte_2012_KW37.csv not found." ] } ], "source": [ "data = np.genfromtxt('data/Netzfrequenz_Sekundenwerte_2012_KW37.csv', delimiter=',')[1:,1:]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'data' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "Input \u001b[0;32mIn [4]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m fig, ax \u001b[38;5;241m=\u001b[39m plt\u001b[38;5;241m.\u001b[39msubplots()\n\u001b[0;32m----> 2\u001b[0m ax\u001b[38;5;241m.\u001b[39mplot(\u001b[43mdata\u001b[49m[:\u001b[38;5;241m3600\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m24\u001b[39m, \u001b[38;5;241m0\u001b[39m])\n", "\u001b[0;31mNameError\u001b[0m: name 'data' is not defined" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "bbdb71a2ba2947919ddca69963f54445", "version_major": 2, "version_minor": 0 }, "image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAen0lEQVR4nO3df2zV9b348VehtFXvbRdhVhBksKsbG7nuUgKjXrLMqzVoXLjZjSzeiHo1WbPtIvS6Oxg3OsiSZruZuXMT3CZolqCX4K94k15H/7gXQbg/6C3LMkhchGthtpJibFG3IvD5/uGXfr9diwLSUzyvxyM5f5y3nw99nbytnyef0x4riqIoAgCANMaN9QAAAJSWAAQASEYAAgAkIwABAJIRgAAAyQhAAIBkBCAAQDICEAAgGQEIAJCMAAQASEYAAgAkIwABAJIRgAAAyQhAAIBkBCAAQDICEAAgGQEIAJCMAAQASEYAAgAkIwABAJIRgAAAyQhAAIBkBCAAQDICEAAgGQEIAJCMAAQASEYAAgAkIwABAJIRgAAAyQhAAIBkBCAAQDICEAAgGQEIAJCMAAQASEYAAgAkIwABAJIRg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14cra2tw47/1re+Fc8//3zs27dvcK25uTl++ctfxq5du87oa/b390ddXV309fVFbW3th38RAMCoc/2OqBzrAc6HY8eORUdHR6xcuXLIelNTU+zcuXPEc3bt2hVNTU1D1m688cbYsGFDvPvuuzFhwoRh5wwMDMTAwMDg876+voh4718kAOCj4dR1u0zugZ2TsgjA3t7eOHHiRNTX1w9Zr6+vj56enhHP6enpGfH448ePR29vb0yePHnYOa2trbFmzZph69OmTfsQ0wMAY+HIkSNRV1c31mOMibIIwFMqKiqGPC+KYtjaBx0/0vopq1atipaWlsHnb775ZkyfPj26urrS/gt0oejv749p06bFwYMH097Ov1DYiwuL/bhw2IsLR19fX1x55ZVx6aWXjvUoY6YsAnDSpEkxfvz4YXf7Dh8+POwu3ymXX375iMdXVlbGxIkTRzynuro6qqurh63X1dX5Zr5A1NbW2osLhL24sNiPC4e9uHCMG1c2vwt71srilVdVVUVDQ0O0t7cPWW9vb4/GxsYRz1mwYMGw47du3Rpz584d8ef/AADKRVkEYERES0tLPProo7Fx48bYt29frFixIrq6uqK5uTki3nv7dunSpYPHNzc3x6uvvhotLS2xb9++2LhxY2zYsCHuu+++sXoJAAAlURZvAUdELFmyJI4cORJr166N7u7umD17drS1tcX06dMjIqK7u3vIZwLOmDEj2traYsWKFfHwww/HlClT4qGHHoovf/nLZ/w1q6ur44EHHhjxbWFKy15cOOzFhcV+XDjsxYXDXpTR5wACAHBmyuYtYAAAzowABABIRgACACQjAAEAkhGAH2DdunUxY8aMqKmpiYaGhti+ffv7Hr9t27ZoaGiImpqamDlzZjzyyCMlmrT8nc1ePPPMM3HDDTfExz/+8aitrY0FCxbEL37xixJOW97O9vvilJdeeikqKyvjc5/73OgOmMjZ7sXAwECsXr06pk+fHtXV1fHJT34yNm7cWKJpy9/Z7semTZvimmuuiYsvvjgmT54cd911Vxw5cqRE05anF198MW655ZaYMmVKVFRUxHPPPfeB56S8dhec1j//8z8XEyZMKH72s58Ve/fuLe69997ikksuKV599dURj9+/f39x8cUXF/f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C", "text/html": [ "\n", "
\n", "
\n", " Figure\n", "
\n", " \n", "
\n", " " ], "text/plain": [ "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig, ax = plt.subplots()\n", "ax.plot(data[:3600*24, 0])" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.02051102806199375" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.std(data[:,0])" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "2b835c8fb082428cabc1ad9112286728", "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" }, { "data": { "text/plain": [ "(1e-06, 0.5)" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Number of samplepoints\n", "N = len(data[:,0])\n", "# sample spacing\n", "T = 1.0\n", "x = np.linspace(0.0, N*T, N)\n", "yf = scipy.fftpack.fft(data[:,0])\n", "xf = np.linspace(0.0, 1.0/(2.0*T), N//2)\n", "\n", "yf = 2.0/N * np.abs(yf[:N//2])\n", "\n", "#yf = sum(yf[s::10] for s in range(10)) / 10\n", "#xf = sum(xf[s::10] for s in range(10)) / 10\n", "\n", "fig, ax = plt.subplots()\n", "ax.loglog(xf, yf)\n", "ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, _pos: f'{1/x:.1f}'))\n", "ax.set_xlabel('T in s')\n", "ax.set_ylabel('Amplitude Δf')\n", "ax.grid()\n", "ax.set_xlim([1/1000000, 0.5])" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "94ca3cb49e7d452dab8f7e2e8d632b84", "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" }, { "data": { "text/plain": [ "(5e-07, 0.02)" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Number of samplepoints\n", "N = len(data[:,0])\n", "# sample spacing\n", "T = 1.0\n", "x = np.linspace(0.0, N*T, N)\n", "yf = scipy.fftpack.fft(data[:,0])\n", "xf = np.linspace(0.0, 1.0/(2.0*T), N//2)\n", "\n", "yf = 2.0/N * np.abs(yf[:N//2])\n", "\n", "average_from = lambda val, start, average_width: np.hstack([val[:start], [ np.mean(val[i:i+average_width]) for i in range(start, len(val), average_width) ]])\n", "\n", "average_width = 20\n", "average_start = 100\n", "yf = average_from(yf, average_start, average_width)\n", "xf = average_from(xf, average_start, average_width)\n", "yf = average_from(yf, 300, average_width)\n", "xf = average_from(xf, 300, average_width)\n", "\n", "fig, ax = plt.subplots()\n", "ax.loglog(xf, yf)\n", "ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, _pos: f'{1/x:.1f}'))\n", "ax.set_xlabel('T in s')\n", "ax.set_ylabel('Amplitude Δf')\n", "\n", "for i, t in enumerate([45, 60, 600, 1200, 1800, 3600]):\n", " ax.axvline(1/t, color='red', alpha=0.5)\n", " ax.annotate(f'{t} s', xy=(1/t, 3e-3), xytext=(-15, 0), xycoords='data', textcoords='offset pixels', rotation=90)\n", "#ax.text(1/60, 10,'60 s', ha='left')\n", "ax.grid()\n", "ax.set_xlim([1/60000, 0.5])\n", "ax.set_ylim([5e-7, 2e-2])" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "91a04300b9164bd7a9915d0028f3e563", "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", "s = 60\n", "\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(len(data)/2, 1, len(data)/2)\n", "\n", "fig, ax = plt.subplots()\n", "ax.loglog(xs[s//2:-s//2+1], ys)\n", "ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, _pos: 1/x))\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "2811a79d4ad8487f822750e4419ccfdb", "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", "s = 1\n", "\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(len(data)/2, 1, len(data)/2)\n", "\n", "fig, ax = plt.subplots()\n", "ax.loglog(xs[s//2:-s//2+1 if s > 1 else None], ys)\n", "ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, _pos: 1/x))\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c678197e011e4ab4982d3e1d2a2cee9a", "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", "s = 1\n", "\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", "\n", "ys *= 2*np.pi*xs\n", "#xs = np.linspace(len(data)/2, 1, len(data)/2)\n", "\n", "fig, ax = plt.subplots()\n", "ax.loglog(xs[s//2:-s//2+1 if s > 1 else None], ys)\n", "ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, _pos: 1/x))\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "52bcd29a41a54ed1bf9dc63e0c9e83d8", "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", "s = 30\n", "\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", "\n", "ys *= 2*np.pi*xs[s//2:-s//2+1]\n", "\n", "#xs = np.linspace(len(data)/2, 1, len(data)/2)\n", "\n", "fig, ax = plt.subplots(figsize=(9,5))\n", "ax.loglog(xs[s//2:-s//2+1], ys)\n", "ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, _pos: 1/x))\n", "ax.grid()\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "15.923566878980893" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "1/0.0628" ] } ], "metadata": { "kernelspec": { "display_name": "jupytersucks-dsss", "language": "python", "name": "jupytersucks-dsss" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.4" } }, "nbformat": 4, "nbformat_minor": 4 }