Skip to content

Commit

Permalink
Updating TJPCov to require python >= 3.8 (#90)
Browse files Browse the repository at this point in the history
* Updating module to require python 3.8 or above.

* Using pytest.approx with a relative error to fix build errors.

* Sacc tracers map and misc are now case sensitive and require first letter capitalized.  Updating tests.

* Also requiring newest version of sacc
  • Loading branch information
mattkwiecien authored May 5, 2023
1 parent 5ffd6d5 commit 26e779b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
access_token: ${{ github.token }}

- uses: actions/checkout@v2
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8'

# TODO: Fix cache
# Commented out because cache makes the actions to fail
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.7"
python: "3.8"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- python>=3.8
- mpi4py
- pip
- numpy
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ authors = [
]
description = "Covariances for LSST DESC"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
Expand All @@ -30,7 +30,7 @@ dependencies = [
"pytest",
"pytest-rerunfailures",
"pyccl>=2.5.0",
"sacc>=0.7",
"sacc>=0.8",
"camb",
"healpy",
"h5py"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_covariance_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def mock_sacc():
# hacks the class to work without building
# an entire sacc file for this test.
s.add_tracer(
"misc",
"Misc",
"clusters_0_0",
metadata={
"Mproxy_name": "richness",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_covariance_fourier_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def mock_sacc():


def setup_module():
os.makedirs(OUTDIR)
os.makedirs(OUTDIR, exist_ok=True)


def teardown_module():
Expand All @@ -41,15 +41,15 @@ def mock_cov_fourier():
def get_dummy_sacc():
s = sacc.Sacc()
s.add_tracer(
"map", "PLAcv", quantity="cmb_convergence", spin=0, ell=None, beam=None
"Map", "PLAcv", quantity="cmb_convergence", spin=0, ell=None, beam=None
)
s.add_tracer(
"NZ", "DESgc__0", quantity="galaxy_density", spin=0, nz=None, z=None
)
s.add_tracer(
"NZ", "DESwl__0", quantity="galaxy_shear", spin=2, nz=None, z=None
)
s.add_tracer("misc", "ForError", quantity="generic")
s.add_tracer("Misc", "ForError", quantity="generic")

return s

Expand Down
4 changes: 2 additions & 2 deletions tests/test_covariance_fourier_gaussian_nmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ def get_data_cl(tr1, tr2, remove_be=False):
def get_dummy_sacc():
s = sacc.Sacc()
s.add_tracer(
"map", "PLAcv", quantity="cmb_convergence", spin=0, ell=None, beam=None
"Map", "PLAcv", quantity="cmb_convergence", spin=0, ell=None, beam=None
)
s.add_tracer(
"NZ", "DESgc__0", quantity="galaxy_density", spin=0, nz=None, z=None
)
s.add_tracer(
"NZ", "DESwl__0", quantity="galaxy_shear", spin=2, nz=None, z=None
)
s.add_tracer("misc", "ForError", quantity="generic")
s.add_tracer("Misc", "ForError", quantity="generic")

return s

Expand Down
7 changes: 4 additions & 3 deletions tests/test_wigner_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,17 @@ def test_wigner_d_parallel(s1, s2):
ell = kwargs["ell"]
wd = wigner_transform.wigner_d(s1, s2, theta, ell)
wd2 = wigner_transform.wigner_d_parallel(s1, s2, theta, ell)
assert np.all(wd == wd2)
assert wd.flatten() == pytest.approx(wd2.flatten(), rel=1e-10)

wd2 = wigner_transform.wigner_d_parallel(s1, s2, theta, ell, ncpu=4)
assert np.all(wd == wd2)
assert wd.flatten() == pytest.approx(wd2.flatten(), rel=1e-10)

wd = wigner_transform.wigner_d(s1, s2, theta, ell, l_use_bessel=None)
wd2 = wigner_transform.wigner_d_parallel(
s1, s2, theta, ell, l_use_bessel=None
)
assert np.all(wd == wd2)

assert wd.flatten() == pytest.approx(wd2.flatten(), rel=1e-10)


def test_bin_cov():
Expand Down

0 comments on commit 26e779b

Please sign in to comment.