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!
==sfin== {| class="wikitable" align="center" cellspacing="0" border="1" ! colspan="4" style="background:#ffdead;" | Display basic information about RSF files. |- ! colspan="4" | sfin info=y check=2. trail=y [<file0.rsf] file1.rsf file2.rsf ... |- | colspan="4" | n1,n2,... are data dimensions<br>o1,o2,... are axis origins<br>d1,d2,... are axis sampling intervals<br>label1,label2,... are axis labels<br>unit1,unit2,... are axis units |- | ''float '' || '''check=2.''' || || Portion of the data (in Mb) to check for zero values. |- | ''bool '' || '''info=y''' || [y/n] || If n, only display the name of the data file. |- | ''bool '' || '''trail=y''' || [y/n] || If n, skip trailing dimensions of one |} <tt>sfin</tt> is one of the most useful programs for operating with RSF files. It produces quick information on the file hypercube dimensions and checks the consistency of the associated data file. Here is an example. Let us create an RSF file and examine it with <tt>sfin</tt>. <pre> bash$ sfspike n1=100 n2=20 > spike.rsf bash$ sfin spike.rsf spike.rsf: in="/tmp/spike.rsf@" esize=4 type=float form=native n1=100 d1=0.004 o1=0 label1="Time" unit1="s" n2=20 d2=0.1 o2=0 label2="Distance" unit2="km" 2000 elements 8000 bytes </pre> <tt>sfin</tt> reports the following information: *location of the data file (<tt>/tmp/spike.rsf\@</tt>) *element size (4 bytes) *element type (floating point) *element form (native) *hypercube dimensions (100 by 20) *axes scale (0.004 and 0.1) *axes origin (0 and 0) *axes labels *axes units *total number of elements *total number of bytes in the data file Suppose that the file got corrupted by a buggy program and reports incorrect dimensions. The <tt>sfin</tt> program should be able to catch the discrepancy. <pre> bash$ echo n2=100 >> spike.rsf bash$ sfin spike.rsf > /dev/null sfin: Actually 8000 bytes, 20% of expected. </pre> <tt>sfin</tt> also checks the first records in the file for zeros. <pre> bash$ sfspike n1=100 n2=100 k2=99 > spike2.rsf bash$ sfin spike2.rsf >/dev/null sfin: The first 32768 bytes are all zeros </pre> The number of bytes to check is adjustable <pre> bash$ sfin spike2.rsf check=0.01 >/dev/null sfin: The first 16384 bytes are all zeros </pre> You can also output only the location of the data file. This is sometimes handy in scripts. <pre> bash$ sfin spike.rsf spike2.rsf info=n /tmp/spike.rsf@ /tmp/spike2.rsf@ </pre> An alternative is to use <tt>sfget</tt>, as follows: <pre> bash$ sfget parform=n in < spike.rsf /tmp/spike.rsf@ </pre> To actually eliminate annoying trailing dimensions of length one (not just stop displaying them with <tt>trail=n</tt>), you may use <tt>sed</tt>. Example for eliminating axis 6: <syntaxhighlight lang="bash"> sed -i 's/n6=1//g' file.rsf </syntaxhighlight>
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