Editing
Guide to madagascar programs
(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!
==sfheaderwindow== {| class="wikitable" align="center" cellspacing="0" border="1" ! colspan="4" style="background:#ffdead;" | Window a dataset based on a header mask. |- ! colspan="4" | sfheaderwindow mask=head.rsf < in.rsf > out.rsf inv=n |- | colspan="4" | <br>The input data is a collection of traces n1xn2,<br>mask is an integer array os size n2, windowed is n1xm2,<br>where m2 is the number of nonzero elements in mask. |- | ''bool '' || '''inv=n''' || [y/n] || inversion flag |- | ''file '' || '''mask=''' || || auxiliary input file name |} <tt>sfheaderwindow</tt> is used to window traces in the input file according to trace header information. Here is an example of using <tt>sfheaderwindow</tt> for randomly selecting part of the traces in the input file. First, let us create an input file with ten traces: <pre> bash$ sfmath n1=5 n2=10 output=x2+1 > input.rsf bash$ < input.rsf sfdisfil 0: 1 1 1 1 1 5: 2 2 2 2 2 10: 3 3 3 3 3 15: 4 4 4 4 4 20: 5 5 5 5 5 25: 6 6 6 6 6 30: 7 7 7 7 7 35: 8 8 8 8 8 40: 9 9 9 9 9 45: 10 10 10 10 10 </pre> Next, we can create a random file with ten header values using <tt>sfnoise</tt>. <pre> bash$ sfspike n1=10 | sfnoise rep=y type=n > random.rsf bash$ < random.rsf sfdisfil 0: -0.005768 0.02258 -0.04331 -0.4129 -0.3909 5: -0.03582 0.4595 -0.3326 0.498 -0.3517 </pre> If you reproduce this example, your numbers will most likely be different, because, in the absence of <tt>seed=</tt> parameter, <tt>sfnoise</tt> uses a random seed value to generate pseudo-random numbers. Finally, we apply <tt>sfheaderwindow</tt> to window the input traces selecting only those for which the header is greater than zero. <pre> bash$ < random.rsf sfmask min=0 > mask.rsf bash$ < mask.rsf sfdisfil 0: 0 1 0 0 0 0 1 0 1 0 bash$ < input.rsf sfheaderwindow mask=mask.rsf > output.rsf bash$ < output.rsf sfdisfil 0: 2 2 2 2 2 5: 7 7 7 7 7 10: 9 9 9 9 9 </pre> In this case, only three traces are selected for the output. Thanks to the separation between headers and data, the operation of <tt>sfheaderwindow</tt> is optimally efficient.
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