示例#1
0
def test_cartesian_to_sphere():
    """Test helper transform function from cartesian to sphere"""
    x, y, z = (1, 0, 0)
    # expected values are (0, 0, 1)
    hypotxy = np.hypot(x, y)
    r = np.hypot(hypotxy, z)
    elev = np.arctan2(z, hypotxy)
    az = np.arctan2(y, x)
    coord = _cartesian_to_sphere(x, y, z)
    assert_equal(coord, (az, elev, r))
    assert_equal(coord, (0, 0, 1))
示例#2
0
def test_cartesian_to_sphere():
    """Test helper transform function from cartesian to sphere"""
    x, y, z = (1, 0, 0)
    # expected values are (0, 0, 1)
    hypotxy = np.hypot(x, y)
    r = np.hypot(hypotxy, z)
    elev = np.arctan2(z, hypotxy)
    az = np.arctan2(y, x)
    coord = _cartesian_to_sphere(x, y, z)
    assert_equal(coord, (az, elev, r))
    assert_equal(coord, (0, 0, 1))