Editing
Revisiting SEP tour with Madagascar and SCons
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Resampling=== The next example demonstrated simple signal processing using the Fast Fourier Transform. We will first subsample the original data and then recover the data using Fourier interpolation. Subsampling is accomplished with <tt>sfwindow</tt>. <syntaxhighlight lang="python"> # decimate time axis by two Flow('subsampled','windowed','window j1=2') </syntaxhighlight> Running <tt>scons -Q subsampled.rsf</tt> produces <pre> < windowed.rsf /path/to/RSF/bin/sfwindow j1=2 > subsampled.rsf </pre> We can verify that the size of the first axis has decreased by running <pre> sfin windowed.rsf subsampled.rsf. </pre> Try also <tt>sfwiggle < subsampled.rsf | sfpen</tt> to quickly inspect the subsampled data on the screen. To interpolate the data back to the original sampling, the following sequence of steps can be applied: #Fourier transform from time domain to frequency domain. #Pad the frequency axis #Inverse Fourier transform from frequency to time. All three steps are conveniently combined into one using pipes. <syntaxhighlight lang="python"> # sinc interpolation in the Fourier domain Flow('resampled','subsampled', 'fft1 | pad n1=102 | fft1 inv=y opt=n | window max1=0.8') </syntaxhighlight> Why do we pad the Fourier domain to 102? The time length of the original data is 201 samples. In the frequency domain, it can be represented with 101 positive frequencies plus the zero frequency, which amounts to 102. Note that the output of <tt>sffft1</tt> does not contain negative frequencies. Finally, we display the result. The reconstructed data is shown in the figure. Comparing this result with the previous plots, we can verify a fairly accurate reconstruction. <syntaxhighlight lang="python"> Result('resampled','wiggle title=Resampled' + plotpar) </syntaxhighlight> [[Image:resampled.png|frame|center|To see this figure on your screen, run <tt>scons resampled.view</tt>]] As an exercise, try subsampling the data by a factor of 4 and see if you can still reconstruct the original data with the Fourier method.
Summary:
Please note that all contributions to Madagascar are considered to be released under the GNU Free Documentation License 1.3 or later (see
My wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Getting Madagascar
download
Installation
GitHub repository
SEGTeX
Introduction
Package overview
Tutorial
Hands-on tour
Reproducible documents
Hall of Fame
User Documentation
List of programs
Common programs
Popular programs
The RSF file format
Reproducibility with SCons
Developer documentation
Adding programs
Contributing programs
API demo: clipping data
API demo: explicit finite differences
Community
Conferences
User mailing list
Developer mailing list
GitHub organization
LinkedIn group
Development blog
Twitter
Slack
Tools
What links here
Related changes
Special pages
Page information