Editing
Library Reference
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!
[[Image:Fotolia_2848987_XS.jpg|right|]] If you are programming with Madagascar, please use the utilities described below instead of creating your own equivalents. The RSF library is written in C, and all facilities offered by it are available directly to the C API via inclusion of header files and linking with the library. Other APIs only have access to a limited set of functions from the library. The ultimate guide to what the libraries provide is the file <tt>RSFSRC/filt/lib/SConstruct</tt>, which contains the instructions for building the RSF library in C and the interfaces to it for the various APIs. =C API= ==Macros== The following useful macros are accessible through the C and C++ APIs: {|class="wikitable" |- ! colspan="3" style="background:#ffdead;"|Functions |- | '''Name''' || '''Value''' || '''Meaning''' |- | SF_ABS(a) || (a) >= 0 ? (a) : (-(a)) || Absolute value |- | SF_MAX(a,b) || (a) < (b) ? (b) : (a) || Maximum of two values |- | SF_MIN(a,b) || (a) < (b) ? (a) : (b) || Minimum of two values |- | SF_SIG(a) || (a) >= 0 ? 1 : -1 || Sign function |} {|class="wikitable" |- ! colspan="3" style="background:#ffdead;"|General constants |- | '''Name''' || '''Value''' || '''Meaning''' |- | SF_EOL || '\014' || End-of-line ASCII character |- | SF_EOT || '\004' || End-of-transmission ASCII character |- | SF_EPS || FLT_EPSILON || The smallest X of type float such that 1.0 + X != 1.0. From <tt>float.h</tt> |- | SF_HUGE || FLT_MAX || The largest finite representable value of type float. From <tt>float.h</tt> |- | SF_MAX_DIM || 9 || Maximum number of dimensions in a RSF file |- | SF_PI || 3.141592653589793 || The number pi |} {|class="wikitable" |- ! colspan="3" style="background:#ffdead;"|SEG-Y-related constants |- | '''Name''' || '''Value''' || '''Meaning''' |- | SF_SEGY_FORMAT || 24 || Byte position in SEG-Y binary reel header, where info on encoding of data samples is kept ([[Guide_to_madagascar_programs#SEG-Y_specific_parameters|format parameter in sfsegyread]]) |- | SF_SEGY_NS || 20 || Byte position in SEG-Y binary reel header, where info on nr of samples in one trace is kept ([[Guide_to_madagascar_programs#Common_parameters|ns parameter in sfsegyread]]) |- | SF_SEGY_DT || 16 || Byte position in SEG-Y binary reel header, where info on time sampling is kept |- | SF_EBCBYTES || 3200 || Bytes in the SEG-Y EBCDIC reel header |- | SF_BNYBYTES || 400 || Bytes in the SEG-Y binary reel header |- | SF_HDRBYTES || 240 || Bytes in each individual SEG-Y trace header |- | SF_NKEYS || 71 || Number of mandated header fields |- | SF_BHKEYS || 27 || Number of mandated binary fields |} These macros were found with: <bash>grep '# define SF_' $RSFROOT/include/rsf.h</bash> ==Data types== See the [http://m8r.info/RSF/book/rsf/manual/manual_html/node8.html Data Types section of the Programming Reference Manual] ==Functions== See the [http://www.reproducibility.org/RSF/book/rsf/manual/manual_html/ Programming Reference Manual]. ==Function wrappers== These programs make the respective function callable from the command line, so that it can be used directly with files/other programs through "metaprograms" (shell/Python scripts). This allows the user to get the best of all worlds -- fast development in Python, all of Madagascar's visualization tools for debugging, and the speed of code written in C. This allows fast prototyping, followed by writing a production version in C calling the functions used. {| class="wikitable" align="center" cellspacing="0" border="1" !Library function || Program |- | sf_filedims || [http://reproducibility.org/RSF/sffiledims.html filedims] |- | sf_leftsize || [http://reproducibility.org/RSF/sfleftsize.html leftsize] |- | sf_quantile || [http://reproducibility.org/RSF/sfquantile.html quantile] |} =C++ API= ==Macros== Same as for the C API. =Fortran 77 API= =Fortran 90 API= The interface is accessed by including a <tt>use rsf</tt> statement in your program. The source code for the <tt>rsf</tt> module can be viewed [http://rsf.svn.sourceforge.net/viewvc/rsf/trunk/api/f90/rsf.f90?view=markup in the repository]. A ('''G''') means that the entity was featured in the [[Guide_to_madagascar_API#Fortran-90_interface|Guide to API]]. ==Constants== For use with <tt>gettype</tt> and <tt>settype</tt>: * <tt>sf_char</tt>=1 * <tt>sf_complex</tt>=4 * <tt>sf_float</tt>=3 ('''G''') * <tt>sf_int</tt>=2 * <tt>sf_short</tt>=5 * <tt>sf_uchar</tt>=0 For use with <tt>sf_seek</tt>: * <tt>sf_seek_set</tt>=0 * <tt>sf_seek_cur</tt>=1 * <tt>sf_seek_end</tt>=2 ==Data types== All procedures in Madagascar's F90 API act upon or take as input one of the following data types: * <tt>axa</tt>: Holds some info about a hypercube axis (integer::n; real::o,d) * <tt>file</tt>: Simply an interface to the <tt>sf_file</tt> type described in the C library. ==Functions== Data types are indicated in ''italics'' and intent in '''''bold italics'''''. In the '''Wrapper for''' column, procedure names with no other description belong to the C library. The '''G?''' heading means "Demo-ed in the [[Guide_to_madagascar_API#Fortran-90_interface|Guide to the F90 API]]?". {|class="wikitable" align="center" cellspacing="0" border="1" |- | '''Name''' || '''Arguments''' || '''Result''' || '''What it does''' || '''Wrapper for''' || '''G?''' |- | <tt>axisname</tt> || ''integer'' '''''in''''' <tt>i</tt>, optional ''character'' '''''in''''' <tt>mystring</tt> || ''character'' <tt>mystringi</tt> || Given a string <tt>mystring</tt> and a positive number <tt>i</tt>, this function will return the concatenation of the string and the number converted to string (<tt>mystringi</tt>). In practice, <tt>mystring</tt> will probably be "n", "o", "d", "label" or "unit", in preparation for writing to a header file. Default value for <tt>mystring</tt> is "n". || Verbose string operations in F90 || N |- | <tt>dimension</tt> || ''file'' '''''in''''' <tt>tag</tt>, ''integer'' '''''out''''' <tt>dims</tt> || ''integer'' <tt>n</tt> || Returns number of dimensions of already-open file handle <tt>tag</tt> in <tt>n</tt>, and the dimension values in <tt>dims</tt> || <tt>sf_filedims</tt> || N |- | <tt>filesize</tt> || ''file'' '''''in''''' <tt>tag</tt>, optional ''integer'' '''''in''''' <tt>n</tt> || ''integer'' nr_elements || Computes number of <tt>n</tt>-dimensional subcubes in file hypercube. When <tt>n</tt> is absent, default is zero and the number of elements in file. || <tt>sf_filesize</tt>, <tt>sf_leftsize</tt>. || Y |- | <tt>gettype</tt> || ''file'' '''''in''''' <tt>tag</tt> || ''integer'' <tt>type</tt> || Reads the binary data type from the already-open file handle <tt>tag</tt>. The <tt>type</tt> constant should be then compared in the user-written code with one of the six type constants provided by the F90 interface || <tt>sf_gettype</tt> || Y |- | <tt>rsf_input</tt> || optional ''character'' '''''in''''' <tt>filename</tt> || ''file'' <tt>tag</tt> || Opens <tt>filename</tt> for reading and returns file handle <tt>tag</tt>. The default is <tt>filename</tt>="in", which corresponds to the standard input stream || <tt>sf_input</tt> || Y |- | <tt>rsf_output</tt> || optional ''character'' '''''in''''' <tt>filename</tt> || ''file'' <tt>tag</tt> || Opens <tt>filename</tt> for writing and returns file handle <tt>tag</tt>. The default is <tt>filename</tt>="out", which corresponds to the standard output stream || <tt>sf_input</tt> || Y |} ==Subroutines== Because subroutine names are preceded by a <tt>call</tt> statement, it is easy to find occurrences of them being used by typing: <bash>grep "call subroutine_name" {filt,user}/*/*.f90 user/*/*/*.f90</bash> in RSFSRC. Below, data types are indicated in ''italics'' and intent in '''''bold italics'''''. The type <i>multi</i> means that multiple data types can be used (subroutine is overloaded). In the '''Wrapper for''' column, procedure names with no other description belong to the C library. The '''G?''' heading means "Demo-ed in the [[Guide_to_madagascar_API#Fortran-90_interface|Guide to the F90 API]]?". {|class="wikitable" align="center" cellspacing="0" border="1" |- | '''Name''' || '''Arguments''' || '''What it does''' || '''Wrapper for''' || '''G?''' |- | <tt>from_either</tt> || ''file'' '''''in''''' <tt>tag</tt>, ''character'' '''''in''''' <tt>name</tt>, ''multi'' '''''out''''' <tt>value</tt>, optional ''multi'' '''''in''''' <tt>default</tt> || This subroutine looks for the real or integer variable <tt>name</tt> first in the history file, then in the parameter table. If it it is not found and <tt>default</tt> is present, it assigns it to <tt>value</tt>, otherwise it terminates the program. || <tt>sf_histint</tt>, <tt>sf_getint</tt> || N |- | <tt>from_par</tt> || optional ''file'' '''''in''''' <tt>tag</tt>, ''character'' '''''in''''' <tt>name</tt>, ''multi'' '''''out''''' <tt>value</tt>, optional ''multi'' '''''in''''' <tt>default</tt> || If already-opened file handle <tt>tag</tt> is supplied, then it reads into <tt>value</tt> a parameter designated by <tt>name</tt> from a history file. Else, it reads it from the parameter table. If the parameter is not found and a <tt>default</tt> is present, then that is used, else ends with failure. It can read from both history files and parameter tables the following types: integer, integer array, real. Strings can be read only from the history file, and not from the parameter table. Real arrays, logicals and logical arrays can be read only from the parameter table. || <tt>sf_histint</tt>, <tt>sf_getint</tt>, <tt>sf_histints</tt>, <tt>sf_getints</tt>, <tt>sf_histfloat</tt>, <tt>sf_getfloat</tt>, <tt>sf_histstring</tt>, <tt>sf_getfloats</tt>, <tt>sf_getbool</tt>, <tt>sf_getbools</tt> || Y |- | <tt>iaxa</tt> || ''file'' '''''in''''' <tt>tag</tt>, ''axa'' '''''out''''' <tt>axisname</tt>, ''integer'' '''''in''''' <tt>axisnr</tt> || Read axis with number <tt>axisnr</tt> as axis <tt>axisname</tt> from the already-open file header indicated by <tt>tag</tt> || Multiple calls to F90 API's <tt>from_par</tt> || N |- | <tt>oaxa</tt> || ''file'' '''''in''''' <tt>tag,</tt> ''axa'' '''''in''''' <tt>axisname,</tt> ''integer'' '''''in''''' <tt>axisnr</tt> || Write axis <tt>axisname</tt> (i.e. its n, o, d) as axis with number <tt>axisnr</tt> to the already-open file header indicated by <tt>tag</tt> || Multiple calls to F90 API's <tt>from_par</tt> || N |- | <tt>raxa</tt> || ''axa'' '''''in''''' <tt>axisname</tt> || unformatted write to I/O unit nr. 0 (usually stdout, but system-dependent) of the contents of the <tt>axisname</tt> structure (n, o, d) || F90 write statement || N |- | <tt>rsf_read</tt> || ''file'' '''''in''''' <tt>tag</tt>, ''multi'' '''''out''''' <tt>array</tt>, optional ''integer'' '''''in''''' <tt>n</tt> || If <tt>n</tt> is specified, the real or complex <tt>array</tt> must be 1-D and <tt>n</tt> elements will be read into it from an already-opened file specified by <tt>tag</tt>. If <tt>n</tt> is not specified, reads enough to fill the array, and the array can be 1-D, 2-D, 3-D, 4-D or 5-D. || <tt>sf_floatread</tt>, <tt>sf_complexread</tt> || Y |- | <tt>rsf_write</tt> || ''file'' '''''in''''' <tt>tag</tt>, ''multi'' '''''in''''' <tt>array</tt>, optional ''integer'' '''''in''''' <tt>n</tt> || If <tt>n</tt> is specified, real or complex <tt>array</tt> must be 1-D and <tt>n</tt> elements will be written to an already-opened file specified by <tt>tag</tt>. If <tt>n</tt> is not specified, writes to file the entire contents of the array, and the array can be 1-D, 2-D, 3-D, 4-D or 5-D || <tt>sf_floatwrite</tt>, <tt>sf_complexwrite</tt> || Y |- | <tt>settype</tt> || ''file'' '''''in''''' <tt>tag</tt>, ''integer'' '''''in''''' <tt>file_type</tt> || Write a type for the binary data to the already-open file header indicated by <tt>tag</tt>. Data type constants are also provided by the F90 API. || <tt>sf_settype</tt> || N |- | <tt>to_par</tt> || ''file'' '''''in''''' <tt>tag</tt>, ''character'' '''''in''''' <tt>name</tt>, ''multi'' '''''in''''' <tt>value</tt> || Writes <tt>name=value</tt> to already-opened file specified by <tt>tag</tt>. Value can be integer, integer array, real or character. || <tt>sf_putint</tt>, <tt>sf_putints</tt>, <tt>sf_putfloat</tt>, <tt>sf_putstring</tt> || N |} ==Functions from the C library== Functions from the C library for which an interface has been defined at the end of <tt>RSFSRC/api/f90/fortran.c</tt> can be called directly from Madagascar F90 programs. The programmer must know, however, that '''an argument type mismatch will result in a silent failure, with no informative errors.''' There may be other sources of problems as well. Caution therefore must be advised when calling these functions. The reason for these issues is that [http://people.scs.fsu.edu/~burkardt/f_src/mixed/mixed.html if a FORTRAN90 routine needs to pass a scalar parameter to a C routine, there is no standard way to ensure that a value is passed rather than an address]. The success rate of calling C from Fortran [http://w3.pppl.gov/~dmccune/papers-reports/linux_f90.txt is compiler-dependent] and [http://www.cs.sandia.gov/Zoltan/ug_html/ug_fortran.html special types may have to be defined for portability]. If you do have to call a C function from F90, follow the examples of the functions below. Use the C library reference to find argument and output types. A C-to-F90 data type dictionary follows: {| class="wikitable" align="center" cellspacing="0" border="1" ! style="background:#ffdead;" | C ||! style="background:#ffdead;" | F90 |- | RSFFILE || type(file) |- | INT || integer |- | OFFSETT || integer(kind=OFFKIND) |} ===Void-output functions callable as subroutines=== These can be treated as subroutines, and accessed with a <tt>call</tt> statement. Follow * <tt>sf_error</tt> ('''G''') * <tt>sf_init</tt> ('''G''') ('''''Can it also be called in subroutines if we want to isolate I/O operations there?''''') * <tt>sf_seek</tt> ===Non-void-output functions=== It is a good idea to declare in your program the function output type and use the keyword <tt>external</tt>, i.e.: <pre>real, external :: sf_dosomething</pre> Alternately, you may define a F90 <tt>interface</tt> block for the procedure(s). Several examples can be found in <tt>RSFSRC/filt/lib/rsf.f90</tt>, but they are not enumerated here because F90 wrappers exist for them and they should be used instead of the direct calls to the C library functions. =Matlab API= Data types are indicated in ''italics''. In the '''Wrapper for''' column, procedure names with no other description belong to the C library. The '''G?''' heading means: "Demo-ed in the [[Guide_to_madagascar_API#MATLAB_interface|Guide to the Matlab API]]?" {|class="wikitable" align="center" cellspacing="0" border="1" |- | '''Name''' || '''Arguments''' || '''What it does''' || '''Wrapper for''' || '''G?''' |- | <tt>rsf_create</tt> || Arg 1: ''string (row vector)'' <tt>new_file_name</tt>;<br /> Arg 2: ''string (row vector)'' <tt>old_file_name</tt>, or ''double (column vector)'' '''in''' <tt>new_file_cube_dims</tt> || Writes to disk RSF header of native_float hypercube of desired dimensions. Takes as input the name of the new file and either the name of another file with a cube of the same size, or a column with cube dimensions || <tt>sf_fileflush</tt>, or <tt>sf_putint</tt> and <tt>sf_setformat</tt> || Y |- | <tt>rsf_dim</tt> || Arg1: ''string (row vector)'' <tt>filename</tt> || Returns a 9-element vector [n1, n2, ... n9] with the dimensions of the hypercube as described in the RSF header '''filename'''. Missing dimensions are given the value 1 || <tt>sf_filedims</tt> || Y |- | <tt>rsf_par</tt> || Arg 1: ''string (row vector)'' <tt>filename</tt>;<br /> Arg 2: ''string (row vector)'' <tt>par_name</tt>;<br /> Arg 3: ''string (row vector)'' <tt>par_type</tt>: i[nt], l[ogical], f[loat];<br /> Arg 4: ''double (scalar)'' <tt>default_val</tt> || Returns a scalar parameter read from a RSF header || <tt>sf_histint</tt>, <tt>sf_histbool</tt>, <tt>sf_histfloat</tt> || N |- | <tt>rsf_read</tt> || Arg 1: ''double'' <tt>data_array</tt>;<br /> Arg 2: ''string (row vector)'' <tt>filename</tt>;<br /> Arg 3 (optional): ''string (row vector)'' <tt>same</tt>. If Arg 3 is given, value should be "same" || Reads <tt>data_array</tt> from <tt>filename</tt>. Input data should be of SF_FLOAT, SF_INT or SF_COMPLEX type. The <tt>same</tt> parameter is a way to indicate if the data is read from the same file as before or from a newly opened file. If <tt>same</tt> is not given, the data will be read from the beginning of the file. || <tt>sf_floatread</tt>, <tt>sf_intread</tt>, <tt>sf_complexread</tt> || Y |- | <tt>rsf_write</tt> || Arg 1: ''double'' <tt>data_array</tt>;<br /> Arg 2: ''string (row vector)'' <tt>filename</tt>;<br /> Arg 3 (optional): ''string (row vector)'' <tt>same</tt>. If Arg 3 is given, value should be "same" || Writes <tt>data_array</tt> to <tt>filename</tt>. Data to be written can be integer, float, double or complex. It will get cast to RSF's native_float or native_complex encoding. || <tt>sf_floatwrite</tt>, <tt>sf_complexwrite</tt> || Y |} =Octave API= =Java API= ''There are two APIs available for Java. New programs should be written to use the SWIG API. The Mines JTK API is provided here only for reference for those who may still be using it.'' == SWIG API == The SWIG API includes three classes. The methods that each class exposes are as follows: === RSF === <java> public RSF(String[] args); // Constructor, pass the command line arguments public float getFloat(String key, float default); // Gets the command line argument associated with this key. public int getInt(String key, int default); // Gets an int from the command line associated with this key. public boolean getBool(String key, boolean default); // Gets a boolean from the command line associated with this key. public String getString(String key, String default); // Gets a string corresponding to this key. </java> === Input === <java> public Input(String name); // Constructor, pass a filename. "in" defaults to stdin public int getN(int index); // Gets the number of elements in the file for that index. Counting starts at 1. Returns 1 if not found. public float getDelta(int index); // Gets the delta for that index. Returns 0.0 if not found. public float getOrigin(int index); // Gets the origin for that file. Returns 0.0 if not found. public String getLabel(int index); // Gets the label name for the index. Returns "" if not found. public String getUnit(int index); // Gets the unit for the index. Returns "" if not found. public void close(); // Close the file. public void read(float[] array); // Read data from the open RSF file into the given array. Reads the length of the array only. public void read(float[][] array); // The following methods all read data from the RSF file in the given shape of the array. public void read(float[][][] array); public void read(float[][][][] array); public void read(float[][][][][] array); public void read(float[][][][][][] array); public void read(float[][][][][][][] array); public void read(float[][][][][][][][] array); public void read(float[][][][][][][][][] array); </java> === Output === <java> public Output(String name); // Constructor, pass a filename. "out" points to standard out. public void setN(int index, int n); // Gets the number of elements in the file for that index. Counting starts at 1. Returns 1 if not found. public void setDelta(int index, float delta); // Gets the delta for that index. Returns 0.0 if not found. public void setOrigin(int index, float origin); // Gets the origin for that file. Returns 0.0 if not found. public void setLabel(int index, String label); // Gets the label name for the index. Returns "" if not found. public void setUnit(int index, String unit); // Gets the unit for the index. Returns "" if not found. public void close(); // Close the file. public void write(float[] array); // Writes data to the RSF file from the given array. Writes the shape of the array only. public void write(float[][] array); // The following methods all write data using the given shape of the array. public void write(float[][][] array); public void write(float[][][][] array); public void write(float[][][][][] array); public void write(float[][][][][][] array); public void write(float[][][][][][][] array); public void write(float[][][][][][][][] array); public void write(float[][][][][][][][][] array); </java> Additional notes: Java does not support complex numbers by default. To use complex numbers, you must convert complex valued RSF files to floating point numbers using sfdd . == MINES JTK API == ''' THIS API IS DEPRECATED. PLEASE DEVELOP YOUR PROGRAMS TO BE COMPATIBLE WITH THE SWIG API.''' The following methods are exposed directly at this time: ==Par Class== <java> public float getFloat(String key, float default); // Gets the command line argument associated with this key. public int getInt(String key, int default); // Gets an int from the command line associated with this key. public boolean getBool(String key, boolean default); // Gets a boolean from the command line associated with this key. public String getString(String key, String default); // Gets a string corresponding to this key. </java> ==Header Class== <java> public void setN(int dim, int n); // Used to set the number of elements in a dimension. For dimension 1, use an index value of 1. public int getN(int dim); public void setDelta(int dim, float delta); // Used to set the delta for a dimension. For dimension 1, use an index value of 1, not 0. public float getDelta(int dim); public void setOrigin(int dim, float origin); // Used to set the origin for a dimension. public float getOrigin(int dim); public void setLabel(int dim, String label); // Sets the label for a dimension. public String getLabel(int dim); public void setUnit(int dim, String unit); // Sets the unit for a dimension. public String getUnit(int dim); public void setFormat(String format); // Sets the output format information, has no effect on how Java treats the data. public String getFormat(); public void setPath(String path); /* Sets the location of the binary file that corresponds to this header file. Not used for writing information to an RSF file. */ public String getPath(); public void setName(String name); /* Change the file name that this header corresponds to. When writing this info to an RSF file, the API automatically will determine the binary file that goes along with this filename. */ public String getName(); public String toString(); // Can be used to print out information about the header file. </java> ==Writer Class== When writing out RSF files, the header file is output in the same directory as the java program was executed. The binary file is placed according to the DATAPATH environment variable. <tt>saveName</tt> is the filename that you want to save your header to. Writing to standard out is not supported. All files must be saved via a name. <java> public static void writeRSF(RSFHeader header, float[] data, String saveName); // Writes a 1D array to an RSF Header and binary file public static void writeRSF(RSFHeader header, float[][] data, String saveName); // Writes a 2D array to an RSF header and binary file. public static void writeRSF(RSFHeader header, float[][][] data, String saveName); // Writes a 3D array to an RSF header and binary file. </java> ==Reader Class== <java> public static Header readHeader(String headerFileName); // Used to parse the RSF Header file for information. public static float[] readBinary(RSFHeader header); // Reads the RSF binary data file into a single array. public static float[][] readBinary2D(RSFHeader header); // Reads the RSF binary data file into a 2D array. public static float[][][] readBinary3D(RSFHeader header); // Reads the RSF binary data file into a 3D array. </java> =Python API= To use the python api, you need to import the rsf package via: <tt>import rsf.api</tt> . '''NOTE: Madagascar now has automatic documentation, currently with Epydoc, and more to come. The information in the table below will be merged into it.''' The rsf package has the following members: {| border="1" |+ Overview of the Python RSF API ! Class !! Use !! Constructor !! Example !! Available Methods |- |File |- |Filter |- |Movie |- |Input || Provides a basic way to read rsf files. || file = rsf.Input(name) || input = rsf.Input(''name''); n1 = input.int('n1') || read(data), data is a numpy array to be read into. |- | || || || || close() |- | || || || || float(key, default=None), key is a string to be extracted, e.g. 'n1'. |- | || || || || int(key, default=None), key is a string to be extracted. |- | || || || || ints(key, num, default=None), key is a string, num is the number of ints. |- | || || || || put(key, val), key is a string to set the value for, val is a numerical value (int or float). |- | || || || || ... and more, type help(rsf.Input) on a python interactive session for more information. |- |Output || Provides a way to output numpy arrays to rsf files. || file = rsf.Output(name) || output=rsf.Output(name); output.write(data) |- |OverUnder |- |Overlay |- |Par || Provides a method for accessing rsf parameters passed from the command line. || par = rsf.Par() || par = rsf.Par(); velname = par.string('vel') |- |SideBySide |- |Temp |- |Vplot || View vplot graphics files from within python. || plot = rsf.Vplot(name) || plot = rsf.Vplot(name); plot.show() |- |Vppen |} =Calling standalone madagascar programs from Python= On systems with recent versions of Python (at least 2.4), and with Numpy and Swig installed, use [http://www.reproducibility.org/rsflog/index.php?/archives/264-Running-Madagascar-in-an-interactive-console.html the m8r module]. On old systems where dependencies cannot be easily installed (i.e. industrial clusters), use the <tt>sf</tt> module (i.e. <tt>import rsf.user.sf as sf</tt>). =SCons custom methods= ==Custom builders== {|class="wikitable" align="center" cellspacing="0" border="1" |- | '''Name''' || '''File implemented in''' || '''Function''' || '''What it does''' |- | <tt>RSF_Include</tt> || RSFSRC/framework/bldutil.py || Header || |- | <tt>RSF_Place</tt> || RSFSRC/framework/bldutil.py || Place || |- | <tt>RSF_Pycompile</tt> || RSFSRC/framework/bldutil.py ||Pycompile || |- | <tt>RSF_Docmerge</tt> || RSFSRC/framework/bldutil.py || Docmerge || |} Other entities can be found in RSFSRC/framework/rsf/proj.py and tex.py
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