00001 """
00002 simple example of how to create a vector and run
00003 commands
00004 """
00005
00006 from slimpy_base import Execute , vector, fft1, env
00007 from slimpy_base import AugVector, AugOperator
00008
00009 from slimpy_base.setup import check_required, parse_env, parse_args, Parameters
00010
00011
00012 def Augment_bldr(target,source,env):
00013 """
00014 Example builder showing how to use a simple aumented matrix
00015 Applys an fft transorn on two vectors then adds them
00016 """
00017 parse_env( env )
00018
00019 x = vector( source[0] )
00020 y = vector( source[1] )
00021
00022
00023 V = AugVector( [[x],
00024 [y]] )
00025
00026 A = fft1( x.space )
00027 B = fft1( y.space )
00028
00029 L = AugOperator( [[ A, B ],
00030 [ A, B ]] )
00031
00032
00033 tmp = L*V
00034
00035 RES = L.adj() * tmp
00036 print map(str,target)
00037
00038 RES.setName( target[:2] )
00039
00040 Execute()
00041
00042
00043 Parameters( 't1','t2','s1','s2' )
00044
00045 if __name__ == '__main__':
00046
00047
00048 check_required('t1'); check_required('t2')
00049 check_required('s1'); check_required('s2')
00050
00051 env = parse_args()
00052
00053 target = [ env.pop('t1'), env.pop('t2') ]
00054 source = [ env.pop('s1'), env.pop('s2') ]
00055
00056 Augment_bldr(target, source, env)
00057
00058 else:
00059
00060 from slimproj_core.builders.CreateBuilders import add_to_slim_env
00061
00062 Augment = add_to_slim_env( "Augment", Augment_bldr )
00063
00064