DMX Class

The DMX class handles pulsar DMX files as output by tempo and dmxparse.py.

class DMX(filename)
Parameters

filename (str) – Path to a .dmx file

Usage:

d = DMX(FILENAME) #automatically parses each DM line with the DM() class
print(d.DMs[0].getMJD()) #prints the MJD of the first DM value.
print(d.getMJDs()) #prints the values of all of the epochs.

Methods

save(filename)

Save a .dmx file.

Parameters

filename (str) – Path to .dmx file

Warning

save() is currently not fully implemented

getMJDs()

Return the MJD of each DM value. Loops over getEpoch() in DM.

Return type

numpy.ndarray

getEpochs()

Return the MJD of each DM value. Loops over getEpoch() in DM.

Return type

numpy.ndarray

getValues()

Return each DM value. Loops over getValue() in DM.

Return type

numpy.ndarray

getErrs()

Return the DM uncertainties for each measurement. Loops over getError() in DM.

Return type

numpy.ndarray

getErrors()

Return the DM uncertainties for each measurement. Loops over getError() in DM.

Return type

numpy.ndarray

getR1s()

Return the R1 values for each measurement, the starting MJD for the bin. Loops over getR1() in DM.

Return type

numpy.ndarray

getR2s()

Return the R2 values for each measurement, the ending MJD for the bin. Loops over getR2() in DM.

Return type

numpy.ndarray

getF1s()

Return the F1 values for each measurement, the lowest frequency for the bin. Loops over getF1() in DM.

Return type

numpy.ndarray

getF2s()

Return the F2 values for each measurement, the highest frequency for the bin. Loops over getF2() in DM.

Return type

numpy.ndarray

getBin()

Return the bin string label. Loops over getDMXbin() in DM.

Return type

numpy.ndarray

getDMXbin()

Return the bin string label. Loops over getDMXbin() in DM.

Return type

numpy.ndarray

getter(func)

Generic helper function to loop over each DM value. Used internally, though hypothetically one could apply additional operations on each DM value

Parameters

func (function) – Function to call on each DM value

Return type

nump.ndarray

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)

getTspan([years=False])

Return the total time span covered by the DM epochs.

Parameters

years (bool) – Divide the total time span in days by 365.25.

Return type

float

DM Class

The DM class handles individual pulsar DMX measurements.

class DM(epoch[, value=None, err=None, R1=None, R2=None, F1=None, F2=None, dmxbin=None])

Stores the entries of a DM line.

Parameters
  • epoch (float/str) – If only the epoch parameter is specified, then the parameter is the entire DM string and will be parsed.

  • value (float) – DM value.

  • err (float) – DM error

  • R1 (float) – R1, starting MJD for the bin

  • R2 (float) – R2, ending MJD for the bin

  • F1 (float) – F1, lowest frequency for the bin

  • F2 (float) – F2, highest frequency for the bin

  • dmxbin (str) – bin label

Methods

getMJD()

Return the value of the epoch.

Return type

float

getEpoch()

Return the value of the epoch.

Return type

float

getDM()

Return the value of the DM.

Return type

float

getValue()

Return the value of the DM.

Return type

float

getErr()

Return the error of the DM.

Return type

float

getError()

Return the error of the DM.

Return type

float

getR1()

Return the R1 of the DM, the starting epoch of the bin.

Return type

float

getR2()

Return the R2 of the DM, the ending epoch of the bin.

Return type

float

getF1()

Return the F1 of the DM, the lowest frequency.

Return type

float

getF2()

Return the F2 of the DM, the highest frequency.

Return type

float

getBin()

Return the label of the bin.

Return type

str

getDMXbin()

Return the label of the bin.

Return type

str

setMJD(epoch)

Set the epoch of the DM to a value.

Parameters

epoch (float) – Value to set the DM epoch to.

setEpoch(epoch)

Set the epoch of the DM to a value.

Parameters

epoch (float) – Value to set the DM epoch to.

setDM(value)

Set the epoch of the DM to a value.

Parameters

value (float) – Value to set the DM to.

setValue(value)

Set the epoch of the DM to a value.

Parameters

value (float) – Value to set the DM to.

setErr(err)

Set the error of the DM to a value.

Parameters

err (float) – Value to set the error to.

setError(err)

Set the error of the DM to a value.

Parameters

err (float) – Value to set the error to.

setR1(R1)

Set the R1 of the DM to a value.

Parameters

R1 (float) – Value to set the R1 to.

setR2(R2)

Set the R2 of the DM to a value.

Parameters

R2 (float) – Value to set the R2 to.

setF1(F1)

Set the F1 of the DM to a value.

Parameters

F1 (float) – Value to set the F1 to.

setF2(F2)

Set the F2 of the DM to a value.

Parameters

F2 (float) – Value to set the F2 to.

setBin(dmxbin)

Set the label of the DM to a value.

Parameters

dmxbin (str) – Value to set the bin label to.

setDMXbin(dmxbin)

Set the label of the DM to a value.

Parameters

dmxbin (str) – Value to set the bin label to.