00001 """/*! 00002 @page es1step7 Step 7 00003 00004 \par Objectives: 00005 - Make the script more portable and easy to use by using the slimproj 00006 \a Solve builder 00007 - Create a SLIMpy application by encapsulating the problem in a portable python module. 00008 @par Additional inputs: 00009 - 'lowfweight.rsf' 00010 - 'swellsep.py' contains definition of swell separation problem 00011 00012 @par Additional outputs: 00013 - 'residual.rsf' 00014 00015 @section Walkthrough 00016 I have replaced the builder with the Built in Solve builder. 00017 I have ecapsulated the swell separation problem into the python module swellsep.py. 00018 Notice how in the function call of the Solve Builder the argument \a problem is given as 00019 \a \ref swellplot.l1swell_sep "l1swell_sep" 00020 . 00021 */""" 00022 00023 00024 from slimproj import * 00025 from SLIMpy import vector 00026 from SLIMpy import DotTest, VectorSpace 00027 from swellsep import l1swell_sep 00028 00029 from rsfproj import * 00030 #=============================================================================== 00031 # import local plotting function 00032 #=============================================================================== 00033 from os.path import abspath 00034 sys.path.append( abspath('..') ) 00035 from swellplot import plot_swell 00036 00037 data = '../data.rsf' 00038 sig = '../sig.rsf' 00039 noise = '../swellnoise.rsf' 00040 weight = 'lowfweight.rsf' 00041 residual = 'residual' 00042 00043 #=============================================================================== 00044 # Flows 00045 #=============================================================================== 00046 Flow ( weight, None, 00047 'math n1=512 output="1-(1*x1*0.1/512.0)" ' 00048 ) 00049 00050 Solve( ['enoise','esig'], [data,weight], 00051 problem=l1swell_sep, 00052 # slimpy options 00053 debug=['stat'] , logfile='sep.log' 00054 ) 00055 00056 Flow( residual, [ data, 'enoise','esig' ], 00057 ' math en=${SOURCES[1]} es=${SOURCES[2]} output="input-en-es" ' 00058 ) 00059 00060 00061 #=============================================================================== 00062 # RSF plotting functions 00063 #=============================================================================== 00064 plot_swell( data, noise, sig , 'enoise', 'esig', 'residual' ) 00065 00066 00067 #=============================================================================== 00068 # Dot Test 00069 #=============================================================================== 00070 00071 @slim_builder 00072 def AugmentedDotTest( target, source, env ): 00073 00074 y = vector(source[0]) 00075 AD = transfrom_callback( target, source, env , y.space ) 00076 DotTest(AD,2,5) 00077 00078 test = AugmentedDotTest( 'test', [data,weight], 00079 debug=[] , logfile='dottest' ) 00080 Alias( 'dottest', test) 00081