Exemplo n.º 1
0
def test_isclose_time_exceptions():
    t1 = Time('2020:001')
    t2 = t1 + 1 * u.s
    match = "'other' argument must support subtraction with Time"
    with pytest.raises(TypeError, match=match):
        t1.isclose(1.5)

    match = "'atol' argument must be a Quantity or TimeDelta instance, got float instead"
    with pytest.raises(TypeError, match=match):
        t1.isclose(t2, 1.5)
Exemplo n.º 2
0
def test_penumbra_event_crossing():
    expected_penumbra_t = Time("2020-01-01 00:04:26.060",
                               scale="utc")  # From Orekit.
    attractor = Earth
    tof = 2 * u.d
    epoch = Time("2020-01-01", scale="utc")
    orbit = Orbit.from_classical(
        attractor=attractor,
        a=6828137.0 * u.m,
        ecc=0.0073 * u.one,
        inc=87.0 * u.deg,
        raan=20.0 * u.deg,
        argp=10.0 * u.deg,
        nu=0 * u.deg,
        epoch=epoch,
    )

    penumbra_event = PenumbraEvent(orbit, terminal=True)
    events = [penumbra_event]

    rr, _ = cowell(
        attractor.k,
        orbit.r,
        orbit.v,
        [tof] * u.s,
        events=events,
    )

    assert expected_penumbra_t.isclose(epoch + penumbra_event.last_t,
                                       atol=1 * u.s)
Exemplo n.º 3
0
def test_umbra_event_crossing():
    expected_umbra_t = Time("2020-01-01 00:04:51.328",
                            scale="utc")  # From Orekit.
    attractor = Earth
    tof = 2 * u.d
    epoch = Time("2020-01-01", scale="utc")
    coe = (
        6828137.0 * u.m,
        0.0073 * u.one,
        87.0 * u.deg,
        20.0 * u.deg,
        10.0 * u.deg,
        0 * u.deg,
    )
    orbit = Orbit.from_classical(attractor, *coe, epoch=epoch)

    umbra_event = UmbraEvent(orbit, terminal=True)
    events = [umbra_event]

    rr, _ = cowell(
        attractor.k,
        orbit.r,
        orbit.v,
        [tof] * u.s,
        events=events,
    )

    assert expected_umbra_t.isclose(epoch + umbra_event.last_t, atol=1 * u.s)