pint.models.dmwavex.DMWaveX

class pint.models.dmwavex.DMWaveX[source]

Bases: Dispersion

Fourier representation of DM variations.

Used for decomposition of DM noise into a series of sine/cosine components with the amplitudes as fitted parameters.

Parameters supported:

Name / Aliases

Description

Kind

DMWXEPOCH

Reference epoch for Fourier representation of DM noise

d

DMWXFREQ_{number}

Component frequency for Fourier representation of DM noise

1 / d

DMWXSIN_{number}

Sine amplitudes for Fourier representation of DM noise

dmu

DMWXCOS_{number}

Cosine amplitudes for Fourier representation of DM noise

dmu

To set up a DMWaveX model, users can use the pint.utils function dmwavex_setup() with either a list of frequencies or a choice of harmonics of a base frequency determined by 2 * pi /Timespan

Methods

add_dmwavex_component(dmwxfreq[, index, ...])

Add DMWaveX component

add_dmwavex_components(dmwxfreqs[, indices, ...])

Add DMWaveX components with specified base frequencies

add_param(param[, deriv_func, setup])

Add a parameter to the Component.

d_delay_d_dmparam(toas, param_name[, acc_delay])

Derivative of delay wrt to DM parameter.

d_dm_d_DMWXCOS(toas, param[, acc_delay])

d_dm_d_DMWXSIN(toas, param[, acc_delay])

dispersion_slope_value(toas)

dispersion_time_delay(DM, freq)

Return the dispersion time delay for a set of frequency.

dispersion_type_delay(toas)

dm_value(toas)

Compute modeled DM value at given TOAs.

dmwavex_delay(toas[, acc_delay])

dmwavex_dm(toas)

get_indices()

Returns an array of intergers corresponding to DMWaveX component parameters using DMWXFREQs

get_params_of_type(param_type)

Get all the parameters in timing model for one specific type.

get_prefix_mapping_component(prefix)

Get the index mapping for the prefix parameters.

is_in_parfile(para_dict)

Check if this subclass included in parfile.

match_param_aliases(alias)

Return the parameter corresponding to this alias.

param_help()

Print help lines for all available parameters in model.

print_par([format])

param format:

Parfile output format. PINT outputs the 'tempo', 'tempo2' and 'pint'

register_deriv_funcs(func, param)

Register the derivative function in to the deriv_func dictionaries.

register_dm_deriv_funcs(func, param)

Register the derivative function in to the deriv_func dictionaries.

remove_dmwavex_component(index)

Remove all DMWaveX components associated with a given index or list of indices

remove_param(param)

Remove a parameter from the Component.

set_special_params(spcl_params)

setup()

Finalize construction loaded values.

validate()

Validate loaded values.

validate_toas(toas)

Check that this model component has TOAs where needed.

Attributes

aliases_map

Return all the aliases and map to the PINT parameter name.

category

component_types

free_params_component

Return the free parameters in the component.

param_prefixs

register

add_dmwavex_component(dmwxfreq, index=None, dmwxsin=0, dmwxcos=0, frozen=True)[source]

Add DMWaveX component

Parameters:
  • dmwxfreq (float or astropy.quantity.Quantity) – Base frequency for DMWaveX component

  • index (int, None) – Interger label for DMWaveX component. If None, will increment largest used index by 1.

  • dmwxsin (float or astropy.quantity.Quantity) – Sine amplitude for DMWaveX component

  • dmwxcos (float or astropy.quantity.Quantity) – Cosine amplitude for DMWaveX component

  • frozen (iterable of bool or bool) – Indicates whether DMWaveX parameters will be fit

Returns:

index – Index that has been assigned to new DMWaveX component

Return type:

int

add_dmwavex_components(dmwxfreqs, indices=None, dmwxsins=0, dmwxcoses=0, frozens=True)[source]

Add DMWaveX components with specified base frequencies

Parameters:
  • dmwxfreqs (iterable of float or astropy.quantity.Quantity) – Base frequencies for DMWaveX components

  • indices (iterable of int, None) – Interger labels for DMWaveX components. If None, will increment largest used index by 1.

  • dmwxsins (iterable of float or astropy.quantity.Quantity) – Sine amplitudes for DMWaveX components

  • dmwxcoses (iterable of float or astropy.quantity.Quantity) – Cosine amplitudes for DMWaveX components

  • frozens (iterable of bool or bool) – Indicates whether sine and cosine amplitudes of DMwavex components will be fit

Returns:

indices – Indices that have been assigned to new DMWaveX components

Return type:

list

remove_dmwavex_component(index)[source]

Remove all DMWaveX components associated with a given index or list of indices

Parameters:

index (float, int, list, np.ndarray) – Number or list/array of numbers corresponding to DMWaveX indices to be removed from model.

get_indices()[source]

Returns an array of intergers corresponding to DMWaveX component parameters using DMWXFREQs

Returns:

  • inds (np.ndarray)

  • Array of DMWaveX indices in model.

setup()[source]

Finalize construction loaded values.

validate()[source]

Validate loaded values.

validate_toas(toas)[source]

Check that this model component has TOAs where needed.

add_param(param, deriv_func=None, setup=False)

Add a parameter to the Component.

The parameter is stored in an attribute on the Component object. Its name is also recorded in a list, self.params.

Parameters:
  • param (pint.models.Parameter) – The parameter to be added.

  • deriv_func (function) – Derivative function for parameter.

property aliases_map

Return all the aliases and map to the PINT parameter name.

This property returns a dictionary from the current in timing model parameters’ aliase to the pint defined parameter names. For the aliases of a prefixed parameter, the aliase with an existing prefix index maps to the PINT defined parameter name with the same index. Behind the scenes, the indexed parameter adds the indexed aliase to its aliase list.

d_delay_d_dmparam(toas, param_name, acc_delay=None)

Derivative of delay wrt to DM parameter.

Parameters:
  • toas (pint.TOAs object.) – Input toas.

  • param_name (str) – Derivative parameter name

  • acc_delay (astropy.quantity or numpy.ndarray) – Accumulated delay values. This parameter is to keep the unified API, but not used in this function.

dispersion_time_delay(DM, freq)

Return the dispersion time delay for a set of frequency.

This equation if cited from Duncan Lorimer, Michael Kramer, Handbook of Pulsar Astronomy, Second edition, Page 86, Equation [4.7] Here we assume the reference frequency is at infinity and the EM wave frequency is much larger than plasma frequency.

dm_value(toas)

Compute modeled DM value at given TOAs.

Parameters:

toas (TOAs object or TOA table(TOAs.table)) –

If given a TOAs object, it will use the whole TOA table in the

TOAs object.

Return type:

DM values at given TOAs in the unit of DM.

property free_params_component

Return the free parameters in the component.

This function collects the non-frozen parameters.

Return type:

A list of free parameters.

get_params_of_type(param_type)

Get all the parameters in timing model for one specific type.

get_prefix_mapping_component(prefix)

Get the index mapping for the prefix parameters.

Parameters:

prefix (str) – Name of prefix.

Returns:

A dictionary with prefix parameter real index as key and parameter name as value.

Return type:

dict

is_in_parfile(para_dict)

Check if this subclass included in parfile.

Parameters:

para_dict (dictionary) – A dictionary contain all the parameters with values in string from one parfile

Returns:

Whether the subclass is included in the parfile.

Return type:

bool

match_param_aliases(alias)

Return the parameter corresponding to this alias.

Parameters:

alias (str) – Alias name.

Note

This function only searches the parameter aliases within the current component. If one wants to search the aliases in the scope of TimingModel, please use TimingModel.match_param_aliase().

param_help()

Print help lines for all available parameters in model.

print_par(format='pint')
Parameters:

format (str, optional) – Parfile output format. PINT outputs the ‘tempo’, ‘tempo2’ and ‘pint’ format. The defaul format is pint. Actual formatting done elsewhere.

Returns:

str

Return type:

formatted line for par file

register_deriv_funcs(func, param)

Register the derivative function in to the deriv_func dictionaries.

Parameters:
  • func (callable) – Calculates the derivative

  • param (str) – Name of parameter the derivative is with respect to

register_dm_deriv_funcs(func, param)

Register the derivative function in to the deriv_func dictionaries.

Parameters:
  • func (callable) – Calculates the derivative

  • param (str) – Name of parameter the derivative is with respect to

remove_param(param)

Remove a parameter from the Component.

Parameters:

param (str or pint.models.Parameter) – The parameter to remove.