Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learning MontePython and CosmoMC #111

Open
esadri21 opened this issue Mar 24, 2018 · 15 comments
Open

Learning MontePython and CosmoMC #111

esadri21 opened this issue Mar 24, 2018 · 15 comments

Comments

@esadri21
Copy link

Dear friends. I have just learnt to use MCMC (M-H algorithm). Now I would like to go toward learning Motepython and CosmoMC.
At first step, I choose MontePython. But I could not find any useful tutorial. I think it is very complicated. Could you help me about this issue?

@brinckmann
Copy link
Contributor

brinckmann commented Mar 25, 2018

You can find MontePython tutorials on the course page of Julien Lesgourgues' website:
https://lesgourg.github.io/courses.html
Best,
Thejs

@ivandebono
Copy link

I found this to a very good tutorial: http://www.iac.es/congreso/cosmo2017/media/montepython.pdf
It goes into a lot more detail than the Montepython manual.

@esadri21
Copy link
Author

@ivandebono Thank you, I have checked it before, but similar to Cosmo MC, EMCEE, CosmoHammer needs to clarifications and class to learn. Really I don't understand why these tutorial are not simple. Assume, in mathematics class they teach 2+2 and in the exam they want us to solve 3order ODE.

@ivandebono
Copy link

I get your point. The best way to learn Montepython is to talk to experienced users, or even someone who's justing starting out. With software, you can often find solutions to little snags just by discussing them with someone else.

I would be happy to provide some hints if you would let me know what you need. I put up a couple of posts on my website, but they're specific to users of the computing cluster at my institute.

@esadri21
Copy link
Author

esadri21 commented Apr 27, 2018

@ivandebono Thank you. Unfortunately I couldn't find anyone so for to do so. But the whole thing is fitting data of a model in astrophysics, from simple models like wCDM to complicated ones. I have wanted to learn EMCEE but after writing the code, there were no one to help me that what are the probable problems of my code (Teachers of EMCEE and authors of papers). Hence, I went toward using MontePython, But this one is more harder than EMCEE. Sometimes I tell God: God, for God sake help me :))

@ivandebono
Copy link

I find that gods tend to have their favourites which they shower with favours, while ignoring the pleas of the rest.

Be that as is it may. The first thing to do is to choose a data set to which you wish to fit your model. Then you must choose a theoretical model: Lambda CDM, or wCDM, for example. It doesn't matter which values your parameters take. You will decide that later.

The instructions here are quite straightforward:
http://monte-python.readthedocs.io/en/latest/example.html

In this example, the date is a fake Planck data set (i.e. essentially CMB anisotropy measurements), and the theoretical model is Lambda CDM. You are trying to find the best value of the six parameters in the Lambda CDM model.

You choose the parameters to fit (usually the ones which will appear in your final triangle plot) in input/lcdm.param

I hope that helps. Have you tried running the example shown here? You should do that before tackling harder stuff.

@esadri21
Copy link
Author

@ivandebono I will try it out for sure. The first reason of why I came toward learning MontePython etc, was my problem in metropolis hastings method. I wrote a correct code in Python, but in each run it printed different outputs. So, I am getting stuck in a loop.

@esadri21
Copy link
Author

About trying MP(montepython), I have to install ubunto, then running a MP code to see what is the output.

@ivandebono
Copy link

Try running the example here: http://monte-python.readthedocs.io/en/latest/example.html

If you get stuck, I'll try to help.

@esadri21
Copy link
Author

esadri21 commented May 4, 2018

Yeah, thank you. I read this link before, but first of all I need to read http://monte-python.readthedocs.io/en/latest/installation.html. I really do not understand what are the instructions. For me they seem Chinese language.
"At minimum, default.conf should contain one line, filled with the path of your class/ directory:"
"path['cosmo'] = 'path/to/your/class/'"
and etc.
I think I need more attention. But I do not used to read these such simple/professional instructions.

@ivandebono
Copy link

Though not quite Chinese, the instructions could do with a bit of language editing.

What these instructions mean to say is that the location CLASS needs to be specified in the default configuration file used by Montepython.

If you followed the installation instructions, you should have installed CLASS somewhere.

There is a file called 'default.conf' in the folder called 'montepython'. It should contain the following line:
path['cosmo'] = 'path/to/your/class/'

Replace 'path/to/your/class/' with the file path to the folder containing CLASS. If you installed it in your home directory, the typical file path would look like this: '~/class'. Or, if you're running your calculations on a cluster with many users, it would be something like '/home/username/class'.

So the line would be:

path['cosmo'] = '~/class'

or

path['cosmo'] = '/home/username/class'

@esadri21
Copy link
Author

esadri21 commented May 4, 2018

I created a folder (with name 'code') copied and pasted the 'montepython' in it. then I downloaded and pasted 'class' folder in code folder too. I mean code folder contains two folders by now, montepython and class. For directory in configuration file should I write: path['cosmo'] = 'c:\user...\class' or its place in code folder is path['cosmo'] = '~/class'. the code folder is in my desktop.

and path['clik'] = 'path/to/your/plc/folder/' what path must be written in it?
and Planck_highl.path_clik = data.path['clik']+'../something.clik' is for Planck_highl. for 3 rest likelihood of planck we should write it again? and where it should be written?

Ah, too many questions. Sorry.
I just read the instruction by this line, and the rest is for another time.

@ivandebono
Copy link

Here's my configuration file. It contains just three lines, giving the location of the root directory (i.e. the home directory where I find myself when I log into the computing cluster), the path to CLASS, and the path to the Planck likelihood code (clik). The cluster runs on UNIX, so you may need to adapt it to your operating system. I haven't tried running it on Windows.

root = '/home/debono'
path['cosmo'] = root+'/class'
path['clik'] = root+'/plc-2.0'

@ivandebono
Copy link

It's been a while, but I thought I might flag up this link:

http://borisbolliet.com/Research.html

It contains one of the best tutorials on Montepython, dealing with some problems specific to installing and running on a cluster (which is what most of us do).

@esadri21
Copy link
Author

Thank you dear friend. By the way I need to be focused on. I will try to learn it. These months I was working on some papers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants