Skip to content

Commit 1424d55

Browse files
committed
Fix deprecated scipy.integrate.trapz (to trapezoid).
1 parent 8665fae commit 1424d55

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

redmapper/zred_color.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ def compute_zred(self, galaxy, no_corrections=False):
140140
calcinds, = np.where(dist > 1e-5)
141141

142142
if calcinds.size >= 3:
143-
tdist = scipy.integrate.trapz(dist[calcinds], self.zredstr.z[calcinds])
144-
zred_temp = scipy.integrate.trapz(dist[calcinds] * self.zredstr.z[calcinds],
143+
tdist = scipy.integrate.trapezoid(dist[calcinds], self.zredstr.z[calcinds])
144+
zred_temp = scipy.integrate.trapezoid(dist[calcinds] * self.zredstr.z[calcinds],
145145
self.zredstr.z[calcinds]) / tdist
146-
zred_e = scipy.integrate.trapz(dist[calcinds] * self.zredstr.z[calcinds]**2.,
146+
zred_e = scipy.integrate.trapezoid(dist[calcinds] * self.zredstr.z[calcinds]**2.,
147147
self.zredstr.z[calcinds]) / tdist - zred_temp**2.
148148
else:
149149
tdist = np.sum(dist[calcinds])
@@ -203,7 +203,7 @@ def compute_zred(self, galaxy, no_corrections=False):
203203
if calcinds.size >= 3:
204204
# Note there maybe should be a distcorr here, but this is not
205205
# actually computed in the IDL code (bug?)
206-
lkhd = scipy.integrate.trapz(newdist[calcinds] * (lndist[calcinds]), self.zredstr.z[calcinds]) / scipy.integrate.trapz(newdist[calcinds], self.zredstr.z[calcinds])
206+
lkhd = scipy.integrate.trapezoid(newdist[calcinds] * (lndist[calcinds]), self.zredstr.z[calcinds]) / scipy.integrate.trapezoid(newdist[calcinds], self.zredstr.z[calcinds])
207207
else:
208208
lkhd = np.sum(newdist[calcinds] * lndist[calcinds]) / np.sum(newdist[calcinds])
209209

0 commit comments

Comments
 (0)