Skip to content

Commit

Permalink
Fix deprecated use of scipy.integrate.simps (to simpson).
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Jun 17, 2024
1 parent d3a8b43 commit 8665fae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion redmapper/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def gen_maskgals(self, maskgalfile):
normmag = mstar - 2.5 * np.log10(self.config.lval_reference)
steps = np.arange(10.0, normmag, 0.01)
f = schechter_pdf(steps, alpha=self.config.calib_lumfunc_alpha, mstar=mstar)
n = scipy.integrate.simps(f, steps)
n = scipy.integrate.simpson(f, steps)
maskgals.lum_pdf = schechter_pdf(maskgals.m + mstar, mstar=mstar, alpha=self.config.calib_lumfunc_alpha)
maskgals.lumwt = maskgals.lum_pdf / n

Expand Down
4 changes: 2 additions & 2 deletions redmapper/zlambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def _zlambda_calc_pz(self, z_lambda, wtvals, maxrad, maxmag, slow=False):
pz = np.exp(ln_lkhd) * self.zredstr.volume_factor[self.zredstr.zindex(pzbins)]

# now normalize
n = scipy.integrate.simps(pz, pzbins)
n = scipy.integrate.simpson(pz, pzbins)
pz = pz / n

self.pzbins = pzbins
Expand Down Expand Up @@ -723,7 +723,7 @@ def apply_correction(self, lam, zlam, zlam_e, pzbins=None, pzvals=None, noerr=Fa

pzbins = pdz * np.arange(npzbins) + zlam - pdz * (npzbins - 1)/2. + offset

n = scipy.integrate.simps(pzvals, pzbins)
n = scipy.integrate.simpson(pzvals, pzbins)
pzvals /= n

zlam_e = np.sqrt(zlam_e**2. + extra_err**2.)
Expand Down
2 changes: 1 addition & 1 deletion redmapper/zred_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def compute_zred(self, galaxy, no_corrections=False):
zred_samp = np.zeros(galaxy.zred_samp.size) + zred
else:
pz = dist.copy()
n = scipy.integrate.simps(pz[gdzbins], self.zredstr.z[gdzbins])
n = scipy.integrate.simpson(pz[gdzbins], self.zredstr.z[gdzbins])
pz /= n

pdf = scipy.interpolate.interp1d(self.zredstr.z[gdzbins], pz[gdzbins], kind='quadratic',
Expand Down

0 comments on commit 8665fae

Please sign in to comment.