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 TOA
s whereas the latter executes serially.
Vela.calc_lnlike
— Functioncalc_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
Vela.calc_lnlike_serial
— Functioncalc_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
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 TOA
s. There is also a get_lnlike_serial_func()
function that always returns the serial version of the callable.
Vela.get_lnlike_func
— Functionget_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
Vela.get_lnlike_serial_func
— Functionget_lnlike_serial_func(model, toas)::Function
Version of get_lnlike_func
that always does serial execution.
Kernels
The matrix operations appearing in the likelihood function expression are evaluated with the help of Kernel
objects.
Vela.Kernel
— TypeKernel
Abstract base class of all likelihood kernels
Three types of Kernel
s are currently supported.
Kernel
├─ EcorrKernel
├─ WhiteNoiseKernel
└─ WoodburyKernel
Vela.WhiteNoiseKernel
— TypeWhiteNoiseKernel
A kernel representing only uncorrelated noise. The covariance matrix is diagonal.
Reference: Hobbs+ 2006, Alam+ 2021
Vela.EcorrKernel
— TypeEcorrKernel
A kernel representing white noise and ECORR. The covariance matrix is block-diagonal. Assumes that the TOA
s are sorted in the correct order. Not applicable for wideband TOAs.
Reference: Johnson+ 2024
Vela.WoodburyKernel
— TypeWoodburyKernel
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
More details about the implementation of time-correlated noise is given in Red noise models.