mirror of
https://github.com/wassname/simpeg.git
synced 2026-09-12 12:51:28 +08:00
Updates to data objects.
This commit is contained in:
@@ -26,10 +26,10 @@ class FDEM_bDerivTests(unittest.TestCase):
|
||||
rxList = EM.FDEM.RxListFDEM(XYZ, 'Ex')
|
||||
Tx0 = EM.FDEM.TxFDEM(None, 'VMD', 3, rxList)
|
||||
|
||||
dat = EM.FDEM.SurveyFDEM([Tx0])
|
||||
survey = EM.FDEM.SurveyFDEM([Tx0])
|
||||
|
||||
prb = EM.FDEM.ProblemFDEM_e(model)
|
||||
prb.pair(dat)
|
||||
prb.pair(survey)
|
||||
|
||||
sigma = np.log(np.ones(mesh.nC)*1e-3)
|
||||
|
||||
@@ -42,15 +42,23 @@ class FDEM_bDerivTests(unittest.TestCase):
|
||||
|
||||
self.sigma = sigma
|
||||
self.prb = prb
|
||||
self.dat = dat
|
||||
self.survey = survey
|
||||
|
||||
def test_JVec(self):
|
||||
def test_Jvec(self):
|
||||
x0 = self.sigma
|
||||
def fun(x):
|
||||
return self.dat.dpred(x), lambda x: self.prb.Jvec(x0, x)
|
||||
return self.survey.dpred(x), lambda x: self.prb.Jvec(x0, x)
|
||||
passed = Tests.checkDerivative(fun, x0, num=3, plotIt=False)
|
||||
self.assertTrue(passed)
|
||||
|
||||
# def test_Jtvec(self):
|
||||
# v = self.survey.nD
|
||||
# x0 = self.sigma
|
||||
# def fun(x):
|
||||
# return self.survey.dpred(x), lambda x: self.prb.Jvec(x0, x)
|
||||
# passed = Tests.checkDerivative(fun, x0, num=3, plotIt=False)
|
||||
# self.assertTrue(passed)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -16,6 +16,7 @@ class FieldsTest(unittest.TestCase):
|
||||
mesh = Mesh.TensorMesh([np.ones(n)*5 for n in [10,11,12]],[0,0,-30])
|
||||
survey = EM.FDEM.SurveyFDEM(txList)
|
||||
self.F = EM.FDEM.FieldsFDEM(mesh, survey)
|
||||
self.D = EM.FDEM.DataFDEM(survey)
|
||||
self.Tx0 = Tx0
|
||||
self.Tx1 = Tx1
|
||||
|
||||
@@ -68,6 +69,20 @@ class FieldsTest(unittest.TestCase):
|
||||
self.assertRaises(AssertionError, EM.FDEM.SurveyFDEM, txs)
|
||||
|
||||
|
||||
def test_dataFDEM(self):
|
||||
V = []
|
||||
for tx in self.D.survey.txList:
|
||||
v = np.random.rand(tx.nD)
|
||||
V += [v]
|
||||
self.D[tx] = v
|
||||
self.assertTrue(np.all(v == self.D[tx]))
|
||||
V = np.concatenate(V)
|
||||
self.assertTrue(np.all(V == Utils.mkvc(self.D)))
|
||||
|
||||
D2 = EM.FDEM.DataFDEM(self.D.survey, V)
|
||||
self.assertTrue(np.all(Utils.mkvc(D2) == Utils.mkvc(self.D)))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user