def setup(self, loop): self.model = { 'src': [0, 0, 990], 'depth': [0, 1000, 2000, 2100], 'res': [2e14, 0.3, 1, 100, 1], 'xdirect': False, 'htarg': HTARG201, 'loop': loop, 'verb': 0 } if not VERSION2: self.model['opt'] = None self.freqtime = np.logspace(-2, 2, 21) self.fmodel = dc(self.model) self.tmodel = dc(self.model) # Till c73d6647 (btw. v1.0.0 and v1.1.0) there were the routines # `frequency` and `time`, which were later merged into `dipole`. try: # Test model.dipole([0, 0, 1], [10, 0, 2], [], 1, 1, verb=0) # Frequency self.freq = model.dipole self.fmodel['freqtime'] = self.freqtime # Time self.time = model.dipole self.tmodel['freqtime'] = self.freqtime except VariableCatch: # Frequency self.freq = model.frequency self.fmodel['freq'] = self.freqtime # Time self.time = model.time self.tmodel['time'] = self.freqtime
def setup(self): # Till c73d6647 (btw. v1.0.0 and v1.1.0) there were the routines # `frequency` and `time`, which were later merged into `dipole`. try: model.dipole([0, 0, 1], [10, 0, 2], [], 1, 1, verb=0) self.func = model.dipole except VariableCatch: self.func = model.frequency
def test_empy_hankel(): # 1. Simple test to compare ['j0', 'j1'] with 'j0' and 'j1' out1 = fdesign.empy_hankel(['j0', 'j1'], 50, 100, [2e14, 1], 1, 0) out2 = fdesign.empy_hankel('j0', 50, 100, [2e14, 1], 1, 0) out3 = fdesign.empy_hankel('j1', 50, 100, [2e14, 1], 1, 0) assert out1[0].name == out2.name assert out1[1].name == out3.name # 2. Check J0, J1 with analytical, wavenumber zsrc = -50 zrec = 0 r = np.arange(1, 101) f = 100 model1 = {'res': 100, 'aniso': 2, 'epermH': 15, 'epermV': 30, 'mpermH': 1, 'mpermV': 5} out4a = fdesign.empy_hankel(['j0', 'j1'], zsrc, zrec, freqtime=f, depth=[], **model1) out4b = model.analytical([0, 0, zsrc], [r/np.sqrt(2), r/np.sqrt(2), zrec], freqtime=f, verb=0, **model1) out4c = model.analytical([0, 0, zsrc], [r, r*0, zrec], freqtime=f, verb=0, ab=31, **model1) out4d, _ = model.dipole_k(src=[0, 0, zsrc], rec=[1/np.sqrt(2), 1/np.sqrt(2), zrec], freq=f, depth=[], wavenumber=1/r, **model1) _, out4e = model.dipole_k(src=[0, 0, zsrc], ab=31, rec=[1, 0, zrec], freq=f, depth=[], wavenumber=1/r, **model1) assert_allclose(out4a[0].rhs(r), out4b) assert_allclose(out4a[1].rhs(r), out4c) assert_allclose(out4a[0].lhs(1/r), out4d) assert_allclose(out4a[1].lhs(1/r), out4e) # 2. Check J2 with dipole, wavenumber zsrc = 950 zrec = 1000 r = np.arange(1, 101)*20 f = 0.1 model2 = {'depth': [0, 1000], 'res': [2e14, 0.3, 1], 'aniso': [1, 1, 1.5], 'epermH': [1, 15, 1], 'epermV': [1, 1, 30], 'mpermH': [1, 1, 10], 'mpermV': [1, 1, 5]} out5a = fdesign.empy_hankel('j2', zsrc, zrec, freqtime=f, **model2) out5b = model.dipole([0, 0, zsrc], [r/np.sqrt(2), r/np.sqrt(2), zrec], freqtime=f, verb=0, ab=12, **model2) out5c, out5d = model.dipole_k(src=[0, 0, zsrc], rec=[1/np.sqrt(2), 1/np.sqrt(2), zrec], ab=12, freq=f, wavenumber=1/r, **model2) assert_allclose(out5a.rhs(r), out5b) assert_allclose(out5a.lhs(1/r)[0], out5c) assert_allclose(out5a.lhs(1/r)[1], out5d)
def rhs(r): out = dipole(rec=[r * x, r * y, zrec], ht='qwe', xdirect=True, verb=verbrhs, htarg=htarg, freqtime=freqtime, **model) return out