Polyco

class baseband_tasks.phases.Polyco(data, *args, **kwargs)[source] [edit on github]

Bases: astropy.table.QTable

Read in polyco file as Table, and set up class.

Methods Summary

__call__(time[, index, rphase, deriv, time_unit])

Predict phase or frequency (derivatives) for given mjd (array)

fpol(index[, t0, time_unit, convert])

Frequency prediction polynomial set up for times in MJD

phasepol(index[, rphase, t0, time_unit, convert])

Phase prediction polynomial set up for times in MJD

polynomial(index[, rphase, deriv, t0, ...])

Prediction polynomial set up for times in MJD

searchclosest(mjd)

Find index to polyco that is closest in time to (set of) Time/MJD

to_polyco([name, style])

Write the polyco table to a polyco file.

Methods Documentation

__call__(time, index=None, rphase=None, deriv=0, time_unit=Unit('s'))[source] [edit on github]

Predict phase or frequency (derivatives) for given mjd (array)

Parameters
mjd_inTime or float (array)

Time instances of MJD’s for which phases are to be generated. If float, assumed to be MJD (NOTE: less precise!)

indexint (array), None, float, or Time

indices into Table for corresponding polyco’s; if None, it will be deterined from mjd_in (giving an explicit index can help speed up the evaluation). If not an index or None, it will be used to find the index. Hence if one has a large array if closely spaced times, one can pass in a single element to speed matters up.

rphaseNone, ‘fraction’, ‘ignore’, or float (array)

Phase zero point; if None, use the one stored in polyco (those are typically large, so we ensure we preserve precision by using the Phase class for the result.) Can also set ‘fraction’ to use the stored one modulo 1, which is fine for folding, but breaks cycle count continuity between sets, ‘ignore’ for just keeping the value stored in the coefficients, or a value that should replace the zero point.

derivint

Derivative to return (Default=0=phase, 1=frequency, etc.)

time_unitUnit

Unit of time in which derivatives are expressed (Default: second)

Returns
resultPhase or Quantity

A phase if deriv=0 and rphase=None to preserve precision; otherwise, a quantity with units of cycle / time_unit**deriv.

fpol(index, t0=0.0, time_unit=Unit('d'), convert=False)[source] [edit on github]

Frequency prediction polynomial set up for times in MJD

Parameters
indexint

index into the polyco table

Returns
freqpolPolynomial

set up for MJDs between mjd_mid +/- span

phasepol(index, rphase=None, t0=0.0, time_unit=Unit('d'), convert=False)[source] [edit on github]

Phase prediction polynomial set up for times in MJD

Parameters
indexint or float

index into the polyco table (or MJD for finding closest)

rphaseNone or ‘fraction’ or float

phase zero point; if None, use the one stored in polyco. (Those are typically large, so one looses some precision.) Can also set ‘fraction’ to use the stored one modulo 1, which is fine for folding, but breaks phase continuity between sets.

Returns
phasepolPolynomial

set up for MJDs between mjd_mid +/- span

polynomial(index, rphase=None, deriv=0, t0=None, time_unit=Unit('min'), out_unit=None, convert=False)[source] [edit on github]

Prediction polynomial set up for times in MJD

Parameters
indexint or float

index into the polyco table (or MJD for finding closest)

rphaseNone or ‘fraction’ or ‘ignore’ or float

Phase zero point; if None, use the one stored in polyco. (Those are typically large, so one looses some precision.) Can also set ‘fraction’ to use the stored one modulo 1, which is fine for folding, but breaks cycle count continuity between sets, ‘ignore’ for just keeping the value stored in the coefficients, or a value that should replace the zero point.

derivint

derivative of phase to take (1=frequency, 2=fdot, etc.); default 0

Returns
polynomialPolynomial

set up for MJDs between mjd_mid +/- span

Notes

Units for the polynomial are cycles/second**deriv. Taking a derivative outside will be per day (e.g., self.polynomial(1).deriv() gives frequencies in cycles/day)

searchclosest(mjd)[source] [edit on github]

Find index to polyco that is closest in time to (set of) Time/MJD

to_polyco(name='polyco.dat', style='tempo2')[source] [edit on github]

Write the polyco table to a polyco file.

Parameters
namestr

Filename

style{‘tempo1’|’tempo2’}, optional

Package which the writer should emulate. Default: ‘tempo2’