00001 """
00002 Linear Operators relating to fft
00003 """
00004
00005 __copyright__ = """
00006 Copyright 2008 Sean Ross-Ross
00007 """
00008 __license__ = """
00009 This file is part of SLIMpy .
00010
00011 SLIMpy is free software: you can redistribute it and/or modify
00012 it under the terms of the GNU Lesser General Public License as published by
00013 the Free Software Foundation, either version 3 of the License, or
00014 (at your option) any later version.
00015
00016 SLIMpy is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 GNU Lesser General Public License for more details.
00020
00021 You should have received a copy of the GNU Lesser General Public License
00022 along with SLIMpy . If not, see <http://www.gnu.org/licenses/>.
00023 """
00024
00025
00026 from slimpy_base.Core.User.linop.rclinOp import linearop_r as LinearOperatorStruct
00027 from slimpy_base.Core.User.linop.linear_operator import CompoundOperator
00028 from slimpy_base.Core.User.linop.linear_operator import LinearOperatorType
00029
00030
00031
00032
00033
00034 class fft1( LinearOperatorStruct ):
00035 """
00036 F = fft1( domain, sym=True, opt=False, adj=False )
00037 Fourier transfrorm on the first axis
00038 """
00039 name = "fft1"
00040 __block_diagonal__ = True
00041 def __init__( self, inSpace, sym=True, opt=False, adj=False ):
00042
00043 kparams = dict( sym=sym, opt=opt, adj=adj )
00044
00045 LinearOperatorStruct.__init__( self, inSpace, **kparams )
00046
00047
00048
00049 class fft( LinearOperatorStruct ):
00050 """
00051 F = fft( inSpace, sym=True, opt=False, pad=1, axis=2, adj=False )
00052 Fourier transform on any axis
00053 """
00054 name = "fft"
00055 __block_diagonal__ = True
00056
00057
00058
00059
00060
00061
00062
00063
00064 def __init__( self, inSpace, sym=True, opt=False, pad=1, axis=2, adj=False ):
00065
00066 kparams = dict( sym=sym, opt=opt, pad=pad, axis=axis, adj=adj )
00067
00068 LinearOperatorStruct.__init__( self, inSpace, **kparams )
00069
00070
00071
00072
00073
00074
00075 @LinearOperatorType
00076 def fft2( inSpace, sym=True, opt=False ):
00077 """
00078 F = fft2( dom, sym=True, opt=False )
00079 The fourier transform in two dimensions
00080 """
00081 f1 = fft1( inSpace, sym=sym, opt=opt )
00082 f2 = fft( f1.range(), sym=sym, opt=opt, axis=2 )
00083
00084 return CompoundOperator( [f2, f1] )
00085
00086
00087
00088
00089
00090
00091 @LinearOperatorType
00092 def fft3( inSpace, sym=True, opt=False ):
00093 """
00094 F = fft3( dom, sym=True, opt=False )
00095 The fourier transform in three dimensions
00096 """
00097 f1 = fft1( inSpace, sym=sym, opt=opt )
00098 f2 = fft( f1.outSpace, sym=sym, opt=opt, axis=2 )
00099 f3 = fft( f2.outSpace, sym=sym, opt=opt, axis=3 )
00100
00101 return CompoundOperator( [f3, f2, f1] )