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 test_dipole_k(): # This is like `frequency`, without the Hankel transform. We just run a # test here, to check that it remains the status quo. res = DATAEMPYMOD['wout'][()] w_res0, w_res1 = dipole_k(**res['inp']) assert_allclose(w_res0, res['PJ0']) assert_allclose(w_res1, res['PJ1']) # Check that ab=36 returns zeros res['inp']['ab'] = 36 w_res0, w_res1 = dipole_k(**res['inp']) assert_allclose(w_res0, np.zeros(res['PJ0'].shape, dtype=complex)) assert_allclose(w_res1, np.zeros(res['PJ1'].shape, dtype=complex))
def lhs(k): lhs0, lhs1 = dipole_k(rec=[x, y, zrec], wavenumber=k, verb=verblhs, freq=freqtime, **model) if ftype == 'j0': return lhs0 elif ftype == 'j1': return lhs1 elif ftype == 'j2': return (lhs0, lhs1)
winp = { 'src': [330, -200, 500], 'rec': [3000, 1000, 600], 'depth': [0, 550], 'res': [1e12, 5.55, 11], 'freq': 3.33, 'wavenumber': np.logspace(-3.6, -3.4, 10), 'ab': 25, 'aniso': [1, 2, 1.5], 'epermH': [1, 50, 10], 'epermV': [80, 20, 1], 'mpermH': [1, 20, 50], 'mpermV': [1, 30, 4], 'verb': 0 } PJ0, PJ1 = dipole_k(**winp) # # C -- FULLSPACE # # # More or less random values, to test a wide range of models. # src fixed at [0, 0, 0]; Never possible to test all combinations... pab = [ 11, 12, 13, 14, 15, 16, 21, 22, 23, 24, 25, 26, 31, 32, 33, 34, 35, 41, 42, 43, 44, 45, 46, 51, 52, 53, 54, 55, 56, 61, 62, 64, 65, 66 ] prec = [[100000, 0, 500], [10000, 0, 400], [1000, 0, 300], [100, 0, 100], [10, 0, 10], [1, 0, 1], [1, 0, -1], [10, 0, -10], [100, 0, -100], [1000, 0, -300], [10000, 0, -400], [100000, 100, -500], [0, 100000, 0], [0, 10000, 0], [0, 1000, 500], [0, 100, 0], [10, 10, 0], [0, 1, 0], [0, 1, 0], [0, 10, 0], [0, 100, 500], [100, 1000, 300], [0, 10000, 0], [0, 100000, 0], [-1, 0, 0], [-10, 0, 500], [-100, 100, 300], [-1000, 0, 0], [0, -1, 0], [0, -10, 0], [-100, -100, -500],