Skip to content

Commit

Permalink
Use quad instead of quad_vec
Browse files Browse the repository at this point in the history
  • Loading branch information
hsinfan1996 committed Jul 18, 2024
1 parent 2b5dfb5 commit a2cccca
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions clmm/theory/parent_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,14 @@ def _set_cosmo(self, cosmo):
r"""Sets the cosmology to the internal cosmology object"""
self.cosmo = cosmo if cosmo is not None else self.cosmo_class()

def _eval_surface_density_miscentered_float(self, r_proj, z_cl, r_mis, backend):
def _eval_surface_density_miscentered_float(self, r_proj_float, z_cl, r_mis, backend):
# pylint: disable=invalid-name, possibly-used-before-assignment

if backend:
integrand = self._integrand_surface_density_mis
res = (
quad_vec(integrand, 0.0, np.pi, args=(r_proj, r_mis, z_cl), epsrel=1e-6)[0] / np.pi
quad(integrand, 0.0, np.pi,
args=(r_proj_float, r_mis, z_cl), epsrel=1e-6)[0] / np.pi
)

else:
Expand All @@ -226,7 +227,7 @@ def _eval_surface_density_miscentered_float(self, r_proj, z_cl, r_mis, backend):
integrand = self._integrand_surface_density_mis_nfw

res = (
quad_vec(integrand, 0.0, np.pi, args=(r_proj, r_mis, r_s), epsrel=1e-6)[0]
quad(integrand, 0.0, np.pi, args=(r_proj_float, r_mis, r_s), epsrel=1e-6)[0]
* 2
* r_s
* rho_s
Expand All @@ -253,8 +254,8 @@ def _eval_surface_density_miscentered_float(self, r_proj, z_cl, r_mis, backend):
integrand = self._integrand_surface_density_mis_einasto

res = (
quad_vec(
integrand, 0.0, np.pi, args=(r_proj, r_mis, r_s, alpha_ein), epsrel=1e-6
quad(integrand, 0.0, np.pi,
args=(r_proj_float, r_mis, r_s, alpha_ein), epsrel=1e-6
)[0]
* 2
* rho_s
Expand All @@ -267,7 +268,8 @@ def _eval_surface_density_miscentered_float(self, r_proj, z_cl, r_mis, backend):
integrand = self._integrand_surface_density_mis_hernquist

res = (
quad_vec(integrand, 0.0, np.pi, args=(r_proj, r_mis, r_s), epsrel=1e-6)[0]
quad(integrand, 0.0, np.pi,
args=(r_proj_float, r_mis, r_s), epsrel=1e-6)[0]
* r_s
* rho_s
/ np.pi
Expand Down

0 comments on commit a2cccca

Please sign in to comment.