# code

## harmonic: Learnt harmonic mean estimator for Bayesian model selection

We resurrect the infamous harmonic mean estimator for computing the marginal likelihood (Bayesian evidence) and solve its problematic large variance. The marginal likelihood is a key component of Bayesian model selection since it is required to evaluate model posterior probabilities; however, its computation is challenging. The original harmonic mean estimator, first proposed in 1994 by Newton and Raftery, involves computing the harmonic mean of the likelihood given samples from the posterior.

## massmappy: Mapping dark matter on the celestial sphere

massmappy provides functionality to recover convergence mass maps on the celestial sphere from weak lensing cosmic shear observations. At present the spherical Kaiser-Squires estimator is implemented. Additional estimators will be added in future. massmappy also supports numerous projection operator to project the sphere to planar regions for comparison with the spherical Kaiser-Squires estimator. massmappy relies on the SSHT (built on the MW sampling theorem) and HEALPIX codes to handle sampled data on the sphere.

## NSHT: Novel optimal sampling spherical harmonic transforms

NSHT implements a novel sampling scheme to accurately sample a signal band-limited at $L$ in $L^2$ samples. Whereas sampling theorems on the sphere require at best $\sim 2 L^2$ samples (see A novel sampling theorem on the sphere; implemented in SSHT), NSHT sampling achieves the optimal sampling rate specified by the dimensionality of band-limited signals in harmonic space. However, a theoretically exact sampling theorem in not obtained. Nevertheless, NSHT provides functionality to compute fast spherical harmonic transforms for signals sampled according to the optimal sampling scheme developed.

## OptimusPrimal: A lightweight primal-dual solver

optimusprimal is a light weight proximal splitting Forward Backward Primal Dual based solver for convex optimization problems. The current version supports finding the minimum of f(x) + h(A x) + p(B x) + g(x), where f, h, and p are lower semi continuous and have proximal operators, and g is differentiable. A and B are linear operators.

## proxnest: Proximal nested sampling for high-dimensional Bayesian model selection

ProxNest is an open source, well tested and documented Python implementation of the proximal nested sampling algorithm, which is uniquely suited for sampling from very high-dimensional posteriors that are log-concave and potentially not smooth (e.g. Laplace priors). This is achieved by exploiting tools from proximal calculus and Moreau-Yosida regularisation to efficiently sample from the prior subject to the hard likelihood constraint.

## PURIFY: Next generation radio interferometric imaging

PURIFY provides functionality to perform radio interferometric imaging, i.e. to recover images from the Fourier measurements taken by radio interferometric telescopes. PURIFY leverages recent developments in the field of compressive sensing and convex optimisation, adapted, in some cases extended, and applied to radio interferometric imaging. PURIFY itself contains functionality specific to radio interferometry, whereas all sparse optimisation functionality is implemented in the companion code SOPT. SOPT provides very general algorithms for solving sparse regularisation problems and is being applied in many areas become radio interferometry.

## RequiSim: Variance weighted overlap measure of the lensing bias

RequiSim computes the variance weighted overlap, which is a measure of the bias on the lensing signal from power spectrum modelling bias.

## S2: Functions on the sphere

The S2 code provides functionality to support functions defined on the sky and was developed primarily for astrophysical applications. More generally, however, any arbitrary function defined on the sphere may be represented. Both real space map and harmonic space spherical harmonic representations are supported. Basic sky representations have been extended to simulate full sky noise distributions and Gaussian cosmic microwave background realisations. Support for the representation and convolution of beams is also provided.

## S2DW: Steerable scale discretised wavelets on the sphere

S2DW provides functionality to perform the scale discretised wavelet transform on the sphere. Routines are provided to compute wavelet and scaling coefficients from the spherical harmonic coefficients of a signal on the sphere and to synthesise the spherical harmonic coefficients of the original signal from its wavelet and scaling coefficients. The reconstruction of the spherical harmonic coefficients of the original signal is exact to numerical precision. Functionality to support functions defined on the sphere is provided by the S2 code.

## S2FIL: Optimal filtering on the sphere

S2FIL provides functionality to support optimal filtering on the sphere. Optimal directional matched (MF) and scale adaptive (SAF) filters may be constructed from a template and stochastic background process. Functionality is also incorporated to filter a sky data map with an optimal filter. Moreover, a simple object detection algorithm is implemented to extract embedded object parameters from the filtered field. Functionality to support functions defined on the sphere is provided by the S2 code; template objects are defined in the COMB code; and functionality to perform fast directional filtering on the sphere is provided by the FastCSWT code.