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!
=user/ivlad programs= ==sfprep4plot== {| class="wikitable" align="center" cellspacing="0" border="1" ! colspan="4" style="background:#ffdead;" | Resamples a 2-D dataset to the desired picture resolution, with antialias |- ! colspan="4" | sfprep4plot inp= out= verb=n h=none w=none unit= ppi= prar=y |- | colspan="4" | Only one of the h and w parameters needs to be specified.<br>If prar=n, no action will be taken on axis for which h/w was not specified<br>If prar=y and only one par (h or w) is specified, the picture will scale<br>along both axes until it is of the specified dimension. |- | ''int '' || '''h=none''' || || output height |- | ''string '' || '''inp=''' || || input file |- | ''string '' || '''out=''' || || output file |- | ''int '' || '''ppi=''' || || output resolution (px/in). Necessary when unit!=px |- | ''bool '' || '''prar=y''' || [y/n] || if y, PReserve Aspect Ratio of input |- | ''string '' || '''unit=''' || || unit of h and w. Can be: px(default), mm, cm, in |- | ''bool '' || '''verb=n''' || [y/n] || if y, print system commands, outputs |- | ''int '' || '''w=none''' || || output width |} For a figure that does not need the aspect ratio preserved, and needs to fill a 1280x1024 projector display: <pre> sfprep4plot inp=file1.rsf out=file2.rsf w=1280 h=1024 prar=n </pre> For a print figure that has to fit in a 6x8in box at a resolution of 250 dpi, preserving the aspect ratio: <pre> sfprep4plot inp=file1.rsf out=file2.rsf w=6 h=8 unit=in ppi=250 </pre> A comparison of images before and after the application of <tt>sfprep4plot</tt>, courtesy of Joachim Mispel, is shown below: [[Image:sf_prep4plot.jpg]] ==sfcsv2rsf== {| class="wikitable" align="center" cellspacing="0" border="1" ! colspan="4" style="background:#ffdead;" | Convert a delimited-text ASCII file to RSF binary floating point or int. |- ! colspan="4" | sfcsv2rsf help=n delimiter=, dtype=float verb=n debug=n trunc=n o1=0. o2=0. d1=1. d2=1. unit1=unknown unit2=unknown label1=unknown label2=unknown |- | colspan="4" | Zeros will be added if number of elements is not the same in each row.<br>n1 and n2 are computed automatically. For consistency with sfdisfil and <br>sfmatmult, output is C-style order (row-first), i.e. rows in input file <br>become dimension-1 columns in output. Output encoding is native. |- | ''float '' || '''d1=1.''' || || |- | ''float '' || '''d2=1.''' || || |- | ''bool '' || '''debug=n''' || [y/n] || Extra verbosity for debugging |- | ''string '' || '''delimiter=,''' || || Separator between values in input file |- | ''string '' || '''dtype=float''' || || Input type |- | ''bool '' || '''help=n''' || [y/n] || |- | ''string '' || '''label1=unknown''' || || |- | ''string '' || '''label2=unknown''' || || |- | ''float '' || '''o1=0.''' || || |- | ''float '' || '''o2=0.''' || || |- | ''bool '' || '''trunc=n''' || [y/n] || Truncate or add zeros if nr elems in rows differs |- | ''string '' || '''unit1=unknown''' || || |- | ''string '' || '''unit2=unknown''' || || |- | ''bool '' || '''verb=n''' || [y/n] || Whether to echo n1, n2, infill/truncation |} A small usage example follow below. First, create an input file: <syntaxhighlight lang="bash"> $ echo -e '5,6,8,9.2\n11,124,5,0,1' | tee file.csv 5,6,8,9.2 11,124,5,0,1 </syntaxhighlight> You may notice that the number of values in each row is different. Run <tt>sfcsv2rsf</tt>. Notice that no options are needed. By default, zeros will be appended to make the rows equal length: <syntaxhighlight lang="bash"> $ <file.csv sfcsv2rsf > junk.rsf ; sfdisfil < junk.rsf 0: 5 6 8 9.2 0 5: 11 124 5 0 1 </syntaxhighlight> Notice that sfdisfil displays in column order (i.e. matrix is transposed if the number of rows is right). The dimensions of the file are actually transposed on disk: <syntaxhighlight lang="bash"> $ sfin junk.rsf junk.rsf: in="/data/path/junk.rsf@" esize=4 type=float form=native n1=5 d1=1 o1=0 unit1="unknown" n2=2 d2=1 o2=0 unit2="unknown" 10 elements 40 bytes </syntaxhighlight> You may want to run the output through <tt>sftransp</tt>, depending on your needs. However, if creating an input for <tt>sfmatmult</tt>, this will not be necessary, because <tt>sfmatmult</tt> is made to work with matrices that are displayed with <tt>sfdisfil</tt>, and takes as input a transpose matrix. Pipes can be used, of course, to skip the creation of intermediary files: <syntaxhighlight lang="bash"> $ <file.csv sfcsv2rsf | sfdisfil 0: 5 6 8 9.2 0 5: 11 124 5 0 1 </syntaxhighlight> Note that since this program does not need any arguments (just stdin and stdout), when called with no arguments it will not display the man page. In order to consult the automatically generated documentation, you need to pass the option <tt>help=y</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