@@ -262,7 +262,10 @@ function acoustic_field(pm::PekerisModeSolver, tx::AbstractAcousticSource, rxs::
262
262
end
263
263
end
264
264
265
- function impulse_response (pm:: PekerisModeSolver , tx:: AbstractAcousticSource , rx:: AbstractAcousticReceiver , fs; abstime= false )
265
+ # impulse response computation is designed for Pekeris mode solver, but should
266
+ # work for any mode solver that returns ModeArrival, and hence is marked as
267
+ # a fallback for any AbstractModePropagationModel
268
+ function impulse_response (pm:: AbstractModePropagationModel , tx:: AbstractAcousticSource , rx:: AbstractAcousticReceiver , fs; abstime= false )
266
269
arr = arrivals (pm, tx, rx)
267
270
isempty (arr) && return signal (ComplexF64[], fs)
268
271
p1 = location (tx)
@@ -271,15 +274,15 @@ function impulse_response(pm::PekerisModeSolver, tx::AbstractAcousticSource, rx:
271
274
N = ceil (Int, R / minimum (a -> a. v, arr) * fs)
272
275
M = ceil (Int, R / maximum (a -> a. v, arr) * fs)
273
276
N -= M
274
- N = nextfastfft (2 N)
277
+ N = nextfastfft (2 N) # heuristic to ensure no aliasing
275
278
Δf = fs / N
276
279
X = map (0 : N- 1 ) do i
277
280
i == 0 && return complex (0.0 )
278
281
tx1 = AcousticSource (location (tx), i * Δf)
279
282
acoustic_field (pm, tx1, rx) |> conj
280
283
end
281
284
x = ifft (X)
282
- x = circshift (x, - mod (M, N) + N ÷ 100 )
285
+ x = circshift (x, - mod (M, N) + N ÷ 100 ) # heuristic to position first arrival
283
286
if abstime
284
287
absx = abs .(x)
285
288
i = findfirst (> (maximum (absx) / 10 ), absx)
0 commit comments