Hints for migrating from tempo1 to tempo2

First of all, the tempo2 web page is here and the quick overview is here. The full wiki documentation is here -- of course it's also linked off the main page.

TOA format: While tempo2 can read in tempo1-format TOAs, the ways tempo2 handles jumps, etc., is sufficiently different that it makes sense to convert tempo1 TOA files to the new format. To help with this, I've written a script called t2t2 which can be downloaded here. The script is designed to identify pairs of jumps and add -jump NNNN flags. It will also add -info flags in accordance with what it finds in the tempo1-format file, or using fixed values that the user inputs. It is also reasonably smart about identifying skipped sections and commented-out TOAs. Note that tempo2 continues to allow you to INCLUDE TOA files from your main .tim file, so my recommendation is to convert your individual TOA files with t2t2, then use more-or-less your original main .tim file with the INCLUDE statements.

Jumps: In tempo2, jump positions are not listed amongst the TOAs. Instead, your par file contains lists of flags that should be jumped around. For example, if you have a file with 2 jumps that you have converted with t2t2, you might include the following lines in your par file:
jump -jump 0
jump -jump 1
since t2t2 will have put "-jump 0" and "-jump 1" on the TOA lines that used to fall between the relevant JUMP pairs. But the tempo2 jumping is far more general than this. If you are timing a mixture of mark4, asp and wapp data, for example, you could have toa flags that say "-machine mark4", "-machine asp" and "-machine wapp" (entered on t2t2 command line) and then have .par file lines that say:
jump -machine asp
jump -machine wapp
This will use the mark4 data as the base and jump the asp and wapp data relative to it.

Mode: The MODE command has also moved from the TOA listings to the par file. Make sure you write "MODE 1" and not just "MODE" -- that's one tempo1 feature that's gone.

Ephemerides: DE200 and DE405 both work; might as well switch everything to DE405.

Time standards: Tempo2 tries to be clever about determining the most efficient route to the time standard you want. Sometimes (eg using UTC(NIST) at UBC) this results in using files that don't actually contain the needed clock corrections, and the residuals are just silly. What seems to work at the moment at UBC is using TT(BIPM) in the input par file, but I am still not sure I understand exactly what corrections are being done -- eg there are warning messages about assuming that UTC(ao) = UTC, which doesn't sound correct. I will work on understanding this. For current trial purposes, just use TT(BIPM).

To force a particular clock-correction chain: as an example, put in your .par file:
CLK_CORR_CHAIN ao2gps.clk gps2utc.clk utc2tai.clk tai2tt_tai.clk
CLK_CORR_CHAIN pks2gps.clk gps2utc.clk utc2tai.clk tai2tt_tai.clk
Note that this still doesn't help the bad judgement calls that tempo2 makes when the correction chain breaks down. Every now and then I harangue George about changing this.

Getting started: If you have TOA files and a par file that you want to test, the best way to get started is to type something like:
tempo2 -gr plk -f ihs.par ihs.tim -tempo1
This will pop up the plk interface to let you look at residuals, zap points, re-fit, etc., which is useful. The -tempo1 flag is absolutely vital, as it tells tempo2 that the .par file is in the old non-SI (!) tempo1 units.

To write out a new .par file: -newpar flag.

To write out a new .par file in tempo2 (SI) units: tempo2 -gr transform tempo1.par tempo2.par. I would recommend doing this with a tempo1.par file that is the product of a tempo2 fit.

To write out residuals: How to do this depends on whether or not you are using the plk plug-in. According to George:
tempo2 -f mypar.par mytim.tim -residuals
will produce a file called residuals.dat. For reasons I don't grasp but that undoubtedly have a certain amount of logic behind them, the -residuals flag doesn't work with plk. Instead, George says that in plk, you should list residuals with either:
Ctrl-j output listing of residuals in Jodrell format
Ctrl-o output listing of residuals in simple format
and, if you're feeling confident, you can define your own output format as in this example:
tempo2 -output general2 -s "{sat} {bat} {pre} {post}\n" -f a.par a.tim
This will print out the site-arrival-times, barycentric arrival times, pre-fit residuals and post-fit residuals. One can also use this to print flags, observing frequencies, clock corrections etc., and the routine can now also output a file instead of dumping to the screen.

Polycos: I don't yet completely understand the tempo2 polyco format. For the time being, tempo2 can be used to produce tempo1-style polyco files as described here.