Skip to content

Commit

Permalink
possibility to call trapezoid for numpy >= 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiardie committed Jul 5, 2024
1 parent f03687d commit 52136eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mflike/theoryforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
from itertools import product

import numpy as np
if np.__version__ >= "2.0.0":
from numpy import trapezoid as trapz
else:
from numpy import trapz

from cobaya.log import LoggedError


Expand Down Expand Up @@ -214,7 +219,7 @@ def _bandpass_construction(self, **params):
tranb = _cmb2bb(nub)
# normalization integral to be evaluated at the shifted freqs
# in order to have cmb component calibrated to 1
tranb_norm = np.trapezoid(_cmb2bb(nub), nub)
tranb_norm = np.trapz(_cmb2bb(nub), nub)
self.bandint_freqs.append([nub, tranb / tranb_norm])
# in case we don't want to do band integration, e.g. when we have multifreq bandpass in sacc file
if self.bandint_nsteps == 1:
Expand All @@ -229,7 +234,7 @@ def _bandpass_construction(self, **params):
data_are_monofreq = True
self.bandint_freqs.append(nub[0])
else:
trans_norm = np.trapezoid(bp * _cmb2bb(nub), nub)
trans_norm = np.trapz(bp * _cmb2bb(nub), nub)
trans = bp / trans_norm * _cmb2bb(nub)
self.bandint_freqs.append([nub, trans])

Expand Down

0 comments on commit 52136eb

Please sign in to comment.