Python plotting and various questions

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Jacques-Joseph Laurens
Posts: 1
Joined: March 14 2014
Affiliation: ENSTA Paristech/CEA

Python plotting and various questions

Post by Jacques-Joseph Laurens » March 21 2014

Dear all,

I am an undergraduate student currently learning to use CosmoMC for an internship. To be fair, this is my first contact with both Fortran and Python and I have a few questions that I hope are not too stupid.

1) My first goal was to plot the experimental constraints for Omegal vs Omegam using the LCDM model on SNLS data. In order to do so, I sampled the chains using Cosmomc then ran them through getdist to do the analysis and generate the plots. But when I tried to run the python script using "python my_file_2D.py", I had the following issues concerning the tick labels and tight layout parameters:


Code: Select all

Traceback (most recent call last):
  File "python_plots/bin_run/SNLS_100k_bin20_sc2_2D.py", line 10, in <module>
    g.plots_2d&#40;roots,param_pairs=pairs,filled=True&#41;
  File "/net/dapserv1/home/manip/mnt/snls/snls/CosmoMC/cosmomc/python/GetDistPlots.py", line 540, in plots_2d
    self.plot_2d&#40;roots, param_pair=pair, filled=filled, add_legend_proxy=i == 0&#41;
  File "/net/dapserv1/home/manip/mnt/snls/snls/CosmoMC/cosmomc/python/GetDistPlots.py", line 333, in plot_2d
    self.setAxes&#40;param_pair, **ax_args&#41;
  File "/net/dapserv1/home/manip/mnt/snls/snls/CosmoMC/cosmomc/python/GetDistPlots.py", line 369, in setAxes
    self.setAxisProperties&#40;ax.xaxis, True, prune&#41;
  File "/net/dapserv1/home/manip/mnt/snls/snls/CosmoMC/cosmomc/python/GetDistPlots.py", line 361, in setAxisProperties
    tick_params&#40;axis='both', which='major', labelsize=self.settings.axes_fontsize&#41;
NameError&#58; global name 'tick_params' is not defined
It appears that for some reason the script fails to define the "tick_params" parameter. If I comment the referred line in "GetDistPlots.py", the rest of the script is executed until it gets to the part where "tight_layout" is called, at which point I get the similar error message :

Code: Select all

Traceback &#40;most recent call last&#41;&#58;
  File "python_plots/bin_run/SNLS_100k_bin20_sc2_2D.py", line 10, in <module>
    g.plots_2d&#40;roots,param_pairs=pairs,filled=True&#41;
  File "/net/dapserv1/home/manip/mnt/snls/snls/CosmoMC/cosmomc/python/GetDistPlots.py", line 542, in plots_2d
    self.finish_plot&#40;&#91;legend_labels, roots&#93;&#91;legend_labels is None&#93;, legend_ncol=legend_ncol&#41;
  File "/net/dapserv1/home/manip/mnt/snls/snls/CosmoMC/cosmomc/python/GetDistPlots.py", line 484, in finish_plot
    else&#58; tight_layout&#40;&#41;
NameError&#58; global name 'tight_layout' is not defined
Commenting both the problematic lines allows the rest of the script to run smoothly and to output the plots that I want. Though, obviously, the result is not exactly very aesthetic without the proper tick labels (see here for an example).

Do you know how I can fix this to get the proper tick_labels to be processed?

2) Using only SNLS data, I managed to generate many different plots. I am trying to get smoothed contours in order to have a plot that can be compared to an ellipse, yet I find it hard to get the proper shape.

According to various tests, it appears to me that two things seem to influence the appearance of my plots : the effective number of samples (that is given when launching getdist on a chain) and the num_bins parameter in getdist (and the smoothing scale parameter related to it).

From what I get, the effective number of samples seems to vary randomly from one chain to another and to be only related to the dataset used. Am I correct here or is there a way to increase this number on a given dataset by adjusting one of the input parameters of cosmomc? Apparently, it seems to be unrelated to the number of samples in the chain.

As for the num_bins parameter, reducing it quite logically increases the smoothing while diminishing the accuracy of the result. Though I can get some decent-looking almost elliptical plots by adjusting this parameter, I feel this approach to be too artificial and I fear that it lacks proper scientific rigor.

So, am I limited here by the SNLS dataset or is there a way to improve the quality of my plots?

3) And now for something completly different... I would have liked to try to incorporate the Gallileon model in CosmoMC. This model uses the WMAP Distance Priors. I have looked around in the code related to WMAP but have not found any reference to them. Are they currently implemented in CosmoMC or should I add them myself?

Thank you very much for your time,

Jacques Laurens

Post Reply