diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index dc3c6bb..525440f 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -25,7 +25,6 @@ jobs: run: | python -m pip install --upgrade pip pip install pytest - pip install -r requirements.txt pip install -e . - name: Cache testing Dataset diff --git a/test_wmap.py b/old_test_wmap.py similarity index 100% rename from test_wmap.py rename to old_test_wmap.py diff --git a/setup.py b/setup.py index c3ab3e4..efa18df 100755 --- a/setup.py +++ b/setup.py @@ -2,17 +2,17 @@ setup( name = "WMAPLike", - version = "0.1.0", + version = "0.1.1", description = "WMAP DR5 likelihood for cobaya", author = "Hidde Jense", author_email = "JenseH@cardiff.ac.uk", zip_safe = True, packages = find_packages(), - python_requires = ">=3.7", + python_requires = ">=3.8", install_requires = [ - "cobaya>=3.1.0", + "cobaya>=3.3.0", "astropy" ], - package_data = { "wmaplike" : [ "WMAPLike.yaml" ] } + package_data = { "wmaplike" : [ "*.yaml", "tests/*" ] }, ) diff --git a/wmaplike/__init__.py b/wmaplike/__init__.py index 1346fa2..255f9cf 100755 --- a/wmaplike/__init__.py +++ b/wmaplike/__init__.py @@ -1 +1 @@ -from .wmap import WMAPLike +from .wmap import WMAPLike, WMAPBestFitv5 diff --git a/wmaplike/tests/test_wmap.py b/wmaplike/tests/test_wmap.py new file mode 100644 index 0000000..713e6ae --- /dev/null +++ b/wmaplike/tests/test_wmap.py @@ -0,0 +1,66 @@ +import pytest # noqa F401 +import numpy as np +from cobaya.model import get_model + +info = { + "params": { + "cl_amp": 1.0 + }, + "theory": { + "wmaplike.WMAPBestFitv5": None + }, + "likelihood": { + "wmaplike.WMAPLike": { + "use_lowl_TT": True, + "use_highl_TT": True, + "use_highl_TE": True, + "use_highl_TB": False, + "use_lowl_pol": False, + "use_lowl_TBEB": False, + "use_highl_TT_beam_ptsrc": False, + "use_sz": False, + "debug": True + } + }, + "sampler": {"evaluate": None}, + "debug": True +} + +chisqr_expected = { + "lowl_TT_gibbs" : -13.614869, + "MASTER_TTTT" : 1200.005224, + "MASTER_TETE_chi2": 831.787122, + "MASTER_TETE_det": 3605.526233, + "MASTER_TBTB_chi2": 775.110063, + "MASTER_TBTB_det": 3610.385517, + "TEEEBB_chi2" : 1320.994614, + "TEEEBB_det" : 692.874562, + "beamptsrc_TT" : 0.735565 +} + +def test_import(): + import wmaplike # noqa F401 + + +def test_model(): + model = get_model(info) # noqa F841 + + +def test_highl(): + info["likelihood"] = { + "wmaplike.WMAPLike": { + "use_lowl_TT": True, + "use_highl_TT": True, + "use_highl_TE": True, + "use_highl_TB": False, + "use_lowl_pol": False, + "use_lowl_TBEB": False, + "use_highl_TT_beam_ptsrc": False, + "use_sz": False, + "debug": True + } + } + + model = get_model(info) + model.loglikes() +