Skip to content
David Kaplan edited this page Dec 17, 2021 · 24 revisions

Find data files for testing/tutorials

The data files (par and tim) associated with the tutorials and other examples can be located via pint.config.examplefile() (available via the pint.config module):

import pint.config
fullfilename = pint.config.examplefile(filename)

For example, the file NGC6440E.par from the Time a Pulsar notebook can be found via:

import pint
fullfilename = pint.config.examplefile("NGC6440E.par")

Load a par file

from pint.models import get_model
m = get_model(parfile)

Load a tim file

from pint.toa import get_TOAs
t = get_TOAs(timfile)

Load a tim and par file together

m, t = get_model_and_toas(parfile, timfile)

Get the red noise basis functions and the corresponding coefficients out of a PINT fitter object

Select TOAs

You can index by column name into the TOAs object, so you can do toas["observatory"] or whatever the column is called; and that's an array, so you can do toas["observatory"]=="arecibo" to get a Boolean array; and you can index with boolean arrays, so you can do toas[toas["observatory"]=="arecibo"] to get a new TOAs object referencing a subset.

Avoid "KeyError: 'obs_jupiter_pos' error when trying to grab residuals?"

You need to have the TOAs object compute the positions of the planets and add them to the table.

ts.compute_posvels(ephem,planets=True)

This should be done automatically if you load your TOAs with the get_TOAs() or get_model_and_TOAs()

Convert from ELAT/ELONG <-> RA/DEC if I have a timing model

model.as_ICRS(epoch=epoch)

which will give it to you as a model with AstrometryEquatorial components at the requested epoch. Similarly,

model.as_ECL(epoch=epoch)

does the same for AstrometryEcliptic (with an optional specification of the obliquity).