diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b345ddba..20384420 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -62,22 +62,21 @@ jobs: use-mamba: true activate-environment: tjpcov miniforge-version: latest - miniforge-variant: Mambaforge - - name: Cache Date - id: get-date - run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT - - - name: Check for cached environment - uses: actions/cache@v3 - id: cache - env: - # Increase this value to reset cache if etc/example-environment.yml has not changed - CACHE_NUMBER: 0 - with: - path: ${{env.CONDA}}/envs - key: - ${{runner.os}}.${{runner.arch}}.mamba-py.${{matrix.python-version}}.${{hashFiles('pyproject.toml')}}.${{hashFiles('environment.yml')}}.${{steps.get-date.outputs.today}}.${{env.CACHE_NUMBER}} + # - name: Cache Date + # id: get-date + # run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT + # + # - name: Check for cached environment + # uses: actions/cache@v3 + # id: cache + # env: + # # Increase this value to reset cache if etc/example-environment.yml has not changed + # CACHE_NUMBER: 0 + # with: + # path: ${{env.CONDA}}/envs + # key: + # ${{runner.os}}.${{runner.arch}}.mamba-py.${{matrix.python-version}}.${{hashFiles('pyproject.toml')}}.${{hashFiles('environment.yml')}}.${{steps.get-date.outputs.today}}.${{env.CACHE_NUMBER}} - name: Install environment packages if: steps.cache.outputs.cache-hit != 'true' @@ -97,7 +96,7 @@ jobs: pip install -U mpi4py --no-cache-dir --no-deps - name: Run Tests - run: coverage run --source=tjpcov -m pytest -vv tests/ + run: coverage run --source=tjpcov -m pytest -vv tests && coverage lcov - name: Run MPI Tests (OpenMPI) run: | @@ -122,6 +121,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} flag-name: run-${{ join(matrix.*, '-') }} parallel: true + path-to-lcov: coverage.lcov finish: needs: tests diff --git a/environment.yml b/environment.yml index 1e51b2d0..b909c26e 100644 --- a/environment.yml +++ b/environment.yml @@ -11,11 +11,12 @@ dependencies: - pytest-rerunfailures - coveralls - numpy - - scipy + # - scipy + - scipy<1.12 # <1.12 to avoid bug in CCL<3.1 (not in pypy) with simpson integration - pyyaml - pyccl>=3.0.0 - sacc>=0.12 - - namaster + - namaster>2 - camb - Jinja2 - healpy diff --git a/pyproject.toml b/pyproject.toml index cd3aa1ca..78f81c3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ "Topic :: Scientific/Engineering :: Physics" ] dependencies = [ - "scipy", + "scipy<1.12", # <1.12 to avoid bug in CCL<3.1 (not in pypy) with simpson integration "numpy", "Jinja2", "pyyaml", @@ -47,13 +47,13 @@ doc = [ "sphinx-book-theme", ] nmt = [ - "pymaster>=1.4.0" + "pymaster>=2" ] mpi = [ "mpi4py" ] full = [ - "pymaster>=1.4.0", + "pymaster>=2", "mpi4py", "sphinx", "sphinx-autoapi", diff --git a/tests/data/conf_covariance_calculator.yml b/tests/data/conf_covariance_calculator.yml index fc7e87ac..d5ab3f5b 100644 --- a/tests/data/conf_covariance_calculator.yml +++ b/tests/data/conf_covariance_calculator.yml @@ -41,19 +41,17 @@ NaMaster: module: pymaster f: n_iter: 0 - lmax_sht: -1 + lmax: null + lmax_mask: null w: - lmax_mask: -1 l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True cw: l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True cache: diff --git a/tests/data/conf_covariance_calculator_mpi.yml b/tests/data/conf_covariance_calculator_mpi.yml index 23438dec..b6d38485 100644 --- a/tests/data/conf_covariance_calculator_mpi.yml +++ b/tests/data/conf_covariance_calculator_mpi.yml @@ -42,19 +42,17 @@ NaMaster: module: pymaster f: n_iter: 0 - lmax_sht: -1 + lmax: null + lmax_mask: null w: - lmax_mask: -1 l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True cw: l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True cache: diff --git a/tests/data/conf_covariance_gaussian_fourier_nmt.yaml b/tests/data/conf_covariance_gaussian_fourier_nmt.yaml index d370cc76..35118288 100644 --- a/tests/data/conf_covariance_gaussian_fourier_nmt.yaml +++ b/tests/data/conf_covariance_gaussian_fourier_nmt.yaml @@ -40,19 +40,17 @@ NaMaster: module: pymaster f: n_iter: 0 - lmax_sht: -1 + lmax: null + lmax_mask: null w: - lmax_mask: -1 l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True cw: l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True parameters: diff --git a/tests/data/conf_covariance_gaussian_fourier_nmt_txpipe.yaml b/tests/data/conf_covariance_gaussian_fourier_nmt_txpipe.yaml index 2e85a600..752af664 100644 --- a/tests/data/conf_covariance_gaussian_fourier_nmt_txpipe.yaml +++ b/tests/data/conf_covariance_gaussian_fourier_nmt_txpipe.yaml @@ -26,19 +26,17 @@ NaMaster: module: pymaster f: n_iter: 0 - lmax_sht: -1 + lmax: null + lmax_mask: null w: - lmax_mask: -1 l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True cw: l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True parameters: diff --git a/tests/data/conf_covariance_gaussian_fourier_nmt_txpipe_mpi.yaml b/tests/data/conf_covariance_gaussian_fourier_nmt_txpipe_mpi.yaml index fbef6b7f..c560f504 100644 --- a/tests/data/conf_covariance_gaussian_fourier_nmt_txpipe_mpi.yaml +++ b/tests/data/conf_covariance_gaussian_fourier_nmt_txpipe_mpi.yaml @@ -26,19 +26,17 @@ NaMaster: module: pymaster f: n_iter: 0 - lmax_sht: -1 + lmax: null + lmax_mask: null w: - lmax_mask: -1 l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True cw: l_toeplitz: -1 l_exact: -1 dl_band: -1 - n_iter: 3 recompute: True parameters: diff --git a/tests/test_covariance_fourier_gaussian_nmt.py b/tests/test_covariance_fourier_gaussian_nmt.py index 9bb593cb..8e3016d9 100644 --- a/tests/test_covariance_fourier_gaussian_nmt.py +++ b/tests/test_covariance_fourier_gaussian_nmt.py @@ -389,16 +389,18 @@ def test_get_cl_for_cov(cov_fg_nmt): with pytest.raises(ValueError): cov_fg_nmt.get_cl_for_cov( - cl_fid_Sh, cl["nl_cp"], m, m, w, nl_is_cp=True + cl_fid_Sh["cl"], cl["nl_cp"], m, m, w, nl_is_cp=True ) with pytest.raises(ValueError): # Uncoupled binned noise - cov_fg_nmt.get_cl_for_cov(cl_fid, cl["nl"], m, m, w, nl_is_cp=True) + cov_fg_nmt.get_cl_for_cov( + cl_fid["cl"], cl["nl"], m, m, w, nl_is_cp=True + ) with pytest.raises(ValueError): cov_fg_nmt.get_cl_for_cov( - cl_fid, cl["nl_cp"], m, m, wSh, nl_is_cp=True + cl_fid["cl"], cl["nl_cp"], m, m, wSh, nl_is_cp=True ) @@ -662,7 +664,7 @@ def test_get_covariance_block_cache(cov_fg_nmt, tracer_comb1, tracer_comb2): @pytest.mark.parametrize( "kwargs", - [{}, {"l_toeplitz": 10, "l_exact": 10, "dl_band": 10, "n_iter": 0}], + [{}, {"l_toeplitz": 10, "l_exact": 10, "dl_band": 10}], ) def test_get_covariance_workspace(cov_fg_nmt, kwargs): m1 = get_mask_from_dtype("galaxy_clustering") @@ -715,7 +717,7 @@ def test_get_covariance_workspace(cov_fg_nmt, kwargs): # Check only the first is written/computed created & that cw is correct for fields, masks_names in zip(combinations, combinations_names): - spins = [fi.fl.spin for fi in fields] + spins = [fi.spin for fi in fields] cw_code = cov_fg_nmt.get_covariance_workspace( *fields, *masks_names, **kwargs ) @@ -967,7 +969,7 @@ def get_data_types(self): @pytest.mark.parametrize( "kwargs", - [{}, {"l_toeplitz": 10, "l_exact": 10, "dl_band": 10, "n_iter": 0}], + [{}, {"l_toeplitz": 10, "l_exact": 10, "dl_band": 10}], ) def test_get_workspace(cov_fg_nmt, kwargs): # Compute NmtBins @@ -1030,7 +1032,7 @@ def test_get_workspace(cov_fg_nmt, kwargs): @pytest.mark.parametrize( "kwargs", - [{}, {"l_toeplitz": 10, "l_exact": 10, "dl_band": 10, "n_iter": 0}], + [{}, {"l_toeplitz": 10, "l_exact": 10, "dl_band": 10}], ) def test_get_workspace_dict(cov_fg_nmt, kwargs): tracers = get_tracers_dict_for_cov() diff --git a/tjpcov/covariance_fourier_gaussian_nmt.py b/tjpcov/covariance_fourier_gaussian_nmt.py index 57a589f4..945048fb 100644 --- a/tjpcov/covariance_fourier_gaussian_nmt.py +++ b/tjpcov/covariance_fourier_gaussian_nmt.py @@ -319,7 +319,6 @@ def get_covariance_block( mn[2], mn[3], mn[4], - lmax=int(ell[-1]), **self.nmt_conf["cw"], ) @@ -385,10 +384,10 @@ def get_covariance_workspace( """ outdir = self.io.outdir spins = { - m1: f1.fl.spin, - m2: f2.fl.spin, - m3: f3.fl.spin, - m4: f4.fl.spin, + m1: f1.spin, + m2: f2.spin, + m3: f3.spin, + m4: f4.spin, } # Any other symmetry? @@ -673,7 +672,7 @@ def get_workspace(self, f1, f2, m1, m2, bins, **kwargs): ) outdir = self.io.outdir - s1, s2 = f1.fl.spin, f2.fl.spin + s1, s2 = f1.spin, f2.spin # Currently, outdir will be always not None. If not specified, it # will be the current directory. I leave this for now since we might @@ -763,7 +762,7 @@ def get_workspaces_dict( if key in cache: w[i] = cache[key] else: - s1, s2 = fields[i1].fl.spin, fields[i2].fl.spin + s1, s2 = fields[i1].spin, fields[i2].spin # In this case you have to check for m1 x m2 and m2 x m1 k = (mask_names[i1], mask_names[i2]) sk = "".join(sorted(f"{s1}{s2}")) diff --git a/tjpcov/covariance_gaussian_fsky.py b/tjpcov/covariance_gaussian_fsky.py index 972252e7..80fcc363 100644 --- a/tjpcov/covariance_gaussian_fsky.py +++ b/tjpcov/covariance_gaussian_fsky.py @@ -43,7 +43,7 @@ def get_binning_info(self, binning="linear"): # TODO: This should be obtained from the sacc file or the input # configuration. Check how it is done in TXPipe: # https://github.com/LSSTDESC/TXPipe/blob/a9dfdb7809ac7ed6c162fd3930c643a67a - out = self.get_binning_info() + out = super().get_binning_info() if out is not None: ell = out[0] ell_eff = out[1]