def test_ellipsoid():
    """Test Ellipsoid initialiser and verify computed attributes."""
    wgs84_polar_radius = 6356752.314245 * u.m

    wgs84_ellipsoid1 = Ellipsoid(a=WGS84_EQUATORIAL_RADIUS, f=WGS84_FLATTENING)
    wgs84_ellipsoid2 = Ellipsoid(a=WGS84_EQUATORIAL_RADIUS, b=wgs84_polar_radius)

    assert qisclose(wgs84_ellipsoid1.b, wgs84_ellipsoid2.b)
    assert qisclose(wgs84_ellipsoid1.f, wgs84_ellipsoid2.f)

    with pytest.raises(TypeError):
        Ellipsoid(a=WGS84_EQUATORIAL_RADIUS)

    with pytest.raises(TypeError):
        Ellipsoid(a=WGS84_EQUATORIAL_RADIUS, b=wgs84_polar_radius,
                  f=WGS84_FLATTENING)
Exemple #2
0
def test_ellipsoid():
    """Test Ellipsoid initialiser and verify computed attributes."""
    wgs84_polar_radius = 6356752.314245 * u.m

    wgs84_ellipsoid1 = Ellipsoid(a=WGS84_EQUATORIAL_RADIUS, f=WGS84_FLATTENING)
    wgs84_ellipsoid2 = Ellipsoid(a=WGS84_EQUATORIAL_RADIUS,
                                 b=wgs84_polar_radius)

    assert qisclose(wgs84_ellipsoid1.b, wgs84_ellipsoid2.b)
    assert qisclose(wgs84_ellipsoid1.f, wgs84_ellipsoid2.f)

    with pytest.raises(TypeError):
        Ellipsoid(a=WGS84_EQUATORIAL_RADIUS)

    with pytest.raises(TypeError):
        Ellipsoid(a=WGS84_EQUATORIAL_RADIUS,
                  b=wgs84_polar_radius,
                  f=WGS84_FLATTENING)
def test_celestial_body():
    "Test CelestialBody initialiser and verify computed attributes"
    a = CelestialBody(name='earth', ellipsoid=wgs84, mu=wgs84.mu)
    b = CelestialBody.from_reference_ellipsoid(name='earth', ellipsoid=wgs84)
    assert a.mu == b.mu == wgs84.mu

    ellipsoid = Ellipsoid(a=1 * u.m, b=1 * u.m)
    c = CelestialBody(name='earth', ellipsoid=ellipsoid,
                      mu=GEOCENTRIC_GRAVITATIONAL_CONSTANT)
    assert qisclose(c.mass, EARTH_MASS)
Exemple #4
0
def test_celestial_body():
    "Test CelestialBody initialiser and verify computed attributes"
    a = CelestialBody(name='earth', ellipsoid=wgs84, mu=wgs84.mu)
    b = CelestialBody.from_reference_ellipsoid(name='earth', ellipsoid=wgs84)
    assert a.mu == b.mu == wgs84.mu

    ellipsoid = Ellipsoid(a=1 * u.m, b=1 * u.m)
    c = CelestialBody(name='earth',
                      ellipsoid=ellipsoid,
                      mu=GEOCENTRIC_GRAVITATIONAL_CONSTANT)
    assert qisclose(c.mass, EARTH_MASS)