pint.polycos.Polycos
- class pint.polycos.Polycos(filename=None, format='tempo')[source]
Bases:
object
A class for polycos model.
Polyco is a fast phase calculator. It fits a set of data using polynomials and can predict phases at points in between.
Initialize polycos from a file
- Parameters:
Methods
add_polyco_file_format
(formatName, methodMood)Add a polyco file format and its reading/writing method to the class.
Polyco evaluate absolute phase for a time array.
eval_phase
(t)Polyco evaluation of fractional phase
Polyco evaluate spin frequency for a time array.
Polyco evaluate spin frequency derivative for a time array.
find_entry
(t)Find the right entry for the input time.
generate_polycos
(model, mjdStart, mjdEnd, ...)Generate the polyco data.
read
(filename[, format])Read polyco file to a table.
read_polyco_file
(filename[, format])Read polyco file to a table.
write_polyco_file
([filename, format])Write Polyco table to a file.
Attributes
polycoFormats
- classmethod add_polyco_file_format(formatName, methodMood, readMethod=None, writeMethod=None)[source]
Add a polyco file format and its reading/writing method to the class. Then register it to the table reading.
- Parameters:
Notes
The read/write methods should correspond to what are needed by
astropy.io.registry.register_reader()
andastropy.io.registry.register_writer()
, respectively
- read_polyco_file(filename, format='tempo')[source]
Read polyco file to a table.
Included for backward compatibility. It is better to use
pint.polycos.Polycos.read()
.
- classmethod generate_polycos(model, mjdStart, mjdEnd, obs, segLength, ncoeff, obsFreq, maxha=12.0, method='TEMPO', numNodes=20, progress=True)[source]
Generate the polyco data.
- Parameters:
model (TimingModel) – TimingModel to generate the Polycos
mjdStart (float, np.longdouble) – Start time of polycos in mjd
mjdEnd (float, np.longdouble) – Ending time of polycos in mjd
obs (str) – Observatory code
segLength (int) – Length of polyco segement [minutes]
ncoeff (int) – Number of coefficents
obsFreq (float) – Observing frequency [MHz]
maxha (float, optional.) – Maximum hour angle. Default 12.0. Only 12.0 is supported for now.
method (str, optional) – Method to generate polycos. Only the
TEMPO
method is supported for now.numNodes (int, optional) – Number of nodes for fitting. It cannot be less then the number of coefficents. Default: 20
progress (bool, optional) – Whether or not to show the progress bar during calculation
- Return type:
- find_entry(t)[source]
Find the right entry for the input time.
- Parameters:
t (numpy.ndarray or float) – A time array in MJD.
- Returns:
Indices corresponding to the desired time(s)
- Return type:
- Raises:
ValueError – If the input time(s) are not covered by the polycos
- eval_phase(t)[source]
Polyco evaluation of fractional phase
- Parameters:
t (numpy.ndarray or float) – An time array in MJD. Time sample should be in order
- Returns:
Fractional phase
- Return type:
Notes
Returns fractional part of
pint.polycos.Polycos.eval_abs_phase()
- eval_abs_phase(t)[source]
Polyco evaluate absolute phase for a time array.
- Parameters:
t (numpy.ndarray or float) – An time array in MJD. Time sample should be in order
- Returns:
Polyco evaluated absolute phase for t.
- Return type:
Notes
Calculates phase according to:
\[\phi = \phi_0 + 60 \Delta T f_0 + COEFF[1] + COEFF[2] \Delta T + COEFF[3] \Delta T^2 + \ldots\]Calculation done using
pint.polycos.PolycoEntry.evalabsphase()
- eval_spin_freq(t)[source]
Polyco evaluate spin frequency for a time array.
- Parameters:
t (numpy.ndarray or float) – An time array in MJD. Time samples should be in order
- Returns:
Polyco evaluated spin frequency [Hz] at time t.
- Return type:
Notes
Calculates frequency according to:
\[f({\rm Hz}) = f_0 + \frac{1}{60}\left(COEFF[2] + 2 \Delta T COEFF[3] + 3 \Delta T^2 COEFF[4] + \ldots\right)\]Calculation done using
pint.polycos.PolycoEntry.evalfreq()
- eval_spin_freq_derivative(t)[source]
Polyco evaluate spin frequency derivative for a time array.
- Parameters:
t (numpy.ndarray or float) – An time array in MJD. Time samples should be in order
- Returns:
Polyco evaluated spin frequency derivative [Hz/s] at time t.
- Return type:
Notes
Calculation done using
pint.polycos.PolycoEntry.evalfreqderiv()