From 33b243944da118a029a2d3cbdb0ab00c391afe5d Mon Sep 17 00:00:00 2001 From: Hsin Fan <57552401+hsinfan1996@users.noreply.github.com> Date: Tue, 20 Feb 2024 09:38:14 +0800 Subject: [PATCH] Rename simps and update README --- README.md | 2 +- clmm/redshift/tools.py | 4 ++-- clmm/theory/parent_class.py | 4 ++-- .../NumCosmo/Example2_Fit_Halo_Mass_to_Shear_Catalog_NC.ipynb | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a6b1ecc02..dd73cc3f4 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ link to this repository: https://github.com/LSSTDESC/CLMM. Please follow the gui 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) +- [SciPy](https://scipy.org/) (v1.6 or later) - [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) diff --git a/clmm/redshift/tools.py b/clmm/redshift/tools.py index 82ffd670e..904d0579a 100644 --- a/clmm/redshift/tools.py +++ b/clmm/redshift/tools.py @@ -1,7 +1,7 @@ """General utility functions that are used in multiple modules""" import warnings import numpy as np -from scipy.integrate import simps +from scipy.integrate import simpson from scipy.interpolate import interp1d @@ -55,7 +55,7 @@ def _integ_pzfuncs(pzpdf, pzbins, zmin=0.0, zmax=5, kernel=lambda z: 1.0, ngrid= pz_matrix = np.array(pzpdf)[:, mask] kernel_matrix = kernel(z_grid) - return simps(pz_matrix * kernel_matrix, x=z_grid, axis=1) + return simpson(pz_matrix * kernel_matrix, x=z_grid, axis=1) def compute_for_good_redshifts( diff --git a/clmm/theory/parent_class.py b/clmm/theory/parent_class.py index d27b8f7c6..bcefc55ed 100644 --- a/clmm/theory/parent_class.py +++ b/clmm/theory/parent_class.py @@ -7,7 +7,7 @@ import numpy as np # functions for the 2h term -from scipy.integrate import simps, quad +from scipy.integrate import simpson, quad from scipy.special import jv from scipy.interpolate import splrep, splev @@ -230,7 +230,7 @@ def __integrand__(l_value, theta): return l_value * jv(sph_harm_ord, l_value * theta) * splev(k_value, interp_pk) l_values = np.logspace(loglbounds[0], loglbounds[1], lsteps) - kernel = np.array([simps(__integrand__(l_values, t), l_values) for t in theta]) + kernel = np.array([simpson(__integrand__(l_values, t), l_values) for t in theta]) return halobias * kernel * rho_m / (2 * np.pi * (1 + z_cl) ** 3 * da**2) def _eval_surface_density_2h( diff --git a/examples/NumCosmo/Example2_Fit_Halo_Mass_to_Shear_Catalog_NC.ipynb b/examples/NumCosmo/Example2_Fit_Halo_Mass_to_Shear_Catalog_NC.ipynb index aab95262e..bf55146d8 100644 --- a/examples/NumCosmo/Example2_Fit_Halo_Mass_to_Shear_Catalog_NC.ipynb +++ b/examples/NumCosmo/Example2_Fit_Halo_Mass_to_Shear_Catalog_NC.ipynb @@ -1033,7 +1033,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -1047,7 +1047,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.5" + "version": "3.11.7" } }, "nbformat": 4,