Skip to content

Commit

Permalink
CAMB accuracy parameters etc (#226)
Browse files Browse the repository at this point in the history
* add AccurateBB for CAMB when tensors on

* dataclasses only install on py3.6

* allow setting CAMB nested type parameters
  • Loading branch information
cmbant authored Jan 22, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent ea1273b commit d0b2237
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cobaya/likelihoods/base_classes/cmblikes.py
Original file line number Diff line number Diff line change
@@ -733,7 +733,7 @@ def make_forecast_cmb_dataset(fiducial_Cl, output_root, output_dir=None,
:param noise_muK_arcmin_P: polarization noise in muK-arcmin
:param NoiseVar: alternatively if noise_muK_arcmin_T is None, effective
isotropic noise variance for the temperature (N_L=NoiseVar with no beam)
:param ENoiseFac: factor by which polarization noise variance is higher thab
:param ENoiseFac: factor by which polarization noise variance is higher than
NoiseVar (usually 2, for Planck about 4
as only half the detectors polarized)
:param fwhm_arcmin: beam fwhm in arcminutes
13 changes: 11 additions & 2 deletions cobaya/theories/camb/camb.py
Original file line number Diff line number Diff line change
@@ -283,6 +283,7 @@ def initialize_with_params(self):
if not self.external_primordial_pk \
and set(self.input_params).intersection({'r', 'At'}):
self.extra_attrs["WantTensors"] = True
self.extra_attrs["Accuracy.AccurateBB"] = True

def get_can_support_params(self):
return self.power_params + self.nonlin_params
@@ -724,8 +725,16 @@ def set(self, params_values_dict, state):
self.log.debug("Setting attributes of CAMBparams: %r",
self.extra_attrs)
for attr, value in self.extra_attrs.items():
if hasattr(params, attr):
setattr(params, attr, value)
obj = params
if '.' in attr:
parts = attr.split('.')
for p in parts[:-1]:
obj = getattr(obj, p)
par = parts[-1]
else:
par = attr
if hasattr(obj, par):
setattr(obj, par, value)
else:
raise LoggedError(
self.log,
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
from os import path
from itertools import chain
import re
import sys

subfolders = {"likelihood": "likelihoods", "sampler": "samplers", "theory": "theories"}

@@ -38,6 +39,13 @@ def extract_docs_requirements():
return ["sphinx"] + reqs


install_requires = ['numpy>=1.17.0', 'scipy>=1.5', 'pandas>=1.0.1',
'PyYAML>=5.1', 'requests>=2.18', 'py-bobyqa>=1.2',
'GetDist>=1.3.1', 'fuzzywuzzy>=0.17', 'packaging', 'tqdm',
'portalocker>=2.3.0', 'dill>=0.3.3']
if sys.version_info < (3, 7):
install_requires.append('dataclasses>=0.6')

setup(
name='cobaya',
version=find_version(),
@@ -67,13 +75,7 @@ def extract_docs_requirements():
python_requires='>=3.6.1',
keywords='montecarlo sampling MCMC cosmology',
packages=find_packages(exclude=['docs', 'tests']),
install_requires=['numpy>=1.17.0', 'scipy>=1.5', 'pandas>=1.0.1',
'PyYAML>=5.1', 'requests>=2.18', 'py-bobyqa>=1.2',
'GetDist>=1.3.1', 'fuzzywuzzy>=0.17', 'packaging', 'tqdm',
'portalocker>=2.3.0', 'dill>=0.3.3',
# DEPRECATION NOTICE: remove 'dataclasses' when 3.6 support dropped
# (built-in in Python >= 3.7)
'dataclasses>=0.6'],
install_requires=install_requires,
extras_require={
'test': ['pytest', 'pytest-forked', 'flaky', 'mpi4py'],
'gui': ['pyqt5', 'pyside2', 'matplotlib'],

0 comments on commit d0b2237

Please sign in to comment.