From Madagascar
Revision as of 13:17, 23 June 2009 by Nick (Talk | contribs) (Artwork)

Jump to: navigation, search
Fotolia 9187373 XS.jpg

The Wiki Sandbox contains links to:

  • useful documentation bits from the blog, mailing lists and forums. These bits may coagulate into documentation pages when a critical mass on a topic is attained;
  • pages under construction that may not be ready to go into the navbar (the navbar = the vertical list of links on the left of this page).
  • obsolete pages that have been unlinked from the navbar

The intent is to provide a middle ground between "fragment of useful information stranded in a forum post/in author's head" and "finished page ready for being posted to the world with pride". This sort of information benefits much more from collaborative editing than finished pages that are incrementally improved after creation.

Pages under construction

Info from the blog/mailing lists/forums

Using Madagascar

Configuration, install, testing, etc



  • Madagascar file bundles
  • Byteswapping option for sfdd
  • Google bombing for Madagascar; interface to industry
  • Parallelization API
  • Using XML in RSF headers;
    • Later: Author's own repudiation of the AJAX part of the previous proposal (other parts still stand).
    • Author's suggestion for an alternative to XML (from a private email to Sergey): "What does one do with XML? Read it with a program, right. XML is good if you can make no assumptions whatsoever about which language the said program was written in, and what that program is (could be a web browser of sorts, could be an Erlang application, could be a Python script, could be a C++ compiled binary). Then to deal with uncertainty you spend resources on insurance, using a verbose, completely unambiguous data description. So XML is the "canonical" approach. But what if one goes for the agile "worse is better" and notices that header file I/O costs nothing, so it can be done all in Python , regardless of what the language of the computational engine of the program. Then it does not make much sense to write from Python to XML, then read it back -- just write the header in Python! This, incidentally, is what the current syntax of RSF headers is. I realize that what I wanted XML for was delimiting in some way what was written to a header by a program and what was written by another. This way one would not get five trailing dimensions of length one because at some point the file was a five dimensional cube, while at the same time retaining meaningful dimensions of length one (i.e. the crossline for an inline extracted from a dataset). Rewriting to the header the complete description (n,o,d,unit,label) of the axes of the output for each program , all "kept together" by some syntax, would make it much easier to figure out what was actually done to the cube, and would avoid having to parse the entire file -- just read the last structure. JSON ( ) is designed to be an alternative to XML that is step in this direction (it is valid Javascript, and not at all far from Python), and of course, one can use Python syntax for keeping some variable values together, and do the I/O all in Python. I think this is what Lisp does and what the whole "data is code/code is data" thing is about."
  • From the Sergey-Reg Beardsley email exchange on rsfuser in Jul 2006: add to each history record Madagascar, OS versions
  • To have a consistent user interface, certain types of inputs and outputs should be standardized. A small beginning has been made by giving the verbosity option the same name everywhere. More meaningful issues would involve:
    • having all frequencies in Hertz
    • deciding whether all offsets should be half offsets or full offsets
    • FFT sign conventions (- for FFT forward in time, + for FFT forward in space, like in BEI)
    • Deciding whether programs should work with velocities or slownesses, and the standard axis order for a velocity model file.
    • Standard axis order for inputs to programs that do similar things, i.e. switching a migration program for another in a SCons rule should be as simple as just changing the name of the program, without having to scratch one's head to determine how should the data and velocity be set up. Create Python metaprograms that add transparently to the user dimensions of length 1 to 2-D datasets when needed by programs that deal with 3-D data.

How to transform a jpg image into a RSF file

Provided that:

  • your image is a grayscale one;
  • samples are in byte format;
  • you know the resolution of the image;
  • you have ImageMagick installed on your computer;

your SConstruct file would look like this (simple jpg->rsf conversion + application of Sobel operator):

<python> from rsfproj import *

n1 = 512 n2 = 512


   convert - ${TARGETS[0]}
   , stdout=0)


   o2=0 | transp | dd type=float
    % (n2, n1))


     grey allpos=y title="Original Image" wantaxis=n



     grey allpos=y title="Sobel Operator" wantaxis=n

End () </python>

How to transform a RSF file into an image, without axes

Using sfbyte2jpg

<bash> < model.rsf sfbyte | sfbyte2jpg > model.jpg </bash> Then use another program to convert model.jpg to the desired format.

Using ImageMagick

The following commands can be used in a SConstruct to generate almost any type of bitmap output: <python> Flow('data.gray','data',

   transp |  # Make data in row-major order
   byte gainpanell=all allpos=y |  # Convert data to byte representation
   disfil col=1 format="%02X" |  # Dump data in one column in ASCII-hex
   sed -e "s/\s*[0-9]*\:\s*//g" |  # Strip column numbers
   xxd -r -p  # Read ASCII output and convert it to binary form


   convert -size %dx%d -depth 8 ${SOURCES[0]} ${TARGETS[0]}  # Run ImageMagick
    % (n2, n1), stdin=0, stdout=0)

</python> This one uses a 3rd party tool from ImageMagick suite (which nowdays is included by default in any Linux distribution). It knows almost any existing bitmap format. Just change the extension in the last Flow() from .png to .gif or .jpg, for example. Create the output simply by running scons data.png


ASCII art – possibly useful for error messages, text UIs with ncurses, etc. Standard font:

 __  __           _                                      
|  \/  | __ _  __| | __ _  __ _  __ _ ___  ___ __ _ _ __ 
| |\/| |/ _` |/ _` |/ _` |/ _` |/ _` / __|/ __/ _` | '__|
| |  | | (_| | (_| | (_| | (_| | (_| \__ \ (_| (_| | |   
|_|  |_|\__,_|\__,_|\__,_|\__, |\__,_|___/\___\__,_|_|   

Big font:

 __  __           _                                      
|  \/  |         | |                                     
| \  / | __ _  __| | __ _  __ _  __ _ ___  ___ __ _ _ __ 
| |\/| |/ _` |/ _` |/ _` |/ _` |/ _` / __|/ __/ _` | '__|
| |  | | (_| | (_| | (_| | (_| | (_| \__ \ (_| (_| | |   
|_|  |_|\__,_|\__,_|\__,_|\__, |\__,_|___/\___\__,_|_|   
                           __/ |