-
Notifications
You must be signed in to change notification settings - Fork 101
Code Architecture
PINT has four basic classes: TOAs Class, Timing Model Class, Residual Class, and Fitter Class. The connection is showed in the figure below.
Raw TOA times are assumed to be UTC as measured by an observatory clock, however they are represented as astropy.Time objects, so it should be OK to specify them in different time systems (TAI, TT, TDB).
Time corrections are then applied to obtain some realization of UTC (is this supposed to be UTC(NIST), UTC(GPS), or what??) in this sense:
UTC = UTC(obs) + CLOCK_CORRECTION
From there, TDB is computed from UTC using the time conversions built in to the astropy.Time class, which proceeds via the following flowchart:
Individual arrival times are represented by a TOA
object, while a collection of them are represented by the TOAs
object. TOA
objects are generally only transitory, since most of the useful functionality for computing with TOAs is implements in the collective TOAs
class
The TOA
class represents a single time of arrival. It has the following instance variables
-
mjd
This is an astropy.time object representing the arrival time. It is generally the UTC time recorded by an observatory clock, but can be in a different time system in certain cases (such as barycentric arrival times). -
obs
This is one of the observatory codes specified in$PINT/datafiles/observatories.txt
. These represent a location in ITRF coordinates and assume an observatory fixed to the rotation Earth. -
error
This is the uncertainty in themjd
as an astropy Quantity with units (typically microseconds) -
freq
This is the observatory-centric frequency of the observed TOA as an astropy Quantity with units (typically in MHz) -
flags
This is any number of keyword=value pairs that provided additional metadata for the TOA (e.g. backend=GUPPI, ...) - (SUGGESTION TOAs should be able to have a position and velocity specified per TOA instead of an observatory. Perhaps this can be implemented as a special
obs
code.)
This class represents a collection of TOAs. Rather than do this as a collection of TOA
objects, the information is kept in an astropy.Table for computational efficiency. A TOAs
object can be instantiated from TEMPO/Tempo2 'tim' files or from a previously pickled TOAs object. (Soon it will also be able to be instantiated from a list of TOA objects, but this is not in the master branch yet)
The instance variables include:
-
toas
a list ofTOA
objects. This only exists until the table is created.
##Introduction PINT model classes are a set of classes which provide the timing model calculation,majorly time delays,phases and delay derivatives. It is an independent module from TOA class module. All the model components classes are subclasses of TimingModel class. Each model class should be aiming for calculating one component of the whole pulsar timing model, for example Dispersion Delay or Pulsar Binary Delay.
##Get your model
- The easiest way to get your model is using PINT built-in model components. If you have a .par file, a type of file provides a set of model parameters. To build your model, just simply do:
[1] import pint.models.model_builder as mbuilder
[2] my_model = mbuilder.get_model('modelname','filename.par')
It will choose the right model components from the built-in list and return the total timing model as a class instance.
- Building your own model from built-in components is very straightforward as well. For example if you want a BT binary model with one component from pint.models.bt.BT and read .par file from J1955.par:
[1] from .bt import BT
[2] mb = model_builder("BT_model")
[3] mb.add_components(BT)
[4] psrJ1955 = mb.get_model_instance('J1955.par')
A model component is a subclass of TimingModel, which is defined in the file pint.models.timing_model.py. In other words, it is based on TimingModel class and uses TimingModel class's attributions. To allow pint interact with your model component, the procedure has to be followed.
- Declare component class
[1]from pint.models.timing_model import TimingModel
[2]class MyComponent(TimingModel):
# Define MyComponent as a subclass of TimingModel
def __init__(self,arg):
# Initial MyComponent class, arg is the arguments input.
super(MyComponent, self).__init__()
# Initialize the base class, TimingModel, attributions
commands
# Commands for initializing MyComponent class
- Astrometry - Requires: - Observatory TOAs in TDB time scale - Provides: - Observatory Position and Velocity relative to pulsar - Roemer Delay - Parallax Delay - Solar System Barycenter TOAs - Solar System Barycenter frequency
- Solar System Shapiro
- Requires:
- Observatory TOAs in TDB time scale
- Provides:
- Solar System Shapiro delay
- Requires:
- Dispersion
- Requires:
- Solar System Barycenter frequency
- Provides:
- Infinite frequency time delay
- Inheritance:
- DMX model
- Requires:
- Frequency Dependent
- Requires:
- Pulsar emission TOA
- Provides:
- Frequency Dependent delay
- Requires:
- Pulsar Binary
- Requires:
- Solar System Barycenter TOAs
- TOAs at infinite frequency
- Provides:
- Binary delay
- Pulse emission time
- Inheritance:
- BT model
- DD model
- Requires:
- Jump
- Requires:
- Not fixed
- Provides:
- Extra delay of phase
- Requires: