pint.models.chromatic_model.ChromaticCMX

class pint.models.chromatic_model.ChromaticCMX[source]

Bases: Chromatic

This class provides a CMX model - piecewise-constant chromatic variations with constant chromatic index.

This model lets the user specify time ranges and fit for a different CMX value in each time range.

It should be used in combination with the ChromaticCM model. Specifically, TNCHROMIDX must be set.

Parameters supported:

Name / Aliases

Description

Kind

CMX_{number}

Dispersion measure variation

pc / (MHz2 cm3)

CMXR1_{number}

Beginning of CMX interval

d

CMXR2_{number}

End of CMX interval

d

Methods

CMX_chromatic_delay(toas[, acc_delay])

This is a wrapper function for interacting with the TimingModel class

add_CMX_range(mjd_start, mjd_end[, index, ...])

Add CMX range to a chromatic model with specified start/end MJDs and CMX value.

add_CMX_ranges(mjd_starts, mjd_ends[, ...])

Add CMX ranges to a dispersion model with specified start/end MJDs and CMXs.

add_param(param[, deriv_func, setup])

Add a parameter to the Component.

chromatic_time_delay(cm, alpha, freq)

Return the chromatic time delay for a set of frequencies.

chromatic_type_delay(toas)

cm_value(toas)

Compute modeled CM value at given TOAs.

cmx_cm(toas)

d_cm_d_CMX(toas, param_name[, acc_delay])

d_delay_d_cmparam(toas, param_name[, acc_delay])

Derivative of delay wrt to CM parameter.

get_indices()

Returns an array of integers corresponding to CMX parameters.

get_params_of_type(param_type)

Get all the parameters in timing model for one specific Parameter subtype.

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_cm_deriv_funcs(func, param)

Register the derivative function in to the deriv_func dictionaries.

register_deriv_funcs(func, param)

Register the derivative function in to the deriv_func dictionaries.

remove_CMX_range(index)

Removes all CMX parameters associated with a given index/list of indices.

remove_param(param)

Remove a parameter from the Component.

set_special_params(spcl_params)

setup()

Finalize construction loaded values.

validate()

Validate the CMX parameters.

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_CMX_range(mjd_start, mjd_end, index=None, cmx=0, frozen=True)[source]

Add CMX range to a chromatic model with specified start/end MJDs and CMX value.

Parameters:
  • mjd_start (float or astropy.quantity.Quantity or astropy.time.Time) – MJD for beginning of CMX event.

  • mjd_end (float or astropy.quantity.Quantity or astropy.time.Time) – MJD for end of CMX event.

  • index (int, None) – Integer label for CMX event. If None, will increment largest used index by 1.

  • cmx (float or astropy.quantity.Quantity) – Change in CM during CMX event.

  • frozen (bool) – Indicates whether CMX will be fit.

Returns:

index – Index that has been assigned to new CMX event.

Return type:

int

add_CMX_ranges(mjd_starts, mjd_ends, indices=None, cmxs=0, frozens=True)[source]

Add CMX ranges to a dispersion model with specified start/end MJDs and CMXs.

Parameters:
  • mjd_starts (iterable of float or astropy.quantity.Quantity or astropy.time.Time) – MJD for beginning of CMX event.

  • mjd_end (iterable of float or astropy.quantity.Quantity or astropy.time.Time) – MJD for end of CMX event.

  • indices (iterable of int, None) – Integer label for CMX event. If None, will increment largest used index by 1.

  • cmxs (iterable of float or astropy.quantity.Quantity, or float or astropy.quantity.Quantity) – Change in CM during CMX event.

  • frozens (iterable of bool or bool) – Indicates whether CMX will be fit.

Returns:

indices – Indices that has been assigned to new CMX events

Return type:

list

remove_CMX_range(index)[source]

Removes all CMX parameters associated with a given index/list of indices.

Parameters:

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

get_indices()[source]

Returns an array of integers corresponding to CMX parameters.

Returns:

inds – Array of CMX indices in model.

Return type:

np.ndarray

setup()[source]

Finalize construction loaded values.

validate()[source]

Validate the CMX parameters.

validate_toas(toas)[source]

Check that this model component has TOAs where needed.

CMX_chromatic_delay(toas, acc_delay=None)[source]

This is a wrapper function for interacting with the TimingModel class

add_param(param: Parameter, deriv_func: Callable | None = None, setup: bool = 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: Dict[str, str]

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.

chromatic_time_delay(cm, alpha, freq)

Return the chromatic time delay for a set of frequencies.

delay_chrom = cm * DMconst * (freq / 1 MHz)**alpha

cm_value(toas)

Compute modeled CM 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:

CM values at given TOAs in the unit of CM.

d_delay_d_cmparam(toas, param_name, acc_delay=None)

Derivative of delay wrt to CM 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.

property free_params_component: List[str]

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: str) List[str]

Get all the parameters in timing model for one specific Parameter subtype.

get_prefix_mapping_component(prefix: str) Dict[int, str]

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: Dict) bool

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: str) str

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() str

Print help lines for all available parameters in model.

print_par(format='pint')[source]
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_cm_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_deriv_funcs(func: Callable, param: str) None

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: str | Parameter) None

Remove a parameter from the Component.

Parameters:

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