Skip to content

Commit

Permalink
deploy: 3e3917b
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanTodoran committed Oct 17, 2023
1 parent 06f07ff commit 67afcbf
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 86 deletions.
150 changes: 71 additions & 79 deletions Chapter2-DataManipulation/2.7_data_spectral_transforms.html
Original file line number Diff line number Diff line change
Expand Up @@ -590,48 +590,41 @@ <h1 class="site-logo" id="site-title">ML Geo Curriculum</h1>
</div>
<nav id="bd-toc-nav" aria-label="Page">
<ul class="visible nav section-nav flex-column">
<li class="toc-h1 nav-item toc-entry">
<a class="reference internal nav-link" href="#">
2.7 Spectral Transforms
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#level-1-fourier-transforms">
1. Level 1-Fourier Transforms
</a>
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#fourier-transform">
Fourier Transform
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#nyquist">
Nyquist
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#nyquist">
Nyquist
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#uncertainties">
Uncertainties
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#filtering-in-the-fourier-space">
Filtering in the Fourier space
</a>
</li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#synthetic-noise">
Synthetic Noise
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#uncertainties">
Uncertainties
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#filtering-in-the-fourier-space">
1.3 Filtering in the Fourier space
</a>
</li>
</ul>
</li>
<li class="toc-h1 nav-item toc-entry">
<a class="reference internal nav-link" href="#use-random-functions">
Use random functions
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#level-2-fourier-transforms-synthetic-noise">
Level 2-Fourier Transforms: Synthetic Noise
</a>
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#d-fourier-transforms">
2D Fourier Transforms
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#random-noise">
2.1 Random noise
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#level3-2d-fourier-transforms">
Level3: 2D Fourier Transforms
</a>
</li>
</ul>
Expand All @@ -655,48 +648,41 @@ <h2> Contents </h2>
</div>
<nav aria-label="Page">
<ul class="visible nav section-nav flex-column">
<li class="toc-h1 nav-item toc-entry">
<a class="reference internal nav-link" href="#">
2.7 Spectral Transforms
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#level-1-fourier-transforms">
1. Level 1-Fourier Transforms
</a>
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#fourier-transform">
Fourier Transform
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#nyquist">
Nyquist
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#uncertainties">
Uncertainties
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#nyquist">
Nyquist
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#uncertainties">
Uncertainties
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#filtering-in-the-fourier-space">
Filtering in the Fourier space
</a>
</li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#synthetic-noise">
Synthetic Noise
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#filtering-in-the-fourier-space">
1.3 Filtering in the Fourier space
</a>
</li>
</ul>
</li>
<li class="toc-h1 nav-item toc-entry">
<a class="reference internal nav-link" href="#use-random-functions">
Use random functions
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#level-2-fourier-transforms-synthetic-noise">
Level 2-Fourier Transforms: Synthetic Noise
</a>
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#d-fourier-transforms">
2D Fourier Transforms
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#random-noise">
2.1 Random noise
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#level3-2d-fourier-transforms">
Level3: 2D Fourier Transforms
</a>
</li>
</ul>
Expand All @@ -714,6 +700,12 @@ <h2> Contents </h2>
<section class="tex2jax_ignore mathjax_ignore" id="spectral-transforms">
<h1>2.7 Spectral Transforms<a class="headerlink" href="#spectral-transforms" title="Permalink to this headline">#</a></h1>
<p>In this section, we will transform the data by projecting it onto basis of functions. The two most used transforms as the <strong>Fourier</strong> and the <strong>wavelet</strong> transforms.</p>
<p>The lecture covers several levels.</p>
<ol class="simple">
<li><p>Level 1-Fourier Transforms: basics</p></li>
<li><p>Level 2-Fourier Transforms: synthetic noise</p></li>
<li><p>Level 3-Fourier Transfrms: 2D Fourier transform and Data Compression</p></li>
</ol>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Import modules for seismic data and feature extraction</span>
Expand Down Expand Up @@ -782,8 +774,8 @@ <h1>2.7 Spectral Transforms<a class="headerlink" href="#spectral-transforms" tit
<img alt="../_images/2.7_data_spectral_transforms_4_1.png" src="../_images/2.7_data_spectral_transforms_4_1.png" />
</div>
</div>
<section id="fourier-transform">
<h2>Fourier Transform<a class="headerlink" href="#fourier-transform" title="Permalink to this headline">#</a></h2>
<section id="level-1-fourier-transforms">
<h2>1. Level 1-Fourier Transforms<a class="headerlink" href="#level-1-fourier-transforms" title="Permalink to this headline">#</a></h2>
<p>We use the Scipy Fourier <a class="reference external" href="%21https://docs.scipy.org/doc/scipy/reference/generated/scipy.fftpack.rfft.html#scipy.fftpack.rfft">package</a> to transform the two time series (earthquake and noise).</p>
<p>The Fourier transform is a decomposition of the time series onto an orthonormal basis of cosine and sine functions. The Fourier transform of a time series <span class="math notranslate nohighlight">\(f(t)\)</span> (but similarly if the variable is space <span class="math notranslate nohighlight">\(x\)</span>).</p>
<p><span class="math notranslate nohighlight">\(\hat{F}(f) = \int_{-\infty}^\infty f(t) \exp^{-i2\pi ft} dt\)</span></p>
Expand Down Expand Up @@ -954,7 +946,7 @@ <h3>Uncertainties<a class="headerlink" href="#uncertainties" title="Permalink to
</div>
</section>
<section id="filtering-in-the-fourier-space">
<h3>Filtering in the Fourier space<a class="headerlink" href="#filtering-in-the-fourier-space" title="Permalink to this headline">#</a></h3>
<h3>1.3 Filtering in the Fourier space<a class="headerlink" href="#filtering-in-the-fourier-space" title="Permalink to this headline">#</a></h3>
<p>The data may superimpose multiple signals of various frequencies. To remove or extract specific signals that do not overlap in frequencies, we can <em>filter</em> the data.</p>
<p>The filter can be:</p>
<ul class="simple">
Expand Down Expand Up @@ -1062,17 +1054,15 @@ <h3>Filtering in the Fourier space<a class="headerlink" href="#filtering-in-the-
</div>
</section>
</section>
<section id="synthetic-noise">
<h2>Synthetic Noise<a class="headerlink" href="#synthetic-noise" title="Permalink to this headline">#</a></h2>
<section id="level-2-fourier-transforms-synthetic-noise">
<h2>Level 2-Fourier Transforms: Synthetic Noise<a class="headerlink" href="#level-2-fourier-transforms-synthetic-noise" title="Permalink to this headline">#</a></h2>
<p>Now we could add more noise to the earthquake time series. There are several strategies:</p>
<ul class="simple">
<li><p>From time domain, use the <code class="docutils literal notranslate"><span class="pre">np.rand[n]</span></code> functions to create a random times series</p></li>
<li><p>From the Fourier domain, use <code class="docutils literal notranslate"><span class="pre">np.rand[n]</span></code> functions to create a random <em>phase spectrum</em> between -<span class="math notranslate nohighlight">\(\pi\)</span> and <span class="math notranslate nohighlight">\(\pi\)</span>. For the <em>amplitude spectrum</em>, you may choose a <em>white</em> color, which means that the amplitude spectrum is flat and equal at all frequencies; you may choose a <em>color</em> for the spectrum, for instance an amplitude that decays with <span class="math notranslate nohighlight">\(1/f\)</span>; you may choose the spectrum of the realistic noise, for instance extracted from raw data.</p></li>
</ul>
</section>
</section>
<section class="tex2jax_ignore mathjax_ignore" id="use-random-functions">
<h1>Use random functions<a class="headerlink" href="#use-random-functions" title="Permalink to this headline">#</a></h1>
<section id="random-noise">
<h3>2.1 Random noise<a class="headerlink" href="#random-noise" title="Permalink to this headline">#</a></h3>
<p>Below, use the random function to create a synthetic noise.</p>
<ol class="simple">
<li><p>Create an array of random numbers between -1 and 1 of length the same length as the data Z.</p></li>
Expand Down Expand Up @@ -1175,8 +1165,9 @@ <h1>Use random functions<a class="headerlink" href="#use-random-functions" title
<img alt="../_images/2.7_data_spectral_transforms_34_1.png" src="../_images/2.7_data_spectral_transforms_34_1.png" />
</div>
</div>
<section id="d-fourier-transforms">
<h2>2D Fourier Transforms<a class="headerlink" href="#d-fourier-transforms" title="Permalink to this headline">#</a></h2>
</section>
<section id="level3-2d-fourier-transforms">
<h3>Level3: 2D Fourier Transforms<a class="headerlink" href="#level3-2d-fourier-transforms" title="Permalink to this headline">#</a></h3>
<p>The 2D Fourier transform is applied on a 2D matrix. It first applies a 1D Fourier transform to every row of the matrix, then applies a 1D Fourier transform to every column of the intermediate matrix.</p>
<p>2D Fourier transforms can be used to find the Fourier coefficients that dominate the image. This can be used for filtering the data. Another application is to compress the data by selecting several coefficients instead of presenting most of the image.</p>
<p>We will practice on a DEM.</p>
Expand Down Expand Up @@ -1325,6 +1316,7 @@ <h2>2D Fourier Transforms<a class="headerlink" href="#d-fourier-transforms" titl
</div>
</div>
</section>
</section>
</section>

<script type="text/x-thebe-config">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
"source": [
"# 2.7 Spectral Transforms\n",
"\n",
"In this section, we will transform the data by projecting it onto basis of functions. The two most used transforms as the **Fourier** and the **wavelet** transforms.\n"
"In this section, we will transform the data by projecting it onto basis of functions. The two most used transforms as the **Fourier** and the **wavelet** transforms.\n",
"\n",
"\n",
"The lecture covers several levels.\n",
"1. Level 1-Fourier Transforms: basics\n",
"2. Level 2-Fourier Transforms: synthetic noise\n",
"3. Level 3-Fourier Transfrms: 2D Fourier transform and Data Compression\n"
]
},
{
Expand Down Expand Up @@ -118,7 +124,7 @@
"source": [
"\n",
"\n",
"## Fourier Transform\n",
"## 1. Level 1-Fourier Transforms\n",
"We use the Scipy Fourier [package](!https://docs.scipy.org/doc/scipy/reference/generated/scipy.fftpack.rfft.html#scipy.fftpack.rfft) to transform the two time series (earthquake and noise).\n",
"\n",
"The Fourier transform is a decomposition of the time series onto an orthonormal basis of cosine and sine functions. The Fourier transform of a time series $f(t)$ (but similarly if the variable is space $x$).\n",
Expand Down Expand Up @@ -393,7 +399,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Filtering in the Fourier space\n",
"### 1.3 Filtering in the Fourier space\n",
"\n",
"The data may superimpose multiple signals of various frequencies. To remove or extract specific signals that do not overlap in frequencies, we can *filter* the data. \n",
"\n",
Expand Down Expand Up @@ -583,7 +589,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Synthetic Noise\n",
"## Level 2-Fourier Transforms: Synthetic Noise\n",
"Now we could add more noise to the earthquake time series. There are several strategies:\n",
"\n",
"* From time domain, use the ``np.rand[n]`` functions to create a random times series\n",
Expand All @@ -594,7 +600,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Use random functions\n",
"### 2.1 Random noise\n",
"\n",
"Below, use the random function to create a synthetic noise. \n",
"1. Create an array of random numbers between -1 and 1 of length the same length as the data Z.\n",
Expand Down Expand Up @@ -772,7 +778,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2D Fourier Transforms\n",
"### Level3: 2D Fourier Transforms\n",
"\n",
"The 2D Fourier transform is applied on a 2D matrix. It first applies a 1D Fourier transform to every row of the matrix, then applies a 1D Fourier transform to every column of the intermediate matrix.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 67afcbf

Please sign in to comment.