00001 __author__ = "Sean Ross-Ross"
00002 __version__ = "Simple example v(3.2)"
00003
00004 """
00005 simple example of how to create a vector and run
00006 commands
00007 """
00008 from slimpy_base import Space, Execute, vector
00009
00010 from slimpy_base.setup import *
00011
00012 from slimpy_base.utils.slim_decorators import depends_on
00013 from new_commands import fft_user, add_3
00014
00015
00016 defaults = { 'thr':0.1 }
00017
00018
00019 @depends_on('thr')
00020 def new_bldr( target, source, env ):
00021 'create a 10 by 10 image of zeros and add 3 to it'
00022
00023
00024 env = parse_env( env, defaults )
00025
00026 vec = vector( source[0] )
00027
00028 F = fft_user( vec.space )
00029
00030 tmp = F * vec
00031
00032 res3 = add_3( tmp )
00033
00034 res3.setName( target[0] )
00035
00036
00037 Execute( )
00038
00039
00040 if __name__ == '__main__':
00041
00042 Parameters( 'target', 'thr' )
00043 Defaults( defaults )
00044 Types( thr=float )
00045
00046
00047
00048 check_required( 'target' )
00049 check_required( 'source' )
00050
00051 env = parse_args( )
00052
00053
00054 target = [ env.pop( 'target' ) ]
00055 source = [ env.pop( 'source' ) ]
00056
00057 new_bldr( target, source, env )
00058
00059 else:
00060
00061
00062 __all__ = [ 'NewOperatorScript' ]
00063
00064
00065 from slimproj_core.builders.CreateBuilders import add_to_slim_env
00066
00067 NewOperatorScript = add_to_slim_env( "NewOperatorScript", new_bldr )
00068
00069