pint.models.transient_events.ChromaticGaussianEvent
- class pint.models.transient_events.ChromaticGaussianEvent[source]
Bases:
DelayComponentSimple chromatic Gaussian model for extreme scattering events or other chromatic transient features
This phenomenological model is defined as a Gaussian in time multiplied by a power law in radio frequency with variable chromaticity. The model parameters include the event epoch, sign, log10 amplitude, chromatic index, and log10 standard deviation of the Gaussian. See Coles et al. 2015 (https://arxiv.org/abs/1506.07948) for more details at extreme scattering events. See Reardon et al. 2023 (https://arxiv.org/abs/2306.16229) for an application of this model in PTAs, but note a typo in Reardon et al., which lacks a negative sign in the exponential. The explicit mathematical form of the Gaussian event is as follows.
\[\Delta_{\text{Gaussian}}(t) = \sum_{i} \text{SIGN}_{i} \cdot 10^{\text{LOGAMP}_{i}} \left(\frac{f}{f_{\text{ref}}}\right)^{-\text{CHROMIDX}_{i}} \exp\left[-\frac{(t-\text{EPOCH}_{i})^2}{2\left(10^{\text{LOGSIG}_{i}}\right)^2}\right]\]where \(\text{LOGAMP}_{i} = \log_{10}(A_i / \text{s})\), \(\text{LOGSIG}_{i} = \log_{10}(\sigma_i / \text{days})\), \(\text{EPOCH}_{i}\) is in MJD, \(f_{\text{ref}} = \text{CHROMGAUSS_FREF}\) in MHz, and \(\text{SIGN}_{i} \in \{-1, +1\}\).
Parameters supported:
Name / Aliases
Description
Kind
CHROMGAUSS_FREF
Chromatic Gaussian event reference frequency
MHz
CHROMGAUSS_EPOCH_{number}
Chromatic Gaussian event epoch
d
CHROMGAUSS_LOGAMP_{number}
Log10 Chromatic Gaussian event amplitude (log10 in seconds)
number
CHROMGAUSS_CHROMIDX_{number}
Chromatic Gaussian event chromatic index
number
CHROMGAUSS_SIGN_{number}
Chromatic Gaussian event sign
number
CHROMGAUSS_LOGSIG_{number}
Log10 Chromatic Gaussian event standard deviation (log10 in days)
number
Examples
Add a chromatic Gaussian event to an existing PINT timing model:
>>> import numpy as np >>> from pint.models.transient_events import ChromaticGaussianEvent >>> chrom_gauss = ChromaticGaussianEvent() >>> model.add_component(chrom_gauss) >>> chrom_comp = model.components['ChromaticGaussianEvent'] >>> chrom_comp.add_chromatic_gaussian_event( ... 55000, # EPOCH (MJD) ... np.log10(5e-6), # LOGAMP log10(s) ... 4, # CHROMIDX: chromatic index (f/fref)^-chromidx ... np.log10(300), # LOGSIGMA log10(days) ... 1, # SIGN: event sign ... index=1, ... force=True, ... )
Notes
The above example will appear in the par file as such:
CHROMGAUSS_FREF 1400 CHROMGAUSS_EPOCH_1 55000.0 1 CHROMGAUSS_LOGAMP_1 -5.301 1 CHROMGAUSS_CHROMIDX_1 4.0 0 CHROMGAUSS_LOGSIG_1 2.477 1 CHROMGAUSS_SIGN_1 1 0
For an additional event replace the
_1suffix with_2. The derivatives w.r.t SIGN and EPOCH can be quite large so it is recommended to fix SIGN and start from a good estimate of EPOCH.Methods
add_chromatic_gaussian_event(epoch, ...[, ...])Add a chromatic Gaussian event to the model.
add_param(param[, deriv_func, setup])Add a parameter to the Component.
chrom_gauss_delay(toas[, acc_delay])Total delay across all chromatic Gaussian events.
chrom_gauss_delay_term(t_mjd, ffac, ii)Compute the delay for a single chromatic Gaussian event.
d_delay_d_chromidx(toas, param[, acc_delay])Derivative of delay w.r.t.
d_delay_d_epoch(toas, param[, acc_delay])Derivative of delay w.r.t.
d_delay_d_log10amp(toas, param[, acc_delay])Derivative of delay w.r.t.
d_delay_d_log10sigma(toas, param[, acc_delay])Derivative of delay w.r.t.
d_delay_d_sign(toas, param[, acc_delay])Derivative of delay w.r.t.
get_ffac(toas)Compute f/fref where f is the observing frequency.
Returns an array of integers corresponding to chromatic Gaussian event 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.
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.
Removes all chromatic Gaussian event 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 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_chromatic_gaussian_event(epoch: float | Quantity | Time, log10amp: float | Quantity, chromidx: float | Quantity, log10sigma: float | Quantity, sign: int | float | Quantity, index: int | None = 1, frozen: bool = True, force: bool = False) int[source]
Add a chromatic Gaussian event to the model. Use force = True to overwrite existing event at given index.
- remove_chromatic_gaussian_event(index: float | int | List[int] | ndarray) None[source]
Removes all chromatic Gaussian event parameters associated with a given index/list of indices.
- get_indices() ndarray[source]
Returns an array of integers corresponding to chromatic Gaussian event parameters.
- Returns:
inds – Array of chromatic Gaussian event indices in model.
- Return type:
np.ndarray
- chrom_gauss_delay_term(t_mjd: ndarray, ffac: ndarray, ii: int) Quantity[source]
Compute the delay for a single chromatic Gaussian event.
- chrom_gauss_delay(toas: TOAs, acc_delay=None) Quantity[source]
Total delay across all chromatic Gaussian events.
- d_delay_d_log10amp(toas: TOAs, param: str, acc_delay=None) Quantity[source]
Derivative of delay w.r.t. chromatic Gaussian amplitude.
- d_delay_d_chromidx(toas: TOAs, param: str, acc_delay=None) Quantity[source]
Derivative of delay w.r.t. chromatic Gaussian index.
- d_delay_d_log10sigma(toas: TOAs, param: str, acc_delay=None) Quantity[source]
Derivative of delay w.r.t. chromatic Gaussian st. deviation.
- d_delay_d_epoch(toas: TOAs, param: str, acc_delay=None) Quantity[source]
Derivative of delay w.r.t. chromatic Gaussian epoch.
- d_delay_d_sign(toas: TOAs, param: str, acc_delay=None) Quantity[source]
Derivative of delay w.r.t. chromatic Gaussian sign.
- 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.
- 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_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