Par Class¶
The Par class handles pulsar parameter files.
- class Par(filename[, numwrap=float, usedecimal=False])¶
- Parameters
Usage:
p = Par(FILENAME)
print(p.getPeriod()) #prints the period in the par file (does not calculate for a specific MJD for now)
t,dmx,dmxerr = p.getDMseries() #returns the DM parameters in a nice time-series. Note that errors are those given in the par file, which may not be the "correct" ones (more info to be provided later)
print(p.get("PX")) #prints the parallax
print(p.get("PX",error=True)) #prints the error on the parallax
Methods¶
- get(tag[, flag=None, error=False])¶
Return the value of a given parameter.
- Parameters
- Returns
value
- getPeriodDot([shklovskii=False])¶
Return the pulsar spin period derivative.
- getFrequencyDot([shklovskii=False])¶
Return the pulsar spin frequency derivative.
- getPM([error=False])¶
Calculate the proper motion in mas/yr. If only one of the two basis parameters is provided, return that value.
- getPX([error=False])¶
Return the parallax in mas.
- getDIST([error=False])¶
Return the distance in kpc.
- getDMX([full_output=False])¶
Return a tuple of the DMX time series (times, DMXs, DMX errors).
- Parameters
full_output (bool) – Return a tuple of the times, DMXs, DMX errors, DMXR1s, DMXR2s, DMXF1s, DMXF2s
- Returns
times (numpy.ndarray), DM (numpy.ndarray), DM errors (numpy.ndarray), unless full_output=True.
- getXMX()¶
Return a tuple of the XMX values.
- Returns
xmxs (numpy.ndarray), errs (numpy.ndarray), R1s (numpy.ndarray), R2s (numpy.ndarray), EXPs (numpy.ndarray),
Warning
This function is under construction.
- getDMseries()¶
Return a tuple of the DM time series (times, DMs, DM errors). DMs are calculated as the DMX model plus the DM parameter (the fiducial value).
- Returns
times (numpy.ndarray), DM (numpy.ndarray), DM errors (numpy.ndarray)
- getFD()¶
Return the coefficients associated with the FD parameters, in order (i.e., FD1, FD2, …).
- Return type
numpy.ndarray
- getFDfunc()¶
Return a Python function (lambda) that provides the timing delays as a function of observing frequency. The function takes one parameter, the observing frequency (in GHz), and returns timing delays in microseconds.
- Return type
function
Parameter Class¶
The Parameter class handles individual pulsar parameters.
- class Parameter(name[, value=None, fit=None, error=None, flag=None, flagvalue=None, numwrap=d.Decimal])¶
Stores the basic values of a Parameter in a par file.
- Parameters
name (str) – If only the name parameter is specified, then this is the entire parameter string and will be parsed. Otherwise, this is the parameter name (e.g. PSR, P0/F0, etc.)
value (str) – Parameter value. Can be supplied a numeric value that will be wrapped with the type numwrap is set to.
fit (str) – Parameter fit value, i.e. whether or not the parameter is to be fit in the timing model. Can be supplied a numeric value that will be wrapped with an int
error (str) – Parameter error. Can be supplied a numeric value that will be wrapped with the type numwrap is set to.
flag (str) – If there is a flag associated with the parameter
flagvalue (str) – The vale the flag is set to.
numwrap (type) – Type to wrap numeric values by. Decimal is used by default to keep numeric precision but becomes difficult to use with other packages. If precision is unneeded, set to float.
Methods¶
- getValue()¶
Return the value of the parameter.
- Return type
numwrap
- getError()¶
Return the value of the parameter error.
- Return type
numwrap