Jodrell Pulsar Timing Programs - Making a new template

Background There is a directory for each pulsar under /psrdata/timing for each pulsar that we observe at jodrell (or have imported data for). If a pulsar goes under a veriety of names there should be soft links to direct the user to a single directory.

Data in the form of profiles with accurate start times can come from a variety of soures. Data from the Jodrells filter bank/hardware dedispersers are taken from the VAX as binary files. Their standard processing is detailed in the "General" section. However data in the form of EPN, mel(Parkes) and a few other formats can also be dealt with.

To produce a set of arrival times from profile data, the following steps are taken (usually by scripts).

So..... to get timing points from observations you need have a template!

We have several forms of templating available in psrprof. These are controlled by the file templates.code in the working directoy. templates.code has a very strictly designed format ie the software is unforgiving. The format is: psrname ABCDE F
where psrname is left justified in a 9 character field
ABCDE are numbers between 0 and 5 and define which freq profile to use at each freq. band (for bands see below). eg 22444 would mean to use the 550 to 750MHz template for freqs up to 750MHz and the 1100MHz to 1500MHz template for freqs. above 750MHz. A zero in this field has special meaning whcih is set by the F flag
F is a flag to push the software into using alternative templating methods.
If the flag is blank, or the flag is M AND the freq. code is NOT zero, method 1 is used - see below.
If F is M (and the appropriate freq code is zero) a template is made. See method 2 below.
If F is G a template is made from a set of gaussian parameters held in a file given by the frequency code. See method 3 below.
If F is S TOAS will be produced by fitting a series of gaussians to the profile. See method 4. This was designed for 1809-1943

Method 1
Getting an ideal profile
For the majority of pulsars a template starts with an "ideal" profile for a particular frequency range.
(A profile can be used for a number of different frequencies, or all of them) Jodrell's software can use up to 5 different profiles which cover the the following frequency ranges.
  • less than 500 MHz
  • from 500 MHz to 750 MHz
  • from 750 MHz to 1100 MHz
  • from 1100 MHz to 1500 MHz
  • greater than 1500 MHz

This assumes that you are working with some data from a new discovery!
and the data is "in house". Observations should have been sorted into a directory /psrdata/timing/PSRNAME which will contain nothing but your new data file(s) called Axx.bin.
If the data is from another source, create a directory and copy your data files there and produce a Jodrell formatted bin file - then you can make use of similar processing methods.)

  • touch auto to create an empty auto file which enables script processing. (you can always remove this later).
  • put the pulsar's ephemeris file in this directory and name it (or copy it to) psrav.eph
  • Run the processing script psrav PSRNAME all to force the processing of whatever data files are in the PSRNAME directory. Thsi script will not run completely, since you haven't got any templates yet, but will produce all the default configuration files required for processing.
    The psrav script should get as far as producing an averaged profile from each set of subints in a file called psrav.bin.
  • If the pulsar is strong and the ephemeris good, you may be able to use the profiles from each subint to produce a template, otherwise you will probably have to try and correct any drift in arrival times between subints before a profile can be seen.
  • Start psrprof
  • If you have good averaged profiles, use the the data in psrav.bin by typing
    set in1file psrav.bin. Otherwise type
    set in1file Axx.bin where Axx.bin is the raw data file,and then type obey psravedit.dat to configure psrprof to average, dedisp.and baseline channels in each subint.
  • If your data file contains observations at different frequencies, you may want to select a particlar frequency range to work on
    selectfreq from XXXX to YYYY where X and Y are in MHz.
  • Read and display profiles until you see a clear example
    read in disp in
  • copy this profile to the av buffer
    copy inav
  • Contine reading and displaying profiles, whenever the profile is "good" ie a reasonable, if noisy, example of the pulse, align this profile with that already stored in the av buffer , and combine them
    align in av average 0.0
  • When you reach the end of all your data, see what you've got in the av buffer
    disp av
    If you have a visible pulse there you can continue to use it as the basis of a template. (A better template can always be produced when more data is available and an improved ephemeris gives less smearing of the pulse in each subint).
  • copy your profile to the in buffer for the next stage
    copy avin
Method 1
Making a template from a profile
You should now have the "best" profile that you can make from observed data in psrprof's in buffer .... or if you've jumped to this step, run psrprof, open a file containing such a profile and read it in
set in1f xxxxx
read in disp in
  • If the profile is noisy, use the smooth command (repeatedly) to reduce the noise. (the smooth command convolves the profile with an N bin triangle) eg
    smooth in 3 disp in
  • Window in on the pulse plus a few pulse widths. We're aiming to make a template with the pulse flanked on each side by approx. a pulse width of basline, so give yourself this plus a bit extra to start with
    window in pulse 0.0 xx.x disp in where xx.x is the window size in secs.
  • flatten the noise from the baseline using the changedata command
    changedata in
    I use the zero command for the baseline, sometimes a little interpolation, and don't worry about the outside edges, thes can be trimmed! (everyone has their own style here :-).
  • Run the profile through smooth again if you like.
  • window in to a final width window in pulse 0.0 xx.x disp in
  • Is it OK?
    If so, create a template
    maketemp in disp a3
    The template is created by normalising the profile (so that the area is 1) and adding a timestamp tothe header to mark the centre of the profile. The new profile is stored in the a3 buffer
  • Write the template to a file
    set out1file newtemp.bin write a3 quit
Method 1
Setting up templates for use
When you have produced your new profile you need to create the correct templates.code file (see above)

psrprof reads templates.code, if no flag is found, it then searches first for a set of templates in templates.bin which must be a multi channel file with the channels containing a template for each of the 5 freq. ranges. If found, these templates sre used. If not, psrprof looks for profiles in separate files for each freq. band (408temps.bin,610temps.bin,910temps.bin,1420temps.bin, and 1600temps.bin

So.... when you have produced your new template (see above):

  • rename the file with the correct name for it's frequency band eg 1420temps.bin
  • produce a templates.code file with the line xPPPPPPPPPx12345 where PPPPPPPPP is the pulsarname and change 12345 to show the new template eg if you have only got a template for the 1100MHz to 1500MHZ range, this should be in 1420temps.bin and templates.code should read xPPPPPPPPPx44444 ie use range 4 template for all ranges.
Method 1
Adding more templates
Briefly, as templates for other frequency ranges are produced, they must be aligned with existing templates and placed in correctly named files. templates.code should be edited to use the new templates. When more than one frequency range is available, the templates can be loaded into templates.bin which will then be used by psrprof.(More detail later).
Method 1
Replacing templates
If you are replacing a template with an improved version and it is the only template in use, simply replace the template file and rerun psrav pulsarname all.
If you have templates at other frequencies, align your new template with the old one, replace the individual file and replace the channel in templates.bin (or remake it).
Method 2
Making templates for 0531+21, and moding pulsars
If the flag in templates.code is set to M and the appropriate freq code is set to 0, then the findtemp command is redirected to make a template by a variey of methods
0531+21 is hardwired to produce a template from a 3 triangles
Any other pulsar will find the best fit template from combination of two templates (it looks for multifreq templates in templatesa.bin and templatesb.bin, then for single freq templates in temp.bin tempb.bin)

These templates are produced in the same way as for method 1, but examples of the different modes of the pulsar are selected for each template file. (Some work with changetbin can also be used to adjust the profiles).

Method 3
Retrieving a pulsar template stored as a set of gaussian parameters
If the flag in templates.code is set to G then the findtemp command is redirected to make a template by reading a file containing parameters describing a set of gaussians
. (This may become more important as the different pulsar groups try to standardise timing results.
The file consists of:
  • comment lines shown by a # in column 1
  • Version: 1.0
  • Pulsar: 0737-3039 (pulsar name max 12 chars)
  • Freq (MHz): 1390.000
  • Tau (deg): 0.000000
  • Components: 26
  • list of components - component number, centre, amplitude,width
    1 86.0696 0.3066 2.5074
    2 66.4865 0.4654 3.7385
    26 80.0024 0.3053 4.9867
The frequency code sets the name of the parameter file, it will be, 408t,610t,910t,1420t or 1600t folled by sumg.tmpl eg if the frequency code in templates.code is 4, then the file opened will be 1420tsumg.tmpl.
Method 4
Finding TOAS by fitting a number of gaussians to the profile
If the flag in templates.code is set to S then the findtemp command creates a set of N gaussians where N is the number in the frequency code slot for the obs. frequency. The cntre of each gaussian is written directly to a file called gaussfit.log as an arrival time in tempo format. The result is a file of multiple SATS for each profile. This was developed for 1809-1943 and a README in the working directory describes the methods of use. Note: you do not need to follow the findtemp command with a getarrtime!
Note: Mod Nov 15 2006. Initial parameter file for the gaussians may be needed, it's called gauss.par and should contain a comment line followed by values (in secs. for the initial hpbw and total width. If no file is found the values of .2 and .8 will be used, which are Ok for 1809-1943.
Dec 20th 2005