Ground true parameter on fine mesh (left). Sample from a posterior distribution for inclusion detection based on a star-shaped parametrization (middle) and a level set parametrization (right) both on a coarse mesh.
@@ Run files from the root folder. @@
The file driver.m
demonstrates the main capabilities of this collections of scripts. It:
- Constructs a triangular finite element mesh for the unit disc based on element size
hmax
. We recommendhmax >= 0.03
for a smooth initial experience. - Samples from prior distributions based on Matern Gaussian fields and the star-shaped set and level set parametrizations.
- Computes data for a specific ground true parameter on a fine mesh, see Data below.
- Approximates approximation error arising from fine and coarse mesh differences.
- Samples a posterior distribution based on the prior distributions and a likelihood arising from white noise observations of
$\langle H, \phi_k \rangle_{L^2(\mathcal{O}))} + \varepsilon \xi_k$ , where$H$ is the true observation,$\phi_k$ are Dirichlet Laplacian eigenfunctions,$\varepsilon>0$ is a noise level and$\xi_k\sim N(0,1)$ i.i.d. The posterior is sampled using a Markov Chain Monte Carlo (MCMC) method, the preconditioned Crank-Nicolson (pCN) scheme.
In this folder the main functions are:
prior_init.m
prior_init2d.m
Both return a structure containing Matern KL (Karhunen-Loeve) eigenfunctions max_freq
. These are basis functions on the 1D and 2D toruses, respectively.
Given an i.i.d Gaussian vector of same length as the number of eigenfunctions, priorsample.m
computes the KL expansion
The two other main functions of this folder are the functions pertaining to the parametrizations:
push_forward_levelset2D_smooth.m
push_forward_star2D_interp.m
The first uses a continuous approximation of the heaviside function to filter the two-dimensional Gaussian field inpoly2.m
, see inpoly.
The FEM
folder builds on finite element routines in first order Lagrange basis and discontinuous Galerkin basis. Many of these routines build on code by Niko Hänninen, Tanja Tarvainen and Ville Kolehmainen (University of Eastern Finland).
The goal of the code is to efficiently compute make_data.m
as a function
Data is synthetised as
N=13
, which means the total number of Dirichlet eigenfunctions are set to trunc = N*(2*N+1)
. The Dirichlet Laplacian eigenfunctions are computed on the fine data mesh, and later interpolated to the coarse mesh so they can be used for forward computations. These are computed using the Matlab routine sptarn
.
This is implemented in the function make_data.m
, which returns a structure datapar
containing the noisy datavector of length trunc
, as well as other useful parameters.
Main function is pCNsampler.m
. This samples from the posterior distribution arising as the normalized product of the likelihood from the above observations and the push-forward priors. pCNsampler.m
only requires one evaluation of the likelihood function each iteration, see pCN wiki. The stepsize is user specified.
@@ Venture into this folder at your own responsibility. @@
There are two main functions in this folder
levelPCN.m
starDGPCN.m
The first file is a function that computes samples from the posterior arising from the level set parametrization. It automatically loads a saved datapar
struct in a certain format. This is also the case of the second file, which computes samples from the posterior arising from the star-shaped set parametrization.
These functions are used for batch job scripts for submission to computing clusters, see also maker.m
. We have not included any presaved datapar
structs, since they are above the size limit. These will then return erros unless suitable datapar
structs are computed and saved beforehand.
@@ Venture into this folder at your own responsibility. @@
The .m scripts in this folder loads structs including samples that are not included for size reasons.
Our figure making scripts build on export_fig, see export_fig and uses tight_subplot
, see tight_subplot
inclusion-qPAT
is licensed under GNU General Public License v3.0.