00001 """
00002 @page es1step7 Step 7
00003 """
00004
00005 from SLIMpy.linear_operators import *
00006 from SLIMpy import vector
00007 from slimpy_contrib.ana.problems.l1_minimization_problem import l1_min
00008
00009
00010
00011 PC = None
00012 W = None
00013
00014 def transform_callback( target, source, env, space ):
00015 """
00016 create a transfrom
00017 [[ PC ],
00018 [ W ]]
00019 Where PC is the weighted cosine transfrom and W is
00020 the wavelt transfrom.
00021 """
00022 global PC, W
00023
00024 weight = vector( source[1] )
00025
00026 C = Cosine( space )
00027 P = DiagonalWeight( space, weight )
00028
00029 PC = CompoundOperator( [P,C] )
00030 W = dwt( space )
00031
00032 AH = AugOperator( [[PC],
00033 [W]] )
00034
00035 D = DiagonalWeight( AH.domain(), .49 )
00036
00037 AD = CompoundOperator( [AH,D] )
00038
00039 A = AD.H
00040 return A
00041
00042 def recovery_callback( target, source, env, space ):
00043 """
00044 do the weighted cosine transfrom and wavelet transform
00045 as a block diagonal so they are not summed together.
00046 """
00047 AH = AugOperator( [[PC.H, 0 ],
00048 [ 0, W.H ]] )
00049
00050 D = DiagonalWeight( AH.range(), .49 )
00051 DA = CompoundOperator( [D,AH] )
00052 return DA
00053
00054 def result_callback( target, source, env, result ):
00055 """
00056 sets the first and second targets estimated swell
00057 noise and and the signal respectivley
00058 """
00059 result.flat[0].setName( str(target[0] ) )
00060 result.flat[1].setName( str(target[1] ) )
00061
00062
00063
00064
00065
00066 l1swell_sep = l1_min.copy()
00067 l1swell_sep['doc'] = l1swell_sep['doc'].copy()
00068
00069 l1swell_sep['transform_callback'] = transform_callback
00070 l1swell_sep['inv_callback'] = recovery_callback
00071 l1swell_sep['result_callback'] = result_callback
00072
00073 l1swell_sep['nouter'] = 10
00074 l1swell_sep['nouter'] = 10
00075 l1swell_sep['lmax'] = 0.001
00076 l1swell_sep['lmin'] = 0.99
00077
00078
00079