-
Notifications
You must be signed in to change notification settings - Fork 101
Clock Corrections and Timescales in PINT
Clock corrections and timescale conversions in PINT are handled by a combination of astropy Time objects (and its built in timescale transformation capabilities) and clock correction files stored in pint/datafiles
.
Here we walk through the transformations and how they happen for a typical TOA read from a .tim file.
TOA times read from TOA (.tim) files are assumed to be in the UTC timescale, referenced to an observatory clock (often a GPS-disciplined rubidium clock). This timescale is denoted UTC(obs), where obs is the name of the observatory [2]. The MJD representation used in these files is the pulsar_mjd
, as described below.
People from the precise timing community know well that using MJD format for UTC times is a bad idea. There is not a unique way to assign MJDs to times during days with leap seconds, and MJD1 - MJD2 does not correctly give the time interval between two times, because of possible leap seconds between MJD1 and MJD2 (this has been the source of incorrect results in the literature). Nevertheless, MJDs are commonly used for UTC times in many places. In pulsar timing, the MJD times in TOA (.tim) files are in the UTC time scale. PINT follows TEMPO and Tempo2 in defining a pulsar MJD (in pint called pulsar_mjd
) format, in which the integer part is the normal integer MJD and the fractional part is seconds_of_day/86400 [1]. The means that MJDs 'tick' at a constant rate, but there is no representation for a time during a leap second, so there is no way to have a TOA during that time.
- I think we need to look through PINT for Time inits with
format='mjd'
and make sure they are correct. Those may break on leap second days. They should probably all beformat='pulsar_mjd'
Given a UTC(obs), PINT applies clock corrections to convert to UTC(GPS). This can be done using either TEMPO or Tempo2 format clock files. The default is to use the set of TEMPO clock files distributed with PINT in pint/datafiles
. These correct UTC as measured by the observatory clock to the UTC(GPS) timescale from GPS.
A further correction can ben applied to convert UTC(GPS) to "UTC" (which I think means UTC(USNO), but this should be confirmed). This is done by default using the Tempo2-format gps2utc.clk file in pint/datafiles
. Those corrections are derived from BIPM Circular T. Whether this correction is applied is controlled by the include_gps
argument to pint.observatory.observatory.get_observatory()
.
UTC is converted to TAI by adding an integer number of seconds. The number changes to account for leap seconds, so that TAI is a continuous timescale. The current value (since January 2017) of TAI-UTC is 37.0 seconds. In PINT, this conversion is handled by astropy, which in turn uses ERFA (the free version of IAU SOFA), which has the leap seconds hard coded. Versions of astropy 1.3 or later include the 2017 January 1 leap second. Note the 37 second difference in this example:
In [10]: t = Time("2017-01-15T06:00:00.000",scale='utc',format='isot')
In [11]: t.utc.isot
Out[11]: '2017-01-15T06:00:00.000'
In [12]: t.tai.isot
Out[12]: '2017-01-15T06:00:37.000'
TT (also known as TDT) ticks at the same rate as TT and UTC, but for reasons of continuity has an offset. TT has a unit of duration 86400 SI seconds on the geoid and is the independent argument of apparent geocentric ephemerides.
The most common realization of TT is TT(TAI), which is defined as:
TT(TAI) = TAI + 32.184 seconds
PINT can also use TT(BIPM), which is a realization of TT published by the BIPM on their web page. In PINT, this clock correction is read from the Tempo2-style clock file pint/datafiles/tai2tt_bipm2015.clk
. Whether this correction is enabled is controlled by the include_bipm
argument to pint.observatory.observatory.get_observatory()
.
[1] Note that some other codes (notably IAU SOFA and thus astropy) use seconds_of_day/86400 for non-leap-second days and seconds_of_day/86401 for days with a leap second. This makes MJDs 'tick' at a different rate on leap second days, but allows all times to have a representation. PINT code that writes TOA files needs to ensure it is using the pulsar_mjd
format for compatibility with the PINT, TEMPO and Tempo2 tim file readers.
[2] Note that this is not sufficient to distinguish between multiple instruments or backends at an observatory. In the past, this has been dealt with by making two different observatory names (e.g. ncy and ncyobs), which have the same position, but different clock correction files. PINT really should do this a better way.
[3] PINT really needs to support TCB as well as TDB, but this is not currently implemented.