Tim Class¶
The Tim class handles pulsar times-of-arrival (TOAs) files
- class Tim(filename[, numwrap=float, usedecimal=False])¶
- Parameters
Usage:
t = Tim(FILENAME) #automatically parses each TOA with the TOA() class
print(t.toas[0].getMJD()) #prints the MJD of the first TOA as a python Decimal
print(t.toas[0].get('snr')) #prints the value of the -snr flag of the TOA if it is available
Methods¶
- load(filename)¶
Loads a .tim file.
- param str filename
Path to .tim file
- getFreqs()¶
Return the frequencies of each pulse profile the TOAs were generated from. Loops over
getFreq()
inTOA
.- Return type
numpy.ndarray
- getMJDs()¶
Return the MJD of each pulse profile the TOAs were generated from. Loops over
getMJD()
inTOA
.- Return type
numpy.ndarray
- getErrors()¶
Return the TOA uncertainties of each pulse profile the TOAs were generated from. Loops over
getError()
inTOA
.- Return type
numpy.ndarray
TOA Class¶
The TOA class handles individual pulsar times-of-arrival (TOAs).
- class TOA(filename[, freq=None, MJD=None, err=None, siteID=None, numwrap=Decimal, **kwargs])¶
Stores the five basic values of a TOA and any additional flags.
- Parameters
filename (str) – If only the filename parameter is specified, then the parameter is the entire TOA string and will be parsed.
freq (str) – TOA frequency. Can be supplied a numeric value that will be wrapped as a float.
MJD (str) – TOA MJD. Can be supplied a numeric value that will be wrapped with the type numwrap.
err (str) – TOA error in microseconds. Can be supplied a numeric value that will be wrapped as a float.
siteID (str) – TOA observatory site ID.
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.
**kwargs –
Additional flags. If the five base parameters are provided, each argument is a tuple of the form (flag, value). Otherwise, this is a string of all of the flags and values that must be parsed.
Methods¶
- getFrequency()¶
Return the frequency of the pulse profile the TOA was generated from.
- Return type
- getFreq()¶
Same as
getFrequency()
.
- get(flag)¶
For any flags stored with the TOA, return the value.
- comment()¶
Comment out the TOA (the TOA string is appended to “C “). Useful when saving out a .tim file.
- setFilename(filename)¶
Set the filename of the TOA to a value.
- Parameters
filename (str) – Filename to set in the TOA.
- setFrequency(freq)¶
Set the frequency of the TOA to a value.
- Parameters
freq (float) – Frequency to set in the TOA.
- setFreq(freq)¶
Same as
setFrequency()
.
- setError(err)¶
Set the error of the TOA to a value.
- Parameters
err (float) – Error to set in the TOA.
- setSiteID(siteID)¶
Set the observatory site ID of the TOA to a value.
- Parameters
siteID (str) – Site ID to set in the TOA.
- set(flag, value)¶
If the flag exists, set the value of an associated flag.