Exemplo n.º 1
0
def test_keplerian_mean_circular(ref_kepl_m, ref_kepl_mc):

    kepl_mc = KEPL_M(ref_kepl_m, KEPL_MC)
    assert np.allclose(ref_kepl_mc, kepl_mc)

    kepl_m = KEPL_MC(ref_kepl_mc, KEPL_M)
    assert np.allclose(ref_kepl_m, kepl_m)
Exemplo n.º 2
0
def test_kepl_m(ref_kepl_m):
    kep = KEPL_M(ref_kepl_m, "keplerian")
    assert np.allclose(kep, [
        7.19263111e+06, 2.18439000e-03, 1.71926101e+00,
        5.51044450e+00, 1.17890602e+00, 3.04376883e+00
    ])

    tle = KEPL_M(ref_kepl_m, TLE)
    assert np.allclose(tle, [
        1.71926101e+00, 5.51044450e+00, 2.18439000e-03,
        1.17890602e+00, 3.04334144e+00, 1.03499315e-03
    ])

    # Small mean anomaly
    kepl_m = ref_kepl_m.copy()
    kepl_m[-1] = 0.1
    kep = KEPL_M(kepl_m, KEPL)
    assert np.allclose(kep, [
        7.19263111e+06, 2.18439000e-03, 1.71926101e+00,
        5.51044450e+00, 1.17890602e+00, 1.00437338e-01
    ])

    # Negative mean anomaly
    kepl_m = ref_kepl_m.copy()
    kepl_m[-1] = -kepl_m[-1]
    kep = KEPL_M(kepl_m, KEPL)
    assert np.allclose(kep, [
        7.19263111e+06, 2.18439000e-03, 1.71926101e+00,
        5.51044450e+00, 1.17890602e+00, 3.23941648e+00
    ])

    kepl_m = ref_kepl_m.copy()
    kepl_m[-1] = 0.0001
    kepl_m[1] = 0.95
    kep = KEPL_M(kepl_m, KEPL)
    assert np.allclose(kep, [
        7.19263111e+06, 9.50000000e-01, 1.71926101e+00,
        5.51044450e+00, 1.17890602e+00, 1.24896796e-02
    ])
Exemplo n.º 3
0
def test_hyperbolic(ref_kepl_hyper):

    def to_orbit(arr, form):
        return Orbit(
            ref_kepl_hyper.date,
            arr,
            form,
            ref_kepl_hyper.frame,
            None
        )

    # To cartesian ...
    cart = to_orbit(KEPL(ref_kepl_hyper, CART), CART.name)
    assert np.allclose(cart, [
        1687.60352732, -4761.78462622, 14918.72031867,
        -159632.45044557, 140048.25302776, 74649.10622557
    ])

    # ... and back
    kepl_h = CART(cart, KEPL)
    assert np.allclose(kepl_h, ref_kepl_hyper)

    # To keplerian eccentric ...
    kepl_e = to_orbit(KEPL(ref_kepl_hyper, KEPL_E), KEPL_E.name)
    assert np.allclose(kepl_e, [
        -7.19263111e+06, 1.00218439e+00, 1.71926101e+00,
        5.51044450e+00, 1.17890602e+00, 3.30579237e-03
    ])

    # ... and back
    kepl_h = to_orbit(KEPL_E(kepl_e, KEPL), KEPL.name)
    assert np.allclose(kepl_h, ref_kepl_hyper)

    # To Keplerian mean ...
    kepl_m = to_orbit(KEPL_E(kepl_e, KEPL_M), KEPL_M.name)
    assert np.allclose(kepl_m, [
        -7.19263111e+06, 1.00218439e+00, 1.71926101e+00,
        5.51044450e+00, 1.17890602e+00, 7.22717405e-06
    ])

    # ... and back
    kepl_e2 = to_orbit(KEPL_M(kepl_m, KEPL_E), KEPL_E.name)
    assert np.allclose(kepl_e, kepl_e2)
Exemplo n.º 4
0
def test_same(ref_kepl_m):
    keplm = KEPL_M(ref_kepl_m, KEPL_M)
    assert (keplm == ref_kepl_m.base).all()