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
def test_ISS_culminations(self): t0 = ts.utc(2017, 1, 1) t1 = ts.utc(2017, 1, 2) times, kinds = culminations(greenwich, ISS, t0, t1) assert ((kinds == 'upper') + (kinds == 'lower')).all() assert isinstance(times, Time) assert isinstance(kinds, ndarray) assert len(times) == len(kinds) == 31 # make sure it also works with plain Topos objects assert (times == culminations(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_extreme(f, times.tt, 2 * ms)
def test_sirius_culminations(self): t0 = ts.utc(2017, 1, 1) t1 = ts.utc(2017, 1, 32) times, kinds = culminations(greenwich, sirius, t0, t1) assert ((kinds == 'upper') + (kinds == 'lower')).all() assert isinstance(times, Time) assert isinstance(kinds, ndarray) assert len(times) == len(kinds) == 63 # Check that the found times produce the correct data f = partial(_alt, greenwich, sirius) assert is_extreme(f, times.tt, 2 * ms)
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())