def test_halfspace(): # 7. halfspace # Compare all to maintain status quo. hs = DATAEMPYMOD['hs'][()] hsres = DATAEMPYMOD['hsres'][()] hsbp = DATAEMPYMOD['hsbp'][()] for key in hs: # Get halfspace hs_res = kernel.halfspace(**hs[key]) # Check # rtol decreased in June '22 - suddenly failed; why? # # (Potentially as SciPy changed mu_0 to inexact, # https://github.com/scipy/scipy/issues/11341). assert_allclose(hs_res, hsres[key], rtol=5e-5) # Additional checks - Time full = kernel.halfspace(**hs['21']) # Check halfspace = sum of split hs['21']['solution'] = 'dsplit' direct, reflect, air = kernel.halfspace(**hs['21']) assert_allclose(full, direct + reflect + air) # Check fullspace = bipole-solution hsbp['21']['xdirect'] = True hsbp['21']['depth'] = [] hsbp['21']['res'] = hsbp['21']['res'][1] hsbp['21']['aniso'] = hsbp['21']['aniso'][1] hsbp['21']['ft'] = 'dlf' hs_res = bipole(**hsbp['21']) assert_allclose(direct, hs_res, rtol=1e-2) # Additional checks - Frequency hs['11']['solution'] = 'dfs' full = kernel.halfspace(**hs['11']) # Check halfspace = sum of split hs['11']['solution'] = 'dsplit' direct, _, _ = kernel.halfspace(**hs['11']) assert_allclose(full, direct) # Check sums of dtetm = dsplit hs['11']['solution'] = 'dsplit' direct, reflect, air = kernel.halfspace(**hs['11']) hs['11']['solution'] = 'dtetm' dTE, dTM, rTE, rTM, air2 = kernel.halfspace(**hs['11']) assert_allclose(direct, dTE + dTM) assert_allclose(reflect, rTE + rTM) assert_allclose(air, air2) # Check fullspace = bipole-solution hsbp['11']['xdirect'] = True hsbp['11']['depth'] = [] hsbp['11']['res'] = hsbp['11']['res'][1] hsbp['11']['aniso'] = hsbp['11']['aniso'][1] hs_res = bipole(**hsbp['11']) assert_allclose(direct, hs_res, atol=1e-2)
def test_halfspace(): # 7. halfspace # Compare all to maintain status quo. hs = DATAEMPYMOD['hs'][()] hsres = DATAEMPYMOD['hsres'][()] hsbp = DATAEMPYMOD['hsbp'][()] for key in hs: # Get halfspace hs_res = kernel.halfspace(**hs[key]) # Check assert_allclose(hs_res, hsres[key]) # Additional checks - Time full = kernel.halfspace(**hs['21']) # Check halfspace = sum of split hs['21']['solution'] = 'dsplit' direct, reflect, air = kernel.halfspace(**hs['21']) assert_allclose(full, direct + reflect + air) # Check fullspace = bipole-solution hsbp['21']['xdirect'] = True hsbp['21']['depth'] = [] hsbp['21']['res'] = hsbp['21']['res'][1] hsbp['21']['aniso'] = hsbp['21']['aniso'][1] hsbp['21']['ft'] = 'sin' hs_res = bipole(**hsbp['21']) assert_allclose(direct, hs_res, rtol=1e-2) # Additional checks - Frequency hs['11']['solution'] = 'dfs' full = kernel.halfspace(**hs['11']) # Check halfspace = sum of split hs['11']['solution'] = 'dsplit' direct, _, _ = kernel.halfspace(**hs['11']) assert_allclose(full, direct) # Check sums of dtetm = dsplit hs['11']['solution'] = 'dsplit' direct, reflect, air = kernel.halfspace(**hs['11']) hs['11']['solution'] = 'dtetm' dTE, dTM, rTE, rTM, air2 = kernel.halfspace(**hs['11']) assert_allclose(direct, dTE + dTM) assert_allclose(reflect, rTE + rTM) assert_allclose(air, air2) # Check fullspace = bipole-solution hsbp['11']['xdirect'] = True hsbp['11']['depth'] = [] hsbp['11']['res'] = hsbp['11']['res'][1] hsbp['11']['aniso'] = hsbp['11']['aniso'][1] hs_res = bipole(**hsbp['11']) assert_allclose(direct, hs_res, atol=1e-2)
def test_halfspace(self): # Comparison to analytical halfspace solution hs = DATAEMPYMOD['hs'][()] hsbp = DATAEMPYMOD['hsbp'][()] for key in hs: # Get halfspace hs_res = halfspace(**hs[key]) # Get bipole bip_res = bipole(**hsbp[key]) # Check if key in ['12', '13', '21', '22', '23', '31']: # t-domain ex. rtol = 1e-2 else: rtol = 1e-7 assert_allclose(hs_res, bip_res, rtol=rtol)
'srcpts': 1, 'mrec': False, 'recpts': 1, 'strength': 0, 'xdirect': False, 'ht': 'fht', 'htarg': None, 'ft': 'sin', 'ftarg': None, 'opt': None, 'loop': None, 'verb': 0 } # Get result for halfspace hs_res[str(pab[i])] = halfspace(**hs[str(pab[i])]) # # E -- GPR # # igpr = { 'src': [[0, 0], [0, 1], 0.0000001], 'rec': [[2, 3], [0, 0], 0.5], 'depth': [0, 1], 'res': [1e23, 200, 20], 'freqtime': np.arange(1, 81) * 1e-9, 'cf': 250e6, 'ab': 11, 'gain': 3, 'aniso': None, 'epermH': [1, 9, 15], 'epermV': [1, 9, 15], 'mpermH': None,