From 11e6b452c96cf419e0f36224975c7c8fdbba8a8b Mon Sep 17 00:00:00 2001 From: Lindsey Heagy Date: Tue, 10 May 2016 17:26:16 -0700 Subject: [PATCH] renamed FDEM.py to ProblemFDEM.py, changed real_or_imag to component --- SimPEG/EM/FDEM/{FDEM.py => ProblemFDEM.py} | 4 +-- SimPEG/EM/FDEM/RxFDEM.py | 40 +++++++++++----------- SimPEG/EM/FDEM/__init__.py | 2 +- SimPEG/Examples/EM_FDEM_1D_Inversion.py | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) rename SimPEG/EM/FDEM/{FDEM.py => ProblemFDEM.py} (99%) diff --git a/SimPEG/EM/FDEM/FDEM.py b/SimPEG/EM/FDEM/ProblemFDEM.py similarity index 99% rename from SimPEG/EM/FDEM/FDEM.py rename to SimPEG/EM/FDEM/ProblemFDEM.py index 026230c6..75b05bf9 100644 --- a/SimPEG/EM/FDEM/FDEM.py +++ b/SimPEG/EM/FDEM/ProblemFDEM.py @@ -137,9 +137,9 @@ class BaseFDEMProblem(BaseEMProblem): df_dmT = df_dmT + du_dmT # TODO: this should be taken care of by the reciever? - if rx.real_or_imag is 'real': + if rx.component is 'real': Jtv += np.array(df_dmT, dtype=complex).real - elif rx.real_or_imag is 'imag': + elif rx.component is 'imag': Jtv += - np.array(df_dmT, dtype=complex).real else: raise Exception('Must be real or imag') diff --git a/SimPEG/EM/FDEM/RxFDEM.py b/SimPEG/EM/FDEM/RxFDEM.py index ef58d807..f15040fb 100644 --- a/SimPEG/EM/FDEM/RxFDEM.py +++ b/SimPEG/EM/FDEM/RxFDEM.py @@ -7,15 +7,15 @@ class BaseRx(SimPEG.Survey.BaseRx): :param numpy.ndarray locs: receiver locations (ie. :code:`np.r_[x,y,z]`) :param string orientation: receiver orientation 'x', 'y' or 'z' - :param string real_or_imag: real or imaginary component 'real' or 'imag' + :param string component: real or imaginary component 'real' or 'imag' """ - def __init__(self, locs, orientation=None, real_or_imag=None): + def __init__(self, locs, orientation=None, component=None): assert(orientation in ['x','y','z']), "Orientation %s not known. Orientation must be in 'x', 'y', 'z'. Arbitrary orientations have not yet been implemented."%orientation - assert(real_or_imag in ['real', 'imag']), "'real_or_imag' must be 'real' or 'imag', not %s"%real_or_imag + assert(component in ['real', 'imag']), "'component' must be 'real' or 'imag', not %s"%component self.projComp = orientation - self.real_or_imag = real_or_imag + self.component = component SimPEG.Survey.BaseRx.__init__(self, locs, rxType=None) #TODO: remove rxType from baseRx @@ -36,7 +36,7 @@ class BaseRx(SimPEG.Survey.BaseRx): P = self.getP(mesh, self.projGLoc(f)) f_part_complex = f[src, self.projField] - f_part = getattr(f_part_complex, self.real_or_imag) # get the real or imag component + f_part = getattr(f_part_complex, self.component) # get the real or imag component return P*f_part @@ -56,13 +56,13 @@ class BaseRx(SimPEG.Survey.BaseRx): if not adjoint: Pv_complex = P * v - Pv = getattr(Pv_complex, self.real_or_imag) + Pv = getattr(Pv_complex, self.component) elif adjoint: Pv_real = P.T * v - if self.real_or_imag == 'imag': + if self.component == 'imag': Pv = 1j*Pv_real - elif self.real_or_imag == 'real': + elif self.component == 'real': Pv = Pv_real.astype(complex) else: raise NotImplementedError('must be real or imag') @@ -76,12 +76,12 @@ class eField(BaseRx): :param numpy.ndarray locs: receiver locations (ie. :code:`np.r_[x,y,z]`) :param string orientation: receiver orientation 'x', 'y' or 'z' - :param string real_or_imag: real or imaginary component 'real' or 'imag' + :param string component: real or imaginary component 'real' or 'imag' """ - def __init__(self, locs, orientation=None, real_or_imag=None): + def __init__(self, locs, orientation=None, component=None): self.projField = 'e' - BaseRx.__init__(self, locs, orientation, real_or_imag) + BaseRx.__init__(self, locs, orientation, component) class bField(BaseRx): @@ -90,12 +90,12 @@ class bField(BaseRx): :param numpy.ndarray locs: receiver locations (ie. :code:`np.r_[x,y,z]`) :param string orientation: receiver orientation 'x', 'y' or 'z' - :param string real_or_imag: real or imaginary component 'real' or 'imag' + :param string component: real or imaginary component 'real' or 'imag' """ - def __init__(self, locs, orientation=None, real_or_imag=None): + def __init__(self, locs, orientation=None, component=None): self.projField = 'b' - BaseRx.__init__(self, locs, orientation, real_or_imag) + BaseRx.__init__(self, locs, orientation, component) class hField(BaseRx): @@ -104,12 +104,12 @@ class hField(BaseRx): :param numpy.ndarray locs: receiver locations (ie. :code:`np.r_[x,y,z]`) :param string orientation: receiver orientation 'x', 'y' or 'z' - :param string real_or_imag: real or imaginary component 'real' or 'imag' + :param string component: real or imaginary component 'real' or 'imag' """ - def __init__(self, locs, orientation=None, real_or_imag=None): + def __init__(self, locs, orientation=None, component=None): self.projField = 'h' - BaseRx.__init__(self, locs, orientation, real_or_imag) + BaseRx.__init__(self, locs, orientation, component) class jField(BaseRx): @@ -118,9 +118,9 @@ class jField(BaseRx): :param numpy.ndarray locs: receiver locations (ie. :code:`np.r_[x,y,z]`) :param string orientation: receiver orientation 'x', 'y' or 'z' - :param string real_or_imag: real or imaginary component 'real' or 'imag' + :param string component: real or imaginary component 'real' or 'imag' """ - def __init__(self, locs, orientation=None, real_or_imag=None): + def __init__(self, locs, orientation=None, component=None): self.projField = 'j' - BaseRx.__init__(self, locs, orientation, real_or_imag) + BaseRx.__init__(self, locs, orientation, component) diff --git a/SimPEG/EM/FDEM/__init__.py b/SimPEG/EM/FDEM/__init__.py index 1701fe3e..c4ff6451 100644 --- a/SimPEG/EM/FDEM/__init__.py +++ b/SimPEG/EM/FDEM/__init__.py @@ -1,5 +1,5 @@ from SurveyFDEM import Survey import SrcFDEM as Src import RxFDEM as Rx -from FDEM import Problem3D_e, Problem3D_b, Problem3D_j, Problem3D_h +from ProblemFDEM import Problem3D_e, Problem3D_b, Problem3D_j, Problem3D_h from FieldsFDEM import Fields3D_e, Fields3D_b, Fields3D_j, Fields3D_h diff --git a/SimPEG/Examples/EM_FDEM_1D_Inversion.py b/SimPEG/Examples/EM_FDEM_1D_Inversion.py index 0a5c59a0..95e3f09f 100644 --- a/SimPEG/Examples/EM_FDEM_1D_Inversion.py +++ b/SimPEG/Examples/EM_FDEM_1D_Inversion.py @@ -43,7 +43,7 @@ def run(plotIt=True): rxOffset=10. - bzi = EM.FDEM.Rx.bField(np.array([[rxOffset, 0., 1e-3]]), orientation='z', real_or_imag='imag') + bzi = EM.FDEM.Rx.bField(np.array([[rxOffset, 0., 1e-3]]), orientation='z', component='imag') freqs = np.logspace(1,3,10) srcLoc = np.array([0., 0., 10.])