move fields to problem

This commit is contained in:
rowanc1
2014-05-18 23:12:58 -07:00
parent f4a38e1165
commit bbf2a2a7f3
5 changed files with 30 additions and 30 deletions
+2 -2
View File
@@ -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
+23 -3
View File
@@ -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):
+1 -21
View File
@@ -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']
+2 -2
View File
@@ -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):
+2 -2
View File
@@ -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