def test_zoeppritz_rpp(self): theta = 40. reflect = avo.zoeppritz(vp1, vs1, rho1, vp2, vs2, rho2, theta) reflect_rpp = avo.zoeppritz_rpp(vp1, vs1, rho1, vp2, vs2, rho2, theta) # Should be the same as the exact solution. self.assertAlmostEquals(reflect_rpp, reflect, places=3)
def test_hilterman(self): """ Does not pass at theta = 25 deg. """ theta = np.arange(10) reflect = avo.hilterman(vp1, vs1, rho1, vp2, vs2, rho2, theta) reflect_rpp = avo.zoeppritz_rpp(vp1, vs1, rho1, vp2, vs2, rho2, theta) test = np.allclose(reflect, reflect_rpp, rtol=self.tolerance) self.assertTrue(test)
def test_zoeppritz_rpp(self): theta = 40. reflect = avo.zoeppritz(vp1, vs1, rho1, vp2, vs2, rho2, theta) reflect_rpp = avo.zoeppritz_rpp(vp1, vs1, rho1, vp2, vs2, rho2, theta) self.assertAlmostEquals(reflect, reflect_rpp, places=5)
class AvoTest(unittest.TestCase): """ Tests zoeppritz using a values from a spreadsheet, and also a qualitative comparison to plots made by the CREWES avo explorer web app. Other algorithms are then tested to be within 1% of the zoeppritz answer for angles < 40 degrees. """ tolerance = 0.01 reflect_rpp = avo.zoeppritz_rpp(vp1, vs1, rho1, vp2, vs2, rho2, theta) def test_zoeppritz(self): theta = 40. reflect = avo.zoeppritz(vp1, vs1, rho1, vp2, vs2, rho2, theta) # Number manually verified using # spreadsheet from http://tbberge.com/id63.html self.assertAlmostEquals(reflect, -0.112236, places=5) def test_zoeppritz_rpp(self): theta = 40. reflect = avo.zoeppritz(vp1, vs1, rho1, vp2, vs2, rho2, theta) reflect_rpp = avo.zoeppritz_rpp(vp1, vs1, rho1, vp2, vs2, rho2, theta) self.assertAlmostEquals(reflect, reflect_rpp, places=5) def test_akirichards(self): reflect = avo.akirichards(vp1, vs1, rho1, vp2, vs2, rho2, theta) test = np.allclose(reflect, self.reflect_rpp, rtol=self.tolerance) self.assertTrue(test) # Test it won't complain about arrays. reflect = avo.akirichards(arr_vp1, arr_vs1, arr_rho1, arr_vp2, arr_vs2, arr_rho2, arr_theta) self.assertTrue(reflect.shape == (40, 1000)) def test_akirichards_alt(self): reflect = avo.akirichards_alt(vp1, vs1, rho1, vp2, vs2, rho2, theta) test = np.allclose(reflect, self.reflect_rpp, rtol=self.tolerance) self.assertTrue(test) reflect = avo.akirichards_alt(arr_vp1, arr_vs1, arr_rho1, arr_vp2, arr_vs2, arr_rho2, arr_theta) self.assertTrue(reflect.shape == (40, 1000)) def test_fatti(self): reflect = avo.fatti(vp1, vs1, rho1, vp2, vs2, rho2, theta) test = np.allclose(reflect, self.reflect_rpp, rtol=self.tolerance) self.assertTrue(test) reflect = avo.fatti(arr_vp1, arr_vs1, arr_rho1, arr_vp2, arr_vs2, arr_rho2, arr_theta) def test_shuey(self): reflect = avo.shuey(vp1, vs1, rho1, vp2, vs2, rho2, theta) test = np.allclose(reflect, self.reflect_rpp, rtol=self.tolerance) self.assertTrue(test) def test_bortfeld(self): reflect = avo.bortfeld(vp1, vs1, rho1, vp2, vs2, rho2, theta) test = np.allclose(reflect, self.reflect_rpp, rtol=self.tolerance) self.assertTrue(test) def test_hilterman(self): """ Does not pass at theta = 25 deg. """ theta = np.arange(10) reflect = avo.hilterman(vp1, vs1, rho1, vp2, vs2, rho2, theta) reflect_rpp = avo.zoeppritz_rpp(vp1, vs1, rho1, vp2, vs2, rho2, theta) test = np.allclose(reflect, reflect_rpp, rtol=self.tolerance) self.assertTrue(test)