kammerje / fouriever

A single toolkit for calibrations, correlations, and companion search for kernel-phase, aperture masking, and long-baseline interferometry data.
6 stars 6 forks source link

Nested sampling with MultiNest #4

Closed tomasstolker closed 2 years ago

tomasstolker commented 2 years ago

Hi @kammerje,

This pull request adds support for using the nested sampling algorithm of MultiNest. The mcmc function takes the additional parameters sampler (default: emcee) and n_live_points. Multiprocessing is supported through mpi4py.

The chains and corner plot functions receive the samples now directly as input, instead of the emcee sampler object. The chains plot is skipped when sampler='multinest'.

The prior boundaries are set to an arbitrary range of 20% from the best-fit value from the chi2map, so that is quite arbitrary and could perhaps be changed.

I have also included the sampler name, the array with samples, and the ln(z), to the dictionary that is returned by mcmc.

Let me know if you have any feedback!

tomasstolker commented 2 years ago

I forgot to mention that the reason that I implemented this is that nested sampling sometimes more effectively explores the prior space while the walkers with the MCMC sometimes get trapped in local minima. So for some cases it may work better as I noticed at least for one dataset that I was working on.