Update thesis
This commit is contained in:
parent
a803d10b03
commit
6ab3ac3dff
18 changed files with 13076 additions and 208 deletions
|
|
@ -76,7 +76,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 75,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 57,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
"(129, 470)"
|
||||
]
|
||||
},
|
||||
"execution_count": 57,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 58,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
"3.90625"
|
||||
]
|
||||
},
|
||||
"execution_count": 58,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -139,21 +139,13 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 61,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-61-530955947ba4>:1: 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(len(test_data), figsize=(8, 20), sharex=True)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "30b7e529e3f94c1b8241c6b6760b7e69",
|
||||
"model_id": "c7a38939cb3a42cfbfe99fe7d603e11a",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -182,21 +174,13 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 76,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-76-31c82486a777>:1: 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(len(test_data), figsize=(8, 20), sharex=True)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "9e0976ade81c4990a10fd1182f0f20d5",
|
||||
"model_id": "e6b769f15870407ba59cff627632d447",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -225,7 +209,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 62,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
|
@ -255,7 +239,7 @@
|
|||
" 492.1875 , 496.09375, 500. ])"
|
||||
]
|
||||
},
|
||||
"execution_count": 62,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
|
@ -266,21 +250,13 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 63,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-63-888d30b0f7d6>:1: 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, axs = plt.subplots(len(test_data), figsize=(8, 20), sharex=True)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "cef58f5753084c54a648418e134775d8",
|
||||
"model_id": "db4021b95410428cb07f76edd932907c",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -388,7 +364,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.1"
|
||||
"version": "3.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
BIN
lab-windows/fig_out/mains_voltage_spectrum-eps-converted-to.pdf
Normal file
BIN
lab-windows/fig_out/mains_voltage_spectrum-eps-converted-to.pdf
Normal file
Binary file not shown.
10404
lab-windows/fig_out/mains_voltage_spectrum.eps
Normal file
10404
lab-windows/fig_out/mains_voltage_spectrum.eps
Normal file
File diff suppressed because it is too large
Load diff
BIN
lab-windows/fig_out/ocxo_freq_stability-eps-converted-to.pdf
Normal file
BIN
lab-windows/fig_out/ocxo_freq_stability-eps-converted-to.pdf
Normal file
Binary file not shown.
1822
lab-windows/fig_out/ocxo_freq_stability.eps
Normal file
1822
lab-windows/fig_out/ocxo_freq_stability.eps
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -36,7 +36,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"db = sqlite3.connect('data/waveform-raspi.sqlite3')"
|
||||
"db = sqlite3.connect('data/waveform-raspi-2-2.sqlite3')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Run 000: 2020-01-31 19:05:24 - 2020-02-01 01:13:45 ( 6:08:21.589, 22126080sp)\n"
|
||||
"Run 000: 2020-03-25 16:07:36 - 2020-03-26 00:15:13 ( 8:07:37.266, 29261120sp)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -100,12 +100,12 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "0b088957d9a24a74ab1b81d68099aa99",
|
||||
"model_id": "582c4360e293466e9baed5bc66a47883",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"HBox(children=(FloatProgress(value=0.0, max=691440.0), HTML(value='')))"
|
||||
"HBox(children=(FloatProgress(value=0.0, max=914410.0), HTML(value='')))"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -133,7 +133,7 @@
|
|||
" 'SELECT seq, data FROM measurements WHERE run_id = ? ORDER BY rx_ts LIMIT ? OFFSET ?',\n",
|
||||
" (last_run, limit, n_records-limit))), total=n_records):\n",
|
||||
" \n",
|
||||
" if last_seq is None or seq == (last_seq + 1)%0xffff:\n",
|
||||
" if last_seq is None or seq == (last_seq + 1)%0x10000:\n",
|
||||
" last_seq = seq\n",
|
||||
" idx = write_index if skip_dropped_sections else i\n",
|
||||
" data[idx*record_size:(idx+1)*record_size] = np.frombuffer(chunk, dtype='<H')\n",
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"227.68691180713367"
|
||||
"227.0922848236977"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
|
|
@ -177,7 +177,7 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "8a6f7e9ac8f04d1b84035c29623cfa99",
|
||||
"model_id": "ecf3e3e261c54d87b169c1eb391a67f9",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -266,7 +266,7 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "a3824e732a0647d4a12e8c5a567f5dc0",
|
||||
"model_id": "cc101709475d440ea77e68bcb56ce3b7",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -299,12 +299,12 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "342f89b5d55f435ab132deb5d051c926",
|
||||
"model_id": "b0202d59643548cf83b6fa6fd7580d2d",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"HBox(children=(FloatProgress(value=0.0, max=221260.0), HTML(value='')))"
|
||||
"HBox(children=(FloatProgress(value=0.0, max=292611.0), HTML(value='')))"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -364,7 +364,7 @@
|
|||
" #print(coeff)\n",
|
||||
" A, mu, sigma, *_ = coeff\n",
|
||||
" f_mean[le_t] = mu\n",
|
||||
" except Exception:\n",
|
||||
" except Exception as e:\n",
|
||||
" f_mean[le_t] = np.nan"
|
||||
]
|
||||
},
|
||||
|
|
@ -376,7 +376,7 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "33431729d479469cb89bcf86e22508ad",
|
||||
"model_id": "59d50a2876634433bdfb751a7a66d9ca",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -420,6 +420,8 @@
|
|||
"for i in np.where(np.isnan(f_mean))[0]:\n",
|
||||
" ax.axvspan(f_t[i], f_t[i+1], color='lightblue')\n",
|
||||
"\n",
|
||||
"formatter = matplotlib.ticker.FuncFormatter(lambda s, x: str(datetime.timedelta(seconds=s)))\n",
|
||||
"ax.xaxis.set_major_formatter(formatter)\n",
|
||||
"ax.set_xlabel('recording time t [s]')\n",
|
||||
"None"
|
||||
]
|
||||
|
|
@ -432,7 +434,7 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "e8a4ecab028f4fcf8d9821dd66a42027",
|
||||
"model_id": "95cfea97c3b946ed9cdf351b16c2c45e",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -529,13 +531,80 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 53,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-53-c54c3e4ac2be>: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(figsize=(5, 2))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "bcf4b384d95949c38a4754cdb47ae512",
|
||||
"model_id": "ad5454f664734681adb8640f480ce69a",
|
||||
"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": [
|
||||
"Text(20, 1, '50 Hz')"
|
||||
]
|
||||
},
|
||||
"execution_count": 53,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Number of samplepoints\n",
|
||||
"N = len(data)\n",
|
||||
"# sample spacing\n",
|
||||
"T = 1.0 / sampling_rate\n",
|
||||
"x = np.linspace(0.0, N*T, N)\n",
|
||||
"yf = scipy.fftpack.fft(data * sig.blackman(N))\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 = 6\n",
|
||||
"average_start = 20\n",
|
||||
"yf = average_from(yf, average_start, average_width)\n",
|
||||
"xf = average_from(xf, average_start, average_width)\n",
|
||||
"yf = average_from(yf, 200, average_width)\n",
|
||||
"xf = average_from(xf, 200, average_width)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 68,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-68-21b49a5af249>:1: 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(figsize=(6, 3))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "4a3edb0925fe47eb8751150aa7da8c22",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -550,60 +619,48 @@
|
|||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/home/user/safety-reset/lab-windows/env/lib/python3.8/site-packages/numpy/core/_asarray.py:85: ComplexWarning: Casting complex values to real discards the imaginary part\n",
|
||||
" return array(a, dtype, copy=False, order=order)\n"
|
||||
"The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"data = f_copy\n",
|
||||
"ys = scipy.fftpack.fft(data)\n",
|
||||
"ys = scipy.fftpack.fftshift(ys)\n",
|
||||
"#ys = 2.0/len(data) * np.abs(ys[:len(data)//2])\n",
|
||||
"#s = 3\n",
|
||||
"\n",
|
||||
"#ys = np.convolve(ys, np.ones((s,))/s, mode='valid')\n",
|
||||
"\n",
|
||||
"#xs = np.linspace(0, 5, len(data)//2)\n",
|
||||
"xs = np.linspace(-5, 5, len(data))\n",
|
||||
"\n",
|
||||
"#ys *= 2*np.pi*xs[s//2:-s//2+1]\n",
|
||||
"#ys *= xs\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.loglog(xs[s//2:-s//2+1], ys)\n",
|
||||
"#ax.loglog(xs, ys)\n",
|
||||
"#ys[len(xs)//2] = 0\n",
|
||||
"#ax.set_yscale('log')\n",
|
||||
"ax.plot(xs, ys)\n",
|
||||
"fig, ax = plt.subplots(figsize=(6, 3))\n",
|
||||
"fig.tight_layout()\n",
|
||||
"ax.loglog(xf, yf)\n",
|
||||
"#ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, _pos: f'{1/x:.1f}'))\n",
|
||||
"ax.set_xlabel('f [Hz]')\n",
|
||||
"ax.set_ylabel('Amplitude V [V]')\n",
|
||||
"ax.grid()\n",
|
||||
"#plt.show()\n",
|
||||
"xs[-1]"
|
||||
"ax.set_xlim([0.1, 500])\n",
|
||||
"fig.subplots_adjust(bottom=0.2)\n",
|
||||
"\n",
|
||||
"for le_f in (50, 150, 250, 350, 450):\n",
|
||||
" ax.axvline(le_f, color=(1, 0.5, 0.5), zorder=-2)\n",
|
||||
"ax.annotate('50 Hz', xy=(20, 1), xycoords='data', bbox=dict(fc='white', alpha=0.8, ec='none'))\n",
|
||||
"font = {'family' : 'normal',\n",
|
||||
" 'weight' : 'normal',\n",
|
||||
" 'size' : 10}\n",
|
||||
"matplotlib.rc('font', **font)\n",
|
||||
"fig.savefig('fig_out/mains_voltage_spectrum.eps')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 43,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-43-2e31f0cb9460>:21: 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": "cbc03380a4234b4d8160d25e867ff5a9",
|
||||
"model_id": "37e159955f114f36824dd42da060b9ea",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -617,41 +674,49 @@
|
|||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(1.6666666666666667e-05, 0.5)"
|
||||
"[<matplotlib.lines.Line2D at 0x7fafc108cdc0>]"
|
||||
]
|
||||
},
|
||||
"execution_count": 17,
|
||||
"execution_count": 43,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Number of samplepoints\n",
|
||||
"N = len(data)\n",
|
||||
"newcopy = np.copy(f_mean[1:-2])\n",
|
||||
"N = len(newcopy)\n",
|
||||
"# sample spacing\n",
|
||||
"T = 1.0 / 10.0\n",
|
||||
"T = 1.0 / 10\n",
|
||||
"x = np.linspace(0.0, N*T, N)\n",
|
||||
"yf = scipy.fftpack.fft(data)\n",
|
||||
"xf = np.linspace(0.0, 1.0/(2.0*T), N//2)\n",
|
||||
"yf = scipy.fftpack.fft(newcopy * sig.blackman(N))\n",
|
||||
"xf = np.linspace(0.0, 10/2, 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 = 6\n",
|
||||
"average_start = 20\n",
|
||||
"yf = average_from(yf, average_start, average_width)\n",
|
||||
"xf = average_from(xf, average_start, average_width)\n",
|
||||
"yf = average_from(yf, 200, average_width)\n",
|
||||
"xf = average_from(xf, 200, average_width)\n",
|
||||
"average_width1, average_start1 = 3, 40\n",
|
||||
"average_width2, average_start2 = 4, 100\n",
|
||||
"yf = average_from(yf, average_start1, average_width1)\n",
|
||||
"xf = average_from(xf, average_start1, average_width1)\n",
|
||||
"yf = average_from(yf, average_start2, average_width2)\n",
|
||||
"xf = average_from(xf, average_start2, average_width2)\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.set_xlabel('T [s]')\n",
|
||||
"ax.set_ylabel('Amplitude Δf [Hz]')\n",
|
||||
"\n",
|
||||
"for i, t in enumerate([60, 300, 450, 1200, 1800]):\n",
|
||||
" ax.axvline(1/t, color='red', alpha=0.5)\n",
|
||||
" ax.annotate(f'{t} s', xy=(1/t, 3e-5), 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])"
|
||||
"#ax.set_xlim([1/60000, 0.5])\n",
|
||||
"ax.set_ylim([5e-7, 2e-2])\n",
|
||||
"ax.plot(xf[1:], 2e-6/xf[1:])"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -662,7 +727,7 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "8eb3621b74c04c4fb7dd3e919f0d1fed",
|
||||
"model_id": "671ae919bf124e72b54144310ea1602d",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
|
@ -672,59 +737,20 @@
|
|||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(5e-07, 0.02)"
|
||||
]
|
||||
},
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Number of samplepoints\n",
|
||||
"N = len(data)\n",
|
||||
"# sample spacing\n",
|
||||
"T = 1.0 / 10.0\n",
|
||||
"x = np.linspace(0.0, N*T, N)\n",
|
||||
"yf = scipy.fftpack.fft(data)\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 = 6\n",
|
||||
"average_start = 20\n",
|
||||
"yf = average_from(yf, average_start, average_width)\n",
|
||||
"xf = average_from(xf, average_start, average_width)\n",
|
||||
"yf = average_from(yf, 70, 4)\n",
|
||||
"xf = average_from(xf, 70, 4)\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-5), 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])"
|
||||
"ax.plot(np.linspace(0, (len(f_mean)-3)/10, len(f_mean)-3) , f_mean[1:-2])\n",
|
||||
"ax.grid()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "winlabenv",
|
||||
"display_name": "labenv",
|
||||
"language": "python",
|
||||
"name": "winlabenv"
|
||||
"name": "labenv"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
|
|
@ -736,7 +762,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.6"
|
||||
"version": "3.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue