Install Madagascar (svn 7866) under sage

As I mentioned in the last post, SageMath is a powerful platform for scientific computation integrating your favorite software packages. One of my favorite packages, for example, is Madagascar for seismic data processing and visualization. So I decided to integrate it with sage. I took the following steps:

0. Sage is installed at $SAGE_ROOT
1. unzip one version of Madagascar (in my case it is svn 7866 checked out in Nov 2011). Newer versions should work as well.
2. under the directory of madagascar source, type

sage -sh

to get into the sage shell, followed by

./configure API=python

Sage will automatically configure it with Sage environmental variables and will install it to $SAGE_ROOT/local
4. exit sage shell, and type

sage --scons install

5. now you should find all Madagascar binary executables in $SAGE_ROOT/local/bin together with other binaries files:

x11pen             sfsort            sfplanemis3     sfitaupmo2         sfederiv2d          sfabalance                           mcube
vpwhitepruf        sfsnrstack        sfplanemis2     sfitaupmo          sfdwt97             sfaastack                           optimal
vpvrms             sfsnr             sfplane         sfisolr3           sfdwt               sfTestcdstep                    class.x
vpsg               sfsmstack         sfpick3         sfisolr2one        sfduwt              sfScanCoef                  ipbori                      cws.x
vpreflkine         sfsmoothreg2      sfpick          sfisolr2tau        sfdsr2              pspen                       PolyGUI                     mori.x
vpreflexpt         sfsmoothreg       sfphaserot      sfisolr2           sfdsr               ppmpen                      python2                     nef.x
vpreflector        sfsmoothderLS     sfpfactor2      sfisin2ang         sfdrays             pngpen                      python2-config              poly.x
vppen              sfsmoothder2      sfpetscawefd2d  sfiphase           sfdrayinte          pdfpen                      python-config               mori-11d.x
vpnmotraj          sfsmoothder1      sfpermlr2       sfinvrec1          sfdowmf             oglpen                      python                      nef-11d.x
vplot2png          sfsmoothder       sfpermlr3       sfinvbin1          sfdottest           latex2wiki                  python2.7                   cws-11d.x
vplot2gif          sfsmoothcur       sfpermlr1       sfinvbin           sfdots              jpegpen                     srptool                     class-11d.x
vplot2eps          sfsmooth          sfpen           sfinttest2         sfdonf              gdpen                       certtool                    poly-11d.x
vplot2avi          sfslice           xtpen           sfinttest1         sfdominantf         mayavi2                     gnutls-cli-debug            mori-6d.x
vphyplay           sfslant           sfpefdeburst    sfintshow          sfdomf              tvtk_doc                    psktool                     nef-6d.x
vpheadray          sfsizes           sfpef           sfintervalVTI      sfdoeps             editra                      gnutls-cli                  cws-6d.x
vpfrancis          sfsinc            sfpatch         sfinterpt          sfdmo               helpviewer                  gnutls-serv                 class-6d.x
vpellipse          sfsin             sfparcel        sfinterp2          sfdmeig             img2py                      libgnutls-extra-config      poly-6d.x
vpdcretard         sfsimilarity      sfpad           sfinterleave       sfdixshape          pyalamode                   libgnutls-config            mori-5d.x
vpdc               sfsimenv          sfovc           sfintegral1        sfdix               pycrust                     tconic                      nef-5d.x
vpcsp              sfsignoi          sfopsmigrk      sfintbin3          sfdivn              pywrap                      indep                       cws-5d.x
vpcroshyp          sfsigmoid         sfomp           sfintbin           sfdistmap           img2png                     allisog                     class-5d.x
vpconvert          sfsic3d           sfofsemb        sfint3d            sfdistance          img2xpm                     twist                       poly-5d.x
vpcmp              sfsic             sfofpwd2        sfinstattr         sfdisfil            pyalacarte                  torsion                     mori-4d.x
vp7ab              sfshotprop        sfofpwd         sfinmo3            sfdips              pyshell                     conductor                   nef-4d.x
tiffpen            sfshotholes       sfofilp         sfinmo             sfdiplet            pywxrc                      tate                        cws-4d.x
svgpen             sfshotconstkirch  sfoff2abs3      sfinitial          sfdipfilter         xrced                       findinf                     class-4d.x
sfztrace           sfshot2grid       sfoff2abs       sfinfill           sfdip2              wx-config                   ratpoint                    poly-4d.x
sfzomva            sfshot2cmp        sfofd2_7        sfin               sfdip               wxrc                        mwrank                      vsyasm
sfzomig3           sfshoot2          sfofd2_5        sfimray            sfdimag             wxrc-2.8                    opencdk-config              ytasm
sfzomig            sfshifts          sfofd2_25       sfimpl3            sfdijkstra          vtkpython                   fplll_micro                 yasm
sfzoeppritz        sfshift           sfofd2_13       sfimpl2            sfdiffraction       lproj                       llldiff                     freetype-config
sfzerocross        sfshearer         sfofd2_10       sfimpl1            sfdiffoc            vtkEncodeString             generate                    patch
sfzero             sfsharpsimi       sfofd1_5        sfimospray         sfdifference        vtkWrapPython               fplll_verbose               bzless
sfzcwt             sfsharpen         sfofd1          sfimage            sfdespike3          vtkWrapPythonInit           fplll                       bzcmp
sfxlagtoang2d      sfshapesigk       sfoctentwt      sfimag             sfdespike2          ctest                       sage_singular               bzegrep
sfxcor2d           sfshapebin1       sfocparcel      sfreal             sfdespike           cpack                       Singular                    bzfgrep
sfwmf              sfshapebin        sfoclet         sfigrad            sfderiv             cmake                       singular                    bzdiff
sfwkbjTI           sfshapeagc        sfnsmooth1      sfidempatch        sfdepth2time        ccmake                      LLL                         bzmore

and python files under

$SAGE_ROOT/local/lib/python2.7/site-packages/rsf$ ls    gui             sfbash.pyc        sfjun.pyc       sfplplot.pyc   sftour.pyc
apibak.pyc   sfgee.pyc       sfmain.pyc        sfseplib_compat.pyc        use.pyc        vplot2png.pyc       __init__.pyc    sfbrowaeys.pyc    sfjyan.pyc    sfpsava.pyc            sftrip.pyc       user        sfgeneric.pyc   sfmccowan.pyc     sfslim.pyc      vpplot.pyc
book.pyc     latex2wiki.pyc  sfchen.pyc    sfkourkina.pyc   sfrickettj.pyc          sftriptrace.pyc  version.pyc       sfgodwinj.pyc   sfparvaneh.pyc        sfsongxl.pyc
conf.pyc     path.pyc        sfcuda.pyc      sflcasasan.pyc       sfroman.pyc          sftsai.pyc       vpconvert.pyc   sfivlad.pyc     sfpens.pyc        sfsumain.pyc       prog.pyc        sfeffsilva.pyc       sflexing.pyc      sfsalah.pyc          sfxuxin.pyc      vplot2avi.pyc
doc.pyc     sfjeff.pyc    sfpetsc.pyc   sfsuplot.pyc   proj.pyc        sffomels.pyc   sflibplot.pyc       sfsaragiotis.pyc           sfyliu.pyc       vplot2eps.pyc      recipes     sfjennings.pyc     sfplot.pyc      sftariq.pyc 
flow.pyc       sfgchliu.pyc        sfllisiw.pyc     sfseismic.pyc            tex.pyc          vplot2gif.pyc

Now you can start a sage notebook and text the following code:

import m8r as sf
import numpy, pylab
f = sf.spike(n1=1000,k1=300)[0]
# sf.spike is an operator
# f is an RSF file object
# Inspect the file with sfattr
b = sf.bandpass(fhi=2,phase=1)[f]
# Now f is filtered through sfbandpass
c = sf.spike(n1=1000,k1=300).bandpass(fhi=2,phase=1)[0]
# c is equivalent to b but created with a pipe
g = c.wiggle(clip=0.02,title='Welcome to Madagascar')
# g is a Vplot file object
# Display it on the screen
d = b - c
# Elementary arithmetic operations on files are defined
g = g + d.wiggle(wanttitle=False)
# So are operations on plots
# This shows a movie

The result looks like the following

Link to the Madagascar sage notebook page.

Leave a Reply

Your email address will not be published. Required fields are marked *