TEMPO2 with your calculator
Emily Petroff (Carleton College; University of Sydney)
Introduction
Here we provide a step-by-step overview of how to calculate the various delays used by Tempo2 to convert a Site Arrival Time (SAT) to the Barycentric Arrival Time (BAT) used for pulsar timing and modelling. In the following tutorial, a single observation is used throughout and all values are for the timing delays pertaining to this unique data point. A table of the calculated delays is presented below with links to more detailed descriptions of each delay and how it is calculated.
Overview of Tempo2- and hand-calculated delays
| Delay | {command} for general2 plugin | Tempo2 value | Calculator result | Section Link |
| | | (seconds) | (seconds) | |
| TT Correction | {tt} | 66.183998454340468243 | 66.18399845434048 | TT Correction |
| TT to TB | {tt2tb} | 15.901240920369285465 | -- | TT to TB Correction |
| Tropospheric | {tropo} | 1.4190938457860982459*10^-8 | -- | Tropospheric Delay |
| Shapiro | {shapiro} | -5.3009884720612458276*10^-6 | -5.301317203384069*^-6 | Shapiro Delay |
| Roemer | {roemer} | 345.54296607898590651 | 345.8772614577373 | Roemer Delay |
| ISM / Tdis1 | {ism} | 0.15647330642621240515 | 0.15651032273209736 | TDis1 |
| IPM / Tdis2 | {ipm} | 4.7088004314713416481*10^-8 | 4.708800058360121*10^-8 | TDis2 |
| | Total | 427.471737386978977 | -- | |
Where a red delay indicates an effect greater than 1 microsecond and the total delay is calculated using the equation
Total Delay = TT Correction + TT to TB - Tropospheric + Roemer - Shapiro - TDis1 - TDis2
The general2 plugin
All the delays that are calculated by Tempo2 to convert a SAT to the BAT can be output as part of the general2 plugin by calling
tempo2 -output general2 -s "{command}" -f filename.par filename2.tim
Several other values related to each observation and used by Tempo2 can also be displayed, including many values used in intermediate steps as part of the delay calculations. Each time a value is obtained using general2 in the following sections it is enclosed by curly brackets { }.
The observation
All the following calculations and analyses are for an observation of J1939+2134 at 20cm. The observation file can be found at the pathname
/pulsar/archive16/ppta_finalFiles//J1939+2134/20cm/t090701_133835.czFTp .
The site arrival time of this observation is SAT = 55013.5797401199099 days, which can be obtained using {sat}.
TT Correction
The site arrival times are all recorded using the clock at the Parkes Telescope and as such need to be corrected to a terrestrial time (TT) standard. To do this several smaller clock corrections must be made. First, correct from Parkes time to GPS time using the pks2gps.clk file in $Tempo2/clock/. This clock correction is a two-column file of dates and corrections updated regularly from the clock correction record kept of Parkes time with respect to GPS time since MJD 52311.17.
Find the line with the MJD closest to the observation date. In this case the closest one in the table is 55013.78299 with a clock correction of -0.000001545355 seconds, so using this MJD and the next smallest one (55012.77951, -0.000001533227 seconds), create a linear fit and interpolate to get the clock correction at the exact date. This number can also be obtained from the {clock0} command in the general2 plugin.
PKStoGPS = -1.5429*10^-6 s
Next convert the GPS time to coordinated universal time (UTC) using the gps2utc.clk file in the same directory using the same process. For this file, as well, the clock corrections are imorted regularly from an update file. Here the closest two MJD's are 55013.0000 and 55014.0000 with clock corrections of -0.000000000500 and -0.000000004400, respectively. Again, create a linear fit line between the two and interpolate to get the correction for the exact MJD of the particular observation. Alternatively, this number can be found using the {clock1} command in the general2 plugin.
GPStoUTC = -2.76099*10^-9 s
Now, looking for the correction between UTC and international atomic time (TAI), use the utc2tai.clk file. The addition of seconds for leap times is defined at the following two websites: ftp://maia.usno.navy.mil/ser7/tai-utc.dat and http://hpiers.obspm.fr/eop-pc/earthor/utc/UTC-offsets_tab.html . Here only leap seconds are added and anything after 54832.000 has a correction of 34 seconds. This can be verified with the {clock2} command in general2.
UTCtoTAI = 34.0 s
The final clock correction is from TAI to TT(TAI) and this correction file is in the same directory with the name tai2tt_tai.clk. This correction is always a set added value of 32.184s, as terrestrial time runs at the same rate as the atomic timescale, but has an historical offset of that magnitude. This added value can be verified by using the {clock 3} command in general2.
TAItoTT = 32.184 s
The total TT correction is a sum of all these different clock corrections, such that
CorrectionTT = 66.18399845434048 s
This agrees with the value output as part of the general2 plugin which is CorrectionTT = 66.183998454340468243 s.
TT to TB Correction
A second conversion from Terrestrial Time to Barycentric Coordinate Time (TCB) needs to be done. This correction is done using the TE405 ephemeris from Irwin and Fukushima (1999) and is read from a binary file located in $Tempo2/ephemeris/ by Tempo2. The value can be found using the {tt2tb} command in the general2 plugin. This value is found to be 15.901240920369285465 seconds. Note that compared to pulsar periods and timing errors, this number is very large and close attention must be paid that it is included for all observations.
Alternatively, the ephemeris can be looked up in a table available for download from ftp://astroftp.phys.uvic.ca/pub/irwin/tephemeris/ by Irwin. In the downloadable package the 405 ephemeris table can be accessed and the value can be looked up by Julian Ephemeris Date (JED). One consideration to be made in these calculations is the use of ephemerides calculated in 1999 and applied to data from then onwards. Since that time some more updated models maybe have been created making the decade-old model less optimal. Tempo2 continues to use the 1999 model and we must consider small inaccuracies that this may cause in the timing model.
Tropospheric Delay
Tropospheric delays are read from the tropo.C file in the /Tempo2/ directory. They are broken up into two parts - a hydrostatic delay and a wet delay. To calculate these delays, the delay is first calculated at the zenith and then multiplied by a mapping function to apply it to a specific position or direction in the sky. The equation, as written by Davis et al. (Radio Sci 20 1593) is given by
Here tau is the tropospheric delay, me is the mapping function at elevation e and the subscritps d and w are for "dry" and "wet", respectively. Tempo2 approximates the mapping function to be csc(e) throughout. The hydrostatic delay is calculated by the formula given in the Tempo2 Paper II by Edwards et al., 2006 as

.
where ∆hz is the hydrostatic zenith delay, P is the atmospheric pressure, phi is the geodedic latitude of the observation site, and H is the height above the geoid. If the pressure information is unavailable a standard value of 1 atmosphere is used with P = 101.325kPa. This delay normally ends up being on the order of ~7.7 ns * csc(e) (Edwards et al., 2006).
The wet delay only accounts for a small fraction of the total tropospheric delay and is calculated using measurements from GPS, radiosonde, and water vapour radiometers. This information is not always available but is used by Tempo2 when provided for that observation time. If no information is avaiable a default tauw=0 is used.
If we intend to be accurate with our timing down to the nanosecond scale then the tropospheric delay must be taken into account, but on the timescale of days, this term will be very small compared to other more important correction factors. For the current point the tropospheric delay is only 1.4190938457860982459*10^-8 seconds (1.64247*10^-13 days).
Shapiro Delay
The Shapiro delay accounts for the signal from the pulsar traveling through curved spacetime in the solar system. Tempo2 takes the effects of the Sun, Jupiter, Venus, Saturn, Neptune, and Uranus into account separately and then the total Shapiro delay is the sum of all these terms.
To calculate the Shapiro delay, the main effect that needs to be considered is that of the Sun. If there is a delay that needs to be taken into account because of the planets the parameter file for the data set will have a PLANET_SHAPIRO term which multiplies all the calculated planet delays by 1, if there is no PLANET_SHAPIRO term, the delays from the planets will be multiplied by 0. The equation for the Shapiro delay as presented in the Tempo2 Paper II is of the form

Here, j corresponds to a specific object in the solar system, and psij is the pulsar-telescope-object angle (Edwards et al., 2006). To calculate this angle, a dot product is taken between the vector from the observatory to the pulsar, and the vector from the observatory to the solar system object, then divided by the length of the observatory to object vector |rj|. The observatory to object vector is calculated using the JPL ephemeris, and will not be explored in detail right now. Furthermore, for this observation of J1939, no PLANET_SHAPIRO term exists in the par file, so the planet calculations do not need to be done.
The delay due to the Sun can be calculated using the {sun_ssb1}, {sun_ssb2}, {sun_ssb3}, {earth_ssb1} (etc.) and {posTel} output in the general2 plugin as light travel times in seconds, since the vector from the observatory to the sun is the sum of these three terms for each coordinate in 3-dimensional space.
sunSSB = {-1.5237522050508911509, 1.7651841766939797562, 0.75958608141739969444}
earthSSBVector = {84.242292929369284593, -456.99273229890167158, -198.12304865952424393}
posTel = {0.002042, -0.017744, -0.011523}
telSun = -sunSSB + earthSSBVector + posTel
lengthTelSun = SquareRoot(DotProduct[telSun, telSun])
cosPhi = DotProduct(posPulsar, telSun)/lengthTelSun
Shapiro Delay = -5.301317203384068*10^-6 s
Where the value given by tempo2 as {shapiro} is -5.3009884720612458276*10^-6 seconds. These values differ slightly, but at a level smaller than a microsecond.
Roemer Delay
The Roemer delay is the time light takes to travel from the arrival at the observatory to the arrival at the Solar System Barycentre (SSB). To do this the distance from the telescope to the centre of the Earth is first calculated and then the distance from the Earth to the SSB is found using the DE405 ephemeris. The equation used for this calculation is given in Edwards et al. (2006) to be
and
where ∆RO is the Roemer delay, r is the position vector of the observatory, RBB is the direction unit vector of the barycentre, RO is the position vector of the barycenter at the time of observation, µ is the proper motion, ta_BB is the TOA of the pulse in the barycentre frame and tpos is the epoch of position (Edwards et al., 2006). Tempo2 calculates the roemer delay in calculate_bclt.C in the Tempo2 directory mentioned above using input parameters of proper motion, parallax, and position among others.
To calculate by hand, the main time delay that must be considered is the time light takes to travel from the centre of the Earth to the SSB. As in the equation above, this distance vector from Earth to SSB is RO and the time delay depends on this vector dotted with the unit vector in the direction of the pulsar such that the time delay t is
where theta depends on the right ascension and declination of the pulsar. RO cannot be calculated by hand, as it is found using the solar system ephemeris; however, the results of this calculation can be obtained from Tempo2 using the general2 plugin by calling {earth_ssb1}, {earth_ssb2}, and {earth_ssb3} as was done in the Shapiro Delay section. Such that the total light travel time between Earth and the SSB is total distance using the light travel times in each direction
EarthToSSB = 505.1651845705100455 s
This is the maximum delay possible from the centre of the Earth to the SSB at the time of observation, if the pulsar was directly in line making a pulsar-Earth-SSB angle of 180 degrees. But the total vector is from the observatory to the SSB, so the distance from the Parkes Telescope to the centre of the Earth must be added to the EarthToSSB distance calculation. The distance from the Parkes Telescope to the centre of the Earth should be easy to find given the radius of the Earth, but the location of Parkes with respect to the solar system barycentre depends on the rotation and precession of the Earth. The travel time for light from Parkes to the centre of the Earth in seconds, assuming that the distance to the centre is the average distance, 6371.0 km, would be
PKStoEarth = 0.0212367 s
maxDist = 505.1864212371767 s
This is the maximum delay possible from the centre of the Earth to the SSB at the time of observation, if the pulsar was directly in line making a pulsar-observatory-SSB angle of 180 degrees. But keep in mind that the fraction of the telescope to Earth time delay added to or subtracted from the Earth to SSB depends on the position of Parkes at the time of observation, and also depends on the angle the pulsar makes with the SSB with the observatory at the vertex.
A rough calculation can be done using the dot product of the observatory-pulsar vector and the observatory-SSB vector calculated in the Shapiro Delay section. When multiplied with the maximum possible delay from the observatory to the SSB the result is
maxDist*cosPhi = 345.8772614577373 s
The value of the roemer delay for a specific observation can be obtained using the {roemer} command in the general2 plugin; for this observation the value 345.54296607898590651 seconds is returned. It is still inaccurate on the level of a 10th of a second, which, for the purposes of pulsar timing, needs to be more accurate. Note that this value is very large for the timescale of pulsar observations and is a parameter that must be considered for all observations.
ISM Delay / TDis1
The dispersion measure (DM) delay in the timing of the pulse is related to the interstellar dispersion (ISD) along the line of travel of the pulse to the observatory. The DM value itself is a known parameter from Tempo2 and can be found using the general plugin using {DM_v}. This returns the value
DMval = 71.0398 pc cm^-3
which can then be used in the delay calculation. Here, the DM delay is calculated using the formula
where DM is the value of the DM for that observation, (2.410*10^-4) is the defined DM constant in Tempo2, and f^SSB is the observing frequency at the SSB. A separate frequency-dependent term can also be added to the ISD delay which is calculated as
where fk defines the scale and is the frequency-dependent term and zeta is the spectral index of the term (Edwards et al., 2006). In most cases, a value for the frequency-dependent term is not avaialable in the paramter file and the delay is set to zero.
To calculate the DM delay by hand, the frequency of the observation must be known. To get this frequency, use the Tempo2 general2 plugin with the {freq} command. For this observation it returns
freq = 1372.4069999999999254 MHz
Convert to Hz and transform due to the Einstein delay using Earth's velocity (obtained using {earth_ssb[4,5,6]}), the site velocity ({siteVel}), the position of the pulsar ({posPulsar}) and the Einstein Rate ({einstein}) such that
earthSSBVel = {9.6270722747879731106*10^-5, 1.5078184188503323637*10^-5, 6.536990635622206964*10^-6}
siteVel = {0.000001, 0, 0}
posPulsar = {0.391672, -0.843374, 0.367850}
pos = earthSSBVel + siteVel
vobs = posPulsar
vel = Dot[pos, vobs]
einsteinRate = 1.0000000153040300432
freqSSB = (freq*10^6 (1 - vel))/einsteinRate
where vel is the velocity of telescope along the line to the pulsar at the time of the observation relative to the speed of light. So the DM delay is
DM Delay = 0.1565103227320974 s
my value for the DM delay is still slightly different from the one calculated and output by general2 of 0.15647330642621240515 seconds, starting in the 4th decimal place.
IPM Delay / TDis2
The final delay Tempo2 takes into account is due to the interplanetary medium from the electrons in the solar wind. This delay is of a similar form to the ISM delay, but the solar DM is given by
where r is the vector from the observatory to the SSB and rho is the pulsar-Sun-observatory angle, no is the scale parameter that describes the electron density at 1 AU from the SSB. The scale parameter value is read from the par file from the NE1AU heading; if it is not specified in the par file, a default value of 4 cm^-3 at 1 AU is used. To go on to calculate the interplanetary medium (IPM) delay the following equation is used.
where f^SSB is the same frequency as was calculated in the ISM delay section. However, if we want to calculate this delay the same way as Tempo2 the following equation is required, which is similar, but not identical, to the previous equations.
Where DMconstSI is given in Tempo2 as 7.436*10^6, 1AU is 1.49598*10^11meters, and the other values are already known or have been previously calculated, such that
IPM Delay = 4.708800058360121*10-8 s
This values is fairly close to that calculated by Tempo2 using the {ipm} command in general2 of 4.7088004314713416481*10^-8 seconds and given that the delay, in seconds, is so small, it might be considered a term that we don't have to worry about as much as other larger terms when going through with the calculation.
The final BAT
In the end we want a corrected time in days, meaning that after all delays are calculated in seconds the final result to be added to the SAT will be
Delay = 0.004947589553090034 days
This is the value that should be added to the SAT to obtain the final barycentric arrival time. Therefore, the final result is
BAT = 55013.58468770947