diff --git a/openpmd_viewer/addons/pic/lpa_diagnostics.py b/openpmd_viewer/addons/pic/lpa_diagnostics.py index d035d08..7f5d4d7 100644 --- a/openpmd_viewer/addons/pic/lpa_diagnostics.py +++ b/openpmd_viewer/addons/pic/lpa_diagnostics.py @@ -1041,7 +1041,12 @@ def get_spectrogram( self, t=None, iteration=None, pol=None, T = tmax - tmin dt = T / Nz # Normalize the Envelope - env /= np.sqrt(np.trapezoid(env ** 2, dx=dt)) + # Note that np.trapz has been deprecated and is replaced by np.trapezoid in numpy2 + try: + trapezoid = np.trapezoid + except AttributeError: + trapezoid = np.trapz + env /= np.sqrt(trapezoid(env ** 2, dx=dt)) # Allocate array for the gating function and the spectrogran E_shift = np.zeros_like(E) spectrogram = np.zeros((2 * Nz, Nz))