diff --git a/simpegEM/FDEM/SurveyFDEM.py b/simpegEM/FDEM/SurveyFDEM.py index 67db6674..dce06ba5 100644 --- a/simpegEM/FDEM/SurveyFDEM.py +++ b/simpegEM/FDEM/SurveyFDEM.py @@ -1,4 +1,4 @@ -from SimPEG import Survey, Utils, np, sp +from SimPEG import Survey, Problem, Utils, np, sp class RxFDEM(Survey.BaseRx): @@ -79,7 +79,7 @@ class TxFDEM(Survey.BaseTx): -class FieldsFDEM(Survey.Fields): +class FieldsFDEM(Problem.Fields): """Fancy Field Storage for a FDEM survey.""" knownFields = {'b': 'F', 'e': 'E'} dtype = complex diff --git a/simpegEM/TDEM/BaseTDEM.py b/simpegEM/TDEM/BaseTDEM.py index 8b876f45..d12e776e 100644 --- a/simpegEM/TDEM/BaseTDEM.py +++ b/simpegEM/TDEM/BaseTDEM.py @@ -1,7 +1,6 @@ -from SimPEG import Solver +from SimPEG import Solver, Problem from SimPEG.Problem import BaseTimeProblem from simpegEM.Utils import Sources -from SurveyTDEM import FieldsTDEM, SurveyTDEM from scipy.constants import mu_0 from SimPEG.Utils import sdiag, mkvc from SimPEG import Utils, Mesh @@ -9,12 +8,33 @@ from simpegEM.Base import BaseEMProblem import numpy as np +class FieldsTDEM(Problem.TimeFields): + """Fancy Field Storage for a TDEM survey.""" + knownFields = {'b': 'F', 'e': 'E'} + + def tovec(self): + nTx, nF, nE = self.survey.nTx, self.mesh.nF, self.mesh.nE + u = np.empty(0 if nTx == 1 else (0, nTx)) + + for i in range(self.survey.prob.nT): + if 'b' in self: + b = self[:,'b',i+1] + else: + b = np.zeros(nF if nTx == 1 else (nF, nTx)) + + if 'e' in self: + e = self[:,'e',i+1] + else: + e = np.zeros(nE if nTx == 1 else (nE, nTx)) + u = np.concatenate((u, b, e)) + return Utils.mkvc(u) + + class BaseTDEMProblem(BaseTimeProblem, BaseEMProblem): """docstring for ProblemTDEM1D""" def __init__(self, mesh, mapping=None, **kwargs): BaseTimeProblem.__init__(self, mesh, mapping=mapping, **kwargs) - surveyPair = SurveyTDEM _FieldsForward_pair = FieldsTDEM #: used for the forward calculation only def fields(self, m): diff --git a/simpegEM/TDEM/SurveyTDEM.py b/simpegEM/TDEM/SurveyTDEM.py index c9a67856..b4cc1b5d 100644 --- a/simpegEM/TDEM/SurveyTDEM.py +++ b/simpegEM/TDEM/SurveyTDEM.py @@ -1,6 +1,7 @@ from SimPEG import Utils, Survey, np from SimPEG.Survey import BaseSurvey from simpegEM.Utils import Sources +from BaseTDEM import FieldsTDEM class RxTDEM(Survey.BaseTimeRx): @@ -64,27 +65,6 @@ class RxTDEM(Survey.BaseTimeRx): return P.T * v[tx, self] -class FieldsTDEM(Survey.TimeFields): - """Fancy Field Storage for a TDEM survey.""" - knownFields = {'b': 'F', 'e': 'E'} - - def tovec(self): - nTx, nF, nE = self.survey.nTx, self.mesh.nF, self.mesh.nE - u = np.empty(0 if nTx == 1 else (0, nTx)) - - for i in range(self.survey.prob.nT): - if 'b' in self: - b = self[:,'b',i+1] - else: - b = np.zeros(nF if nTx == 1 else (nF, nTx)) - - if 'e' in self: - e = self[:,'e',i+1] - else: - e = np.zeros(nE if nTx == 1 else (nE, nTx)) - u = np.concatenate((u, b, e)) - return Utils.mkvc(u) - class TxTDEM(Survey.BaseTx): rxPair = RxTDEM knownTxTypes = ['VMD_MVP'] diff --git a/simpegEM/TDEM/TDEM_b.py b/simpegEM/TDEM/TDEM_b.py index 90e91ea3..a9acc181 100644 --- a/simpegEM/TDEM/TDEM_b.py +++ b/simpegEM/TDEM/TDEM_b.py @@ -1,7 +1,7 @@ -from BaseTDEM import BaseTDEMProblem +from BaseTDEM import BaseTDEMProblem, FieldsTDEM from SimPEG.Utils import mkvc import numpy as np -from SurveyTDEM import SurveyTDEM, FieldsTDEM +from SurveyTDEM import SurveyTDEM class FieldsTDEM_e_from_b(FieldsTDEM): diff --git a/simpegEM/TDEM/__init__.py b/simpegEM/TDEM/__init__.py index fed1a2dc..15ff3f43 100644 --- a/simpegEM/TDEM/__init__.py +++ b/simpegEM/TDEM/__init__.py @@ -1,3 +1,3 @@ -from SurveyTDEM import SurveyTDEM, FieldsTDEM, RxTDEM, TxTDEM -from BaseTDEM import BaseTDEMProblem +from SurveyTDEM import SurveyTDEM, RxTDEM, TxTDEM +from BaseTDEM import BaseTDEMProblem, FieldsTDEM from TDEM_b import ProblemTDEM_b