From 14f7cf4fff4565377245643595a02b22f4b71078 Mon Sep 17 00:00:00 2001 From: Lindsey Heagy Date: Thu, 5 Nov 2015 14:58:47 -0800 Subject: [PATCH] test 4 source types for cross check --- tests/em/fdem/forward/test_FDEM_forward.py | 67 +++++++++------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/tests/em/fdem/forward/test_FDEM_forward.py b/tests/em/fdem/forward/test_FDEM_forward.py index b9fcf74e..4f2bfd1f 100644 --- a/tests/em/fdem/forward/test_FDEM_forward.py +++ b/tests/em/fdem/forward/test_FDEM_forward.py @@ -17,7 +17,7 @@ MU = mu_0 freq = 1e-1 addrandoms = True -SrcType = 'RawVec' #or 'MAgDipole_Bfield', 'CircularLoop', 'RawVec' +SrcList = ['RawVec', 'MagDipole_Bfield', 'MagDipole', 'CircularLoop'] def getProblem(fdemType, comp): @@ -35,58 +35,47 @@ def getProblem(fdemType, comp): XYZ = Utils.ndgrid(x,x,np.r_[0.]) Rx0 = EM.FDEM.RxFDEM(XYZ, comp) - if SrcType is 'MagDipole': - Src = EM.FDEM.SrcFDEM_MagDipole([Rx0], freq=freq, loc=np.r_[0.,0.,0.]) - elif SrcType is 'MagDipole_Bfield': - Src = EM.FDEM.SrcFDEM_MagDipole_Bfield([Rx0], freq=freq, loc=np.r_[0.,0.,0.]) - elif SrcType is 'CircularLoop': - Src2 = EM.FDEM.SrcFDEM_CircularLoop([Rx0], freq=freq, loc=np.r_[0.,0.,0.]) + Src = [] + + for SrcType in SrcList: + if SrcType is 'MagDipole': + Src.append(EM.FDEM.SrcFDEM_MagDipole([Rx0], freq=freq, loc=np.r_[0.,0.,0.])) + elif SrcType is 'MagDipole_Bfield': + Src.append(EM.FDEM.SrcFDEM_MagDipole_Bfield([Rx0], freq=freq, loc=np.r_[0.,0.,0.])) + elif SrcType is 'CircularLoop': + Src.append(EM.FDEM.SrcFDEM_CircularLoop([Rx0], freq=freq, loc=np.r_[0.,0.,0.])) + elif SrcType is 'RawVec': + if fdemType is 'e' or fdemType is 'b': + S_m = np.zeros(mesh.nF) + S_e = np.zeros(mesh.nE) + S_m[Utils.closestPoints(mesh,[0.,0.,0.],'Fz') + np.sum(mesh.vnF[:1])] = 1. + S_e[Utils.closestPoints(mesh,[0.,0.,0.],'Ez') + np.sum(mesh.vnE[:1])] = 1. + Src.append(EM.FDEM.SrcFDEM_RawVec([Rx0], freq, S_m, S_e)) + + elif fdemType is 'h' or fdemType is 'j': + S_m = np.zeros(mesh.nE) + S_e = np.zeros(mesh.nF) + S_m[Utils.closestPoints(mesh,[0.,0.,0.],'Ez') + np.sum(mesh.vnE[:1])] = 1. + S_e[Utils.closestPoints(mesh,[0.,0.,0.],'Fz') + np.sum(mesh.vnF[:1])] = 1. + Src.append(EM.FDEM.SrcFDEM_RawVec([Rx0], freq, S_m, S_e)) if verbose: print ' Fetching %s problem' % (fdemType) if fdemType == 'e': - if SrcType is 'RawVec': - S_m = np.zeros(mesh.nF) - S_e = np.zeros(mesh.nE) - S_m[Utils.closestPoints(mesh,[0.,0.,0.],'Fz') + np.sum(mesh.vnF[:1])] = 1. - S_e[Utils.closestPoints(mesh,[0.,0.,0.],'Ez') + np.sum(mesh.vnE[:1])] = 1. - Src = EM.FDEM.SrcFDEM_RawVec([Rx0], freq, S_m, S_e) - - survey = EM.FDEM.SurveyFDEM([Src]) + survey = EM.FDEM.SurveyFDEM(Src) prb = EM.FDEM.ProblemFDEM_e(mesh, mapping=mapping) elif fdemType == 'b': - if SrcType is 'RawVec': - S_m = np.zeros(mesh.nF) - S_e = np.zeros(mesh.nE) - S_m[Utils.closestPoints(mesh,[0.,0.,0.],'Fz') + np.sum(mesh.vnF[:1])] = 1. - S_e[Utils.closestPoints(mesh,[0.,0.,0.],'Ez') + np.sum(mesh.vnE[:1])] = 1. - Src = EM.FDEM.SrcFDEM_RawVec([Rx0], freq, S_m, S_e) - - survey = EM.FDEM.SurveyFDEM([Src]) + survey = EM.FDEM.SurveyFDEM(Src) prb = EM.FDEM.ProblemFDEM_b(mesh, mapping=mapping) elif fdemType == 'j': - if SrcType is 'RawVec': - S_m = np.zeros(mesh.nE) - S_e = np.zeros(mesh.nF) - S_m[Utils.closestPoints(mesh,[0.,0.,0.],'Ez') + np.sum(mesh.vnE[:1])] = 1. - S_e[Utils.closestPoints(mesh,[0.,0.,0.],'Fz') + np.sum(mesh.vnF[:1])] = 1. - Src = EM.FDEM.SrcFDEM_RawVec([Rx0], freq, S_m, S_e) - - survey = EM.FDEM.SurveyFDEM([Src]) + survey = EM.FDEM.SurveyFDEM(Src) prb = EM.FDEM.ProblemFDEM_j(mesh, mapping=mapping) elif fdemType == 'h': - if SrcType is 'RawVec': - S_m = np.zeros(mesh.nE) - S_e = np.zeros(mesh.nF) - S_m[Utils.closestPoints(mesh,[0.,0.,0.],'Ez') + np.sum(mesh.vnE[:1])] = 1. - S_e[Utils.closestPoints(mesh,[0.,0.,0.],'Fz') + np.sum(mesh.vnF[:1])] = 1. - Src = EM.FDEM.SrcFDEM_RawVec([Rx0], freq, S_m, S_e) - - survey = EM.FDEM.SurveyFDEM([Src]) + survey = EM.FDEM.SurveyFDEM(Src) prb = EM.FDEM.ProblemFDEM_h(mesh, mapping=mapping) else: