Page 1 of 1

Get plain filled contours with getdist

Posted: May 28 2023
by Dournac Fabien

I ran a MCMC code and after convergence is reached (with automecee), I don't undertsand why I get a cloud of points (see figure in attachment) instead of having plain disk contours (see also other attachment). On some box, I get simply a full square , not really nice ellipse or contours expected.

The script using getdist is :

Code: Select all

import os,sys
from getdist import plots, MCSamples
import getdist
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

# Load MCMC samples
if sys.argv[1] == 'bd':
  samps = np.loadtxt('./chain_BD.txt')

# samps 
samps = samps[:,0:7]
ndim = samps.shape[1]
names = ["x%s"%i for i in range(ndim)]
if sys.argv[1] == 'bd':
  labels = ['\Omega_m', '\Omega_k', '\Omega_{BD}', 'H_0', '\Psi_0', '\dot{\Phi}_0', '\omega_{BD}']

samples = MCSamples(samples=samps,names = names, labels = labels)

# Triangle plot
g = plots.get_subplot_plotter()
g.triangle_plot([samples], filled=True)
It seems that I need an interpolation to transform the cloud of points into continuous filled contours.

Is there anyone already be faced to this issue ?

Kind regards.

Re: Get plain filled contours with getdist

Posted: May 29 2023
by Antony Lewis
Make sure you set the ranges self-consistently for any prior bounds (box 24
[Cobaya and CosmoMc automatically produce outputs containing this information]

Re: Get plain filled contours with getdist

Posted: May 30 2023
by Dournac Fabien
Hi Antony,

it seems that "corner" package partially solves my issue. you can see the following figure :
Capture d’écran 2023-05-30 à 19.12.30.png
Capture d’écran 2023-05-30 à 19.12.30.png (1.2 MiB) Viewed 9204 times
As you can see, there are different big degeneracies between some parameters.

For the priors, they are defined self consistently in my script. I think the problem is that in the script in which the contours look nice with getdist, the chain didn’t converge.

Because of not having enough samples, getdist probably turns on some high smoothing, giving nice ellipses - this is my guess. What do you think about this ?

While with having a lot of points, getdist just shows cloud of points for some reason. I could be playing with getdist to get the same results as with corner, but I don’t know how to reproduce the same than with "corner" package.

Any help is welcome.


Re: Get plain filled contours with getdist

Posted: May 31 2023
by Antony Lewis
See my previous comment, did you try it? If there are sharp prior cuts in the samples, but you don't give the prior range, it infers that there is a real sharp feature in the posterior and hence uses a very narrow smoothing kernel, giving you very unsmooth results. If it knows there's a prior cut, it models the boundary consistently. The "corner" smooth contours will not actually be correct if you have prior cuts, because the edges should be sharp not smoothed out like that.