pint.models.cmwavex.CMWaveX
- class pint.models.cmwavex.CMWaveX[source]
Bases:
ChromaticFourier representation of chromatic variations.
Used for decomposition of chromatic noise into a series of sine/cosine components with the amplitudes as fitted parameters.
Parameters supported:
Name / Aliases
Description
Kind
CMWXEPOCH
Reference epoch for Fourier representation of chromatic noise
d
CMWXFREQ_{number}
Component frequency for Fourier representation of chromatic noise
1 / d
CMWXSIN_{number}
Sine amplitudes for Fourier representation of chromatic noise
pc / (MHz2 cm3)
CMWXCOS_{number}
Cosine amplitudes for Fourier representation of chromatic noise
pc / (MHz2 cm3)
To set up a CMWaveX model, users can use the pint.utils function cmwavex_setup() with either a list of frequencies or a choice of harmonics of a base frequency determined by 2 * pi /Timespan
Methods
add_cmwavex_component(cmwxfreq[, index, ...])Add CMWaveX component
add_cmwavex_components(cmwxfreqs[, indices, ...])Add CMWaveX components with specified base frequencies
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.
cmwavex_cm(toas)cmwavex_delay(toas[, acc_delay])d_cm_d_CMWXCOS(toas, param[, acc_delay])d_cm_d_CMWXSIN(toas, param[, acc_delay])d_delay_d_cmparam(toas, param_name[, acc_delay])Derivative of delay wrt to CM parameter.
Returns an array of intergers corresponding to CMWaveX component parameters using CMWXFREQs
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.
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_cmwavex_component(index)Remove all CMWaveX 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
Return all the aliases and map to the PINT parameter name.
categorycomponent_typesReturn the free parameters in the component.
param_prefixsregister- add_cmwavex_component(cmwxfreq, index=None, cmwxsin=0, cmwxcos=0, frozen=True)[source]
Add CMWaveX component
- Parameters:
cmwxfreq (float or astropy.quantity.Quantity) – Base frequency for CMWaveX component
index (int, None) – Interger label for CMWaveX component. If None, will increment largest used index by 1.
cmwxsin (float or astropy.quantity.Quantity) – Sine amplitude for CMWaveX component
cmwxcos (float or astropy.quantity.Quantity) – Cosine amplitude for CMWaveX component
frozen (iterable of bool or bool) – Indicates whether CMWaveX parameters will be fit
- Returns:
index – Index that has been assigned to new CMWaveX component
- Return type:
- add_cmwavex_components(cmwxfreqs, indices=None, cmwxsins=0, cmwxcoses=0, frozens=True)[source]
Add CMWaveX components with specified base frequencies
- Parameters:
cmwxfreqs (iterable of float or astropy.quantity.Quantity) – Base frequencies for CMWaveX components
indices (iterable of int, None) – Interger labels for CMWaveX components. If None, will increment largest used index by 1.
cmwxsins (iterable of float or astropy.quantity.Quantity) – Sine amplitudes for CMWaveX components
cmwxcoses (iterable of float or astropy.quantity.Quantity) – Cosine amplitudes for CMWaveX components
frozens (iterable of bool or bool) – Indicates whether sine and cosine amplitudes of CMwavex components will be fit
- Returns:
indices – Indices that have been assigned to new CMWaveX components
- Return type:
- remove_cmwavex_component(index)[source]
Remove all CMWaveX components associated with a given index or list of indices
- get_indices()[source]
Returns an array of intergers corresponding to CMWaveX component parameters using CMWXFREQs
- Returns:
inds (np.ndarray)
Array of CMWaveX indices in model.
- 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.
- 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:
- 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().
- print_par(format: Literal['tempo', 'tempo2', 'pint'] = 'pint') str
- 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