Step 1

This is the very first example you should look at when learning SLIMpy

Objectives:
  • get SLIMpy ready to use
  • become familiar with the python syntax
  • do a simple non-iterative de-noise with surfacelets

Setup

Now that you have acquired SLIMpy you should configure it using the configure_slimpy.py script this creates a .slimpy_rc file in your home directory

Walkthrough

Preamble
 >>> from SLIMpy import *
Include the SLIMpy package into the current python module.

 >>> options = parse_args( )

parse_args tells SLIMpy that it is working as a command line program and to enable the SLIMpy command line arguments.

parse_args initializes SLIMpy. This produces the following output

 SLIMpy: Building AST ...

 >>> sig = vector( '../sig.rsf' )
 >>> noise = vector( '../swellnoise.rsf' )
 >>> data  = sig + noise

Here we tell SLIMpy to look at the files `sig.rsf' and 'swellnoise.rsf' as vectors. vector is acutaly a forctory function that creates a Vector Class instance.

 >>> A = Cosine( sig.space )
This creates an implicit linear operator representing the Surfacelet Transform.

Body
 >>> tmp1 = A * data
 >>> tmp2 = tmp1.thr( 0.0001 )
 >>> res = A.H * tmp2 

These line represents the body of the code. this is where slimpy makes it easy for the user to create a flow.

Finalize
 >>> data.setName('data')
 >>> res.setName( "res" )

The command setName tells SLIMpy that the vector res is a target to be built and kept.

Note:
that the previous lines two produce NO output because there is no actual work done here since SLIMpy is still in the ``Build AST'' mode.
     >>> Execute( )

Execute is where the work is done, it produces the following lines of output:

 SLIMpy: Done building AST 
 SLIMpy: Executing commands ... 
 true | sfmath type="float" n2="256" n1="256" output="0" | 
        sfput label1="Time" label2="Lateral" var="0.0002" unit2="km" unit1="s" d1="0.004" d2="0.032" o2="0" o1="0" | 
        DATAPATH=./ sfnoise mean="0" > ./slim.18526.env1.exampl.creat.00001.rsf 
 < ./sig.rsf DATAPATH=./ sfmath output="vec+input" vec="./slim.18526.env1.exampl.creat.00001.rsf" > ./data.rsf 
 < ./data.rsf sfsurf adj="n" Pyr_Level="2" | sfthr mode="soft" thr="0.0001" | 
        DATAPATH=./ sfsurf adj="y" Pyr_Level="2" > ./res.rsf 
 sync 
 sfrm ./slim.18526.env1.exampl.creat.00001.rsf 
 SLIMpy: Done executing commands 

Generated on Sun Aug 10 09:11:08 2008 for SLIMpy by  doxygen 1.5.6