The Likelihood Function and Kernels

The pulsar timing log-likelihood function is given by

$\ln L = -\frac{1}{2}r^T C^{-1} r - \frac{1}{2}\ln \det C$

where r is contains the residuals (both time & DM residuals in the case of wideband timing), and C is the covariance matrix incorporating the measurement uncertainties and the various correlated noise processes. C is represented by a Kernel.

The calc_lnlike() and calc_lnlike_serial() functions compute this log-likelihood function. The difference between them is that the former parallelizes the computation using threads over TOAs whereas the latter executes serially.

Vela.calc_lnlikeFunction
calc_lnlike(::TimingModel, ::Vector{T}, params)::Float64 where {T<:TOABase}

Compute the log-likelihood value for a given timing model and collection of TOAs (parallel execution).

Reference: Lentati+ 2014

source
Vela.calc_lnlike_serialFunction
calc_lnlike_serial(::TimingModel, ::Vector{T}, params)::Float64 where {T<:TOABase}

Compute the log-likelihood value for a given timing model and collection of TOAs (serial execution).

Reference: Lentati+ 2014

source

The get_lnlike_func() function returns a callable that can be passed on to sampling packages. It chooses parallel or serial execution based on the number of available threads. It also has a vectorize option that evaluates the likelihood function over multiple sets of parameters parallely. This is supported by some samplers like emcee, and is more efficient than parallelizing over TOAs. There is also a get_lnlike_serial_func() function that always returns the serial version of the callable.

Vela.get_lnlike_funcFunction
get_lnlike_func(model, toas)::Function

Get the log_likelihood(params) function for a given timing model and collection of TOAs. Serial or parallel execution is decided based on the number of available threads.

Supports both narrowband and wideband TOAs.

Use get_lnlike_serial_func(model, toas) to force serial execution of the likelihood. The serial version should be used if parallelization is to be implemented at a different level (e.g., within the sampling method).

Reference: Lentati+ 2014, Alam+ 2021, Johnson+ 2024

source

Kernels

The matrix operations appearing in the likelihood function expression are evaluated with the help of Kernel objects.

Three types of Kernels are currently supported.

Kernel
├─ EcorrKernel
├─ WhiteNoiseKernel
└─ WoodburyKernel
Vela.EcorrKernelType
EcorrKernel

A kernel representing white noise and ECORR. The covariance matrix is block-diagonal. Assumes that the TOAs are sorted in the correct order. Not applicable for wideband TOAs.

Reference: Johnson+ 2024

source
Vela.WoodburyKernelType
WoodburyKernel

A kernel representing white noise and correlated noise including ECORR.

This type has an inner_kernel attribute which represents the time-uncorrelated part of the timing noise. It can be a WhiteNoiseKernel if the only time-uncorrelated noise is white noise, or EcorrKernel if ECORR noise is also present.

The gp_components attribute contains a collection of amplitude-marginalized Gaussian noise components. These are treated as part of the covariance matrix. WoodburyKernel.gp_components and TimingModel.components must have no common elements.

Reference: Johnson+ 2024

source

More details about the implementation of time-correlated noise is given in Red noise models.