caput.astro.time#

Routines for calculation of solar and sidereal times.

Constants#

Note

These are just re-exported from caput.astro.constants.

SIDEREAL_S

Number of SI seconds in a sidereal second [s/sidereal s].

STELLAR_S

Approximate number of SI seconds in a stellar second (i.e. 1/86400 of a stellar day) [s/stellar s].

Why not Sidereal Time?#

Sidereal time is a long established and well known quantity that is very similar to the Earth Rotation Angle (and the derived quantities, LSA and LSD). The reason we don’t use that is that Sidereal Time is essentially the Earth’s rotation measured with respect to the vernal equinox, but this quantity moves significantly with respect to the fixed frame due to precession of the Earth’s pole.

The Earth Rotation Angle is measured with respect to the Celestial Intermediate Origin (CIO), which essentially moves the minimal amount as the Earth precesses to remain on the celestial equator. For experiments like CHIME which map the sky as a function of the Earth’s rotation, this gives the minimal coordinate shifts when combining maps made on different days.

See USNO Circular 179 for more details about the CIO based coordinates.

Accuracy#

Conversions between time standards (as opposed to representations of UTC) in this module are mostly handled by Skyfield, which has a comprehensive and modern handling of the various effects. This includes leap seconds, which PyEphem mostly ignored, just pretending that UTC and UT1 were equivalent.

Skyfield uses Julian Dates for its internal representations. For a double precision floating point (np.float64), the effective precision on calculations is around 30 us. A technical note discussing this further is available here. Most conversions should be accurate to around this accuracy 0.1 ms. However, the era_to_unix routine (and related routines), are accurate to only around 5 ms at the moment as they ignore the difference in time between the Sidereal day, and a complete cycle of ERA.

Functions#

datetime_to_timestr(dt)

Converts a datetime to "YYYYMMDDTHHMMSSZ" format.

datetime_to_unix(dt)

Converts a datetime object to the unix time.

ensure_unix(time)

Convert the input time to Unix time format.

era_to_unix(era, time0)

Calculate the UNIX time for a given Earth Rotation Angle.

leap_seconds_between(time_a, time_b)

Determine how many leap seconds occurred between two Unix times.

naive_datetime_to_utc(dt)

Add UTC timezone info to a naive datetime.

time_of_day(time)

Return the time since the start of the UTC day in seconds.

timestr_to_datetime(time_str)

Converts date "YYYYMMDDTHHMMSS*" to a datetime.

unix_to_datetime(unix_time)

Converts UNIX time to a datetime object.

unix_to_era(unix_time)

Calculate the Earth Rotation Angle for a given time.