add exercise 03 #11

Merged
kasper merged 3 commits from develop into main 2021-05-17 14:38:09 +02:00
2 changed files with 36 additions and 12 deletions
Showing only changes of commit 010335a394 - Show all commits

View File

@ -238,7 +238,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"scrolled": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -429,15 +428,26 @@
"# reconstruct signal\n", "# reconstruct signal\n",
"g = np.ones_like(t_) * a0\n", "g = np.ones_like(t_) * a0\n",
"for k, (ak, bk) in enumerate(zip(a, b)):\n", "for k, (ak, bk) in enumerate(zip(a, b)):\n",
" g += ak * np.sin(bk*t_)\n", " g += ak * np.sin(bk*t_)"
"\n", ]
"# plotting\n", },
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"outputs": [],
"source": [
"# Cell 7b: plotting\n",
"plt.plot(t_, square, 'r', label='original signal') \n", "plt.plot(t_, square, 'r', label='original signal') \n",
"plt.plot(t_, g, 'g', label='Reihenentwicklung')\n", "plt.plot(t_, g, 'g', label='Reihenentwicklung')\n",
"plt.ticklabel_format(axis='y', style='sci', scilimits=(-1,1))\n", "plt.ticklabel_format(axis='y', style='sci', scilimits=(-1,1))\n",
"plt.xlabel('time [sec]')\n", "plt.xlabel('time [sec]')\n",
"plt.ylabel('amplitude')\n", "plt.ylabel('amplitude')\n",
"#plt.ylim(-1.1,1.1)\n", "#plt.ylim(0.9,1.1)\n",
"plt.legend()\n", "plt.legend()\n",
"plt.show()" "plt.show()"
] ]
@ -494,14 +504,14 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"scrolled": true, "scrolled": false,
"slideshow": { "slideshow": {
"slide_type": "subslide" "slide_type": "subslide"
} }
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"#plotting\n", "#Cell 8b: plotting\n",
"plt.subplot(311)\n", "plt.subplot(311)\n",
"plt.title('Time Domain')\n", "plt.title('Time Domain')\n",
"plt.plot(t, square, linewidth=1)\n", "plt.plot(t, square, linewidth=1)\n",

View File

@ -12,7 +12,7 @@
" <div style=\"float: right ; margin: 50px ; padding: 20px ; background: rgba(255 , 255 , 255 , 0.7) ; width: 50% ; height: 150px\">\n", " <div style=\"float: right ; margin: 50px ; padding: 20px ; background: rgba(255 , 255 , 255 , 0.7) ; width: 50% ; height: 150px\">\n",
" <div style=\"position: relative ; top: 50% ; transform: translatey(-50%)\">\n", " <div style=\"position: relative ; top: 50% ; transform: translatey(-50%)\">\n",
" <div style=\"font-size: xx-large ; font-weight: 900 ; color: rgba(0 , 0 , 0 , 0.8) ; line-height: 100%\">Signal Processing</div>\n", " <div style=\"font-size: xx-large ; font-weight: 900 ; color: rgba(0 , 0 , 0 , 0.8) ; line-height: 100%\">Signal Processing</div>\n",
" <div style=\"font-size: large ; padding-top: 20px ; color: rgba(0 , 0 , 0 , 0.5)\">Filtering Basics</div>\n", " <div style=\"font-size: large ; padding-top: 20px ; color: rgba(0 , 0 , 0 , 0.5)\">Filtering Basics - Solution</div>\n",
" </div>\n", " </div>\n",
" </div>\n", " </div>\n",
"</div>\n", "</div>\n",
@ -157,6 +157,7 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Cell 1b: print stats\n",
"print(st[0].stats)" "print(st[0].stats)"
] ]
}, },
@ -206,7 +207,7 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# filtered traces\n", "# Cell 2b: filtered traces\n",
"stHP = st.copy()\n", "stHP = st.copy()\n",
"stHP.filter('highpass', freq=f0, corners=corners, zerophase=True)\n", "stHP.filter('highpass', freq=f0, corners=corners, zerophase=True)\n",
"stLP = st.copy()\n", "stLP = st.copy()\n",
@ -229,13 +230,15 @@
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"slideshow": { "slideshow": {
"rise": {
"scroll": true
},
"slide_type": "subslide" "slide_type": "subslide"
} }
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# ---------------------------------------------------------------\n", "# Cell 2c - plot\n",
"# plot\n",
"plt.rcParams['figure.figsize'] = 17, 17\n", "plt.rcParams['figure.figsize'] = 17, 17\n",
"tx1 = 3000\n", "tx1 = 3000\n",
"tx2 = 8000\n", "tx2 = 8000\n",
@ -392,7 +395,7 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# plot - comment single lines to better see the remaining ones\n", "# Cell 3b: plot - comment single lines to better see the remaining ones\n",
"plt.rcParams['figure.figsize'] = 15, 4\n", "plt.rcParams['figure.figsize'] = 15, 4\n",
"plt.plot(t, tr.data, 'k', label='original', linewidth=1.)\n", "plt.plot(t, tr.data, 'k', label='original', linewidth=1.)\n",
"plt.plot(t, tr_filt.data, 'b', label='causal, n=2', linewidth=1.2)\n", "plt.plot(t, tr_filt.data, 'b', label='causal, n=2', linewidth=1.2)\n",
@ -491,6 +494,7 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Cell 5b: plot\n",
"plt.rcParams['figure.figsize'] = 17, 21\n", "plt.rcParams['figure.figsize'] = 17, 21\n",
"fig = plt.figure()\n", "fig = plt.figure()\n",
"ax1 = fig.add_subplot(7,1,1)\n", "ax1 = fig.add_subplot(7,1,1)\n",
@ -574,6 +578,13 @@
"\n", "\n",
"6) There is no clear S-wave visible. Also in the horizontal components (channel 0 and 1) almost no S-wave energy is visible. This is a clear hint for an explosive type of event. Indeed, this is the recording of a nuclear test explosion. The recording with exactly these bandpass filters was used as cover figure for the book 'Quantitative Seismology' by Keiiti Aki and Paul G. Richards, 2nd edition." "6) There is no clear S-wave visible. Also in the horizontal components (channel 0 and 1) almost no S-wave energy is visible. This is a clear hint for an explosive type of event. Indeed, this is the recording of a nuclear test explosion. The recording with exactly these bandpass filters was used as cover figure for the book 'Quantitative Seismology' by Keiiti Aki and Paul G. Richards, 2nd edition."
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {
@ -594,6 +605,9 @@
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.7.6" "version": "3.7.6"
},
"rise": {
"scroll": true
} }
}, },
"nbformat": 4, "nbformat": 4,