00001 __author__ = "Sean Ross-Ross"
00002 __version__ = "Simple mpi example v(1.0)"
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 pdb import set_trace
00014
00015
00016
00017
00018 defaults = { 'thr':0.1 }
00019
00020
00021 @depends_on('thr')
00022 def PerformSimleOpBldr( target, source, env ):
00023 'create a 10 by 10 image of zeros and add 3 to it'
00024
00025
00026 env = parse_env( env ,defaults)
00027
00028
00029 vec = vector( source[0] )
00030
00031 P = env['precondition_callback']( vec.space )
00032 C = env['transform_callback']( P.range() )
00033
00034
00035 augvec = P*vec
00036
00037 coeffs = C * augvec
00038
00039 tmp3 = coeffs.thr( env['thr'] )
00040
00041 augres = C.adj() * tmp3
00042
00043 result = P.adj() * augres
00044
00045 result.setName( target[0] )
00046
00047 Execute()
00048
00049
00050
00051
00052
00053 __all__ = ['PerformSimleOp']
00054
00055
00056 from slimproj_core.builders.CreateBuilders import add_to_slim_env
00057
00058 PerformSimleOp = add_to_slim_env("PerformSimleOp", PerformSimleOpBldr )
00059