mirror of
https://github.com/wassname/simpeg.git
synced 2026-09-12 12:51:28 +08:00
Changed Data --> Survey
This commit is contained in:
@@ -20,7 +20,7 @@ class MagFwdProblemTests(unittest.TestCase):
|
||||
sph_ind = PF.MagAnalytics.spheremodel(M, 0., 0., 0., 100)
|
||||
chi[sph_ind] = chiblk
|
||||
model = PF.BaseMag.BaseMagModel(M)
|
||||
prob = PF.Magnetics.MagneticsDiffSecondary(M, model)
|
||||
prob = PF.Magnetics.MagneticsDiffSecondary(model)
|
||||
self.prob = prob
|
||||
self.M = M
|
||||
self.chi = chi
|
||||
@@ -28,39 +28,31 @@ class MagFwdProblemTests(unittest.TestCase):
|
||||
|
||||
def test_anal_forward(self):
|
||||
|
||||
data = PF.BaseMag.BaseMagData()
|
||||
survey = PF.BaseMag.BaseMagSurvey()
|
||||
|
||||
Inc = 45.
|
||||
Dec = 45.
|
||||
Btot = 51000
|
||||
|
||||
b0 = PF.MagAnalytics.IDTtoxyz(Inc, Dec, Btot)
|
||||
data.setBackgroundField(Inc, Dec, Btot)
|
||||
survey.setBackgroundField(Inc, Dec, Btot)
|
||||
xr = np.linspace(-300, 300, 41)
|
||||
yr = np.linspace(-300, 300, 41)
|
||||
X, Y = np.meshgrid(xr, yr)
|
||||
Z = np.ones((xr.size, yr.size))*150
|
||||
rxLoc = np.c_[Utils.mkvc(X), Utils.mkvc(Y), Utils.mkvc(Z)]
|
||||
data.rxLoc = rxLoc
|
||||
survey.rxLoc = rxLoc
|
||||
|
||||
self.prob.pair(data)
|
||||
self.prob.pair(survey)
|
||||
u = self.prob.fields(self.chi)
|
||||
B = u['B']
|
||||
|
||||
bxa,bya,bza = PF.MagAnalytics.MagSphereAnalFunA(rxLoc[:,0],rxLoc[:,1],rxLoc[:,2],100.,0.,0.,0.,0.01, b0,'secondary')
|
||||
|
||||
dpred = data.projectFieldsAsVector(B)
|
||||
dpred = survey.projectFieldsAsVector(B)
|
||||
err = np.linalg.norm(dpred-np.r_[bxa, bya, bza])/np.linalg.norm(np.r_[bxa, bya, bza])
|
||||
|
||||
# plt.plot(dpred)
|
||||
# plt.plot(np.r_[bxa, bya, bza])
|
||||
# plt.show()
|
||||
|
||||
if err > 0.05:
|
||||
raise Exception('Anaytic test is failed T.T')
|
||||
else:
|
||||
print "Anaytic test is passed"
|
||||
pass
|
||||
self.assertTrue(err < 0.05)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user