Package overview: Difference between revisions
typos |
|||
(37 intermediate revisions by 6 users not shown) | |||
Line 4: | Line 4: | ||
The Madagascar environment consists of: | The Madagascar environment consists of: | ||
# Standalone programs for out-of-core | # Standalone programs for out-of-core data analysis; | ||
# Standalone programs for geophysical data processing and imaging; | # Standalone programs for geophysical data processing and imaging; | ||
# A development kit for C, C++, Fortran-77, Fortran-90, Python, Matlab, and Octave; | # A development kit for C, C++, Java, Fortran-77, Fortran-90, Python, Matlab, and Octave; | ||
# A framework for reproducible numerical experiments, based on [http://www.scons.org/ SCons]; | # A framework for reproducible numerical experiments, based on [http://www.scons.org/ SCons]; | ||
# A framework for scientific publications, based on [http://www.scons.org/ SCons] and [http://en.wikipedia.org/wiki/LaTeX LaTeX]; | # A framework for scientific publications, based on [http://www.scons.org/ SCons] and [http://en.wikipedia.org/wiki/LaTeX LaTeX]; | ||
Line 12: | Line 12: | ||
# A collection of datasets used as input to reproducible numerical experiments. | # A collection of datasets used as input to reproducible numerical experiments. | ||
This guide serves as a brief introduction | This guide serves as a brief introduction to different components and shows how they all fit together. | ||
==How to obtain Madagascar== | |||
See [[Download|download]] and [[Installation | installation instructions]]. Madagascar runs on Unix/Linux platforms, including MacOS X and Unix emulations under Microsoft Windows. Its installation requires a working C compiler and Python. | |||
==How to find your way around Madagascar== | ==How to find your way around Madagascar== | ||
Start by checking the [[Reproducible_Documents|list of reproducible papers]]. If any of these papers look close to your interests, follow the links until you find a figure with a "wrench" button under it [[Image:configure.png]]. Click on the wrench, and it will open a computational recipe used for generating the figure (the <tt>SConstruct</tt> file). | |||
<syntaxhighlight lang="python"> | |||
from rsf.proj import * | |||
Flow('rose',None, | |||
''' | |||
math n1=629 d1=0.01 o1=0 n2=40 d2=1 o2=5 | |||
output="x2*(8+sin(6*x1+x2/10))" | | |||
rtoc | | |||
math output="input*exp(I*x1)" | |||
''') | |||
Result('rose', | |||
'graph title=Rose screenratio=1 wantaxis=n') | |||
End() | |||
</syntaxhighlight> | |||
You can copy this recipe to your computer or find it already in the "book" subtree under the Madagascar source directory. For example, the recipe at https://ahay.org/RSF/book/rsf/rsf/sfmath.html also exists in the file <tt>RSFSRC/book/rsf/rsf/sfmath/SConstruct</tt>. After copying or locating the appropriate <tt>SConstruct</tt> file, | |||
run | run | ||
<pre> | <pre> | ||
Line 31: | Line 49: | ||
scons: done reading SConscript files. | scons: done reading SConscript files. | ||
scons: Building targets ... | scons: Building targets ... | ||
/RSFROOT/bin/sfmath n1=629 d1=0.01 o1=0 n2=40 d2=1 o2=5 output="x2*(8+sin(6*x1+x2/10))" | /RSFROOT/bin/sfrtoc | | |||
< rose.rsf | /RSFROOT/bin/sfmath output="input*exp(I*x1)" > rose.rsf | ||
< rose.rsf /RSFROOT/bin/sfgraph title=Rose screenratio=1 wantaxis=n > Fig/rose.vpl | |||
/RSFROOT/bin/sfpen Fig/rose.vpl | |||
scons: done building targets. | scons: done building targets. | ||
</pre> | </pre> | ||
with a picture appearing on your screen. | with a picture appearing on your screen. | ||
[[Image:rose.png|frame|center]] | |||
If there are several figures in the recipe, you can run | If there are several figures in the recipe, you can run | ||
<pre> | <pre> | ||
scons figurename.view | scons figurename.view | ||
</pre> | </pre> | ||
(e.g. <tt>scons rose.view</tt>) to display individual figures. To remove all | (e.g. <tt>scons rose.view</tt>) to display individual figures. To remove all files that <tt>scons view</tt> generated, run | ||
<pre> | <pre> | ||
scons -c view | scons -c view | ||
</pre> | </pre> | ||
If you want to know what commands will be executed to generate the figures | If you want to know in advance what commands will be executed to generate the figures, try | ||
<pre> | <pre> | ||
scons -n view | scons -n view | ||
Line 54: | Line 73: | ||
scons -n -Q view > script.sh | scons -n -Q view > script.sh | ||
</pre> | </pre> | ||
and use <tt>script.sh</tt> as a shell script. If you are to | and use <tt>script.sh</tt> as a shell script. If you are to modify the data processing recipe (changing parameters or trying new data), working with SCons is more powerful and convenient than running shell scripts. | ||
A computational recipe puts together individual commands through Unix pipes and SCons rules. These commands act like Lego blocks for creating complex data analysis constructions. In the example above, three "blocks" are used: <tt>sfmath</tt>, <tt>sfrtoc</tt>, and <tt>sfgraph</tt>. To find out what a particular command is doing, follow the links from the bottom of the web page: https://ahay.org/RSF/book/rsf/rsf/sfmath.html . | |||
Alternatively, run the command without arguments on the command line. Running | |||
<pre> | |||
bash$ sfrtoc | |||
</pre> | |||
produces something like | |||
<pre> | |||
NAME | |||
sfrtoc | |||
DESCRIPTION | |||
Convert real data to complex (by adding zero imaginary part). | |||
SYNOPSIS | |||
sfrtoc < real.rsf > cmplx.rsf | |||
COMMENTS | |||
See also: sfcmplx | |||
USED IN | |||
bei/ft1/plane4 | |||
bei/ft1/autocor | |||
bei/ft1/brad | |||
[...] | |||
SOURCE | |||
user/main/rtoc.c | |||
DOCUMENTATION | |||
https://ahay.org/wiki/Guide_to_madagascar_programs#sfrtoc | |||
</pre> | |||
The <b>DOCUMENTATION</b> section links to more detailed documentation on the web. The most helpful part is the <b>USED IN</b> section, which points to more examples of using the program. As an exercise, change the directory to <tt>RSFSRC/book/bei/ft1/plane4</tt> or any other example directory, examine the <tt>SConstruct</tt> file and run <tt>scons view</tt>. Alternatively, look at https://ahay.org/RSF/book/bei/ft1/plane4.html . | |||
Want to find a program by keywords? Try <tt>sfdoc -k</tt>. | |||
<pre> | |||
bash$ sfdoc -k complex | |||
sfsort: Sort a float/complex vector by absolute values. | |||
sfrtoc: Convert real data to complex (by adding zero imaginary part). | |||
sfjacobi2: Find eigenvalues of a general complex matrix by Jacobi-like iteration. | |||
sfboolcmp: Element-wise boolean comparison of values. For int/float/complex datasets. | |||
sfcmatmult: Simple matrix multiplication for complex matrices | |||
sfimag: Extract real (sfreal) or imaginary (sfimag) part of a complex dataset. | |||
sfthr: Threshold float/complex inputs given a constant/varying threshold level. | |||
sfcpef: 1-D prediction-error filter estimation from complex data | |||
sfroots: Find roots of a complex polynomial. | |||
sfreal: Extract real (sfreal) or imaginary (sfimag) part of a complex dataset. | |||
sfcmplx: Create a complex dataset from its real and imaginary parts. | |||
sfsin: Simple operations with complex sinusoids | |||
sfcdottest: Generic dot-product test for complex linear operators with adjoints | |||
sfcconjgrad: Generic conjugate-gradient solver for linear inversion with complex data | |||
</pre> | |||
Individual components of the Madagascar environment are described in more detail below. | |||
==Madagascar components== | |||
==Standalone programs== | ===Standalone programs=== | ||
Most programs act as filters on input data and can be chained through Unix pipes, i.e.: | The list of all standalone programs is available [https://ahay.org/RSF/ online]. Most programs act as filters on input data and can be chained through Unix pipes, i.e.: | ||
<bash> | <bash> | ||
< data.rsf sfwindow n1=100 | sfbandpass fhi=60 > data2.rsf | < data.rsf sfwindow n1=100 | sfbandpass fhi=60 > data2.rsf | ||
</bash> | </bash> | ||
This approach follows the Unix philosophy, as formulated by Doug McIlroy, the inventor of Unix pipes (Salus, 1994<ref>Salus, P. H., 1994, A quarter-century of Unix: Addison-Wesley.</ref>): | This approach follows the Unix philosophy, as formulated by Doug McIlroy, the inventor of Unix pipes (Salus, 1994<ref>Salus, P. H., 1994, A quarter-century of Unix: Addison-Wesley.</ref>): | ||
#Write programs that do one thing and do it well. | #Write programs that do one thing and do it well. | ||
#Write programs to work together. | #Write programs to work together. | ||
#Write programs to handle text streams | #Write programs to handle text streams because that is a universal interface. | ||
Following the Unix convention, programs have brief <tt>man</tt> pages explaining the program's purpose and parameters. You can access this documentation by running a program without parameters. To search for a program by a keyword, use <tt>sfdoc -k <keyword></tt>. | |||
The [[guide to Madagascar programs]] provides more detailed documentation for selected programs, while the [[task-centric program list]] attempts to categorize them. The programs in actual use can be found in [[Reproducible Documents]]. | |||
== | ===Data format=== | ||
For data, Madagascar uses the [[Guide to RSF file format| Regularly Sampled Format]] (RSF), which is based on the concept of hypercubes (n-D arrays, or regularly sampled functions of several variables), much like the SEPlib (its closest relative), DDS, or the regularly-sampled version of the Javaseis format (SVF). Up to 9 dimensions are supported. For 1D it is conceptually analogous to a time series, | For data, Madagascar uses the [[Guide to RSF file format| Regularly Sampled Format]] (RSF), which is based on the concept of hypercubes (n-D arrays, or regularly sampled functions of several variables), much like the SEPlib (its closest relative), DDS, or the regularly-sampled version of the Javaseis format (SVF). Up to 9 dimensions are supported. For 1D, it is conceptually analogous to a time series, 2D to a raster image, and 3D to a [http://en.wikipedia.org/wiki/Voxel voxel volume]. The format (actually a [http://en.wikipedia.org/wiki/Meta meta]format) makes use of an ASCII file with metadata (information about the data), including a pointer (<tt>in=</tt> parameter) to the location of the file with the actual data values. Irregularly sampled data are currently handled as a pair of datasets, one containing data and the second containing the corresponding irregular geometry information. Programs for conversion to and from other formats, such as SEG-Y and SU, are provided. | ||
Madagascar currently uses the Vplot vector graphics format for graphics. Converters to other graphics formats (Postscript, PNG, GIF, JPEG) are also provided. | |||
==Reproducible documents== | ===Reproducible documents=== | ||
A reproducible document consists of LaTeX source combined with SCons rules required to fully build the | A reproducible document consists of LaTeX source combined with SCons rules required to fully build the document. These rules are expressed in terms of SCons extensions provided as part of Madagascar. | ||
This is the key to | This is the key to Madagascar's reproducibility. An introduction to reproducible Madagascar documents is at [[Reproducible_computational_experiments_using_SCons]]. | ||
== | ===Vplot graphics=== | ||
In contrast to most other Madagascar Components, graphics components produce Vplot data as output. | In contrast to most other Madagascar Components, graphics components produce Vplot data as output. | ||
Vplot is a device independent graphics format that allows both vector and raster elements (as such, | Vplot is a device-independent graphics format that allows both vector and raster elements (as such, | ||
it is comparable to Postscript). Vplot files | it is comparable to Postscript). Several output devices can interpret Vplot files. The typical usage is for a visual display in X-windows. A list of them is [[Guide to Madagascar programs#Plotting programs | provided on the wiki]]. | ||
Here is an example of a Madagascar pipe. In this case it takes a subsection of a file, low-pass | Here is an example of a Madagascar pipe. In this case, it takes a subsection of a file, low-pass | ||
filters it, and saves the result | filters it, and saves the result | ||
<bash> | <syntaxhighlight lang="bash"> | ||
< data.rsf sfwindow n1=100 | sfbandpass fhi=60 > data2.rsf | < data.rsf sfwindow n1=100 | sfbandpass fhi=60 > data2.rsf | ||
</ | </syntaxhighlight> | ||
In this more elaborate case, the final output is passed to a graphics program and plotted. | In this more elaborate case, the final output is passed to a graphics program and plotted. | ||
<bash> | <syntaxhighlight lang="bash"> | ||
< data.rsf sfwindow n1=100 | sfbandpass fhi=60 | sfcontour | xtpen | < data.rsf sfwindow n1=100 | sfbandpass fhi=60 | sfcontour | xtpen | ||
</ | </syntaxhighlight> | ||
More extensive examples are | More extensive examples are in [[Guide to Madagascar programs]]. The novice reader should read the material below before proceeding to that page. | ||
==Reproducibility and Project Management== | ===Reproducibility and Project Management=== | ||
Madagascar uses and extends [http://www.scons.org/ SCons], an open-source | Madagascar uses and extends [http://www.scons.org/ SCons], an open-source | ||
software construction package | software construction package to document and maintain data processing flows. Documented projects become | ||
computational recipes that can be easily exchanged among Madagascar users. | computational recipes that can be easily exchanged among Madagascar users. | ||
SCons is a rule-based package in Python typically used as a build system analogous to <tt>make</tt>. Familiarity with any build system will | SCons is a rule-based package in Python typically used as a build system analogous to <tt>make</tt>. Familiarity with any build system will | ||
help understand SCons. SCons statements, as Python statements, are invoked in the sequence in which they are | |||
written, but as such they only define rules. The rules are invoked | written, but as such, they only define rules. The rules are invoked by a dependency graph, which | ||
SCons builds based on those rules. Components regarded as "up-to-date" are not rebuilt. | SCons builds based on those rules. Components regarded as "up-to-date" are not rebuilt. | ||
SCons allows user-contributed Builders (meta-rule categories) and Madagascar uses this capability extensively. | SCons allows for user-contributed Builders (meta-rule categories), and Madagascar uses this capability extensively. | ||
The idea is that building an output file based on a workflow chain is | The idea is that building an output file based on a workflow chain is analogous to building a | ||
software package based on a software | software package based on a software toolchain. The calculation is seen simply as a build with dependencies. | ||
This | This setup greatly benefits developing alternative workflows using a given dataset. The system | ||
maintains an awareness of already completed calculations. Without user intervention, redundant calculations | maintains an awareness of already completed calculations. Without user intervention, redundant calculations | ||
are avoided. | are avoided. | ||
Madagascar calculations are thus expressed as SCons scripts (<tt>SConstruct</tt> files). SCons extensions follow SCons conventions | Madagascar calculations are thus expressed as SCons scripts (<tt>SConstruct</tt> files). SCons extensions follow SCons conventions, beginning | ||
with an uppercase letter. The most common Madagascar extensions are <tt>Flow()</tt>, <tt>Result()</tt>, and <tt>End()</tt>. A <tt>Flow()</tt> invocation wraps Madagascar computational components. <tt>Result()</tt> is a version of <tt>Flow()</tt> with a graphical output. Finally an | with an uppercase letter. The most common Madagascar extensions are <tt>Flow()</tt>, <tt>Result()</tt>, and <tt>End()</tt>. A <tt>Flow()</tt> invocation wraps Madagascar computational components. <tt>Result()</tt> is a version of <tt>Flow()</tt> with a graphical output. Finally an | ||
End() | End() invokes the default rules for multiple results. | ||
Finally, Madagascar enables a collection of reproducible documents | Finally, Madagascar enables a collection of reproducible documents to be organized into living books. Each | ||
reproducible book contains a collection of Madagascar recipes (<tt>SConstruct</tt> files) used to generate book figures. The recipes | reproducible book contains a collection of Madagascar recipes (<tt>SConstruct</tt> files) used to generate book figures. The recipes | ||
cover a variety of data processing and imaging tasks described in the books. Figures and recipes serve | cover a variety of data processing and imaging tasks described in the books. Figures and recipes serve | ||
dual purpose | a dual purpose concerning Madagascar maintenance. They provide demos to introduce new users to the | ||
functionality of the package and, at the same time, regression tests | functionality of the package and, at the same time, [[Automatic Testing|regression tests]] to assure the system's stability | ||
under change | under change. | ||
==Madagascar Trivia== | |||
== | ===Why the Name "Madagascar"?=== | ||
[http://ahay.org/blog/2006/04/19/madagascar/ Whimsy, really]. It seems easier to remember than the previous name "RSF", and it provides us interesting [http://ahay.org/blog/2008/10/21/ahay/ mascots]. | |||
==License== | ===License=== | ||
The Madagascar package is released | The Madagascar package is released open-source under the standard [http://www.gnu.org/copyleft/gpl.html GNU GPL] license. In simple | ||
words, there are no restrictions on the use of the software (including copying, modifying, selling, etc.) | words, there are no restrictions on the use of the software (including copying, modifying, selling, etc.) | ||
However, there are restrictions on the software redistribution intended to prevent the package from losing | However, there are restrictions on the software redistribution intended to prevent the package from losing | ||
its open-source status. Users are | its open-source status. Users are encouraged to [[Contributing new programs to Madagascar|submit their modifications]] back to the original distribution for the benefit of the whole [[Package_overview#Community|community]]. | ||
===Community=== | |||
Madagascar seeks to be an open and active community. Mailing lists are maintained, and annual meetings take place. See | |||
Madagascar seeks to | |||
* [[Conferences]] | * [[Conferences]] | ||
* [http:// | * [http://ahay.org/blog/ Development blog] | ||
* [https://lists.sourceforge.net/lists/listinfo/rsf-user RSF-user mailing list] | * [https://lists.sourceforge.net/lists/listinfo/rsf-user RSF-user mailing list] | ||
* [https://lists.sourceforge.net/lists/listinfo/rsf-devel RSF-devel mailing list] | * [https://lists.sourceforge.net/lists/listinfo/rsf-devel RSF-devel mailing list] | ||
* [http://www.linkedin.com/e/vgh/1847746 LinkedIn group] | |||
Your participation is welcome. | Your participation is welcome. | ||
==History== | ===History=== | ||
Madagascar was first publicly presented at the [[Conferences#Vienna_2006_.28EAGE.29|EAGE Workshop]] in Vienna in June 2006. The work on the package (previously named RSF) was started by Sergey Fomel in 2003. Since then, many people have contributed to it. See [https://github.com/ahay/src/blob/master/AUTHORS.txt AUTHORS.txt] for an incomplete list. | |||
Madagascar also borrows ideas from [http://timna.mines.edu/cwpcodes/ Seismic Unix] (SU), | While being written primarily from scratch, Madagascar borrows ideas from the design of [http://sepwww.stanford.ed/doku.php?id=sep:software:seplib SEPlib], a package maintained by Bob Clapp at the Stanford Exploration Project (SEP). Generations of SEP students and researchers contributed to SEPlib. The most significant contributions came from Rob Clayton, Jon Claerbout, Dave Hale, Stew Levin, Rick Ottolini, Joe Dellinger, Steve Cole, Dave Nichols, Martin Karrenbach, Biondo Biondi, and Bob Clapp. | ||
Madagascar also borrows ideas from [http://timna.mines.edu/cwpcodes/ Seismic Unix] (SU), an open-source package maintained by John Stockwell at the Center for Wave Phenomena (CWP) at the Colorado School of Mines (Stockwell, 1997<ref>Stockwell, J. W., 1997, Free software in education: A case study of CWP/SU: Seismic Unix: The Leading Edge, '''16''', 1045--1049.</ref>;Stockwell, 1999<ref>--------, 1999, The CWP/SU: Seismic Un*x package: Computers and Geosciences, '''25''', 415--419.</ref>). Main contributors to SU included Einar Kjartansson, Shuki Ronen, Jack Cohen, Chris Liner, Dave Hale, and John Stockwell. SU adopted an open-source BSD-style license starting with release 40 (April 10, 2007). | |||
<references/> | <references/> | ||
===Estimated Cost=== | |||
The Project Cost Calculator on Madagascar's [https://www.openhub.net/p/m8r Open Hub (formerly Ohloh) metrics page] shows the estimated cost of the project, using the Basic COCOMO Model, to be about $22 million by October 29, 2024. |
Latest revision as of 22:11, 29 October 2024
The mission of the Madagascar project is to provide a shared research environment for computational data analysis in geophysics and related fields.
The Madagascar environment consists of:
- Standalone programs for out-of-core data analysis;
- Standalone programs for geophysical data processing and imaging;
- A development kit for C, C++, Java, Fortran-77, Fortran-90, Python, Matlab, and Octave;
- A framework for reproducible numerical experiments, based on SCons;
- A framework for scientific publications, based on SCons and LaTeX;
- A collection of reproducible scientific articles also used as usage examples and regression tests for the standalone programs;
- A collection of datasets used as input to reproducible numerical experiments.
This guide serves as a brief introduction to different components and shows how they all fit together.
How to obtain Madagascar[edit]
See download and installation instructions. Madagascar runs on Unix/Linux platforms, including MacOS X and Unix emulations under Microsoft Windows. Its installation requires a working C compiler and Python.
How to find your way around Madagascar[edit]
Start by checking the list of reproducible papers. If any of these papers look close to your interests, follow the links until you find a figure with a "wrench" button under it . Click on the wrench, and it will open a computational recipe used for generating the figure (the SConstruct file).
from rsf.proj import *
Flow('rose',None,
'''
math n1=629 d1=0.01 o1=0 n2=40 d2=1 o2=5
output="x2*(8+sin(6*x1+x2/10))" |
rtoc |
math output="input*exp(I*x1)"
''')
Result('rose',
'graph title=Rose screenratio=1 wantaxis=n')
End()
You can copy this recipe to your computer or find it already in the "book" subtree under the Madagascar source directory. For example, the recipe at https://ahay.org/RSF/book/rsf/rsf/sfmath.html also exists in the file RSFSRC/book/rsf/rsf/sfmath/SConstruct. After copying or locating the appropriate SConstruct file, run
scons view
on the command line to generate all the figures in the selected project and to display them on your screen. For example, try
bash$ cd RSFSRC/book/rsf/rsf/sfmath bash$ scons view
where bash$ stands for the Unix prompt and RSFSRC stands for the Madagascar source directory. The output should look like
scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... /RSFROOT/bin/sfmath n1=629 d1=0.01 o1=0 n2=40 d2=1 o2=5 output="x2*(8+sin(6*x1+x2/10))" | /RSFROOT/bin/sfrtoc | /RSFROOT/bin/sfmath output="input*exp(I*x1)" > rose.rsf < rose.rsf /RSFROOT/bin/sfgraph title=Rose screenratio=1 wantaxis=n > Fig/rose.vpl /RSFROOT/bin/sfpen Fig/rose.vpl scons: done building targets.
with a picture appearing on your screen.
If there are several figures in the recipe, you can run
scons figurename.view
(e.g. scons rose.view) to display individual figures. To remove all files that scons view generated, run
scons -c view
If you want to know in advance what commands will be executed to generate the figures, try
scons -n view
You can output this command to a file
scons -n -Q view > script.sh
and use script.sh as a shell script. If you are to modify the data processing recipe (changing parameters or trying new data), working with SCons is more powerful and convenient than running shell scripts.
A computational recipe puts together individual commands through Unix pipes and SCons rules. These commands act like Lego blocks for creating complex data analysis constructions. In the example above, three "blocks" are used: sfmath, sfrtoc, and sfgraph. To find out what a particular command is doing, follow the links from the bottom of the web page: https://ahay.org/RSF/book/rsf/rsf/sfmath.html . Alternatively, run the command without arguments on the command line. Running
bash$ sfrtoc
produces something like
NAME sfrtoc DESCRIPTION Convert real data to complex (by adding zero imaginary part). SYNOPSIS sfrtoc < real.rsf > cmplx.rsf COMMENTS See also: sfcmplx USED IN bei/ft1/plane4 bei/ft1/autocor bei/ft1/brad [...] SOURCE user/main/rtoc.c DOCUMENTATION https://ahay.org/wiki/Guide_to_madagascar_programs#sfrtoc
The DOCUMENTATION section links to more detailed documentation on the web. The most helpful part is the USED IN section, which points to more examples of using the program. As an exercise, change the directory to RSFSRC/book/bei/ft1/plane4 or any other example directory, examine the SConstruct file and run scons view. Alternatively, look at https://ahay.org/RSF/book/bei/ft1/plane4.html .
Want to find a program by keywords? Try sfdoc -k.
bash$ sfdoc -k complex sfsort: Sort a float/complex vector by absolute values. sfrtoc: Convert real data to complex (by adding zero imaginary part). sfjacobi2: Find eigenvalues of a general complex matrix by Jacobi-like iteration. sfboolcmp: Element-wise boolean comparison of values. For int/float/complex datasets. sfcmatmult: Simple matrix multiplication for complex matrices sfimag: Extract real (sfreal) or imaginary (sfimag) part of a complex dataset. sfthr: Threshold float/complex inputs given a constant/varying threshold level. sfcpef: 1-D prediction-error filter estimation from complex data sfroots: Find roots of a complex polynomial. sfreal: Extract real (sfreal) or imaginary (sfimag) part of a complex dataset. sfcmplx: Create a complex dataset from its real and imaginary parts. sfsin: Simple operations with complex sinusoids sfcdottest: Generic dot-product test for complex linear operators with adjoints sfcconjgrad: Generic conjugate-gradient solver for linear inversion with complex data
Individual components of the Madagascar environment are described in more detail below.
Madagascar components[edit]
Standalone programs[edit]
The list of all standalone programs is available online. Most programs act as filters on input data and can be chained through Unix pipes, i.e.: <bash> < data.rsf sfwindow n1=100 | sfbandpass fhi=60 > data2.rsf </bash> This approach follows the Unix philosophy, as formulated by Doug McIlroy, the inventor of Unix pipes (Salus, 1994[1]):
- Write programs that do one thing and do it well.
- Write programs to work together.
- Write programs to handle text streams because that is a universal interface.
Following the Unix convention, programs have brief man pages explaining the program's purpose and parameters. You can access this documentation by running a program without parameters. To search for a program by a keyword, use sfdoc -k <keyword>.
The guide to Madagascar programs provides more detailed documentation for selected programs, while the task-centric program list attempts to categorize them. The programs in actual use can be found in Reproducible Documents.
Data format[edit]
For data, Madagascar uses the Regularly Sampled Format (RSF), which is based on the concept of hypercubes (n-D arrays, or regularly sampled functions of several variables), much like the SEPlib (its closest relative), DDS, or the regularly-sampled version of the Javaseis format (SVF). Up to 9 dimensions are supported. For 1D, it is conceptually analogous to a time series, 2D to a raster image, and 3D to a voxel volume. The format (actually a metaformat) makes use of an ASCII file with metadata (information about the data), including a pointer (in= parameter) to the location of the file with the actual data values. Irregularly sampled data are currently handled as a pair of datasets, one containing data and the second containing the corresponding irregular geometry information. Programs for conversion to and from other formats, such as SEG-Y and SU, are provided.
Madagascar currently uses the Vplot vector graphics format for graphics. Converters to other graphics formats (Postscript, PNG, GIF, JPEG) are also provided.
Reproducible documents[edit]
A reproducible document consists of LaTeX source combined with SCons rules required to fully build the document. These rules are expressed in terms of SCons extensions provided as part of Madagascar.
This is the key to Madagascar's reproducibility. An introduction to reproducible Madagascar documents is at Reproducible_computational_experiments_using_SCons.
Vplot graphics[edit]
In contrast to most other Madagascar Components, graphics components produce Vplot data as output.
Vplot is a device-independent graphics format that allows both vector and raster elements (as such, it is comparable to Postscript). Several output devices can interpret Vplot files. The typical usage is for a visual display in X-windows. A list of them is provided on the wiki.
Here is an example of a Madagascar pipe. In this case, it takes a subsection of a file, low-pass filters it, and saves the result
< data.rsf sfwindow n1=100 | sfbandpass fhi=60 > data2.rsf
In this more elaborate case, the final output is passed to a graphics program and plotted.
< data.rsf sfwindow n1=100 | sfbandpass fhi=60 | sfcontour | xtpen
More extensive examples are in Guide to Madagascar programs. The novice reader should read the material below before proceeding to that page.
Reproducibility and Project Management[edit]
Madagascar uses and extends SCons, an open-source software construction package to document and maintain data processing flows. Documented projects become computational recipes that can be easily exchanged among Madagascar users.
SCons is a rule-based package in Python typically used as a build system analogous to make. Familiarity with any build system will help understand SCons. SCons statements, as Python statements, are invoked in the sequence in which they are written, but as such, they only define rules. The rules are invoked by a dependency graph, which SCons builds based on those rules. Components regarded as "up-to-date" are not rebuilt.
SCons allows for user-contributed Builders (meta-rule categories), and Madagascar uses this capability extensively. The idea is that building an output file based on a workflow chain is analogous to building a software package based on a software toolchain. The calculation is seen simply as a build with dependencies. This setup greatly benefits developing alternative workflows using a given dataset. The system maintains an awareness of already completed calculations. Without user intervention, redundant calculations are avoided.
Madagascar calculations are thus expressed as SCons scripts (SConstruct files). SCons extensions follow SCons conventions, beginning with an uppercase letter. The most common Madagascar extensions are Flow(), Result(), and End(). A Flow() invocation wraps Madagascar computational components. Result() is a version of Flow() with a graphical output. Finally an End() invokes the default rules for multiple results.
Finally, Madagascar enables a collection of reproducible documents to be organized into living books. Each reproducible book contains a collection of Madagascar recipes (SConstruct files) used to generate book figures. The recipes cover a variety of data processing and imaging tasks described in the books. Figures and recipes serve a dual purpose concerning Madagascar maintenance. They provide demos to introduce new users to the functionality of the package and, at the same time, regression tests to assure the system's stability under change.
Madagascar Trivia[edit]
Why the Name "Madagascar"?[edit]
Whimsy, really. It seems easier to remember than the previous name "RSF", and it provides us interesting mascots.
License[edit]
The Madagascar package is released open-source under the standard GNU GPL license. In simple words, there are no restrictions on the use of the software (including copying, modifying, selling, etc.) However, there are restrictions on the software redistribution intended to prevent the package from losing its open-source status. Users are encouraged to submit their modifications back to the original distribution for the benefit of the whole community.
Community[edit]
Madagascar seeks to be an open and active community. Mailing lists are maintained, and annual meetings take place. See
Your participation is welcome.
History[edit]
Madagascar was first publicly presented at the EAGE Workshop in Vienna in June 2006. The work on the package (previously named RSF) was started by Sergey Fomel in 2003. Since then, many people have contributed to it. See AUTHORS.txt for an incomplete list.
While being written primarily from scratch, Madagascar borrows ideas from the design of SEPlib, a package maintained by Bob Clapp at the Stanford Exploration Project (SEP). Generations of SEP students and researchers contributed to SEPlib. The most significant contributions came from Rob Clayton, Jon Claerbout, Dave Hale, Stew Levin, Rick Ottolini, Joe Dellinger, Steve Cole, Dave Nichols, Martin Karrenbach, Biondo Biondi, and Bob Clapp.
Madagascar also borrows ideas from Seismic Unix (SU), an open-source package maintained by John Stockwell at the Center for Wave Phenomena (CWP) at the Colorado School of Mines (Stockwell, 1997[2];Stockwell, 1999[3]). Main contributors to SU included Einar Kjartansson, Shuki Ronen, Jack Cohen, Chris Liner, Dave Hale, and John Stockwell. SU adopted an open-source BSD-style license starting with release 40 (April 10, 2007).
Estimated Cost[edit]
The Project Cost Calculator on Madagascar's Open Hub (formerly Ohloh) metrics page shows the estimated cost of the project, using the Basic COCOMO Model, to be about $22 million by October 29, 2024.