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!
==Processing exercises== ===Windowing and plotting=== Our next task is to window and plot a significant portion of the data. Add the following line to the <tt>SConstruct</tt> file: <syntaxhighlight lang="python"> Flow('windowed','Txx.HH','window n2=10 min1=0.4 max1=0.8') </syntaxhighlight> The window command selects the first ten traces and the time window between 0.4 and 0.8 seconds. We will plot the windowed data with three different plotting programs. <syntaxhighlight lang="python"> plotpar = ''' transp=y poly=y yreverse=y pclip=100 nc=100 allpos=n ''' for plot in ('wiggle','contour','grey'): Result(plot,'windowed',plot + plotpar) </syntaxhighlight> For convenience, plotting parameters are put in a string called <tt>plotpar</tt>. A Python string can be enclosed in single, double, or triple quotes. Triple quotes allow the string to span multiple lines. In this case, we use triple quotes for convenience. Next, we loop (using Python's <tt>for</tt> construct) through three different programs (<tt>wiggle</tt>, <tt>contour</tt>, and <tt>grey</tt>). For each program, the command portion of <tt>Result</tt> is formed by concatenating two strings with Python's addition operator. Try running <tt>scons -Q wiggle.view</tt>. You should see something like the following output in your terminal: <pre> bash$ scons -Q wiggle.view < Txx.HH /path/to/RSF/bin/sfwindow n2=10 n1=200 f1=200 > windowed.rsf < windowed.rsf /path/to/RSF/bin/sfwiggle transp=y poly=y yreverse=y pclip=100 nc=200 > Fig/wiggle.vpl /path/to/RSF/bin/sfpen Fig/wiggle.vpl </pre> and a figure similar to Figure~(fig:wiggle) appearing on your screen. The <tt>-Q</tt> switch tells SCons to run in a quiet mode, suppressing verbose comments. We will use it from now on to save space. You can dismiss the figure by using the "q" key on the keyboard or by hitting the "quit" button. Run <tt>scons -Q view</tt>, and you should see simply <pre> bash$ scons -Q view /path/to/RSF/bin/sfpen Fig/wiggle.vpl </pre> Since the <tt>wiggle.vpl</tt> figure is up to date, SCons does not rebuild it. After quitting the figure, SCons will resume processing with <pre> < windowed.rsf /path/to/RSF/bin/sfcontour transp=y poly=y yreverse=y pclip=100 nc=200 > Fig/contour.vpl /path/to/RSF/bin/sfpen Fig/contour.vpl </pre> and a figure appearing on your screen. Quitting the figure, produces <pre> < windowed.rsf /path/to/RSF/bin/sfgrey transp=y poly=y yreverse=y pclip=100 nc=200 > Fig/grey.vpl /path/to/RSF/bin/sfpen Fig/grey.vpl </pre> and the next figure. [[Image:wiggle.png|frame|center|To see this figure on your screen, run <tt>scons~wiggle.view</tt>]] [[Image:contour.png|frame|center|To see this figure on your screen, run <tt>scons~contour.view</tt>]] [[Image:grey.png|frame|center|To see this figure on your screen, run <tt>scons~grey.view</tt>]] ===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. ===Normal Moveout=== The next example applies a simple constant-velocity NMO correction to the windowed data and pipes the result to a wiggle plotting command: <syntaxhighlight lang="python"> Result('nmo','windowed', ''' nmostretch v0=2.05 half=n | wiggle pclip=100 max1=0.6 poly=y ''') </syntaxhighlight> Running <tt>scons -Q nmo.view</tt> produces <pre> < windowed.rsf /path/to/RSF/bin/sfnmostretch v0=2.05 half=n | /path/to/RSF/bin/sfwiggle pclip=100 max1=0.6 poly=y > Fig/nmo.vpl /path/to/RSF/bin/sfpen Fig/nmo.vpl </pre> Note that SCons does not recreate the <tt>windowed.rsf</tt> file if that file is up to date. You can experiment with the NMO velocity (2.05~km/s) or with plotting parameters to get different results. As Dellinger and Tálas (1992<ref>Dellinger, J. and S. Tálas, 1992, A tour of SEPlib for new users, ''in'' SEP-73, 461--502. Stanford Exploration Project.</ref>) point out, the NMO velocity of 2.05~km/s "appears to split the difference between two distinctly non-hyperbolic shear waves". [[Image:nmo.png|frame|center|To see this figure on your screen, run <tt>scons nmo.view</tt>]] ===Advanced plotting=== Sometimes, we need to combine different plots either by overlaying them on top of each other or by putting them side by side. Here is an example of accomplishing it with RSF and SCons. Start by creating common plotting plotting arguments and plotting the data in greyscale. <syntaxhighlight lang="python"> plotpar = plotpar+' min1=.4 max1=.8 max2=1. min2=.05 poly=n' Plot('grey','windowed', 'grey wheretitle=t wherexlabel=b' + plotpar) </syntaxhighlight> Next, plot the wiggle traces twice: the fist time, using thick black lines (<tt>plotcol=0 plotfat=10</tt>), and the second time, using thinner white lines (<tt>plotcol=7 plotfat=5</tt>). <syntaxhighlight lang="python"> Plot('wiggle1','windowed', 'wiggle plotcol=0 plotfat=10' + plotpar) Plot('wiggle2','windowed', 'wiggle plotcol=7 plotfat=3' + plotpar) </syntaxhighlight> The plots are combined by overlaying or by putting them side by side. <syntaxhighlight lang="python"> Result('overplot','grey wiggle1 wiggle2','Overlay') Result('sidebyside','grey wiggle2','SideBySideIso') </syntaxhighlight> The resultant plots are shown in the figures. [[Image:overplot.png|frame|center|To see this figure on your screen, run <tt>scons overplot.view</tt>]] [[Image:sidebyside.png|frame|center|To see this figure on your screen, run <tt>scons sidebyside.view</tt>]]
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