示例#1
0
def test_small_intervals():
    t0 = ts.utc(2018)
    t1 = ts.utc(2018, 1, 1, 1, 1)

    times, kinds = meridian_transits(greenwich, moon, t0, t1)
    assert len(times) == len(kinds.radians) == 0

    times, kinds = culminations(greenwich, moon, t0, t1)
    assert len(times) == len(kinds) == 0

    times, kinds = risings_settings(greenwich, moon, t0, t1)
    assert len(times) == len(kinds) == 0

    times, kinds = twilights(greenwich, sun, t0, t1)
    assert len(times) == len(kinds) == 0

    times, kinds = seasons(earth, t0, t1)
    assert len(times) == len(kinds.radians) == 0

    times, kinds = moon_phases(moon, t0, t1)
    assert len(times) == len(kinds.radians) == 0

    times, kinds = apsides(moon, earth, t0, t1)
    assert len(times) == len(kinds) == 0

    times, kinds = nodes(moon, earth, t0, t1)
    assert len(times) == len(kinds) == 0
示例#2
0
    def test_ISS_risings_settings(self):
        t0 = ts.utc(2017, 6, 1)
        t1 = ts.utc(2017, 6, 2)
        times, kinds = risings_settings(greenwich, ISS, t0, t1)

        assert ((kinds == 'rise') + (kinds == 'set')).all()

        assert isinstance(times, Time)
        assert isinstance(kinds, ndarray)
        assert len(times) == len(kinds) == 13

        # make sure it also works with plain Topos objects
        assert (times == risings_settings(plain_greenwich, ISS, t0,
                                          t1)[0]).all()

        # Check that the found times produce the correct data
        f = partial(_satellite_alt, plain_greenwich, ISS)
        assert is_root(f, times.tt, -34 / 60, ms / 2)
示例#3
0
    def test_sirius_risings_settings(self):
        t0 = ts.utc(2017, 1, 1)
        t1 = ts.utc(2017, 1, 32)
        times, kinds = risings_settings(greenwich, sirius, t0, t1)

        assert ((kinds == 'rise') + (kinds == 'set')).all()

        assert isinstance(times, Time)
        assert isinstance(kinds, ndarray)
        assert len(times) == len(kinds) == 62

        # Check that the found times produce the correct data
        f = partial(_alt, greenwich, sirius)
        assert is_root(f, times.tt, 0, ms / 2)
示例#4
0
    def test_moon_risings_settings(self):
        t0 = ts.utc(2017, 1, 1)
        t1 = ts.utc(2017, 1, 32)
        times, kinds = risings_settings(greenwich, moon, t0, t1)

        assert ((kinds == 'rise') + (kinds == 'set')).all()

        assert isinstance(times, Time)
        assert isinstance(kinds, ndarray)
        assert len(times) == len(kinds) == 60

        compare(times[0].tt, ts.utc(2017, 1, 1, 9, 46).tt, minute / 2)

        # Check that the found times produce the correct data
        f = partial(_moon_ul_alt, greenwich, moon)
        assert is_root(f, times.tt, -34 / 60, ms / 2)
示例#5
0
"""
ISS = EarthSatellite(*iss_tle.splitlines())

sirius = Star(ra_hours=(6, 45, 8.91728), dec_degrees=(-16, 42, 58.0171))

t0 = ts.utc(2017, 1, 1)
t1 = ts.utc(2017, 1, 8)

# Equinoxes and Solstices
season_times, lons = seasons(earth, ts.utc(2000), ts.utc(2026))

# Moon Phases
phase_times, lon_diffs = moon_phases(moon, ts.utc(2018, 1), ts.utc(2018, 2))

# Rise and Set Times
rise_set_times, rise_or_set = risings_settings(greenwich, sun, t0, t1)

# Culminations
culmination_times, kinds = culminations(greenwich, sun, t0, t1)

# Meridian Transits
transit_times, hour_angles = meridian_transits(greenwich, mars, t0, t1)

# Twilights
naut_twilight_times, am_pm = twilights(greenwich, sun, t0, t1, kind='nautical')

# You can submit different object types to the same function:
for name, body in zip(['Sun', 'Mars', 'Sirius', 'ISS'],
                      [sun, mars, sirius, ISS]):
    times, kinds = risings_settings(greenwich, body, t0, t1)
    print(name, 'first rises at:', times[kinds == 'rise'][0].utc_jpl())