00001 """
00002 Simple example on how to Integrate a linear
00003 Operator into SLIMpy.
00004 """
00005
00006
00007 from NewFFT import fft1X
00008 from slimpy_base.setup import *
00009 from slimpy_base import Execute
00010 from slimpy_base import vector
00011
00012
00013
00014 def new_fft_bldr( target, source, env ):
00015 """
00016 use our new fft operator
00017 """
00018 z = vector( source[0] )
00019
00020
00021 F = fft1X( z.space, sym=True, opt=False )
00022
00023 x = F*z
00024
00025 scal_max = x.norm( 1 )
00026
00027 tmp = x - scal_max
00028
00029 res = F.adj( ) * tmp
00030
00031 res.setName( 'fftRes' )
00032
00033 Execute( )
00034
00035
00036 if __name__ == '__main__':
00037
00038 Parameters( 'target', 'source' )
00039
00040
00041
00042 check_required( 'target' )
00043 check_required( 'source' )
00044
00045 env = parse_args( )
00046
00047
00048 target = [env.pop( 'target' )]
00049 source = [env.pop( 'source' )]
00050
00051 new_fft_bldr( target, source, env )
00052
00053
00054 else:
00055
00056
00057 __all__ = ['New_FFT']
00058
00059
00060 from slimproj_core.builders.CreateBuilders import add_to_slim_env
00061
00062 New_FFT = add_to_slim_env("New_FFT", new_fft_bldr )
00063