00001
00002
00003
00004 from slimpy_base.Core.User.linop.rclinOp import linearop_r as LinearOperatorStruct
00005 from numpy import ceil
00006 from slimpy_base.api.Plugins.slim2rsf.sfCommandFactory import rsfCommandFactory
00007 from slimpy_base.api.Plugins.slim2rsf.sfcommands.sfConverter import sfConverter
00008
00009
00010
00011
00012
00013
00014 class imospray_Converter( sfConverter ):
00015 """
00016 This is a mapping instance that maps a SLIMpy command into an object that
00017 can be run
00018 This also maps the agruments and keyword arguments to be pugin specific
00019 """
00020
00021 @classmethod
00022 def map( cls, source, command ):
00023 """
00024 map a SLIMpy command to a rsf command
00025 """
00026
00027 command = cls.default_function( command, "imospray" )
00028
00029 command = cls.truefalseHelper( command )
00030
00031 return cls.pack( command )
00032
00033 @classmethod
00034 def trans( cls, command, space, *spaces ):
00035 'define how this operator affect the space'
00036
00037 n2 = command['n2']
00038 space["n2"] = n2
00039 return space
00040
00041 @classmethod
00042 def trans_adj( cls, command, space, *spaces ):
00043 """
00044 trans_adj will automatically be called in the case
00045 where the command has an adj keyword that is true
00046 """
00047 space['n2']= 1
00048 return space
00049
00050 @classmethod
00051 def constr( cls, command, space ):
00052 'make sure the data on the forward command is float'
00053 cls.match( space, data_type='float' )
00054
00055 @classmethod
00056 def constr_adj( cls, command, space ):
00057 'make sure the data on the adjoint command is float'
00058 cls.match( space, data_type='float' )
00059
00060
00061
00062
00063
00064 class IMOSpray( LinearOperatorStruct ):
00065 """
00066 Inversion of constant-velocity nearest-neighbor inverse NMO
00067 """
00068 name = "imospray"
00069
00070 def __init__( self, domain, n2, d2=200,o2=0, velocity=1000, adj=False ):
00071
00072 kparams = dict( n2=n2, d2=d2,o2=o2, v=velocity, adj=adj )
00073
00074 LinearOperatorStruct.__init__( self, domain, **kparams )
00075
00076
00077
00078
00079
00080 factory = rsfCommandFactory()
00081
00082
00083
00084
00085 factory['imospray'] = imospray_Converter
00086