+ All Categories
Home > Documents > New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and...

New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and...

Date post: 15-Sep-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
27
Monte Python: all run and analyze options Benjamin Audren ´ Ecole Polytechnique F´ ed´ erale de Lausanne 29/10/2014 Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 1 / 19
Transcript
Page 1: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Monte Python: all run and analyze options

Benjamin Audren

Ecole Polytechnique Federale de Lausanne

29/10/2014

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 1 / 19

Page 2: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Outline

1 Running

2 Analysis

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 2 / 19

Page 3: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Outline

1 Running

2 Analysis

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 3 / 19

Page 4: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Methods

python montepython/MontePython.py run -h

Choosing the Sampling Method

flag: -m [MH, NS, CH, IS, Der]

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 4 / 19

Page 5: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition

Idea

Cosmological parameters are slow to update (class), butnuisance parameters can be fast.If varied together, this distinction is lost.But, there are correlations between them!

Proposition

Instead of varying all the parameters at each step,we vary both fast and slow some of the time, andonly the fast one the rest of the time.

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 5 / 19

Page 6: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition and Over-sampling

Slow

Fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 6 / 19

Page 7: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition and Over-sampling

Slow

Fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 6 / 19

Page 8: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition and Over-sampling

Slow

Fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 6 / 19

Page 9: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition and Over-sampling

Slow

Fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 6 / 19

Page 10: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition and Over-sampling

Slow

Fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 6 / 19

Page 11: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition and Over-sampling

Slow

Fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 6 / 19

Page 12: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition and Over-sampling

Slow

Fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 6 / 19

Page 13: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cholesky Decomposition and Over-sampling

Slow

Fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 6 / 19

Page 14: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Metropolis Hastings

Basic Options

Number of steps: -N 1000

Jumping factor: -f 1.4

Jumping strategy: -j [global, sequential, fast]

Best-fit file: -b, --bestfit best-fit point

Covmat file: -c, --covmat proposal density

Restart: -r filename restart from chain?

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 7 / 19

Page 15: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Metropolis HastingsTricks

Computing the likelihood in one point

python montepython/MontePython.py run -o chains/jla -N 1 -f 0

Cholesky decomposition

python montepython/MontePython.py run -o chains/jla -j fast

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 8 / 19

Page 16: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Nested Sampling

Full description at http://monte-python.readthedocs.org/en/latest/nested.html

Principle

All options from MultiNest can be used

Simply use --NS_option_from_MultiNest

Most important one: --NS_n_live_points 100

Strategy

separate subfolder (NS)

chains are translated with info chains/folder/NS

Warning

To see the options, either edit montepython/nested_sampling.py

or pip install pymultinest (--user) then run --help

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 9 / 19

Page 17: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Cosmo Hammer

Full description at http://www.astro.ethz.ch/refregier/research/Software/cosmohammer/

Principle

All options from CosmoHammer can be used

Simply use --CH_option_from_CosmoHammer

Most important one: --CH_walkersRatio

Strategy

separate subfolder (CH)

chains are translated with info chains/folder/CH

Doc

To see the options, either edit montepython/cosmo_hammer.py

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 10 / 19

Page 18: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Importance Sampling

Syntax

run -m IS -o chains/new -p new.param \

--IS_starting_folder chains/old

Warning

new.param and old.param should differ only through thelist of experiments, and by a mildly constraining likelihood

Notably, the updated list of experiment can not contain morenuisance parameters.

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 11 / 19

Page 19: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Running

Adding a derived parameter

Syntax

run -o existing_folder -m Der \

--Der-target-folder non_existing_folder \

--Der-param-list Omega_Lambda

Warning

You obviously can add only derived parameters known to class

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 12 / 19

Page 20: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Analysis

Outline

1 Running

2 Analysis

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 13 / 19

Page 21: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Analysis

Reminder

python montepython/MontePython.py info --help

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 14 / 19

Page 22: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Analysis

Options when analyzing

Main options

compare several folders info folder_1 folder_2

Remove the mean-likelihood with --no-mean

Only compute the covmat with --noplot

Output all sub plots with --all

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 15 / 19

Page 23: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Analysis

Using an extra file for plotting options

Alternative to command line

example in plot_files/example.plot

syntax: --extra plot_files/example.plot

4 exclusive arguments

redefine: dict for combining parameters

to change: dict for renaming

new scales: dict for rescaling

to plot: list for plotting new names

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 16 / 19

Page 24: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Analysis

Using an extra file for plotting options

Alternative to command line

example in plot_files/example.plot

syntax: --extra plot_files/example.plot

4 exclusive arguments

redefine: dict for combining parameters

to change: dict for renaming

new scales: dict for rescaling

to plot: list for plotting new names

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 16 / 19

Page 25: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Analysis

Renaming parameters

info.to_change = {’Omega_cdm ’: r’$\Omega_ {\rm cdm}$’, ’alpha ’: ’$\gamma$ ’}

info.new_scales = {’$\gamma$ ’: 10}

info.to_plot = [r’$\Omega_ {\rm cdm}$’, ’$\gamma$ ’, ’beta’]

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 17 / 19

Page 26: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Analysis

Full example

import matplotlib.pyplot as plt

info.redefine = {’log_alpha ’: ’log_alpha/math.log (10)’,

’log_sound_speed_sq ’: ’log_sound_speed_sq/math.log (10)’}

info.to_change = {’log_alpha ’: r’$\log_ {10}(\ alpha)$’,

’log_sound_speed_sq ’: r’$\log_ {10}( c_\chi^2)$’,

’Y_dm’: ’Y’}

info.to_plot = [r’$\log_ {10}(\ alpha)$’, r’$\log_ {10}( c_\chi ^2)$’, ’Y’]

info.fontsize = 24

info.ticksize = 12

info.ticknumber = 5

info.decimal = 2

info.legend -style = ’top’

info.bins = 16

info.cm = [(0.99843 , 0.25392 , 0.14765 , 1.) ,]

info.cmaps = [plt.cm.Reds]

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 18 / 19

Page 27: New Monte Python: all run and analyze options · 2019. 11. 26. · Monte Python: all run and analyze options Benjamin Audren Ecole Polytechnique F ed erale de Lausanne 29/10/2014

Analysis

Beware of non-raw strings

Python is picky about that

Benjamin Audren (EPFL) CLASS/MP MP advanced 29/10/2014 19 / 19


Recommended