We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fc2c2d commit 08ea743Copy full SHA for 08ea743
tidy3d/components/time.py
@@ -79,7 +79,7 @@ def spectrum(
79
time_amps = np.real(time_amps)
80
81
# if all time amplitudes are zero, just return (complex-valued) zeros for spectrum
82
- if np.allclose(time_amps, 0.0):
+ if np.all(np.equal(time_amps, 0.0)):
83
return (0.0 + 0.0j) * np.zeros_like(freqs)
84
85
# Cut to only relevant times
@@ -89,6 +89,8 @@ def spectrum(
89
stop_ind = relevant_time_inds[0][-1]
90
time_amps = time_amps[start_ind:stop_ind]
91
times_cut = times[start_ind:stop_ind]
92
+ if times_cut.size == 0:
93
+ return (0.0 + 0.0j) * np.zeros_like(freqs)
94
95
# only need to compute DTFT kernel for distinct dts
96
# usually, there is only one dt, if times is simulation time mesh
0 commit comments