Skip to content

Commit c7cdfeb

Browse files
committed
Ignore NaN data in computing radiated energy
1 parent 64e7ecd commit c7cdfeb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sourcespec/ssp_radiated_energy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ def _spectral_integral(spec, t_star, fmin=None, fmax=None):
4545
data[freq < fmin] = 0.
4646
if fmax is not None:
4747
data[freq > fmax] = 0.
48+
# Compute the integral and return it. Make sure to ignore
49+
# NaN values in the data array.
4850
# Returned value has units of (m^2)^2 * Hz = m^4/s
49-
return np.sum(data**2) * deltaf
51+
return np.sum(data[~np.isnan(data)]**2) * deltaf
5052

5153

5254
def _radiated_energy_coefficient(rho, vel, free_surf_ampl, rp, average_rp):

0 commit comments

Comments
 (0)