diff --git a/.travis.yml b/.travis.yml index 6aef1f7f..59c1fa2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,11 +17,8 @@ before_install: install: - conda install --yes pip python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib cython - pip install nose-cov python-coveralls - # Remove this when SimPEG is on pip - - git clone https://github.com/simpeg/simpeg.git - - cd simpeg/ + # - pip install -r requirements.txt - python setup.py install - - cd ../ # Run test script: @@ -35,3 +32,4 @@ notifications: email: - rowanc1@gmail.com - sgkang09@gmail.com + - lindseyheagy@gmail.com diff --git a/simpegEM/Base.py b/simpegEM/Base.py index 373cee75..c22252fa 100644 --- a/simpegEM/Base.py +++ b/simpegEM/Base.py @@ -17,15 +17,31 @@ class BaseEMProblem(Problem.BaseProblem): verbose = False + + #################################################### + # Mu Model + #################################################### + @property + def mu(self): + if getattr(self, '_mu', None) is None: + self._mu = mu_0 + return self._mu + @mu.setter + def mu(self, value): + if getattr(self, '_MfMui', None) is not None: + del self._MfMui + self._mu = value + + + #################################################### # Mass Matrices #################################################### @property def MfMui(self): - #TODO: assuming constant mu if getattr(self, '_MfMui', None) is None: - self._MfMui = self.mesh.getFaceInnerProduct(1/mu_0) + self._MfMui = self.mesh.getFaceInnerProduct(1/self.mu) return self._MfMui @property diff --git a/simpegEM/Tests/test_FDEM.py b/simpegEM/Tests/test_FDEM.py index af727785..e1d8f1c5 100644 --- a/simpegEM/Tests/test_FDEM.py +++ b/simpegEM/Tests/test_FDEM.py @@ -7,7 +7,7 @@ from scipy.constants import mu_0 TOL = 1e-4 CONDUCTIVITY = 1e3 MU = mu_0 -addrandoms = True +addrandoms = True def getProblem(fdemType, comp): cs = 5. @@ -48,11 +48,11 @@ def adjointTest(fdemType, comp): print 'Adjoint %s formulation - %s' % (fdemType, comp) m = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY) - mu = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY) + mu = np.log(np.ones(prb.mesh.nC)*MU) 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 + mu = mu + np.random.randn(prb.mesh.nC)*MU*1e-3 prb.mu = mu survey = prb.survey @@ -71,11 +71,13 @@ def derivTest(fdemType, comp): prb = getProblem(fdemType, comp) print '%s formulation - %s' % (fdemType, comp) x0 = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY) + mu = np.log(np.ones(prb.mesh.nC)*MU) 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 + mu = mu + np.random.randn(prb.mesh.nC)*MU*1e-3 + prb.mu = mu survey = prb.survey def fun(x): return survey.dpred(x), lambda x: prb.Jvec(x0, x)