Skip to content

Commit

Permalink
Fix ell range (#60)
Browse files Browse the repository at this point in the history
* fix ell scales and comments regarding bandpass construction

* update dataset

* setting test back to low accuracy

* setting low accuracy camb params in the Fisher section of the notebook

* fixing notebook kernel

* update README
  • Loading branch information
sgiardie committed Jul 10, 2023
1 parent 4fdfb2e commit 6527b41
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 139 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ directory.
Simulation releases
-------------------

- ``v0.8`` release has spectra produced with high accuracy camb parameters up to ``ell = 9000``, the foreground components are integrated in frequency using top-hat bandpasses, stored in the ``sacc`` files

- ``v0.7.1`` is a bugfix release of ``v0.7`` release where the mono-frequency and dirac bandpasses
have been correctly set with the ``sacc`` files

Expand Down
13 changes: 11 additions & 2 deletions examples/mflike_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ debug: True

likelihood:
mflike.MFLike:
input_file: data_sacc_00044.fits
input_file: LAT_simu_sacc_00044.fits
cov_Bbl_file: data_sacc_w_covar_and_Bbl.fits

params:
Expand Down Expand Up @@ -70,7 +70,16 @@ theory:
camb:
stop_at_error: False
extra_args:
lens_potential_accuracy: 1
kmax: 10
k_per_logint: 130
nonlinear: True
lens_potential_accuracy: 8
lens_margin: 2050
AccuracyBoost: 2.0
lSampleBoost: 2.0
lAccuracyBoost: 2.0
DoLateRadTruncation: False


sampler:
mcmc:
Expand Down
13 changes: 7 additions & 6 deletions mflike/MFLike.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# A simple cobaya likelihood for SO/LAT

data_folder: MFLike/v0.7.1
data_folder: MFLike/v0.8
# Path to the input SACC file, containing, minimally,
# information about the different tracers (i.e. frequency
# bands) and the set of power spectra.
Expand All @@ -23,10 +23,10 @@ defaults:
polarizations: [TT, TE, ET, EE]
# Scale cuts (in ell) for each spectrum
scales:
TT: [50, 5000]
TE: [50, 5000]
ET: [50, 5000]
EE: [50, 5000]
TT: [30, 9000]
TE: [30, 9000]
ET: [30, 9000]
EE: [30, 9000]
# If True, TE' = (TE + ET) / 2 will be used
# instead of TE and ET separately.
symmetrize: false
Expand Down Expand Up @@ -71,7 +71,8 @@ data:
# (if bandpass in sacc is a single freq, no band integration)
# the default is to read bandpasses from file, to build top-hat uncomment the
# parameters of the block!
# Bandpass has to be in RJ units
# Bandpass has to be divided by nu^2 if measured with respect to a RJ source
# the nu^2 factor is set back again in the _bandpass_construction function
top_hat_band:
# nsteps: 1
# bandwidth: 0
Expand Down
2 changes: 1 addition & 1 deletion mflike/mflike.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class MFLike(InstallableLikelihood):
_url = "https://portal.nersc.gov/cfs/sobs/users/MFLike_data"
_release = "v0.7.1"
_release = "v0.8"
install_options = {"download_url": f"{_url}/{_release}.tar.gz"}

# attributes set from .yaml
Expand Down
41 changes: 21 additions & 20 deletions mflike/tests/test_mflike.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
)

cosmo_params = {
"cosmomc_theta": 0.0104085,
"cosmomc_theta": 0.0104092,
"As": 2.0989031673191437e-09,
"ombh2": 0.02237,
"omch2": 0.1200,
Expand All @@ -20,17 +20,17 @@
"a_tSZ": 3.30,
"a_kSZ": 1.60,
"a_p": 6.90,
"beta_p": 2.08,
"beta_p": 2.20,
"a_c": 4.90,
"beta_c": 2.20,
"a_s": 3.10,
"T_d": 9.60,
"a_gtt": 2.81,
"a_gtt": 2.80,
"a_gte": 0.10,
"a_gee": 0.10,
"a_psee": 0,
"a_pste": 0,
"xi": 0.20,
"xi": 0.10,
"bandint_shift_LAT_93": 0,
"bandint_shift_LAT_145": 0,
"bandint_shift_LAT_225": 0,
Expand All @@ -50,12 +50,12 @@
}

chi2s = {
"tt": 625.889,
"te-et": 925.511,
"ee": 722.076,
"tt-te-et-ee": 2265.168,
"tt": 920.2630056646808,
"te-et": 1375.0253752060808,
"ee": 850.9616194876838,
"tt-te-et-ee": 3137.874002938912,
}
pre = "data_sacc_"
pre = "LAT_simu_sacc_"


class MFLikeTest(unittest.TestCase):
Expand All @@ -68,7 +68,8 @@ def test_mflike(self):
import camb

camb_cosmo = cosmo_params.copy()
camb_cosmo.update({"lmax": 9000, "lens_potential_accuracy": 1})
#using camb low accuracy parameters for the test
camb_cosmo.update({"lmax": 9001, "lens_potential_accuracy": 1})
pars = camb.set_params(**camb_cosmo)
results = camb.get_results(pars)
powers = results.get_cmb_power_spectra(pars, CMB_unit="muK")
Expand All @@ -80,14 +81,14 @@ def test_mflike(self):
{
"packages_path": packages_path,
"input_file": pre + "00000.fits",
"cov_Bbl_file": pre + "w_covar_and_Bbl.fits",
"cov_Bbl_file": "data_sacc_w_covar_and_Bbl.fits",
"defaults": {
"polarizations": select.upper().split("-"),
"scales": {
"TT": [50, 5000],
"TE": [50, 5000],
"ET": [50, 5000],
"EE": [50, 5000],
"TT": [30, 9000],
"TE": [30, 9000],
"ET": [30, 9000],
"EE": [30, 9000],
},
"symmetrize": False,
},
Expand All @@ -101,8 +102,8 @@ def test_cobaya(self):
"likelihood": {
"mflike.MFLike": {
"input_file": pre + "00000.fits",
"cov_Bbl_file": pre + "w_covar_and_Bbl.fits",
}
"cov_Bbl_file": "data_sacc_w_covar_and_Bbl.fits",
},
},
"theory": {"camb": {"extra_args": {"lens_potential_accuracy": 1}}},
"params": cosmo_params,
Expand Down Expand Up @@ -133,7 +134,7 @@ def get_model(nsteps, bandwidth):
"likelihood": {
"mflike.MFLike": {
"input_file": pre + "00000.fits",
"cov_Bbl_file": pre + "w_covar_and_Bbl.fits",
"cov_Bbl_file": "data_sacc_w_covar_and_Bbl.fits",
"top_hat_band": {
"nsteps": nsteps,
"bandwidth": bandwidth,
Expand All @@ -158,8 +159,8 @@ def get_model(nsteps, bandwidth):

# chi2 reference results for the different models and different bandshifts
chi2s = {
"model1": [2265.168, 3742.528, 43753.809],
"model2": [2345.508, 4458.148, 47533.477],
"model1": [4614.10014353, 4929.98648522, 92894.01666485],
"model2": [3734.34320513, 6034.08286905, 103597.03300165],
}

for model, chi2 in chi2s.items():
Expand Down
12 changes: 8 additions & 4 deletions mflike/theoryforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
from cobaya.log import LoggedError


# Converts from cmb units to brightness.
# There is an additional nu**2 factor to convert the bandpasses
# from RJ to brightness units.
# Converts from cmb temperature to differential source intensity
# (see eq. 8 of https://arxiv.org/abs/1303.5070).
# The bandpass transmission needs to be divided by
# nu^2 if measured with respect to a RJ source.
# This factor is already included here.
# Numerical factors not included,
# it needs proper normalization when used.
def _cmb2bb(nu):
Expand Down Expand Up @@ -81,7 +83,9 @@ def __init__(self, mflike=None):

# Takes care of the bandpass construction. It returns a list of nu-transmittance
# for each frequency or an array with the effective freqs.
# bandpasses saved in the sacc file have to be in RJ units
# bandpasses saved in the sacc file have to be divided by nu^2
# if measured with respect to a RJ source.
# This factor is already included in the _cmb2bb function
def _bandpass_construction(self, **params):
data_are_monofreq = False
self.bandint_freqs = []
Expand Down
Loading

0 comments on commit 6527b41

Please sign in to comment.