Example #1
0
def test_coordinates_init_from_array_cartesian():
    x = [1, 0, 0, 0]
    y = [0, 1, 0, 0]
    z = [0, 0, 1, 0]

    points = np.array([x, y, z])
    coords = Coordinates.from_array(points)

    npt.assert_allclose(coords._x, x, atol=1e-15)
    npt.assert_allclose(coords._y, y, atol=1e-15)
    npt.assert_allclose(coords._z, z, atol=1e-15)
Example #2
0
def test_coordinates_init_from_array_spherical():
    rad = [1., 1., 1., 1.]
    ele = [np.pi / 2, np.pi / 2, 0, np.pi / 2]
    azi = [0, np.pi / 2, 0, np.pi / 4]

    points = np.array([rad, ele, azi])
    coords = Coordinates.from_array(points, coordinate_system='spherical')

    npt.assert_allclose(coords.radius, rad, atol=1e-15)
    npt.assert_allclose(coords.elevation, ele, atol=1e-15)
    npt.assert_allclose(coords.azimuth, azi, atol=1e-15)