Skip to content

Commit

Permalink
Merge branch 'main' into issue/588/miscentering_therory
Browse files Browse the repository at this point in the history
  • Loading branch information
hsinfan1996 committed Feb 20, 2024
2 parents 75e1c8c + 13b7c8a commit 8eef560
Show file tree
Hide file tree
Showing 52 changed files with 1,002 additions and 983 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
- name: Install prereq using conda
run: |
Expand All @@ -33,10 +33,10 @@ jobs:
pip install .
- name: Install CCL from source
run: |
conda install -c conda-forge cmake swig
conda install -c conda-forge cmake swig --override-channels
git clone https://github.com/LSSTDESC/CCL
cd CCL
git checkout 1a351df
git checkout v3.0.0
pip install .
- name: Analysing the code with pylint
run: |
Expand Down
12 changes: 6 additions & 6 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
## Basic procedure <a name="basic_install"></a>

Here we provide a quick guide for a basic instalation, this will install all the packages in your current environment.
To create a specific conda environment for CLMM, we recommend you to check the begining of section
To create a specific conda environment for CLMM, we recommend you to check the begining of section
[Access to the proper environment on cori.nersc.gov](#access_to_the_proper_environment_on_cori).

### Theory backend installation
First, choose and install a theory backend for CLMM.
This can be CCL (versions between 2.6.0 and 2.7.1.dev9+g1a351df6),
NumCosmo (v0.15 or later),
This can be CCL (versions between 2.7.1.dev10+gf81b59a4 and 3),
NumCosmo (v0.19 or later),
or cluster_toolkit and they are installable as follows.

To install CCL as the theory/cosmology backend, run
Expand Down Expand Up @@ -60,7 +60,7 @@ Now, you can install CLMM and its dependencies as
pip install pytest sphinx sphinx_rtd_theme
pip install jupyter # need to have jupyter notebook tied to this environment, you can then see the environment in jupyter.nersc.gov
git clone https://github.com/LSSTDESC/CLMM.git # If you'd like to contribute but don't have edit permissions to the CLMM repo, see below how to fork the repo instead.
cd CLMM
cd CLMM
python setup.py install # build from source
```

Expand All @@ -72,9 +72,9 @@ If you have access to NERSC, this will likely be the easiest to make sure you ha
module load python # Also loads anaconda
conda create --name clmmenv # Create an anaconda environment for clmm
source activate clmmenv # switch to your newly created environment
conda install pip # need pip to install everything else necessary for clmm
conda install pip # need pip to install everything else necessary for clmm
conda install ipython # need to have the ipython tied to this environment
conda install -c conda-forge firefox # Need a browser to view jupyter notebooks
conda install -c conda-forge firefox # Need a browser to view jupyter notebooks
```

Note, for regular contributions and use, we recommend adding `module load python` to your `~/.bashrc` so you have anaconda installed every time you log in. You will subseqeuntly also want to be in the correct environment whenever working with `clmm`, which means running `source activate clmmenv` at the start of each session.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CLMM requires Python version 3.8 or later. CLMM has the following dependencies:

- [NumPy](https://www.numpy.org/) (v1.17 or later)
- [SciPy](https://scipy.org/) (v1.3 or later)
- [Astropy](https://www.astropy.org/) (v4.0 or later for units and cosmology dependence)
- [Astropy](https://www.astropy.org/) (v4.0 or later for units and cosmology dependence)
(Please avoid Astropy v5.0 since there is bug breaking CCL backend. It has been fixed in Astropy v5.0.1.)
- [Matplotlib](https://matplotlib.org/) (for plotting and going through tutorials)

Expand All @@ -35,8 +35,8 @@ CLMM requires Python version 3.8 or later. CLMM has the following dependencies:
For the theoretical predictions of the signal, CLMM relies on existing libraries and **at least one of the following must be installed as well**:

- [cluster-toolkit](https://cluster-toolkit.readthedocs.io/en/latest/)
- [CCL](https://ccl.readthedocs.io/en/latest/) (versions between 2.6.0 and 2.7.1.dev9+g1a351df6)
- [NumCosmo](https://numcosmo.github.io/) (v0.15 or later)
- [CCL](https://ccl.readthedocs.io/en/latest/) (versions between 2.7.1.dev10+gf81b59a4 and 3)
- [NumCosmo](https://numcosmo.github.io/) (v0.19 or later)


(See the [INSTALL documentation](INSTALL.md) for more detailed installation instructions.)
Expand Down Expand Up @@ -91,8 +91,8 @@ non-DESC project concept and progress to be presented to the working group,
so working group members can help co-identify tools and/or ongoing development
that might mutually benefit your non-DESC project and ongoing DESC projects.

**External Projects by Non-DESC members**: If you are not from the DESC
community, you are also welcome to contact CLMM Topical Team leads to introduce
**External Projects by Non-DESC members**: If you are not from the DESC
community, you are also welcome to contact CLMM Topical Team leads to introduce
your project and share feedback.


Expand Down Expand Up @@ -123,7 +123,7 @@ issue](https://github.com/LSSTDESC/CLMM/issues).

The current leads of the LSST DESC CLMM Topical Team are Michel Aguena
(m-aguena, [email protected]) and Marina Ricci (mricci,
marina.ricci@lmu.de)
marina.ricci@apc.in2p3.fr)


# Acknowledgements <a name="acknowledgements"></a>
Expand Down
2 changes: 1 addition & 1 deletion clmm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
)
from . import support

__version__ = "1.8.2"
__version__ = "1.11.0"
2 changes: 1 addition & 1 deletion clmm/cosmology/ccl.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def _eval_sigma_crit_core(self, z_len, z_src):
a_len = self.get_a_from_z(z_len)
a_src = self.get_a_from_z(z_src)

return self.be_cosmo.sigma_critical(a_len, a_src) * self.cor_factor
return self.be_cosmo.sigma_critical(a_lens=a_len, a_source=a_src) * self.cor_factor

def _eval_linear_matter_powerspectrum(self, k_vals, redshift):
return ccl.linear_matter_power(self.be_cosmo, k_vals, self.get_a_from_z(redshift))
8 changes: 7 additions & 1 deletion clmm/cosmology/numcosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class NumCosmoCosmology(CLMMCosmology):

def __init__(self, dist=None, dist_zmax=15.0, **kwargs):
self.dist = None
self.smd = None

super().__init__(**kwargs)

Expand All @@ -54,6 +55,7 @@ def __init__(self, dist=None, dist_zmax=15.0, **kwargs):
self.smd = Nc.WLSurfaceMassDensity.new(self.dist)
self.smd.prepare_if_needed(self.be_cosmo)


def _init_from_cosmo(self, be_cosmo):
assert isinstance(be_cosmo, Nc.HICosmo)
assert isinstance(be_cosmo, Nc.HICosmoDECpl)
Expand All @@ -63,7 +65,7 @@ def _init_from_cosmo(self, be_cosmo):

def _init_from_params(self, H0, Omega_b0, Omega_dm0, Omega_k0):
# pylint: disable=arguments-differ
self.be_cosmo = Nc.HICosmo.new_from_name(Nc.HICosmo, "NcHICosmoDECpl{'massnu-length':<1>}")
self.be_cosmo = Nc.HICosmoDECpl(massnu_length=1)
self.be_cosmo.omega_x2omega_k()
self.be_cosmo.param_set_by_name("w0", -1.0)
self.be_cosmo.param_set_by_name("w1", 0.0)
Expand Down Expand Up @@ -136,6 +138,10 @@ def _update_vec_funcs(self):
self._eval_sigma_crit_core = np.vectorize(
lambda z_len, z_src: (self.smd.sigma_critical(self.be_cosmo, z_src, z_len, z_len))
)
if self.dist is not None:
self.dist.prepare_if_needed(self.be_cosmo)
if self.smd is not None:
self.smd.prepare_if_needed(self.be_cosmo)

def _get_rho_c(self, z):
return (
Expand Down
Loading

0 comments on commit 8eef560

Please sign in to comment.