Get plain filled contours with getdist

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Dournac Fabien
Posts: 74
Joined: May 18 2019
Affiliation: IRAP
Contact:

Get plain filled contours with getdist

Post by Dournac Fabien » May 28 2023

Hello,

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)
g.export('./chains_final_'+str(sys.argv[1])+'.pdf')
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.
Attachments
Capture d’écran 2023-05-28 à 18.34.08.png
Capture d’écran 2023-05-28 à 18.34.08.png (1.31 MiB) Viewed 7531 times
Capture d’écran 2023-05-28 à 18.34.27.png
Capture d’écran 2023-05-28 à 18.34.27.png (1.57 MiB) Viewed 7533 times
Last edited by Dournac Fabien on May 30 2023, edited 1 time in total.

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Get plain filled contours with getdist

Post by Antony Lewis » May 29 2023

Make sure you set the ranges self-consistently for any prior bounds (box 24 https://getdist.readthedocs.io/en/latest/plot_gallery.html).
[Cobaya and CosmoMc automatically produce outputs containing this information]

Dournac Fabien
Posts: 74
Joined: May 18 2019
Affiliation: IRAP
Contact:

Re: Get plain filled contours with getdist

Post by Dournac Fabien » May 30 2023

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 7499 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.

Regards

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Get plain filled contours with getdist

Post by Antony Lewis » May 31 2023

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.

Post Reply