Pulsars and neutron stars/Tutorials and worksheets

Pulsar timing tutorials edit

Timing practice: step-by-step edit

This tutorial was given by G. Hobbs, M. Yu and S. Dai at the Kunming SKA summer school (2015).

Does tempo2 basically work and are the plugins available:

tempo2 –h

Parameter determination for easy data set edit

Have a simulated data set (data1.par and data1.tim). The data only contains white noise. What are the pulsar parameters?

  1. Look at data1.par and data1.tim files
  2. tempo2 -f data1.par data1.tim
  3. tempo2 –gr plk -f data1.par data1.tim
  4. Press ‘h’ to see some “help” information
  5. First check for phase jumps (see later) – check that the -0.5 < residual phase is < 0.5
  6. Click on postfit for the y-axis
  7. Select to fit for F0
  8. Click on RE-FIT
  9. Compare pre-fit with post-fit
  10. Look at the text output for the new parameter and its uncertainty (and check the reduced chisq value)
  11. Now fit for F0 and F1 simultaneously (select F1, select post-fit, click on RE-FIT)
  12. Check the parameter output and uncertainties
  13. Now also fit for RAJ and DECJ (along with F0 and F1)
  14. Now also fit for PMRA and PMDEC
  15. Now select to plot “day of year” on the x-axis and “post-fit” on the y-axis.
  16. Now fit for PX and plot with date on x-axis and post-fit on y-axis (also check with day-of-year on the x-axis)
  17. Check the final parameter output and uncertainties and reduced chisq value?
  18. Save your results by clicking “New par” enter the new name (data1_final.par)
  19. Quit by clicking on “Quit”
  20. tempo2 –gr plk –f data1_final.par data1.tim

(also can try with a different realization of the white noise: data2.par data2.tim)

Visualizing the residuals edit

  1. tempo2 –gr plk –f data4.par data4.tim
  2. Click with the left mouse button on a point to see information about that point. If profiles exist (not for this data) then click the middle mouse button to see the profile
  3. Can use the right mouse button to delete a single point (or press ‘d’)
  4. Can use shift-z to delete a region of points
  5. Can save a new arrival time file by clicking on “New Tim” – select “tempo2” format and then type in a new file name “good.tim”. Quit
  6. tempo2 –gr plk –f data4.par good.tim
  7. Select plotting “frequency” on the x-axis – note the colour scheme for different frequencies (red = 700 MHz data, green = 1400 MHz data, blue = 3100 MHz data).
  8. Click on some green points and note the “-or pks1” (this is a flag in the arrival time file). Note “-or pks2” for the blue points and “-or pks3”, “-or pks4” and “-or pks5” for the red points.
  9. Plot “date” on x-axis and press “ctrl-i” then type –or. This colours the points by the “-or” flag. Press “ctrl-i” again to return to default colours.
  10. There are clearly some offsets between the different systems. Open the parameter file (data4.par) and add in:

JUMP –or pks1 0 1
JUMP –or pks3 0 1

  1. tempo2 –gr plk –f data4.par good.tim (notice that the offsets are changing).
  2. Also add in:

JUMP –or pks4 0 1
JUMP –or pks5 0 1

  1. tempo2 –gr plk –f data4.par good.tim
  2. Why haven’t we put a jump on “-or pks2” ?
  3. Now fit the other parameters and produce a good set of parameters. Save as good.par and good.tim.

Dispersion measure variations edit

  1. tempo2 –gr plk –f data7.par data7.tim
  2. Find the MJD of the earliest observation and the latest observation (click with the left mouse button)
  3. Add into data7.par:
  1. seq 52960 100 56060 | awk ‘{print “DMOFF”,$1,0,0}’ >> data7.par
  2. tempo2 –gr plk –f data7.par data7.tim
  3. Look at the post-fit residuals


plot “J1744-1134.dm” using 1:2:3 w yerr

EFACs and EQUADs edit

  1. tempo2 –gr plk –f data5.par data5.tim
  2. Plot “TOA error” on the x-axis. Note that the error bars are clearly wrong. Must correct the errors somehow.

e’ = (e2 + EQUAD2)1/2 x EFAC (note that this has no physical meaning)

  1. Let’s guess an EQUAD (in microseconds). Add


at the top (after FORMAT 1) of the data5.tim file

  1. tempo2 –gr plk –f data5.par data5.tim (look at the reduced chisq value)
  2. Now change EQUAD 5 to EFAC 10. Check the reduced chisq value
  3. Now remove EFAC and EQUAD from the arrival time file
  4. tempo2 –gr efacEquad –f data5.par data5.tim –flag –or –plot (press ‘q’ to quit)
  5. Copy efacEquad_output.dat into data5.par file.
  6. tempo2 –gr plk –f data5.par data5.tim (look at the reduced chisq value)

Parameter determination with a red noise model edit

  1. tempo2 –gr plk –f data3.par data3.tim
  2. Follow the same process as for data1.par and data1.tim until you have fitted for all the parameters. Check the fit results and the reduced chisq (>> 1). Notice that the post-fit residuals are not white.
  3. Save our best parameters: “New Par” and save as try1.par. Quit
  4. tempo2 –gr spectralModel –f try1.par data3.tim –npsr 1
  5. Type 30 and then type 0
  6. Press ‘2’
  7. Guess 0.1, 5, 5, press ‘0’
  8. Press ‘1’
  9. Notice excess power at 1/1yr. We need to improve our fit for position before getting a good red noise model
  10. Check for J1744-1134.model file on your disk
  11. tempo2 –gr plk –f try1.par data3.tim –dcf J1744-1134.model
  12. Look at pre-fit and post-fit and the resulting parameters (look at PX)
  13. Write out a new parameter file (try2.par) and quit
  14. tempo2 –gr spectralModel –f try2.par data3.tim –npsr 1 –nofit –fit f0 –fit f1
  15. Type “30” then “0” then “2”, “0.1”, “5.5”, “8”, “0”, “1”
  16. Re-run tempo2 –gr plk …. and iterate until the parameters stop changing

Is the noise model good enough? Does it whiten and normalise the residuals?

  1. Save as good.par
  2. gnuplot
  3. plot “cholWhiteRes.dat” using 1:2
  4. Check that these points are “white” and Gaussianly distributed with a standard deviation of 1.

Do you believe the red noise model parameters? Can you get similarly good parameters, but with a different red noise model parameters?

Phase wraps and pulse numbering edit

  1. tempo2 –gr plk –f data6.par data6.tim

(There are quite a few ways to solve this … here’s one …)

  1. Add the following into data6.par:
F2 0 
F3 0
F4 0
F5 0
F6 0
  1. tempo2 –gr plk –f data6.par data6.tim
  2. Choose post-fit plotting on the y-axis. Select a region without a phase jump (use ‘z’). Press ‘y’. Click on “RE-FIT” (that only fits in that small region)
  3. Unzoom ‘u’ and repeat as much as possible
  4. When it is not possible to go further, turn on fitting for F2 and repeat.
  5. Repeat with F3, F4 etc. Note that this works well until MJD 55400
  6. For now let’s delete the data after MJD 55400. Press ‘n’. This produces a new file “withpn.tim”.
  7. cp withpn.tim start.tim
  8. Note that it contains pulse numbers
  9. Now do the same for the data from 55400 onwards (but ensure that one observation overlaps). Press ‘n’ and copy the new withpn.tim to end.tim
  10. We now have to join the files (but ensure that the observation at 55400 has the same pulse number)
  11. In start.tim it has pulse number 50891778739
  12. In end.tim it has pulse number 50891778672 (so must add 67 to all the pulse numbers in end.tim)
  13. awk ‘{print $1,$2,$3,$4,$5,$6,$7+67}’ end.tim >> start.tim
  14. Tell tempo2 to use the pulse numbering scheme. In data6.par add:


  1. tempo2 –gr plk –f data6.par start.tim
  2. Note the timing noise and the glitch!

Also look at the “splk”, “plotMany”, “publish”, “glitch”, “general”, “general2” plugins. See [1] for more usage instructions.