Skip to content

Commit

Permalink
Fix deprecated scipy.integrate.trapz (to trapezoid).
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Jun 17, 2024
1 parent 8665fae commit 1424d55
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions redmapper/zred_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ def compute_zred(self, galaxy, no_corrections=False):
calcinds, = np.where(dist > 1e-5)

if calcinds.size >= 3:
tdist = scipy.integrate.trapz(dist[calcinds], self.zredstr.z[calcinds])
zred_temp = scipy.integrate.trapz(dist[calcinds] * self.zredstr.z[calcinds],
tdist = scipy.integrate.trapezoid(dist[calcinds], self.zredstr.z[calcinds])
zred_temp = scipy.integrate.trapezoid(dist[calcinds] * self.zredstr.z[calcinds],
self.zredstr.z[calcinds]) / tdist
zred_e = scipy.integrate.trapz(dist[calcinds] * self.zredstr.z[calcinds]**2.,
zred_e = scipy.integrate.trapezoid(dist[calcinds] * self.zredstr.z[calcinds]**2.,
self.zredstr.z[calcinds]) / tdist - zred_temp**2.
else:
tdist = np.sum(dist[calcinds])
Expand Down Expand Up @@ -203,7 +203,7 @@ def compute_zred(self, galaxy, no_corrections=False):
if calcinds.size >= 3:
# Note there maybe should be a distcorr here, but this is not
# actually computed in the IDL code (bug?)
lkhd = scipy.integrate.trapz(newdist[calcinds] * (lndist[calcinds]), self.zredstr.z[calcinds]) / scipy.integrate.trapz(newdist[calcinds], self.zredstr.z[calcinds])
lkhd = scipy.integrate.trapezoid(newdist[calcinds] * (lndist[calcinds]), self.zredstr.z[calcinds]) / scipy.integrate.trapezoid(newdist[calcinds], self.zredstr.z[calcinds])
else:
lkhd = np.sum(newdist[calcinds] * lndist[calcinds]) / np.sum(newdist[calcinds])

Expand Down

0 comments on commit 1424d55

Please sign in to comment.