From 2070bca0a680f43a1f4392f0e1c9462e4455dc1b Mon Sep 17 00:00:00 2001 From: rowanc1 Date: Fri, 14 Feb 2014 13:51:17 -0800 Subject: [PATCH] Update to current version of develop in SimPEG --- simpegEM/FDEM/RHSem.py | 24 ++++++++++++------------ simpegEM/Tests/test_forward_EMproblem.py | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/simpegEM/FDEM/RHSem.py b/simpegEM/FDEM/RHSem.py index 4ea411cb..2d498e1b 100644 --- a/simpegEM/FDEM/RHSem.py +++ b/simpegEM/FDEM/RHSem.py @@ -5,10 +5,10 @@ def ismember(a, b): return tf def path2edgeModel(mesh, pts): - edm_x = np.zeros(np.prod(mesh.nEx)) - edm_y = np.zeros(np.prod(mesh.nEy)) - edm_z = np.zeros(np.prod(mesh.nEz)) - + edm_x = np.zeros(np.prod(mesh.vnEx)) + edm_y = np.zeros(np.prod(mesh.vnEy)) + edm_z = np.zeros(np.prod(mesh.vnEz)) + for ii in range (pts.shape[0]-1): pt1 = pts[ii,:] pt2 = pts[ii+1,:] @@ -25,7 +25,7 @@ def path2edgeModel(mesh, pts): edm_x[edgeInd] = delDir # print '>> x-direction', ii # print mesh.gridEx[edgeInd] - if deltaDim == 1: + if deltaDim == 1: xLoc = pts[ii,0] yLoc = mesh.vectorCCy[(min(pt1[1],pt2[1]) < mesh.vectorCCy ) & (mesh.vectorCCy < max(pt1[1],pt2[1]))] zLoc = pts[ii,2] @@ -35,7 +35,7 @@ def path2edgeModel(mesh, pts): edm_y[edgeInd] = delDir # print '>> y-direction', ii # print mesh.gridEy[edgeInd] - if deltaDim == 2: + if deltaDim == 2: xLoc = pts[ii,0] yLoc = pts[ii,1] zLoc = mesh.vectorCCz[(min(pt1[2],pt2[2]) < mesh.vectorCCz ) & (mesh.vectorCCz < max(pt1[2],pt2[2]))] @@ -45,8 +45,8 @@ def path2edgeModel(mesh, pts): edm_z[edgeInd] = delDir # print '>> z-direction', ii # print mesh.gridEz[edgeInd] - - + + edgeModel = np.r_[edm_x, edm_y, edm_z] return edgeModel @@ -67,7 +67,7 @@ def MMRhalf(loc1, loc2, x, y): y2=loc2[1] mu0 = 4*np.pi*1e-7 I = 1 - By =mu0*I/(4*np.pi)*np.array((x-x1)/rho(x1,y1,x,y)**2-(x-x2)/rho(x2,y2,x,y)**2) - Bx =mu0*I/(4*np.pi)*np.array(-(y-y1)/rho(x1,y1,x,y)**2+(y-y2)/rho(x2,y2,x,y)**2) - - return Bx, By \ No newline at end of file + By =mu0*I/(4*np.pi)*np.array((x-x1)/rho(x1,y1,x,y)**2-(x-x2)/rho(x2,y2,x,y)**2) + Bx =mu0*I/(4*np.pi)*np.array(-(y-y1)/rho(x1,y1,x,y)**2+(y-y2)/rho(x2,y2,x,y)**2) + + return Bx, By diff --git a/simpegEM/Tests/test_forward_EMproblem.py b/simpegEM/Tests/test_forward_EMproblem.py index 7ef0dadd..1334a632 100644 --- a/simpegEM/Tests/test_forward_EMproblem.py +++ b/simpegEM/Tests/test_forward_EMproblem.py @@ -210,7 +210,7 @@ class TDEM_bDerivTests(unittest.TestCase): d_sig[d_sig==1e-8] = 0 - derChk = lambda m: [prb.data.dpred(m), lambda mx: -prb.J(sigma, mx)] + derChk = lambda m: [prb.data.dpred(m), lambda mx: -prb.Jvec(sigma, mx)] passed = Tests.checkDerivative(derChk, sigma, plotIt=False, dx=d_sig, num=2, eps=1e-20) self.assertTrue(passed)