def test_ei_log(self): """ Checks that passing in 1-D arrays for vp, vs, and rho works for single values of theta1 as well as a 1-d vector. """ x1 = elastic_impedance(ones_vp, ones_vs, ones_rho, theta1=np.array(30.0)) x2 = elastic_impedance(ones_vp, ones_vs, ones_rho, theta1=theta2) x3 = elastic_impedance(arr_vp, arr_vs, arr_rho, theta1=theta2) self.assertEqual(x1.shape, (ones_vp.size,)) self.assertEqual(x2.shape, (ones_vp.size, theta2.size)) self.assertEqual(x3.shape, (arr_vp.size, theta2.size))
def test_ei_log(self): """ Checks that passing in 1-D arrays for vp, vs, and rho works for single values of theta1 as well as a 1-d vector. """ x1 = elastic_impedance(ones_vp, ones_vs, ones_rho, theta1=np.array(30.0)) x2 = elastic_impedance(ones_vp, ones_vs, ones_rho, theta1=theta2) x3 = elastic_impedance(arr_vp, arr_vs, arr_rho, theta1=theta2) self.assertEqual(x1.shape, (ones_vp.size, )) self.assertEqual(x2.shape, (ones_vp.size, theta2.size)) self.assertEqual(x3.shape, (arr_vp.size, theta2.size))
def test_ei_nan(self): """ Checks to see if we survuve NaNs. """ ei = elastic_impedance(2350, np.nan, 2500, theta1=30.0) self.assertTrue(np.isnan(ei))
def test_ei_ninety(self): """ Checks that EI at 90 degrees = (Vp/Vs)^2. This occurs when K = 0.25 """ ei = elastic_impedance(vp, vp / 2.0, rho, theta1=90.0, use_sin=True) self.assertAlmostEqual(ei, (vp / (vp / 2.0))**2, places=-2)
def test_ei_at_zero(self): """ Checks that EI at zero degrees is equal to AI. """ ei = elastic_impedance(vp, vs, rho, theta1=0) self.assertAlmostEqual(ei, vp * rho, places=-2)
def test_ei_ninety(self): """ Checks that EI at 90 degrees = (Vp/Vs)^2. This occurs when K = 0.25 """ ei = elastic_impedance(vp, vp/2.0, rho, theta1=90.0, use_sin=True) self.assertAlmostEqual(ei, (vp/(vp/2.0))**2, places=-2)