Vetting Pulsars for Timing with TEMPO2

Getting to the data

Log onto the head node of the Green II supercomputer by ssh: ssh -Y [your-username]@g2.hpc.swin.edu.au Switch to one of the interactive nodes (gstar001, gstar002, sstar001, sstar002, or sstar003) by ssh-ing onto it:

ssh -Y gstar002

From here we can go to the directory where the pulsar data is stored:

cd /lustre/projects/p002_swin/your_directory/timing/utmost/

Simply typing ls -l will show all of the pulsars which have observations. To find a dataset that has a file size within some constraints, we can add the following to the ls -l command:

ls -l | awk ‘{if ($5 > 40000 && < 100000) print $9}

Where $5 is the 5th column from the output of ls -l (directory size), and the $9 after the print statement gives the name of the directory.

Visually inspecting data

Going into one of these directories, we find data files with three different file types: *.T have been “scrunched” in time. *.F have been “scrunched” in frequency. *.FT have been “scrunched” in both frequency and time. We can use psrplot (one of PSRCHIVE’s programs) to take a look at the flux of the pulse profile of an observation as:

psrplot -p flux *.FT

There is also a file which ends in .std. This file is a standard template/model which has been created for this particular pulsar. It can be plotted using the previous command by replacing *.FT with *.std.

We can also look at the de-dispersed spectrogram and pulse profile by using pdmp, which finds the optimal dispersion measure and pulsar period:

pdmp *.T

This opens 4 plots in addition to the metadata of the data file. These plots include (from the top): dispersion measure as a function of delta period, elapsed time as a function of pulse phase, phase vs. frequency and power as a function of time.

The spectrograms occasionally have horizontal lines in them, which corresponds to where some radio-frequency interference or RFI (likely originating from a mobile phone near the telescope) has been removed.

Good pulsar observations will have relatively clear pulse peaks in the pulse profiles, and should show up clearly in the de-dispersed spectrograms.

Making a timing file

Now we want to make a timing file. These contain the timing residuals leftover after subtracting the template from the data, and are used by tempo2 to assist in vetting pulsars for timing. To make the .tim file (which we’ll call name.tim) we use pat and tempo2 as:

pat -s *std -f tempo2 *.FT > name.tim

After this, there’s one more step we need to do before we look at the timing residuals.

Making a parameters file

On occasion the ephemeris of the existing .par file is not ideal (or one doesn’t exist yet). We can rip either get the ephemeris of the pulsar from the pulsar catalog:

psrcat -E psr_name > cat.par

or we can rip it from the latest observation by using both vap and grep:

vap -E YYYY-MM-DD-hh:mm:ss.clean.FT | (grep -v FINISH) > name.par

Once we have a .par file we can take a look at the timing residuals. If need be, the ephemerides contained within this .par file can then be applied to all of the frequency scrunched files via the pam tool as follows:

pam -E cat.par -e cF *.F

These “corrected” files are then scrunched in time:

pam -e cFT -T *.cF

From here we run the pat tool again, but using the corrected *clean.cFT files.

Inspecting the timing residuals

We open the timing residuals in an X11 window by using the following tempo2 command:

tempo2 -gr plk -f name.par name.tim -nofit -npsr 1

There’s a number of check-boxes along the top of the GUI you can choose to assist in fitting the data (e.g RA, DEC, F, F0, etc...), and you can change what is plotted on the x/y-axes by checking/unchecking the boxes to the left of the plot.

Any obvious outliers in the resulting timing residual plot can be deleted by zooming in on them by pressing the z key and drawing a box around them, pressing the o key to highlight the points and then pressing ctrl d to delete them. Alternatively, scrolling in with the mouse wheel will also get rid of them (but be careful to not overdo it with this method).

We also want to get rid of any points with very large TOA errors (likely due to low SNR). We can remove these by changing the x-axis to TOA error and removing these points in the same was as the outliers from before.

Having gotten rid of these points, we can then re-fit the residuals by pressing the REFIT button.

In the most ideal scenario, the timing residuals will be very small and largely scattered around zero. For this pulsar we can then also fit for RA, DEC, F0 and F1. From this fit, we can then make new .tim and .par files directly from tempo2.

Note that not all pulsars can be fit for these parameters, those in binaries tend to have many other parameters which can be fit for (but shouldn’t be fit for in practice!). Pulsars with very few points over a short observation span cannot be accurately localised, so fitting for RA and Dec doesn’t make much sense. The same with fitting for F1 if there is number of observations is low. From this fit, we can then make new .tim and .par files directly from tempo2 by clicking the New par and New tim buttons.

Combining archives into one

Sometimes the provided standard is not an accurate model of the pulse profile, or there may not be a standard template to begin with. To make a standard from the data, we generally want to use either an observation with a very high SNR, or a stack of observations to artificially boost the SNR.

Using cat ml.tim, we can see all of the individual archives that went into making the .tim file. A more detailed version of this can be viewed by using:

cat name.tim | grep mo | awk ‘{print $1}

To combine all of these archives into to make single pulse profile (the grand.FT data file), we use the psradd program as follows:

psradd -o grand.FT -E name.par `cat ml.tim | grep -v C | awk ‘{print $1}| grep 20` -F

We can then visually inspect the combined pulse profile using pdmp grand.FT or by using pav -DFT grand.FT to plot the spectrogram. If it looks like a good match to the rest of the observations, we can then move on to processing it. We then scrunch grand.ar in time by using pam:

pam -m -T grand.FT

Now we can make the standard by using the package:

pas grand.FT /xs

Once we have our new standard, we can apply it to the observations using the pat tool as before:

pat -A FDM -s *.std -f tempo2 *.clean.FT > name.tim

And then using tempo2 to inspect the residuals.