Ejemplo n.º 1
0
def test_strike_dip_rake_from_ln():
    """
    Tests computation of strike dip and rake from fault vectors l and n
    """
    for strike, dip, rake in zip((42., 180., -140.), (22., 0., 90.),
                                 (17., 32., 120.)):
        l, m, n = fault_vectors_lmn(strike, dip, rake)
        s, d, r = strike_dip_rake_from_ln(l, n)

        np.testing.assert_allclose(np.array([strike]), np.array([s]))
        np.testing.assert_allclose(np.array([dip]), np.array([d]))
        np.testing.assert_allclose(np.array([rake]), np.array([r]))
Ejemplo n.º 2
0
def test_strike_dip_rake_from_ln():
    """
    Tests computation of strike dip and rake from fault vectors l and n
    """
    for strike, dip, rake in zip((42., 180., -140.), (22., 0., 90.),
                                 (17., 32., 120.)):
        l, m, n = fault_vectors_lmn(strike, dip, rake)
        s, d, r = strike_dip_rake_from_ln(l, n)

        np.testing.assert_allclose(np.array([strike]), np.array([s]))
        np.testing.assert_allclose(np.array([dip]), np.array([d]))
        np.testing.assert_allclose(np.array([rake]), np.array([r]))
Ejemplo n.º 3
0
def test_fault_vectors_lmn():
    """
    Tests computation of fault vectors l, m and n
    """
    strike, dip, rake = 35., 70., 17.
    l, m, n = fault_vectors_lmn(strike, dip, rake)

    # vectors should be perpendicular
    np.testing.assert_allclose(np.array([np.dot(l, n)]),
                               np.array([0.0]), atol=1e-15)
    np.testing.assert_allclose(np.array([np.dot(l, m)]),
                               np.array([0.0]), atol=1e-15)
    np.testing.assert_allclose(np.array([np.dot(m, n)]),
                               np.array([0.0]), atol=1e-15)

    np.testing.assert_allclose(np.cross(n, l), m, atol=1e-15)

    # vectors should be normalized
    np.testing.assert_allclose(np.array([1.0]), (l**2).sum())
    np.testing.assert_allclose(np.array([1.0]), (m**2).sum())
    np.testing.assert_allclose(np.array([1.0]), (n**2).sum())
Ejemplo n.º 4
0
def test_fault_vectors_lmn():
    """
    Tests computation of fault vectors l, m and n
    """
    strike, dip, rake = 35., 70., 17.
    l, m, n = fault_vectors_lmn(strike, dip, rake)

    # vectors should be perpendicular
    np.testing.assert_allclose(np.array([np.dot(l, n)]),
                               np.array([0.0]), atol=1e-15)
    np.testing.assert_allclose(np.array([np.dot(l, m)]),
                               np.array([0.0]), atol=1e-15)
    np.testing.assert_allclose(np.array([np.dot(m, n)]),
                               np.array([0.0]), atol=1e-15)

    np.testing.assert_allclose(np.cross(n, l), m, atol=1e-15)

    # vectors should be normalized
    np.testing.assert_allclose(np.array([1.0]), (l**2).sum())
    np.testing.assert_allclose(np.array([1.0]), (m**2).sum())
    np.testing.assert_allclose(np.array([1.0]), (n**2).sum())