Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-b246709
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

Header file for the likelihood and prior functions used in parameter estimation code for known pulsar searches using the nested sampling algorithm. More...

Prototypes

REAL8 pulsar_log_likelihood (LALInferenceVariables *vars, LALInferenceIFOData *data, LALInferenceModel *get_pulsar_model)
 The log likelihood function. More...
 
REAL8 noise_only_likelihood (LALInferenceRunState *runState)
 Calculate the natural logarithm of the evidence that the data consists of only Gaussian noise The function will calculate the natural logarithm of the evidence that the data (from one or more detectors) consists of stationary segments/chunks described by a Gaussian with zero mean and unknown variance. More...
 
REAL8 priorFunction (LALInferenceRunState *runState, LALInferenceVariables *params, LALInferenceModel *mode)
 
REAL8 theta_prior (REAL8 theta)
 Prior for angle that is equivalent to an latitude value to give a uniform prior on a sphere. More...
 
UINT4 in_range (LALInferenceVariables *priors, LALInferenceVariables *params)
 Check that any parameters with minimum and maximum ranges are within that range. More...
 
void ns_to_posterior (LALInferenceRunState *runState)
 Convert an array of nested samples to posterior samples. More...
 
void create_kdtree_prior (LALInferenceRunState *runState)
 Create a k-d tree from prior samples. More...
 

Detailed Description

Header file for the likelihood and prior functions used in parameter estimation code for known pulsar searches using the nested sampling algorithm.

Author
Matthew Pitkin, John Veitch, Colin Gill

Definition in file ppe_likelihood.h.

Go to the source code of this file.

Function Documentation

◆ pulsar_log_likelihood()

REAL8 pulsar_log_likelihood ( LALInferenceVariables vars,
LALInferenceIFOData data,
LALInferenceModel get_model 
)

The log likelihood function.

This function calculates natural logarithm of the likelihood of a signal model (specified by a given set of parameters) given the data from a set of detectors.

The likelihood is the joint likelihood of chunks of data over which the noise is assumed stationary and Gaussian. For each chunk a Gaussian likelihood for the noise and data has been marginalised over the unknown noise standard deviation using a Jeffreys prior on the standard deviation. Given the data consisting of independent real and imaginary parts this gives a Students-t distribution for each chunk (of length \( m \) ) with \( m/2 \) degrees of freedom:

\[ p(\mathbf{\theta}|\mathbf{B}) = \prod_{j=1}^M \frac{(m_j-1)!}{2\pi^{m_j}} \left( \sum_{k=k_0}^{k_0+(m_j-1)} |B_k - y(\mathbf{\theta})_k|^2 \right)^{-m_j}, \]

where \( \mathbf{B} \) is a vector of the complex data, \( y(\mathbf{\theta}) \) is the model for a set of parameters \( \mathbf{\theta} \) , \( M \) is the total number of independent data chunks with lengths \( m_j \) and \( k_0 = \sum_{i=1}^j 1 + m_{i-1} \) (with \( m_0 = 0 \) ) is the index of the first data point in each chunk. The product of this for each detector will give the full joint likelihood. See [8] for a more detailed description.

In this function data in chunks smaller than a certain minimum length chunkMin are ignored.

Parameters
vars[in] The parameter values
data[in] The detector data and initial signal phase template
get_model[in] The signal model structure
Returns
The natural logarithm of the likelihood function

Definition at line 65 of file ppe_likelihood.c.

◆ noise_only_likelihood()

REAL8 noise_only_likelihood ( LALInferenceRunState runState)

Calculate the natural logarithm of the evidence that the data consists of only Gaussian noise The function will calculate the natural logarithm of the evidence that the data (from one or more detectors) consists of stationary segments/chunks described by a Gaussian with zero mean and unknown variance.

The evidence is obtained from the joint likelihood given in pulsar_log_likelihood with the model term \( y \) set to zero.

Parameters
runState[in] The algorithm run state
Returns
The natural logarithm of the noise only evidence

Definition at line 334 of file ppe_likelihood.c.

◆ priorFunction()

REAL8 priorFunction ( LALInferenceRunState runState,
LALInferenceVariables params,
LALInferenceModel mode 
)

◆ theta_prior()

REAL8 theta_prior ( REAL8  theta)

Prior for angle that is equivalent to an latitude value to give a uniform prior on a sphere.

If you have two angles that define spherical polar coordinates and you want these to have a prior that is uniform over the sphere then you can instead work with the cosine of the latitude-like angle and have this to be uniform between -1 and 1. However, if you want to work in the actual angle then you need to set the correct prior which will be \( p(\theta) \propto \sin{\theta) \) .

Parameters
theta[in] The angle in radians
Returns
The log prior as defined above.

Definition at line 621 of file ppe_likelihood.c.

◆ in_range()

UINT4 in_range ( LALInferenceVariables priors,
LALInferenceVariables params 
)

Check that any parameters with minimum and maximum ranges are within that range.

This function performs any cylcic transform and then makes sure that all parameters in params, that have a defined minimum and maximum value, are within their allowed prior ranges.

Parameters
priors[in] A pointer to the prior args LALInferenceVariables
params[in] The current parameters
Returns
0 if out of range and 1 if in range

Definition at line 964 of file ppe_likelihood.c.

◆ ns_to_posterior()

void ns_to_posterior ( LALInferenceRunState runState)

Convert an array of nested samples to posterior samples.

This function generates an array of posterior samples from the nested samples by drawing points from the nested samples weighted by their prior weighting. This assumes that the nested samples are in the array in ascending likelihood order (which should be the case for the output of the LALInferenceNestedSampler() function. The posterior sample generation is based on the method used in lalapps/src/inspiral/posterior/nest2pos.py

Within the input runstate->algorthimParams there needs to be: an array of LALInferenceVariables called "nestedsamples" containing nested samples to be converted in to the posterior; a value of "Nsamp" giving the number of nested samples; and, a value of "numberlive" giving the number live points used to generate the posterior samples.

The posterior samples will be output in runstate->algorthimParams as an array of LALInferenceVariables called "posteriorsamples", and the number of these in a value called "Nposterior".

Parameters
runState[in]

Definition at line 644 of file ppe_likelihood.c.

◆ create_kdtree_prior()

void create_kdtree_prior ( LALInferenceRunState runState)

Create a k-d tree from prior samples.

This function creates a k-d tree from prior samples for use as a prior distribution in the algorithm. The ranges of the tree dimensions (parameters) are calculated from the maximum and minimum values of the parameter. If the the lower and upper values are closer than half of there overall range to those specified in the prior file then the prior file values are used. Otherwise the upper/lower value + half the overall range is used. In this case the prior ranges set in priorArgs, and scale factors, will need to be replaced. [NOTE: This case will mean that the whole prior range specified may not be searched, however the prior samples would suggest that there is very little probability of information existing in the excluded areas]. The reason for not just using the full prior ranges is that if the prior samples are tightly peaked in a small area of the prior space the k-D tree resolution is poor and can cause an unwanted broadening of the prior e.g. if the h0 samples are peaked at zero with a distribution width of ~1e-24, but the prior range is set from 0 to 1e-22 then new samples drawn from a k-D tree produced with the full range in h0 yields a broader distribution than required.

[WARNING: Do NOT use this function. As the k-d tree is a binned, rather than smooth, version of the posterior there will be areas of zero probability that actually should contain some probability. This will end up severely biasing any result. Instead some sort of smooth form should be used such as a Gaussian Mixture Model, maybe found though a DPGMM approach!]

Parameters
runState[in] A pointer to the LALInferenceRunState

Definition at line 772 of file ppe_likelihood.c.