From 714b92d9343e19ff0ac9b7555a8c113847e6bbb4 Mon Sep 17 00:00:00 2001 From: Hsin Fan <57552401+hsinfan1996@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:02:59 +0800 Subject: [PATCH] Prepare for new CCL release (#620) * Install CCL from main branch * setup-miniconda@v3 * only require CCL v3.0 * add pylint ignores * Move Sphinx prereqs up * Install setuptools_scm * document PR on comment in build_check * Update version to 1.12.1 --------- Co-authored-by: m-aguena --- .github/workflows/build_check.yml | 16 ++++++++-------- clmm/__init__.py | 2 +- clmm/theory/ccl.py | 5 ++--- clmm/theory/parent_class.py | 17 ++++++++++++++++- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_check.yml b/.github/workflows/build_check.yml index 0949a3d07..95963d8aa 100644 --- a/.github/workflows/build_check.yml +++ b/.github/workflows/build_check.yml @@ -12,11 +12,11 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v3 - name: Install prereq using conda run: | echo "$CONDA/bin" >> $GITHUB_PATH - conda install -c conda-forge gobject-introspection pygobject + conda install -c conda-forge gobject-introspection pygobject sphinx sphinx_rtd_theme nbconvert pandoc ipython - name: Install prereq using pip run: | pip install -r requirements.txt @@ -33,11 +33,10 @@ jobs: pip install . - name: Install CCL from source run: | - conda install -c conda-forge cmake swig --override-channels + conda install -c conda-forge cmake swig setuptools_scm git clone https://github.com/LSSTDESC/CCL cd CCL - git checkout v3.0.0 - pip install . + pip install --no-use-pep517 . - name: Analysing the code with pylint run: | pip install pylint @@ -48,9 +47,10 @@ jobs: pytest tests/ --ignore=cluster_toolkit/tests --cov=clmm/ env: DISPLAY: test - - name: Install Sphinx prereq - run: | - conda install -c conda-forge sphinx sphinx_rtd_theme nbconvert pandoc ipython ipython_genutils +# temporarily moved up due to libarchive issue - see PR 620 +# - name: Install Sphinx prereq +# run: | +# conda install -c conda-forge sphinx sphinx_rtd_theme nbconvert pandoc ipython ipython_genutils - name: Run the docs run: | make -C docs/ html diff --git a/clmm/__init__.py b/clmm/__init__.py index 3499c132b..50f8fa49f 100644 --- a/clmm/__init__.py +++ b/clmm/__init__.py @@ -26,4 +26,4 @@ ) from . import support -__version__ = "1.12.0" +__version__ = "1.12.1" diff --git a/clmm/theory/ccl.py b/clmm/theory/ccl.py index e95271031..7fcff5511 100644 --- a/clmm/theory/ccl.py +++ b/clmm/theory/ccl.py @@ -13,9 +13,8 @@ # Check which versions of ccl are currently supported from . import _ccl_supported_versions -if parse(ccl.__version__) < parse(_ccl_supported_versions.VMIN) or parse(ccl.__version__) > parse( - _ccl_supported_versions.VMAX -): +if (parse(ccl.__version__) < parse(_ccl_supported_versions.VMIN) + or parse(ccl.__version__).major > parse(_ccl_supported_versions.VMAX).major): raise EnvironmentError( f"Current CCL version ({ccl.__version__}) not supported by CLMM. " f"It must be between {_ccl_supported_versions.VMIN} and {_ccl_supported_versions.VMAX}." diff --git a/clmm/theory/parent_class.py b/clmm/theory/parent_class.py index b9d4fabfa..dea95d7f1 100644 --- a/clmm/theory/parent_class.py +++ b/clmm/theory/parent_class.py @@ -759,7 +759,10 @@ def eval_tangential_shear(self, r_proj, z_cl, z_src, z_src_info="discrete", verb if self.halo_profile_model == "einasto" and verbose: print(f"Einasto alpha = {self._get_einasto_alpha(z_cl=z_cl)}") - gammat = None + + # function _validate_z_src already safekeeps from this error: + # pylint: disable=possibly-used-before-assignment + if z_src_info == "discrete": warning_msg = ( "\nSome source redshifts are lower than the cluster redshift." @@ -844,6 +847,9 @@ def eval_convergence(self, r_proj, z_cl, z_src, z_src_info="discrete", verbose=F if self.halo_profile_model == "einasto" and verbose: print(f"Einasto alpha = {self._get_einasto_alpha(z_cl=z_cl)}") + # function _validate_z_src already safekeeps from this error: + # pylint: disable=possibly-used-before-assignment + if z_src_info == "discrete": warning_msg = ( "\nSome source redshifts are lower than the cluster redshift." @@ -1053,6 +1059,9 @@ def eval_reduced_tangential_shear( if self.halo_profile_model == "einasto" and verbose: print(f"Einasto alpha = {self._get_einasto_alpha(z_cl=z_cl)}") + # functions _validate_z_src, _validate_approx_z_src_info already safekeeps from this error: + # pylint: disable=possibly-used-before-assignment + if approx is None: if z_src_info == "distribution": gt = self._pdz_weighted_avg( @@ -1211,6 +1220,9 @@ def eval_magnification( if self.halo_profile_model == "einasto" and verbose: print(f"Einasto alpha = {self._get_einasto_alpha(z_cl=z_cl)}") + # functions _validate_z_src, _validate_approx_z_src_info already safekeeps from this error: + # pylint: disable=possibly-used-before-assignment + if approx is None: if z_src_info == "distribution": mu = self._pdz_weighted_avg( @@ -1375,6 +1387,9 @@ def eval_magnification_bias( if self.halo_profile_model == "einasto" and verbose: print(f"Einasto alpha = {self._get_einasto_alpha(z_cl=z_cl)}") + # functions _validate_z_src, _validate_approx_z_src_info already safekeeps from this error: + # pylint: disable=possibly-used-before-assignment + if approx is None: # z_src (float or array) is redshift if z_src_info == "distribution":