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!
==sfwindow== {| class="wikitable" align="center" cellspacing="0" border="1" ! colspan="4" style="background:#ffdead;" | Window a portion of a dataset. |- ! colspan="4" | sfwindow < in.rsf > out.rsf verb=n squeeze=y j#=(1,...) d#=(d1,d2,...) f#=(0,...) min#=(o1,o2,,...) n#=(0,...) max#=(o1+(n1-1)*d1,o2+(n1-1)*d2,,...) |- | colspan="4" | <br>Other parameters from the command line are passed to the output (similar to sfput). |- | ''float '' || '''d#=(d1,d2,...)''' || || sampling in #-th dimension |- | ''largeint'' || '''f#=(0,...)''' || || window start in #-th dimension |- | ''int '' || '''j#=(1,...)''' || || jump in #-th dimension |- | ''float '' || '''max#=(o1+(n1-1)*d1,o2+(n1-1)*d2,,...)''' || || maximum in #-th dimension |- | ''float '' || '''min#=(o1,o2,,...)''' || || minimum in #-th dimension |- | ''largeint'' || '''n#=(0,...)''' || || window size in #-th dimension |- | ''bool '' || '''squeeze=y''' || [y/n] || if y, squeeze dimensions equal to 1 to the end |- | ''bool '' || '''verb=n''' || [y/n] || Verbosity flag |} <b>sfwindow</b> is used to window a portion of the dataset. Here is a quick example: Start by creating some data. <pre> bash$ sfmath n1=5 n2=3 o1=1 o2=1 output="x1*x2" > test.rsf bash$ < test.rsf sfdisfil 0: 1 2 3 4 5 5: 2 4 6 8 10 10: 3 6 9 12 15 </pre> Now window the first two rows: <pre> bash$ < test.rsf sfwindow n2=2 | sfdisfil 0: 1 2 3 4 5 5: 2 4 6 8 10 </pre> Window the first three columns: <pre> bash$ < test.rsf sfwindow n1=3 | sfdisfil 0: 1 2 3 2 4 5: 6 3 6 9 </pre> Window the middle row: <pre> bash$ < test.rsf sfwindow f2=1 n2=1 | sfdisfil 0: 2 4 6 8 10 </pre> You can interpret the <b>f#</b> and <b>n#</b> parameters as meaning "skip that many rows/columns" and "select that many rows/columns" correspondingly. Window the middle point in the dataset: <pre> bash$ < test.rsf sfwindow f1=2 n1=1 f2=1 n2=1 | sfdisfil 0: 6 </pre> Window every other column: <pre> bash$ < test.rsf sfwindow j1=2 | sfdisfil 0: 1 3 5 2 6 5: 10 3 9 15 </pre> Window every third column: <pre> bash$ < test.rsf sfwindow j1=3 | sfdisfil 0: 1 4 2 8 3 5: 12 </pre> Alternatively, <b>sfwindow</b> can select a window from the minimum and maximum parameters. In the following example, we are creating a dataset with <b>sfspike</b> and then windowing a portion of it between 1 and 2 seconds in time and sampled at 8 miliseconds. <pre> bash$ sfspike n1=1000 n2=10 > spike.rsf bash$ sfin spike.rsf spike.rsf: in="/var/tmp/spike.rsf@" esize=4 type=float form=native n1=1000 d1=0.004 o1=0 label1="Time" unit1="s" n2=10 d2=0.1 o2=0 label2="Distance" unit2="km" 10000 elements 40000 bytes bash$ < spike.rsf sfwindow min1=1 max1=2 d1=0.008 > window.rsf bash$ sfin window.rsf window.rsf: in="/var/tmp/window.rsf@" esize=4 type=float form=native n1=126 d1=0.008 o1=1 label1="Time" unit1="s" n2=10 d2=0.1 o2=0 label2="Distance" unit2="km" 1260 elements 5040 bytes </pre> By default, <b>sfwindow</b> "squeezes" the hypercube dimensions that are equal to one toward the end of the dataset. Here is an example of taking a time slice: <pre> bash$ < spike.rsf sfwindow n1=1 min1=1 > slice.rsf bash$ sfin slice.rsf slice.rsf: in="/var/tmp/slice.rsf@" esize=4 type=float form=native n1=10 d1=0.1 o1=0 label1="Distance" unit1="km" n2=1 d2=0.004 o2=1 label2="Time" unit2="s" 10 elements 40 bytes </pre> You can change this behavior by specifying <b>squeeze=n</b>. <pre> bash$ < spike.rsf sfwindow n1=1 min1=1 squeeze=n > slice.rsf bash$ sfin slice.rsf slice.rsf: in="/var/tmp/slice.rsf@" esize=4 type=float form=native n1=1 d1=0.004 o1=1 label1="Time" unit1="s" n2=10 d2=0.1 o2=0 label2="Distance" unit2="km" 10 elements 40 bytes </pre>
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