From 71881c7ce8d51055b0dace1fee876f820d1ac1bb Mon Sep 17 00:00:00 2001 From: Lindsey Date: Tue, 24 Feb 2015 11:43:59 -0800 Subject: [PATCH] - added capability for adding a mu model - added variable mu in the FDEM testing - also added capability to add a small random vector to sigma and mu for testing --- simpegEM/Tests/test_FDEM.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/simpegEM/Tests/test_FDEM.py b/simpegEM/Tests/test_FDEM.py index a76ad539..af727785 100644 --- a/simpegEM/Tests/test_FDEM.py +++ b/simpegEM/Tests/test_FDEM.py @@ -2,9 +2,12 @@ import unittest from SimPEG import * import simpegEM as EM import sys +from scipy.constants import mu_0 TOL = 1e-4 CONDUCTIVITY = 1e3 +MU = mu_0 +addrandoms = True def getProblem(fdemType, comp): cs = 5. @@ -44,7 +47,14 @@ def adjointTest(fdemType, comp): prb = getProblem(fdemType, comp) print 'Adjoint %s formulation - %s' % (fdemType, comp) - m = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY) + m = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY) + mu = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY) + + if addrandoms is True: + m = m + np.random.randn(prb.mesh.nC)*CONDUCTIVITY*1e-3 + mu = mu + np.random.randn(prb.mesh.nC)*CONDUCTIVITY*1e-3 + + prb.mu = mu survey = prb.survey v = np.random.rand(survey.nD) @@ -61,6 +71,11 @@ def derivTest(fdemType, comp): prb = getProblem(fdemType, comp) print '%s formulation - %s' % (fdemType, comp) x0 = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY) + + if addrandoms is True: + x0 = x0 + np.random.randn(prb.mesh.nC)*CONDUCTIVITY*1e-3 + mu = mu + np.random.randn(prb.mesh.nC)*CONDUCTIVITY*1e-3 + survey = prb.survey def fun(x): return survey.dpred(x), lambda x: prb.Jvec(x0, x)