diff --git a/covmat/planck20_TTTEEE.covmat b/covmat/planck20_TTTEEE.covmat new file mode 100644 index 00000000..2c0f5325 --- /dev/null +++ b/covmat/planck20_TTTEEE.covmat @@ -0,0 +1,28 @@ +# omega_b, omega_cdm, n_s, ln10^{10}A_s, tau_reio, 100*theta_s, A_planck, cal100A, cal100B, cal143B, cal217A, cal217B, AdustT, beta_dustT, AdustP, beta_dustP, Aradio, Adusty, beta_dusty, Acib, Atsz, Aksz, xi, z_reio, Omega_Lambda, A_s, H0 + 1.840240e-08 -9.844223e-08 2.461074e-07 3.466029e-07 1.791125e-07 9.747048e-09 2.114019e-08 -7.859908e-08 -1.849875e-08 -9.439712e-08 -3.123796e-08 -5.127669e-08 -1.218057e-07 1.612356e-08 2.057271e-07 -4.992869e-08 9.731289e-07 9.862855e-07 4.055256e-08 3.925337e-07 3.954476e-06 -7.070384e-05 7.713336e-07 1.197509e-05 6.777182e-07 7.235976e-16 5.478000e-05 +-9.844223e-08 1.453346e-06 -3.458809e-06 -1.418125e-06 -1.803109e-06 -9.490650e-08 -1.898047e-07 2.862719e-07 5.488950e-07 8.259054e-07 2.585908e-07 4.928197e-07 6.632473e-07 -2.328195e-08 -1.609441e-06 9.665055e-07 9.515673e-06 -4.229444e-06 1.817085e-07 -3.786795e-06 -3.373463e-05 2.469045e-04 -5.891204e-06 -1.335299e-04 -8.820154e-06 -2.956279e-15 -6.377312e-04 + 2.461074e-07 -3.458809e-06 1.616490e-05 7.233634e-06 6.445059e-06 3.050385e-07 5.077061e-07 -1.275205e-06 -1.039523e-06 -2.432890e-06 -1.023703e-06 -1.615055e-06 1.016594e-05 -2.799777e-07 9.091211e-06 -3.926106e-06 5.673456e-04 2.354717e-04 -3.976805e-06 -9.521328e-05 -1.984541e-04 -3.639022e-03 3.056258e-05 5.324632e-04 2.129765e-05 1.507474e-14 1.555086e-03 + 3.466029e-07 -1.418125e-06 7.233634e-06 1.919708e-04 6.987095e-05 2.742058e-07 9.730918e-06 -1.859432e-05 -1.410698e-05 -3.246388e-05 -1.721372e-05 -1.444148e-05 1.179817e-05 7.041550e-07 2.733993e-05 -2.511366e-06 2.764393e-03 4.339771e-04 6.333277e-06 1.100864e-04 5.022837e-04 -4.753779e-03 -4.535069e-05 6.906325e-03 1.063569e-05 4.011037e-13 9.077986e-04 + 1.791125e-07 -1.803109e-06 6.445059e-06 6.987095e-05 3.828166e-05 1.337671e-07 -7.752258e-07 -3.092030e-07 1.333381e-06 1.047667e-06 7.361560e-07 6.099767e-07 -9.288704e-06 -1.624189e-07 -1.731937e-06 -2.054725e-06 -4.848227e-04 -2.691597e-05 3.661810e-07 4.066851e-05 4.333970e-05 -1.571131e-03 -1.453730e-05 3.767535e-03 1.131767e-05 1.460042e-13 8.480720e-04 + 9.747048e-09 -9.490650e-08 3.050385e-07 2.742058e-07 1.337671e-07 6.397486e-08 3.985364e-08 -5.890412e-08 -4.509948e-08 -1.026150e-07 -4.771522e-08 -4.657357e-08 1.037112e-07 4.201974e-08 1.065874e-07 -6.603654e-08 1.943370e-06 1.955609e-06 1.116957e-07 -8.019492e-07 7.874163e-06 -1.031093e-05 -1.660969e-07 9.697638e-06 7.736771e-07 5.720486e-16 6.389753e-05 + 2.114019e-08 -1.898047e-07 5.077061e-07 9.730918e-06 -7.752258e-07 3.985364e-08 6.030081e-06 6.388278e-07 -2.181853e-07 4.407630e-07 4.953891e-08 4.628820e-07 6.127432e-06 -1.107084e-07 6.724249e-06 -7.171283e-07 8.468127e-04 9.146022e-05 -9.103157e-07 9.454978e-06 1.026862e-04 -1.819521e-04 -5.557621e-06 -8.530258e-05 1.287541e-06 2.032108e-14 9.977298e-05 +-7.859908e-08 2.862719e-07 -1.275205e-06 -1.859432e-05 -3.092030e-07 -5.890412e-08 6.388278e-07 4.597547e-05 -2.618571e-05 1.925199e-05 9.532142e-06 9.845116e-06 -4.421378e-06 -2.479901e-07 -1.425274e-05 -2.403668e-06 -4.461737e-03 6.863017e-05 -1.957729e-06 -9.980441e-05 1.155702e-03 4.176499e-04 -1.773587e-04 -9.550186e-06 -2.195769e-06 -3.884571e-14 -1.927229e-04 +-1.849875e-08 5.488950e-07 -1.039523e-06 -1.410698e-05 1.333381e-06 -4.509948e-08 -2.181853e-07 -2.618571e-05 4.377068e-05 1.781603e-05 9.553313e-06 7.558668e-06 -6.551631e-06 -5.723337e-07 -9.084896e-06 2.198280e-06 3.131913e-03 -3.367207e-04 -5.261447e-06 6.180468e-05 -1.802217e-03 2.431963e-04 1.894150e-04 1.470479e-04 -3.264674e-06 -2.946301e-14 -2.266320e-04 +-9.439712e-08 8.259054e-07 -2.432890e-06 -3.246388e-05 1.047667e-06 -1.026150e-07 4.407630e-07 1.925199e-05 1.781603e-05 3.700643e-05 1.916173e-05 1.756032e-05 -1.654469e-05 -5.922455e-07 -2.328865e-05 -1.186339e-07 -1.032480e-03 -2.586462e-04 -5.832466e-06 -1.270953e-05 -5.151174e-04 5.053475e-04 -1.318968e-05 1.389484e-04 -5.390549e-06 -6.781155e-14 -4.131433e-04 +-3.123796e-08 2.585908e-07 -1.023703e-06 -1.721372e-05 7.361560e-07 -4.771522e-08 4.953891e-08 9.532142e-06 9.553313e-06 1.916173e-05 5.809793e-05 -3.814880e-05 -1.627697e-05 -1.229002e-06 -1.246862e-05 4.233637e-07 -1.279889e-03 6.936332e-05 -3.144755e-06 -9.650052e-05 2.404845e-04 2.799154e-04 2.463971e-05 8.347604e-05 -1.749373e-06 -3.594227e-14 -1.360365e-04 +-5.127669e-08 4.928197e-07 -1.615055e-06 -1.444148e-05 6.099767e-07 -4.657357e-08 4.628820e-07 9.845116e-06 7.558668e-06 1.756032e-05 -3.814880e-05 5.669923e-05 -1.949274e-05 4.645827e-07 -1.129255e-05 -7.126504e-07 -1.708754e-03 -3.966261e-05 -6.495942e-06 1.280121e-05 4.693752e-04 3.353928e-04 -1.058132e-04 8.130375e-05 -3.136340e-06 -3.016777e-14 -2.372048e-04 +-1.218057e-07 6.632473e-07 1.016594e-05 1.179817e-05 -9.288704e-06 1.037112e-07 6.127432e-06 -4.421378e-06 -6.551631e-06 -1.654469e-05 -1.627697e-05 -1.949274e-05 7.774506e-04 4.581974e-05 -1.253732e-05 -1.016558e-05 1.225531e-03 6.226687e-03 -4.098436e-05 -6.874444e-03 -5.877500e-03 -6.792076e-03 2.005832e-03 -8.869159e-04 -4.005608e-06 2.452478e-14 -3.115967e-04 + 1.612356e-08 -2.328195e-08 -2.799777e-07 7.041550e-07 -1.624189e-07 4.201974e-08 -1.107084e-07 -2.479901e-07 -5.723337e-07 -5.922455e-07 -1.229002e-06 4.645827e-07 4.581974e-05 9.979283e-05 1.198632e-06 -9.581335e-07 4.797010e-04 5.994743e-05 -7.095976e-06 1.712167e-05 -3.669122e-04 2.183215e-04 -4.650691e-05 -1.781926e-05 3.777093e-07 1.473960e-15 3.584764e-05 + 2.057271e-07 -1.609441e-06 9.091211e-06 2.733993e-05 -1.731937e-06 1.065874e-07 6.724249e-06 -1.425274e-05 -9.084896e-06 -2.328865e-05 -1.246862e-05 -1.129255e-05 -1.253732e-05 1.198632e-06 6.763898e-04 3.218554e-04 5.397361e-03 -5.429908e-04 7.773019e-06 5.785127e-04 -1.002273e-03 -9.984173e-04 2.619928e-05 -2.414659e-04 1.033572e-05 5.698178e-14 7.944932e-04 +-4.992869e-08 9.665055e-07 -3.926106e-06 -2.511366e-06 -2.054725e-06 -6.603654e-08 -7.171283e-07 -2.403668e-06 2.198280e-06 -1.186339e-07 4.233637e-07 -7.126504e-07 -1.016558e-05 -9.581335e-07 3.218554e-04 3.414193e-04 1.145459e-03 -1.974027e-04 5.635922e-06 1.582577e-04 -2.080866e-04 3.064776e-04 -4.739990e-05 -1.752200e-04 -5.769069e-06 -5.232584e-15 -4.114280e-04 + 9.731289e-07 9.515673e-06 5.673456e-04 2.764393e-03 -4.848227e-04 1.943370e-06 8.468127e-04 -4.461737e-03 3.131913e-03 -1.032480e-03 -1.279889e-03 -1.708754e-03 1.225531e-03 4.797010e-04 5.397361e-03 1.145459e-03 2.251021e+01 -8.509432e-01 2.326935e-02 3.380926e-01 -5.897223e+00 -2.219705e+00 5.642074e-01 -4.911396e-02 -4.732883e-05 5.758056e-12 -1.588059e-03 + 9.862855e-07 -4.229444e-06 2.354717e-04 4.339771e-04 -2.691597e-05 1.955609e-06 9.146022e-05 6.863017e-05 -3.367207e-04 -2.586462e-04 6.936332e-05 -3.966261e-05 6.226687e-03 5.994743e-05 -5.429908e-04 -1.974027e-04 -8.509432e-01 3.490880e-01 -1.409323e-02 -1.328494e-01 4.654434e-01 -4.728364e-01 -1.808381e-02 -2.976879e-03 3.654253e-05 9.071442e-13 2.991911e-03 + 4.055256e-08 1.817085e-07 -3.976805e-06 6.333277e-06 3.661810e-07 1.116957e-07 -9.103157e-07 -1.957729e-06 -5.261447e-06 -5.832466e-06 -3.144755e-06 -6.495942e-06 -4.098436e-05 -7.095976e-06 7.773019e-06 5.635922e-06 2.326935e-02 -1.409323e-02 2.006805e-03 -6.223253e-04 -7.418521e-03 2.562491e-03 -1.117960e-03 3.492301e-05 -5.427980e-07 1.311581e-14 1.306783e-05 + 3.925337e-07 -3.786795e-06 -9.521328e-05 1.100864e-04 4.066851e-05 -8.019492e-07 9.454978e-06 -9.980441e-05 6.180468e-05 -1.270953e-05 -9.650052e-05 1.280121e-05 -6.874444e-03 1.712167e-05 5.785127e-04 1.582577e-04 3.380926e-01 -1.328494e-01 -6.223253e-04 1.205578e-01 -8.948235e-02 7.040759e-03 -3.102271e-02 3.874726e-03 2.054708e-05 2.302574e-13 1.434847e-03 + 3.954476e-06 -3.373463e-05 -1.984541e-04 5.022837e-04 4.333970e-05 7.874163e-06 1.026862e-04 1.155702e-03 -1.802217e-03 -5.151174e-04 2.404845e-04 4.693752e-04 -5.877500e-03 -3.669122e-04 -1.002273e-03 -2.080866e-04 -5.897223e+00 4.654434e-01 -7.418521e-03 -8.948235e-02 2.773842e+00 -7.441553e-01 -3.626788e-01 2.712531e-03 2.347130e-04 1.060807e-12 1.808377e-02 +-7.070384e-05 2.469045e-04 -3.639022e-03 -4.753779e-03 -1.571131e-03 -1.031093e-05 -1.819521e-04 4.176499e-04 2.431963e-04 5.053475e-04 2.799154e-04 3.353928e-04 -6.792076e-03 2.183215e-04 -9.984173e-04 3.064776e-04 -2.219705e+00 -4.728364e-01 2.562491e-03 7.040759e-03 -7.441553e-01 5.556855e+00 3.364099e-01 -1.369179e-01 -1.803093e-03 -9.916522e-12 -1.546286e-01 + 7.713336e-07 -5.891204e-06 3.056258e-05 -4.535069e-05 -1.453730e-05 -1.660969e-07 -5.557621e-06 -1.773587e-04 1.894150e-04 -1.318968e-05 2.463971e-05 -1.058132e-04 2.005832e-03 -4.650691e-05 2.619928e-05 -4.739990e-05 5.642074e-01 -1.808381e-02 -1.117960e-03 -3.102271e-02 -3.626788e-01 3.364099e-01 9.293302e-02 -1.664305e-03 3.565081e-05 -9.577948e-14 2.756848e-03 + 1.197509e-05 -1.335299e-04 5.324632e-04 6.906325e-03 3.767535e-03 9.697638e-06 -8.530258e-05 -9.550186e-06 1.470479e-04 1.389484e-04 8.347604e-05 8.130375e-05 -8.869159e-04 -1.781926e-05 -2.414659e-04 -1.752200e-04 -4.911396e-02 -2.976879e-03 3.492301e-05 3.874726e-03 2.712531e-03 -1.369179e-01 -1.664305e-03 3.731198e-01 8.296338e-04 1.442919e-11 6.159178e-02 + 6.777182e-07 -8.820154e-06 2.129765e-05 1.063569e-05 1.131767e-05 7.736771e-07 1.287541e-06 -2.195769e-06 -3.264674e-06 -5.390549e-06 -1.749373e-06 -3.136340e-06 -4.005608e-06 3.777093e-07 1.033572e-05 -5.769069e-06 -4.732883e-05 3.654253e-05 -5.427980e-07 2.054708e-05 2.347130e-04 -1.803093e-03 3.565081e-05 8.296338e-04 5.462667e-05 2.217831e-14 4.007586e-03 + 7.235976e-16 -2.956279e-15 1.507474e-14 4.011037e-13 1.460042e-13 5.720486e-16 2.032108e-14 -3.884571e-14 -2.946301e-14 -6.781155e-14 -3.594227e-14 -3.016777e-14 2.452478e-14 1.473960e-15 5.698178e-14 -5.232584e-15 5.758056e-12 9.071442e-13 1.311581e-14 2.302574e-13 1.060807e-12 -9.916522e-12 -9.577948e-14 1.442919e-11 2.217831e-14 8.381452e-22 1.893555e-12 + 5.478000e-05 -6.377312e-04 1.555086e-03 9.077986e-04 8.480720e-04 6.389753e-05 9.977298e-05 -1.927229e-04 -2.266320e-04 -4.131433e-04 -1.360365e-04 -2.372048e-04 -3.115967e-04 3.584764e-05 7.944932e-04 -4.114280e-04 -1.588059e-03 2.991911e-03 1.306783e-05 1.434847e-03 1.808377e-02 -1.546286e-01 2.756848e-03 6.159178e-02 4.007586e-03 1.893555e-12 2.976239e-01 diff --git a/input/Planck20_TTTEEE.param b/input/Planck20_TTTEEE.param new file mode 100644 index 00000000..2c09e8ab --- /dev/null +++ b/input/Planck20_TTTEEE.param @@ -0,0 +1,102 @@ +#------Experiments to test (separated with commas)----- +# To see all the available ones, please look in the +# montepython/likelihoods folder. Every folder there is a valid likelihood to +# test. +data.experiments=['Planck20_Hillipop_TTTEEE','Planck_lowl_TT','Planck20_Lollipop_EE'] + + +#------ Settings for the over-sampling. +# The first element will always be set to 1, for it is the sampling of the +# cosmological parameters. The other numbers describe the over sampling of the +# nuisance parameter space. This array must have the same dimension as the +# number of blocks in your run (so, 1 for cosmological parameters, and then 1 +# for each experiment with varying nuisance parameters). +# Note that when using Planck likelihoods, you definitely want to use [1, 4], +# to oversample as much as possible the 14 nuisance parameters. +# Remember to order manually the experiments from slowest to fastest (putting +# Planck as the first set of experiments should be a safe bet, except if you +# also have LSS experiments). +# If you have experiments without nuisance, you do not need to specify an +# additional entry in the over_sampling list (notice for instance that, out of +# the three Planck likelihoods used, only Planck_highl requires nuisance +# parameters, therefore over_sampling has a length of two (cosmology, plus one +# set of nuisance). +data.over_sampling=[1, 4] + + + +#------ Parameter list ------- +# data.parameters[class name] = [mean, min, max, 1-sigma, scale, role] +# - if min max irrelevant, put to -1 or None (if you want a boundary of -1, use -1.0) +# - if fixed, put 1-sigma to 0 +# - if scale irrelevant, put to 1, otherwise to the appropriate factor +# - role is either 'cosmo', 'nuisance' or 'derived' + + +# Cosmological parameters list +data.parameters['omega_b'] = [0.0223, 0.017, 0.027, 0.0002, 1, 'cosmo'] +data.parameters['omega_cdm'] = [0.1188, 0.09, 0.15, 0.002, 1, 'cosmo'] +data.parameters['n_s'] = [ 0.968, 0.9, 1.1, 0.005, 1, 'cosmo'] +data.parameters['ln10^{10}A_s'] = [ 3.040, 2.7, 3.4, 0.02, 1, 'cosmo'] +data.parameters['tau_reio'] = [ 0.058, 0.01, 0.17, 0.008, 1, 'cosmo'] +data.parameters['100*theta_s'] = [1.0410, 1.03, 1.05, 0.0003, 1, 'cosmo'] + +# Nuisance parameter list, same call, except the name does not have to be a class name +# Note the nuisance parameters must follow *immediately after* the cosmo parameters, +# MP expects cosmo, nuisance, derived + +# Nuisance parameters +data.parameters['A_planck'] = [ 1.0, 0.9, 1.1, 0.0025, 1, 'nuisance'] +data.parameters['cal100A'] = [ 1.0, 0.9, 1.1, 0.005, 1, 'nuisance'] +data.parameters['cal100B'] = [ 1.0, 0.9, 1.1, 0.005, 1, 'nuisance'] +data.parameters['cal143A'] = [ 1.0, 1, 1, 0, 1, 'nuisance'] +data.parameters['cal143B'] = [ 1.0, 0.9, 1.1, 0.005, 1, 'nuisance'] +data.parameters['cal217A'] = [ 1.0, 0.9, 1.1, 0.005, 1, 'nuisance'] +data.parameters['cal217B'] = [ 1.0, 0.9, 1.1, 0.005, 1, 'nuisance'] + +data.parameters['AdustT'] = [ 1.0, 0.5, 1.5, 0.03, 1, 'nuisance'] +data.parameters['beta_dustT'] = [ 1.51, 1.2, 1.8, 0.01, 1, 'nuisance'] +data.parameters['AdustP'] = [ 1.0, 0.5, 1.5, 0.03, 1, 'nuisance'] +data.parameters['beta_dustP'] = [ 1.58, 1.2, 1.8, 0.02, 1, 'nuisance'] +data.parameters['Aradio'] = [ 63.3, 0, 150, 4.7, 1, 'nuisance'] +data.parameters['beta_radio'] = [ -0.8, -0.8, -0.8, 0, 1, 'nuisance'] +data.parameters['Adusty'] = [ 6.07, 0, 100, 0.6, 1, 'nuisance'] +data.parameters['beta_dusty'] = [ 1.75, 1.6, 1.9, 0.06, 1, 'nuisance'] +data.parameters['Acib'] = [ 1.0, 0., 20, 0.3, 1, 'nuisance'] +data.parameters['Atsz'] = [ 5.9, 0., 50, 1.6, 1, 'nuisance'] +data.parameters['Aksz'] = [ 1.0, 0., 50, 2.5, 1, 'nuisance'] +data.parameters['xi'] = [ 0.4, -1., 1., 0.3, 1, 'nuisance'] + +# Derived parameter list +data.parameters['z_reio'] = [0, None, None, 0, 1, 'derived'] +data.parameters['Omega_Lambda'] = [0, None, None, 0, 1, 'derived'] +data.parameters['A_s'] = [0, None, None, 0, 1e-9, 'derived'] +data.parameters['H0'] = [0, None, None, 0, 1, 'derived'] +#data.parameters['sigma8'] = [0, None, None, 0, 1, 'derived'] + + +# CLASS parameters +data.cosmo_arguments['sBBN file'] = data.path['cosmo']+'/external/bbn/sBBN_2017.dat' +data.cosmo_arguments['k_pivot'] = 0.05 +data.cosmo_arguments['N_ur'] = 2.0328 +data.cosmo_arguments['N_ncdm'] = 1 +data.cosmo_arguments['m_ncdm'] = 0.06 +data.cosmo_arguments['T_ncdm'] = 0.71611 +data.cosmo_arguments['l_max_scalars'] = 2500 +data.cosmo_arguments['non_linear'] = 'halofit' + +# These two are required to get sigma8 as a derived parameter +# (class must compute the P(k) until sufficient k) +#data.cosmo_arguments['output'] = 'mPk' +#data.cosmo_arguments['P_k_max_h/Mpc'] = 1. + + +#------ Mcmc parameters ---- +# Number of steps taken, by default (overwritten by the -N command) +data.N=10 +# Number of accepted steps before writing to file the chain. Larger means less +# access to disc, but this is not so much time consuming. +data.write_step=5 + + +# Note: MP will only interpret comments if the line begins with # (you cannot add comments at the end of lines!) diff --git a/montepython/likelihoods/Planck20_Hillipop_TT/Planck20_Hillipop_TT.data b/montepython/likelihoods/Planck20_Hillipop_TT/Planck20_Hillipop_TT.data new file mode 100755 index 00000000..cfb13bee --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TT/Planck20_Hillipop_TT.data @@ -0,0 +1,13 @@ +Planck20_Hillipop_TT.data_directory = '' +Planck20_Hillipop_TT.file = '' + +Planck20_Hillipop_TT.use_nuisance = ['A_planck','cal100A','cal100B','cal143A','cal143B','cal217A','cal217B','Aradio','Adusty','AdustT','Acib','Atsz','Aksz','Aksz','xi','beta_dustT','beta_radio','beta_dusty'] + +Planck20_Hillipop_TT.A_planck_prior_center = 1 +Planck20_Hillipop_TT.A_planck_prior_std = 0.0025 +Planck20_Hillipop_TT.AdustT_prior_center = 1.0 +Planck20_Hillipop_TT.AdustT_prior_std = 0.1 +Planck20_Hillipop_TT.beta_dustT_prior_center = 1.51 +Planck20_Hillipop_TT.beta_dustT_prior_std = 0.01 +Planck20_Hillipop_TT.beta_dusty_prior_center = 1.75 +Planck20_Hillipop_TT.beta_dusty_prior_std = 0.06 diff --git a/montepython/likelihoods/Planck20_Hillipop_TT/Planck20_Hillipop_TT.py b/montepython/likelihoods/Planck20_Hillipop_TT/Planck20_Hillipop_TT.py new file mode 100644 index 00000000..3a7c8e13 --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TT/Planck20_Hillipop_TT.py @@ -0,0 +1,62 @@ +from montepython.likelihood_class import Likelihood +import numpy as np +import planck_2020_hillipop +import os +import tempfile + +packages_path = os.environ.get("COBAYA_PACKAGES_PATH") or os.path.join( + tempfile.gettempdir(), "Hillipop_packages" +) + +class Planck20_Hillipop_TT(Likelihood): + def __init__(self, path, data, command_line): + Likelihood.__init__(self, path, data, command_line) + + #Create Cobaya likelihood + self.lik = planck_2020_hillipop.TT({"packages_path": packages_path}) + + self.need_cosmo_arguments( + data, {'lensing': 'yes', 'output': 'tCl pCl lCl', 'l_max_scalars': self.lik.lmax}) + + print( "Init Hillipop TT done !") + + def loglkl(self, cosmo, data): + + cls = self.get_cl(cosmo) + + fac = cls['ell'] * (cls['ell']+1) / (2*np.pi) + dl = {mode:np.zeros(self.lik.lmax+1) for mode in ['TT','TE','EE']} + for mode in ['TT','TE','EE']: + dl[mode][cls['ell']] = fac*cls[mode.lower()] + + data_params = {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['nuisance'])} + + #fix beta_cib to beta_dusty + if 'beta_cib' not in data_params: + data_params['beta_cib'] = data_params['beta_dusty'] + + #compute log-likelihood + lkl = self.lik.loglike(dl, **data_params) +# print( lkl) + + #Add priors + lkl = self.add_nuisance_prior(lkl, data) + + return lkl + + + def add_nuisance_prior(self, lkl, data): + # Recover the current value of the nuisance parameter. + for nuisance in self.use_nuisance: + nuisance_value = float( + data.mcmc_parameters[nuisance]['current'] * + data.mcmc_parameters[nuisance]['scale']) + + # add prior on nuisance parameters + if hasattr(self, "%s_prior_center" % nuisance) and getattr(self, "%s_prior_std" % nuisance) > 0: + # convenience variables + prior_center = getattr(self, "%s_prior_center" % nuisance) + prior_std = getattr(self, "%s_prior_std" % nuisance) + lkl += -0.5*((nuisance_value-prior_center)/prior_std)**2 + + return lkl diff --git a/montepython/likelihoods/Planck20_Hillipop_TT/README.md b/montepython/likelihoods/Planck20_Hillipop_TT/README.md new file mode 100644 index 00000000..bc4e6a6d --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TT/README.md @@ -0,0 +1,22 @@ +# Hillipop is a high-l polarized likelihood for Planck PR4 data. + +Hillipop is a multifrequency CMB likelihood for Planck data. The likelihood is a spectrum-based Gaussian approximation for cross-correlation spectra from Planck 100, 143 and 217GHz split-frequency maps, with semi-analytic estimates of the Cl covariance matrix based on the data. The cross-spectra are debiased from the effects of the mask and the beam leakage using Xpol (a generalization to polarization of the algorithm presented in Tristram et al. 2005) before being compared to the model, which includes CMB and foreground residuals. They cover the multipoles from ℓ = 30 to 2500. + +Reference:\ +[Tristram et al., A&A, 2023](https://arxiv.org/abs/2309.10034) + +The code is available here:\ +[https://github.com/planck-npipe/hillipop](https://github.com/planck-npipe/hillipop)\ +This is a wrapper for MontePython. + +You need to install the code before: +``` +pip install planck-2020-hillipop +``` + +Then get the data, untar and set the variable $COBAYA_PACKAGES_PATH to the local directory: +``` +wget https://portal.nersc.gov/cfs/cmb/planck2020/likelihoods/planck_2020_hillipop_TT_v4.2.tar.gz +tar -zxvf planck_2020_hillipop_TT_v4.2.tar.gz --directory /path/to/data +export COBAYA_PACKAGES_PATH=/path/to/data +``` diff --git a/montepython/likelihoods/Planck20_Hillipop_TT/__init__.py b/montepython/likelihoods/Planck20_Hillipop_TT/__init__.py new file mode 100644 index 00000000..856bad55 --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TT/__init__.py @@ -0,0 +1 @@ +from .Planck20_Hillipop_TT import Planck20_Hillipop_TT diff --git a/montepython/likelihoods/Planck20_Hillipop_TTTEEE/Planck20_Hillipop_TTTEEE.data b/montepython/likelihoods/Planck20_Hillipop_TTTEEE/Planck20_Hillipop_TTTEEE.data new file mode 100755 index 00000000..c0d39f2c --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TTTEEE/Planck20_Hillipop_TTTEEE.data @@ -0,0 +1,17 @@ +Planck20_Hillipop_TTTEEE.data_directory = '' +Planck20_Hillipop_TTTEEE.file = '' + +Planck20_Hillipop_TTTEEE.use_nuisance = ['A_planck','cal100A','cal100B','cal143A','cal143B','cal217A','cal217B','Aradio','Adusty','AdustT','AdustP','Acib','Atsz','Aksz','Aksz','xi','beta_radio','beta_dusty','beta_dustT','beta_dustP'] + +Planck20_Hillipop_TTTEEE.A_planck_prior_center = 1 +Planck20_Hillipop_TTTEEE.A_planck_prior_std = 0.0025 +Planck20_Hillipop_TTTEEE.beta_dusty_prior_center = 1.75 +Planck20_Hillipop_TTTEEE.beta_dusty_prior_std = 0.06 +Planck20_Hillipop_TTTEEE.AdustT_prior_center = 1.0 +Planck20_Hillipop_TTTEEE.AdustT_prior_std = 0.1 +Planck20_Hillipop_TTTEEE.beta_dustT_prior_center = 1.51 +Planck20_Hillipop_TTTEEE.beta_dustT_prior_std = 0.01 +Planck20_Hillipop_TTTEEE.AdustP_prior_center = 1.0 +Planck20_Hillipop_TTTEEE.AdustP_prior_std = 0.1 +Planck20_Hillipop_TTTEEE.beta_dustP_prior_center = 1.59 +Planck20_Hillipop_TTTEEE.beta_dustP_prior_std = 0.02 diff --git a/montepython/likelihoods/Planck20_Hillipop_TTTEEE/Planck20_Hillipop_TTTEEE.py b/montepython/likelihoods/Planck20_Hillipop_TTTEEE/Planck20_Hillipop_TTTEEE.py new file mode 100644 index 00000000..804ad1df --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TTTEEE/Planck20_Hillipop_TTTEEE.py @@ -0,0 +1,63 @@ +from montepython.likelihood_class import Likelihood +import numpy as np +import planck_2020_hillipop +import os +import tempfile + +packages_path = os.environ.get("COBAYA_PACKAGES_PATH") or os.path.join( + tempfile.gettempdir(), "Hillipop_packages" +) + +class Planck20_Hillipop_TTTEEE(Likelihood): + def __init__(self, path, data, command_line): + Likelihood.__init__(self, path, data, command_line) + + #Create Cobaya likelihood + self.lik = planck_2020_hillipop.TTTEEE({"packages_path": packages_path}) + + self.need_cosmo_arguments( + data, {'lensing': 'yes', 'output': 'tCl pCl lCl', 'l_max_scalars': self.lik.lmax}) + + print( "Init Hillipop TTTEEE done !") + + def loglkl(self, cosmo, data): + + cls = self.get_cl(cosmo) + + fac = cls['ell'] * (cls['ell']+1) / (2*np.pi) + dl = {mode:np.zeros(self.lik.lmax+1) for mode in ['TT','TE','EE']} + for mode in ['TT','TE','EE']: + dl[mode][cls['ell']] = fac*cls[mode.lower()] + + data_params = {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['nuisance'])} + for par in ['pe100A','pe100B','pe143A','pe143B']: data_params[par] = 1.0 + data_params['pe217A'] = data_params['pe217B'] = 0.975 + + #fix beta_cib to beta_dusty + if 'beta_cib' not in data_params: + data_params['beta_cib'] = data_params['beta_dusty'] + + #compute log-likelihood + lkl = self.lik.loglike(dl, **data_params) + + #Add priors + lkl = self.add_nuisance_prior(lkl, data) + + return lkl + + + def add_nuisance_prior(self, lkl, data): + # Recover the current value of the nuisance parameter. + for nuisance in self.use_nuisance: + nuisance_value = float( + data.mcmc_parameters[nuisance]['current'] * + data.mcmc_parameters[nuisance]['scale']) + + # add prior on nuisance parameters + if hasattr(self, "%s_prior_center" % nuisance) and getattr(self, "%s_prior_std" % nuisance) > 0: + # convenience variables + prior_center = getattr(self, "%s_prior_center" % nuisance) + prior_std = getattr(self, "%s_prior_std" % nuisance) + lkl += -0.5*((nuisance_value-prior_center)/prior_std)**2 + + return lkl diff --git a/montepython/likelihoods/Planck20_Hillipop_TTTEEE/README.md b/montepython/likelihoods/Planck20_Hillipop_TTTEEE/README.md new file mode 100644 index 00000000..f267371e --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TTTEEE/README.md @@ -0,0 +1,22 @@ +# Hillipop is a high-l polarized likelihood for Planck PR4 data + +Hillipop is a multifrequency CMB likelihood for Planck data. The likelihood is a spectrum-based Gaussian approximation for cross-correlation spectra from Planck 100, 143 and 217GHz split-frequency maps, with semi-analytic estimates of the Cl covariance matrix based on the data. The cross-spectra are debiased from the effects of the mask and the beam leakage using Xpol (a generalization to polarization of the algorithm presented in Tristram et al. 2005) before being compared to the model, which includes CMB and foreground residuals. They cover the multipoles from ℓ = 30 to 2500. + +Reference:\ +[Tristram et al., A&A, 2023](https://arxiv.org/abs/2309.10034) + +The code is available here:\ +[https://github.com/planck-npipe/hillipop](https://github.com/planck-npipe/hillipop)\ +This is a wrapper for MontePython. + +You need to install the code before: +``` +pip install planck-2020-hillipop +``` + +Then get the data, untar and set the variable $COBAYA_PACKAGES_PATH to the local directory: +``` +wget https://portal.nersc.gov/cfs/cmb/planck2020/likelihoods/planck_2020_hillipop_TTTEEE_v4.2.tar.gz +tar -zxvf planck_2020_hillipop_TTTEEE_v4.2.tar.gz --directory /path/to/data +export COBAYA_PACKAGES_PATH=/path/to/data +``` diff --git a/montepython/likelihoods/Planck20_Hillipop_TTTEEE/__init__.py b/montepython/likelihoods/Planck20_Hillipop_TTTEEE/__init__.py new file mode 100644 index 00000000..5c60eb8e --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TTTEEE/__init__.py @@ -0,0 +1 @@ +from .Planck20_Hillipop_TTTEEE import Planck20_Hillipop_TTTEEE diff --git a/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/Planck20_Hillipop_TTTEEE_lite.data b/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/Planck20_Hillipop_TTTEEE_lite.data new file mode 100755 index 00000000..4bd5a42b --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/Planck20_Hillipop_TTTEEE_lite.data @@ -0,0 +1,17 @@ +Planck20_Hillipop_TTTEEE_lite.data_directory = '' +Planck20_Hillipop_TTTEEE_lite.file = '' + +Planck20_Hillipop_TTTEEE_lite.use_nuisance = ['A_planck','cal100A','cal100B','cal143A','cal143B','cal217A','cal217B','Aradio','Adusty','AdustT','AdustP','Acib','Atsz','Aksz','Aksz','xi','beta_radio','beta_dusty','beta_dustT','beta_dustP'] + +Planck20_Hillipop_TTTEEE_lite.A_planck_prior_center = 1 +Planck20_Hillipop_TTTEEE_lite.A_planck_prior_std = 0.0025 +Planck20_Hillipop_TTTEEE_lite.beta_dusty_prior_center = 1.75 +Planck20_Hillipop_TTTEEE_lite.beta_dusty_prior_std = 0.06 +Planck20_Hillipop_TTTEEE_lite.AdustT_prior_center = 1.0 +Planck20_Hillipop_TTTEEE_lite.AdustT_prior_std = 0.1 +Planck20_Hillipop_TTTEEE_lite.beta_dustT_prior_center = 1.51 +Planck20_Hillipop_TTTEEE_lite.beta_dustT_prior_std = 0.01 +Planck20_Hillipop_TTTEEE_lite.AdustP_prior_center = 1.0 +Planck20_Hillipop_TTTEEE_lite.AdustP_prior_std = 0.1 +Planck20_Hillipop_TTTEEE_lite.beta_dustP_prior_center = 1.59 +Planck20_Hillipop_TTTEEE_lite.beta_dustP_prior_std = 0.02 diff --git a/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/Planck20_Hillipop_TTTEEE_lite.py b/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/Planck20_Hillipop_TTTEEE_lite.py new file mode 100644 index 00000000..3a948de2 --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/Planck20_Hillipop_TTTEEE_lite.py @@ -0,0 +1,63 @@ +from montepython.likelihood_class import Likelihood +import numpy as np +import planck_2020_hillipop +import os +import tempfile + +packages_path = os.environ.get("COBAYA_PACKAGES_PATH") or os.path.join( + tempfile.gettempdir(), "Hillipop_packages" +) + +class Planck20_Hillipop_TTTEEE_lite(Likelihood): + def __init__(self, path, data, command_line): + Likelihood.__init__(self, path, data, command_line) + + #Create Cobaya likelihood + self.lik = planck_2020_hillipop.TTTEEE_lite({"packages_path": packages_path}) + + self.need_cosmo_arguments( + data, {'lensing': 'yes', 'output': 'tCl pCl lCl', 'l_max_scalars': self.lik.lmax}) + + print( "Init Hillipop TTTEEE_lite done !") + + def loglkl(self, cosmo, data): + + cls = self.get_cl(cosmo) + + fac = cls['ell'] * (cls['ell']+1) / (2*np.pi) + dl = {mode:np.zeros(self.lik.lmax+1) for mode in ['TT','TE','EE']} + for mode in ['TT','TE','EE']: + dl[mode][cls['ell']] = fac*cls[mode.lower()] + + data_params = {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['nuisance'])} + for par in ['pe100A','pe100B','pe143A','pe143B']: data_params[par] = 1.0 + data_params['pe217A'] = data_params['pe217B'] = 0.975 + + #fix beta_cib to beta_dusty + if 'beta_cib' not in data_params: + data_params['beta_cib'] = data_params['beta_dusty'] + + #compute log-likelihood + lkl = self.lik.loglike(dl, **data_params) + + #Add priors + lkl = self.add_nuisance_prior(lkl, data) + + return lkl + + + def add_nuisance_prior(self, lkl, data): + # Recover the current value of the nuisance parameter. + for nuisance in self.use_nuisance: + nuisance_value = float( + data.mcmc_parameters[nuisance]['current'] * + data.mcmc_parameters[nuisance]['scale']) + + # add prior on nuisance parameters + if hasattr(self, "%s_prior_center" % nuisance) and getattr(self, "%s_prior_std" % nuisance) > 0: + # convenience variables + prior_center = getattr(self, "%s_prior_center" % nuisance) + prior_std = getattr(self, "%s_prior_std" % nuisance) + lkl += -0.5*((nuisance_value-prior_center)/prior_std)**2 + + return lkl diff --git a/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/README.md b/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/README.md new file mode 100644 index 00000000..adc7d764 --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/README.md @@ -0,0 +1,24 @@ +# Hillipop is a high-l polarized likelihood for Planck PR4 data (lite, i.e. binned version) + +Hillipop is a multifrequency CMB likelihood for Planck data. The likelihood is a spectrum-based Gaussian approximation for cross-correlation spectra from Planck 100, 143 and 217GHz split-frequency maps, with semi-analytic estimates of the Cl covariance matrix based on the data. The cross-spectra are debiased from the effects of the mask and the beam leakage using Xpol (a generalization to polarization of the algorithm presented in Tristram et al. 2005) before being compared to the model, which includes CMB and foreground residuals. They cover the multipoles from ℓ = 30 to 2500. + +Reference:\ +[Tristram et al., A&A, 2023](https://arxiv.org/abs/2309.10034) + +The code is available here:\ +[https://github.com/planck-npipe/hillipop](https://github.com/planck-npipe/hillipop)\ +This is a wrapper for MontePython. + +You need to install the code before: +``` +git clone https://github.com/planck-npipe/hillipop --branch v4.3 +cd hillipop +pip install . +``` + +Then get the data, untar and set the variable $COBAYA_PACKAGES_PATH to the local directory: +``` +wget https://portal.nersc.gov/cfs/cmb/planck2020/likelihoods/planck_2020_hillipop_TTTEEE_lite_v4.2.tar.gz +tar -zxvf planck_2020_hillipop_TTTEEE_lite_v4.2.tar.gz --directory /path/to/data +export COBAYA_PACKAGES_PATH=/path/to/data +``` diff --git a/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/__init__.py b/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/__init__.py new file mode 100644 index 00000000..a168dd42 --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TTTEEE_lite/__init__.py @@ -0,0 +1 @@ +from .Planck20_Hillipop_TTTEEE_lite import Planck20_Hillipop_TTTEEE_lite diff --git a/montepython/likelihoods/Planck20_Hillipop_TT_lite/Planck20_Hillipop_TT_lite.data b/montepython/likelihoods/Planck20_Hillipop_TT_lite/Planck20_Hillipop_TT_lite.data new file mode 100755 index 00000000..63d8c83f --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TT_lite/Planck20_Hillipop_TT_lite.data @@ -0,0 +1,13 @@ +Planck20_Hillipop_TT_lite.data_directory = '' +Planck20_Hillipop_TT_lite.file = '' + +Planck20_Hillipop_TT_lite.use_nuisance = ['A_planck','cal100A','cal100B','cal143A','cal143B','cal217A','cal217B','Aradio','Adusty','AdustT','Acib','Atsz','Aksz','Aksz','xi','beta_dustT','beta_radio','beta_dusty'] + +Planck20_Hillipop_TT_lite.A_planck_prior_center = 1 +Planck20_Hillipop_TT_lite.A_planck_prior_std = 0.0025 +Planck20_Hillipop_TT_lite.AdustT_prior_center = 1.0 +Planck20_Hillipop_TT_lite.AdustT_prior_std = 0.1 +Planck20_Hillipop_TT_lite.beta_dustT_prior_center = 1.51 +Planck20_Hillipop_TT_lite.beta_dustT_prior_std = 0.01 +Planck20_Hillipop_TT_lite.beta_dusty_prior_center = 1.75 +Planck20_Hillipop_TT_lite.beta_dusty_prior_std = 0.06 diff --git a/montepython/likelihoods/Planck20_Hillipop_TT_lite/Planck20_Hillipop_TT_lite.py b/montepython/likelihoods/Planck20_Hillipop_TT_lite/Planck20_Hillipop_TT_lite.py new file mode 100644 index 00000000..5718a112 --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TT_lite/Planck20_Hillipop_TT_lite.py @@ -0,0 +1,62 @@ +from montepython.likelihood_class import Likelihood +import numpy as np +import planck_2020_hillipop +import os +import tempfile + +packages_path = os.environ.get("COBAYA_PACKAGES_PATH") or os.path.join( + tempfile.gettempdir(), "Hillipop_packages" +) + +class Planck20_Hillipop_TT_lite(Likelihood): + def __init__(self, path, data, command_line): + Likelihood.__init__(self, path, data, command_line) + + #Create Cobaya likelihood + self.lik = planck_2020_hillipop.TT_lite({"packages_path": packages_path}) + + self.need_cosmo_arguments( + data, {'lensing': 'yes', 'output': 'tCl pCl lCl', 'l_max_scalars': self.lik.lmax}) + + print( "Init Hillipop TT_lite done !") + + def loglkl(self, cosmo, data): + + cls = self.get_cl(cosmo) + + fac = cls['ell'] * (cls['ell']+1) / (2*np.pi) + dl = {mode:np.zeros(self.lik.lmax+1) for mode in ['TT','TE','EE']} + for mode in ['TT','TE','EE']: + dl[mode][cls['ell']] = fac*cls[mode.lower()] + + data_params = {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['nuisance'])} + + #fix beta_cib to beta_dusty + if 'beta_cib' not in data_params: + data_params['beta_cib'] = data_params['beta_dusty'] + + #compute log-likelihood + lkl = self.lik.loglike(dl, **data_params) +# print( lkl) + + #Add priors + lkl = self.add_nuisance_prior(lkl, data) + + return lkl + + + def add_nuisance_prior(self, lkl, data): + # Recover the current value of the nuisance parameter. + for nuisance in self.use_nuisance: + nuisance_value = float( + data.mcmc_parameters[nuisance]['current'] * + data.mcmc_parameters[nuisance]['scale']) + + # add prior on nuisance parameters + if hasattr(self, "%s_prior_center" % nuisance) and getattr(self, "%s_prior_std" % nuisance) > 0: + # convenience variables + prior_center = getattr(self, "%s_prior_center" % nuisance) + prior_std = getattr(self, "%s_prior_std" % nuisance) + lkl += -0.5*((nuisance_value-prior_center)/prior_std)**2 + + return lkl diff --git a/montepython/likelihoods/Planck20_Hillipop_TT_lite/README.md b/montepython/likelihoods/Planck20_Hillipop_TT_lite/README.md new file mode 100644 index 00000000..a0a1b915 --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TT_lite/README.md @@ -0,0 +1,24 @@ +# Hillipop is a high-l polarized likelihood for Planck PR4 data (lite, i.e. binned version) + +Hillipop is a multifrequency CMB likelihood for Planck data. The likelihood is a spectrum-based Gaussian approximation for cross-correlation spectra from Planck 100, 143 and 217GHz split-frequency maps, with semi-analytic estimates of the Cl covariance matrix based on the data. The cross-spectra are debiased from the effects of the mask and the beam leakage using Xpol (a generalization to polarization of the algorithm presented in Tristram et al. 2005) before being compared to the model, which includes CMB and foreground residuals. They cover the multipoles from ℓ = 30 to 2500. + +Reference:\ +[Tristram et al., A&A, 2023](https://arxiv.org/abs/2309.10034) + +The code is available here:\ +[https://github.com/planck-npipe/hillipop](https://github.com/planck-npipe/hillipop)\ +This is a wrapper for MontePython. + +You need to install the code before: +``` +git clone https://github.com/planck-npipe/hillipop --branch v4.3 +cd hillipop +pip install . +``` + +Then get the data, untar and set the variable $COBAYA_PACKAGES_PATH to the local directory: +``` +wget https://portal.nersc.gov/cfs/cmb/planck2020/likelihoods/planck_2020_hillipop_TT_lite_v4.2.tar.gz +tar -zxvf planck_2020_hillipop_TT_lite_v4.2.tar.gz --directory /path/to/data +export COBAYA_PACKAGES_PATH=/path/to/data +``` diff --git a/montepython/likelihoods/Planck20_Hillipop_TT_lite/__init__.py b/montepython/likelihoods/Planck20_Hillipop_TT_lite/__init__.py new file mode 100644 index 00000000..20ca9486 --- /dev/null +++ b/montepython/likelihoods/Planck20_Hillipop_TT_lite/__init__.py @@ -0,0 +1 @@ +from .Planck20_Hillipop_TT_lite import Planck20_Hillipop_TT_lite diff --git a/montepython/likelihoods/Planck20_Lollipop_BB/Planck20_Lollipop_BB.data b/montepython/likelihoods/Planck20_Lollipop_BB/Planck20_Lollipop_BB.data new file mode 100755 index 00000000..63e2dc7a --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_BB/Planck20_Lollipop_BB.data @@ -0,0 +1,17 @@ +Planck20_Lollipop_BB.data_directory = '' +Planck20_Lollipop_BB.file = '' + +Planck20_Lollipop_BB.Nsim = 400 +Planck20_Lollipop_BB.lmin = 2 +Planck20_Lollipop_BB.lmax = 150 +Planck20_Lollipop_BB.use_nuisance = ['A_planck'] + +# note concerning the Planck likelihoods: +# This likelihood has a nuisance parameter A_planck that should be declared in +# your input parameter file. +# Usually this likelihood is used in combination with the highl likelihood, +# which imposes a gaussian prior on this nuisance parameter. +# If you run this likelihood alone (without any highl one), you need to +# impose the gaussian prior here. In that case, uncomment the two lines: +#Planck20_Lollipop_BB.A_planck_prior_center = 1 +#Planck20_Lollipop_BB.A_planck_prior_std = 0.0025 diff --git a/montepython/likelihoods/Planck20_Lollipop_BB/Planck20_Lollipop_BB.py b/montepython/likelihoods/Planck20_Lollipop_BB/Planck20_Lollipop_BB.py new file mode 100644 index 00000000..6a47cb0d --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_BB/Planck20_Lollipop_BB.py @@ -0,0 +1,58 @@ +from montepython.likelihood_class import Likelihood +import numpy as np +import planck_2020_lollipop +import os +import tempfile + +packages_path = os.environ.get("COBAYA_PACKAGES_PATH") or os.path.join( + tempfile.gettempdir(), "Lollipop_packages" +) + +hartlap_factor = False +marginalised_over_covariance = True + + +class Planck20_Lollipop_BB(Likelihood): + def __init__(self, path, data, command_line): + Likelihood.__init__(self, path, data, command_line) + + #Create Cobaya likelihood + self.lik = planck_2020_lollipop.lowlB({"packages_path": packages_path, "Nsim": self.Nsim, "lmin":self.lmin, "lmax":self.lmax}) + + self.need_cosmo_arguments( + data, {'lensing': 'yes', 'output': 'pCl lCl', 'non_linear': 'halofit', 'l_max_scalars': self.lik.bins.lmax}) + + print( "Init Lollipop (lowlB) done !") + + def loglkl(self, cosmo, data): + +# print( {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['cosmo'])}) + cls = self.get_cl(cosmo) + + data_params = {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['nuisance'])} + + #compute log-likelihood + lkl = self.lik.loglike(cls, **data_params) + + #Add priors + lkl = self.add_nuisance_prior(lkl, data) + + return lkl + + + def add_nuisance_prior(self, lkl, data): + # Recover the current value of the nuisance parameter. + for nuisance in self.use_nuisance: + nuisance_value = float( + data.mcmc_parameters[nuisance]['current'] * + data.mcmc_parameters[nuisance]['scale']) + + # add prior on nuisance parameters + if hasattr(self, "%s_prior_center" % nuisance) and getattr(self, "%s_prior_std" % nuisance) > 0: + # convenience variables + prior_center = getattr(self, "%s_prior_center" % nuisance) + prior_std = getattr(self, "%s_prior_std" % nuisance) + lkl += -0.5*((nuisance_value-prior_center)/prior_std)**2 + return lkl + + diff --git a/montepython/likelihoods/Planck20_Lollipop_BB/README.md b/montepython/likelihoods/Planck20_Lollipop_BB/README.md new file mode 100644 index 00000000..3265c85f --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_BB/README.md @@ -0,0 +1,30 @@ +# Lollipop is a low-l polarized likelihood for Planck PR4 data (BB spectrum) + +Lollipop is a Planck low-l polarization likelihood based on +cross-power-spectra for which the bias is zero when the noise is +uncorrelated between maps. It uses the approximation presented in +Hamimeche & Lewis (2008), modified as described in Mangilli et +al. (2015) to apply to cross-power spectra. This version is based on +the Planck PR4 data. Cross-spectra are computed on the CMB maps from +Commander component separation applied on each detset-split Planck +frequency maps. + +References:\ +[Tristram et al., A&A, 2021](https://arxiv.org/abs/2010.01139)\ +[Tristram et al., A&A, 2022](https://arxiv.org/abs/2112.07961) + +The code is available here:\ +[https://github.com/planck-npipe/lollipop](https://github.com/planck-npipe/lollipop)\ +This is a wrapper for MontePython. + +You need to install the code before: +``` +pip install planck-2020-lollipop +``` + +Then get the data, untar and set the variable $COBAYA_PACKAGES_PATH to the local directory: +``` +wget https://portal.nersc.gov/cfs/cmb/planck2020/likelihoods/planck_2020_lollipop.tar.gz +tar -zxvf planck_2020_lollipop.tar.gz --directory /path/to/data +export COBAYA_PACKAGES_PATH=/path/to/data +``` diff --git a/montepython/likelihoods/Planck20_Lollipop_BB/__init__.py b/montepython/likelihoods/Planck20_Lollipop_BB/__init__.py new file mode 100644 index 00000000..e17c047f --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_BB/__init__.py @@ -0,0 +1 @@ +from .Planck20_Lollipop_BB import Planck20_Lollipop_BB diff --git a/montepython/likelihoods/Planck20_Lollipop_EE/Planck20_Lollipop_EE.data b/montepython/likelihoods/Planck20_Lollipop_EE/Planck20_Lollipop_EE.data new file mode 100755 index 00000000..3764b099 --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_EE/Planck20_Lollipop_EE.data @@ -0,0 +1,17 @@ +Planck20_Lollipop_EE.data_directory = '' +Planck20_Lollipop_EE.file = '' + +Planck20_Lollipop_EE.Nsim = 400 +Planck20_Lollipop_EE.lmin = 2 +Planck20_Lollipop_EE.lmax = 30 +Planck20_Lollipop_EE.use_nuisance = ['A_planck'] + +# note concerning the Planck likelihoods: +# This likelihood has a nuisance parameter A_planck that should be declared in +# your input parameter file. +# Usually this likelihood is used in combination with the highl likelihood, +# which imposes a gaussian prior on this nuisance parameter. +# If you run this likelihood alone (without any highl one), you need to +# impose the gaussian prior here. In that case, uncomment the two lines: +#Planck20_Lollipop_EE.A_planck_prior_center = 1 +#Planck20_Lollipop_EE.A_planck_prior_std = 0.0025 diff --git a/montepython/likelihoods/Planck20_Lollipop_EE/Planck20_Lollipop_EE.py b/montepython/likelihoods/Planck20_Lollipop_EE/Planck20_Lollipop_EE.py new file mode 100644 index 00000000..68e19d7f --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_EE/Planck20_Lollipop_EE.py @@ -0,0 +1,60 @@ +from montepython.likelihood_class import Likelihood +import numpy as np +import planck_2020_lollipop +import os +import tempfile + +packages_path = os.environ.get("COBAYA_PACKAGES_PATH") or os.path.join( + tempfile.gettempdir(), "Lollipop_packages" +) + + + +class Planck20_Lollipop_EE(Likelihood): + def __init__(self, path, data, command_line): + Likelihood.__init__(self, path, data, command_line) + + #Create Cobaya likelihood + self.lik = planck_2020_lollipop.lowlE({"packages_path": packages_path, "Nsim": self.Nsim, "lmin":self.lmin, "lmax":self.lmax}) + + self.lik.hartlap_factor = False + self.lik.marginalised_over_covariance = True + + self.need_cosmo_arguments( + data, {'lensing': 'yes', 'output': 'pCl lCl', 'non_linear': 'halofit', 'l_max_scalars': self.lik.bins.lmax}) + + print( "Init Lollipop (lowlE) done !") + + def loglkl(self, cosmo, data): + +# print( {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['cosmo'])}) + cls = self.get_cl(cosmo) + + data_params = {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['nuisance'])} +# print(data_params) + + #compute log-likelihood + lkl = self.lik.loglike(cls, **data_params) + + #Add priors + lkl = self.add_nuisance_prior(lkl, data) + + return lkl + + + def add_nuisance_prior(self, lkl, data): + # Recover the current value of the nuisance parameter. + for nuisance in self.use_nuisance: + nuisance_value = float( + data.mcmc_parameters[nuisance]['current'] * + data.mcmc_parameters[nuisance]['scale']) + + # add prior on nuisance parameters + if hasattr(self, "%s_prior_center" % nuisance) and getattr(self, "%s_prior_std" % nuisance) > 0: + # convenience variables + prior_center = getattr(self, "%s_prior_center" % nuisance) + prior_std = getattr(self, "%s_prior_std" % nuisance) + lkl += -0.5*((nuisance_value-prior_center)/prior_std)**2 + return lkl + + diff --git a/montepython/likelihoods/Planck20_Lollipop_EE/README.md b/montepython/likelihoods/Planck20_Lollipop_EE/README.md new file mode 100644 index 00000000..539f802a --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_EE/README.md @@ -0,0 +1,31 @@ +# Lollipop is a low-l polarized likelihood for Planck PR4 data (EE spectrum) + +Lollipop is a Planck low-l polarization likelihood based on +cross-power-spectra for which the bias is zero when the noise is +uncorrelated between maps. It uses the approximation presented in +Hamimeche & Lewis (2008), modified as described in Mangilli et +al. (2015) to apply to cross-power spectra. This version is based on +the Planck PR4 data. Cross-spectra are computed on the CMB maps from +Commander component separation applied on each detset-split Planck +frequency maps. + +References:\ +[Tristram et al., A&A, 2021](https://arxiv.org/abs/2010.01139)\ +[Tristram et al., A&A, 2022](https://arxiv.org/abs/2112.07961) + +The code is available here:\ +[https://github.com/planck-npipe/lollipop](https://github.com/planck-npipe/lollipop)\ +This is a wrapper for MontePython. + +You need to install the code before: +``` +pip install planck-2020-lollipop +``` + +Then get the data, untar and set the variable $COBAYA_PACKAGES_PATH to the local directory: +``` +wget https://portal.nersc.gov/cfs/cmb/planck2020/likelihoods/planck_2020_lollipop.tar.gz +tar -zxvf planck_2020_lollipop.tar.gz --directory /path/to/data +export COBAYA_PACKAGES_PATH=/path/to/data +``` + diff --git a/montepython/likelihoods/Planck20_Lollipop_EE/__init__.py b/montepython/likelihoods/Planck20_Lollipop_EE/__init__.py new file mode 100644 index 00000000..1cb3a88d --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_EE/__init__.py @@ -0,0 +1 @@ +from .Planck20_Lollipop_EE import Planck20_Lollipop_EE diff --git a/montepython/likelihoods/Planck20_Lollipop_EEBBEB/Planck20_Lollipop_EEBBEB.data b/montepython/likelihoods/Planck20_Lollipop_EEBBEB/Planck20_Lollipop_EEBBEB.data new file mode 100755 index 00000000..65aa2908 --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_EEBBEB/Planck20_Lollipop_EEBBEB.data @@ -0,0 +1,17 @@ +Planck20_Lollipop_EB.data_directory = '' +Planck20_Lollipop_EB.file = '' + +Planck20_Lollipop_EB.Nsim = 400 +Planck20_Lollipop_EB.lmin = 2 +Planck20_Lollipop_EB.lmax = 30 +Planck20_Lollipop_EB.use_nuisance = ['A_planck'] + +# note concerning the Planck likelihoods: +# This likelihood has a nuisance parameter A_planck that should be declared in +# your input parameter file. +# Usually this likelihood is used in combination with the highl likelihood, +# which imposes a gaussian prior on this nuisance parameter. +# If you run this likelihood alone (without any highl one), you need to +# impose the gaussian prior here. In that case, uncomment the two lines: +#Planck20_Lollipop_EB.A_planck_prior_center = 1 +#Planck20_Lollipop_EB.A_planck_prior_std = 0.0025 diff --git a/montepython/likelihoods/Planck20_Lollipop_EEBBEB/Planck20_Lollipop_EEBBEB.py b/montepython/likelihoods/Planck20_Lollipop_EEBBEB/Planck20_Lollipop_EEBBEB.py new file mode 100644 index 00000000..3ed6c1d0 --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_EEBBEB/Planck20_Lollipop_EEBBEB.py @@ -0,0 +1,59 @@ +from montepython.likelihood_class import Likelihood +import numpy as np +import planck_2020_lollipop +import os +import tempfile + +packages_path = os.environ.get("COBAYA_PACKAGES_PATH") or os.path.join( + tempfile.gettempdir(), "Lollipop_packages" +) + +hartlap_factor = False +marginalised_over_covariance = True + + +class Planck20_Lollipop_EB(Likelihood): + def __init__(self, path, data, command_line): + Likelihood.__init__(self, path, data, command_line) + + #Create Cobaya likelihood + self.lik = planck_2020_lollipop.lowlEB({"packages_path": packages_path, "Nsim": self.Nsim, "lmin":self.lmin, "lmax":self.lmax}) + + self.need_cosmo_arguments( + data, {'lensing': 'yes', 'output': 'pCl lCl', 'non_linear': 'halofit', 'l_max_scalars': self.lik.bins.lmax}) + + print( "Init Lollipop (lowlEB) done !") + + def loglkl(self, cosmo, data): + +# print( {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['cosmo'])}) + cls = self.get_cl(cosmo) + + data_params = {par:data.mcmc_parameters[par]['current'] for par in data.get_mcmc_parameters(['nuisance'])} +# print(data_params) + + #compute log-likelihood + lkl = self.lik.loglike(cls, **data_params) + + #Add priors + lkl = self.add_nuisance_prior(lkl, data) + + return lkl + + + def add_nuisance_prior(self, lkl, data): + # Recover the current value of the nuisance parameter. + for nuisance in self.use_nuisance: + nuisance_value = float( + data.mcmc_parameters[nuisance]['current'] * + data.mcmc_parameters[nuisance]['scale']) + + # add prior on nuisance parameters + if hasattr(self, "%s_prior_center" % nuisance) and getattr(self, "%s_prior_std" % nuisance) > 0: + # convenience variables + prior_center = getattr(self, "%s_prior_center" % nuisance) + prior_std = getattr(self, "%s_prior_std" % nuisance) + lkl += -0.5*((nuisance_value-prior_center)/prior_std)**2 + return lkl + + diff --git a/montepython/likelihoods/Planck20_Lollipop_EEBBEB/README.md b/montepython/likelihoods/Planck20_Lollipop_EEBBEB/README.md new file mode 100644 index 00000000..a11333f1 --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_EEBBEB/README.md @@ -0,0 +1,30 @@ +# Lollipop is a low-l polarized likelihood for Planck PR4 data (EE, BB, and EB spectra) + +Lollipop is a Planck low-l polarization likelihood based on +cross-power-spectra for which the bias is zero when the noise is +uncorrelated between maps. It uses the approximation presented in +Hamimeche & Lewis (2008), modified as described in Mangilli et +al. (2015) to apply to cross-power spectra. This version is based on +the Planck PR4 data. Cross-spectra are computed on the CMB maps from +Commander component separation applied on each detset-split Planck +frequency maps. + +References:\ +[Tristram et al., A&A, 2021](https://arxiv.org/abs/2010.01139)\ +[Tristram et al., A&A, 2022](https://arxiv.org/abs/2112.07961) + +The code is available here:\ +[https://github.com/planck-npipe/lollipop](https://github.com/planck-npipe/lollipop)\ +This is a wrapper for MontePython. + +You need to install the code before: +``` +pip install planck-2020-lollipop +``` + +Then get the data, untar and set the variable $COBAYA_PACKAGES_PATH to the local directory: +``` +wget https://portal.nersc.gov/cfs/cmb/planck2020/likelihoods/planck_2020_lollipop.tar.gz +tar -zxvf planck_2020_lollipop.tar.gz --directory /path/to/data +export COBAYA_PACKAGES_PATH=/path/to/data +``` diff --git a/montepython/likelihoods/Planck20_Lollipop_EEBBEB/__init__.py b/montepython/likelihoods/Planck20_Lollipop_EEBBEB/__init__.py new file mode 100644 index 00000000..8c9ab70d --- /dev/null +++ b/montepython/likelihoods/Planck20_Lollipop_EEBBEB/__init__.py @@ -0,0 +1 @@ +from .Planck20_Lollipop_EB import Planck20_Lollipop_EB