Analytical marginalisation¶
The forward model is linear in the sky coefficients, and both their prior and the noise are Gaussian, so the coefficients can be integrated out exactly. This leaves a likelihood for the power spectrum alone, in which the uncertainty in every coefficient, and the degeneracies between the EoR and foregrounds, are fully propagated.
1. Combine the components¶
The EoR and foreground contributions combine into a single linear model over the joint coefficient vector, \(\boldsymbol b\), with a block-diagonal Gaussian prior.
\(\mathbf T'_{\rm FG}\) is either the physical foreground operator, with prior \(\mathbf\Sigma'_{\rm FG}=\mathbf\Sigma_q\), or its reduced basis, with \(\mathbf\Sigma'_{\rm FG}=\mathbf I\). Only the EoR block, \(\mathbf\Phi\), depends on the power spectrum; the foreground prior is fixed.
Setup assembles \(\mathbf T\) as T.npy, and the diagonal of
\(\mathbf\Psi^{-1}(\boldsymbol\varphi)\) is returned by
PhiInverse. The
foreground widths are foreground_prior_std_mk for the physical basis, or ones
for a reduced basis.
2. The prior-predictive covariance¶
Integrating over \(\boldsymbol b\) leaves a Gaussian likelihood for the data, whose covariance combines the noise with the uncertainty each component induces in the visibilities.
The foreground term is the same for every proposed power spectrum. Its structure is what the KL reduced basis compresses.
The \(N_{\rm d}\times N_{\rm d}\) covariance is never built. The equivalent coefficient-space form below is used instead.
3. Evaluate in coefficient space¶
The same likelihood can be written in terms of a system the size of the coefficient vector. Its fixed parts are computed once during setup, so each proposed power spectrum needs only one Cholesky factorisation.
With the fixed products
each proposal forms and solves
giving the log likelihood
The factors of one half arise because \(\boldsymbol d\) holds each visibility and its conjugate, so it contains only \(N_{\rm d}/2\) independent measurements (see data vector ordering). The single Cholesky factorisation of \(\mathbf\Sigma\) supplies both the solve and the determinant, and is the dominant cost of each evaluation.
MarginalisedLikelihood evaluates this for a vector of log amplitudes, omitting \(c_{\rm fixed}\):
likelihood = setup.likelihood_class
log_l = likelihood.log_likelihood(rho)
On one CPU or GPU it uses a native JAX Cholesky factorisation; across several GPUs it uses JAXMg.
Configuration¶
The likelihood is set by the two fixed covariances that are not sampled: the noise, \(\mathbf N\), and the foreground prior, \(\mathbf\Sigma_q\).
Noise covariance¶
The likelihood assumes Gaussian thermal noise with a diagonal covariance, \(\mathbf N\), whose entries are the variance \(\langle|n|^2\rangle\) of each complex visibility. It is set by one of:
sigma-
The default model, with variance \(N_{tfb} = \sigma^2/R_{tb}\) for a baseline of redundancy \(R_{tb}\) (see array layout).
- Units: mK sr, the complex RMS per visibility before redundancy averaging.
- Required: unless
effective_noise_pathis set, including when the data usenoise_data_pathorcalc_noise.
effective_noise_path-
Per-visibility noise amplitudes, replacing the
sigmamodel.- Format: a
.npyvector of length \(2N_tN_\nu N_{\rm bls}\), in the data vector ordering; its squared magnitudes are the variances. - Note: it only changes the weights. It does not affect whether noise is added to the data.
- Format: a
A noise vector supplied with noise_data_path, or estimated with calc_noise,
does not set these weights, so sigma should still describe the noise level of
the data. See noise in the data.
Foreground prior¶
foreground_prior_std_mk-
The prior standard deviation of each foreground spectral component.
- Default:
[8690.96, 2479547.30, 1406322.41]. - Units: mK.
- Format: one value for the constant term and one per entry of
beta_fg; each is applied to every pixel. - Note: not used with
foreground_kl_path, whose coefficients have a unit prior.
- Default: