コード例 #1
0
ファイル: test_rotate.py プロジェクト: rpratt20/obspy
    def test_rotate2ZNE_round_trip(self):
        """
        The rotate2ZNE() function has an inverse argument. Thus round
        tripping should work.
        """
        z = np.ones(10, dtype=np.float64)
        n = 2.0 * np.ones(10, dtype=np.float64)
        e = 3.0 * np.ones(10, dtype=np.float64)

        # Random values.
        dip_1, dip_2, dip_3 = 0.0, 30.0, 60.0
        azi_1, azi_2, azi_3 = 0.0, 170.0, 35.0

        a, b, c = rotate2ZNE(z, azi_1, dip_1, n, azi_2, dip_2, e, azi_3, dip_3)

        z_new, n_new, e_new = rotate2ZNE(a,
                                         azi_1,
                                         dip_1,
                                         b,
                                         azi_2,
                                         dip_2,
                                         c,
                                         azi_3,
                                         dip_3,
                                         inverse=True)

        self.assertTrue(np.allclose(z, z_new, rtol=1E-7, atol=1e-7))
        self.assertTrue(np.allclose(n, n_new, rtol=1E-7, atol=1e-7))
        self.assertTrue(np.allclose(e, e_new, rtol=1E-7, atol=1e-7))
コード例 #2
0
ファイル: test_rotate.py プロジェクト: 3rdcycle/obspy
    def test_galperin_configuration(self):
        """
        Equal arrays on a Galperin configuration should result in only the
        vertical component remaining.
        """
        dip = - (90.0 - np.rad2deg(np.arctan(np.sqrt(2.0))))

        u = np.array([1.0, 0.0, 1.0])
        v = np.array([1.0, 1.0, -1.0])
        w = np.array([1.0, -1.0, -1.0])

        z, n, e = rotate2ZNE(
            u, -90, dip,
            v, 30, dip,
            w, 150, dip)

        fac = 1.0 / np.sqrt(6.0)

        z_ref = np.array([fac * 3.0 * np.sqrt(2.0), 0.0, -fac * np.sqrt(2.0)])
        n_ref = np.array([0.0, fac * 2.0 * np.sqrt(3.0), 0.0])
        e_ref = np.array([0.0, 0.0, -4.0 * fac])

        self.assertTrue(np.allclose(z, z_ref, rtol=1E-7, atol=1E-7))
        self.assertTrue(np.allclose(n, n_ref, rtol=1E-7, atol=1E-7))
        self.assertTrue(np.allclose(e, e_ref, rtol=1E-7, atol=1E-7))
コード例 #3
0
ファイル: test_rotate.py プロジェクト: 3rdcycle/obspy
    def test_rotate2ZNE_round_trip(self):
        """
        The rotate2ZNE() function has an inverse argument. Thus round
        tripping should work.
        """
        z = np.ones(10, dtype=np.float64)
        n = 2.0 * np.ones(10, dtype=np.float64)
        e = 3.0 * np.ones(10, dtype=np.float64)

        # Random values.
        dip_1, dip_2, dip_3 = 0.0, 30.0, 60.0
        azi_1, azi_2, azi_3 = 0.0, 170.0, 35.0

        a, b, c = rotate2ZNE(z, azi_1, dip_1, n, azi_2, dip_2, e, azi_3, dip_3)

        z_new, n_new, e_new = rotate2ZNE(a, azi_1, dip_1,
                                         b, azi_2, dip_2,
                                         c, azi_3, dip_3,
                                         inverse=True)

        self.assertTrue(np.allclose(z, z_new, rtol=1E-7, atol=1e-7))
        self.assertTrue(np.allclose(n, n_new, rtol=1E-7, atol=1e-7))
        self.assertTrue(np.allclose(e, e_new, rtol=1E-7, atol=1e-7))
コード例 #4
0
ファイル: test_rotate.py プロジェクト: rpratt20/obspy
    def test_galperin_configuration(self):
        """
        Equal arrays on a Galperin configuration should result in only the
        vertical component remaining.
        """
        dip = -(90.0 - np.rad2deg(np.arctan(np.sqrt(2.0))))

        u = np.array([1.0, 0.0, 1.0])
        v = np.array([1.0, 1.0, -1.0])
        w = np.array([1.0, -1.0, -1.0])

        z, n, e = rotate2ZNE(u, -90, dip, v, 30, dip, w, 150, dip)

        fac = 1.0 / np.sqrt(6.0)

        z_ref = np.array([fac * 3.0 * np.sqrt(2.0), 0.0, -fac * np.sqrt(2.0)])
        n_ref = np.array([0.0, fac * 2.0 * np.sqrt(3.0), 0.0])
        e_ref = np.array([0.0, 0.0, -4.0 * fac])

        self.assertTrue(np.allclose(z, z_ref, rtol=1E-7, atol=1E-7))
        self.assertTrue(np.allclose(n, n_ref, rtol=1E-7, atol=1E-7))
        self.assertTrue(np.allclose(e, e_ref, rtol=1E-7, atol=1E-7))