Skip to content

Commit a7369af

Browse files
committed
doc(pm): added comments
1 parent 81b976b commit a7369af

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/pm_pekeris.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,10 @@ function acoustic_field(pm::PekerisModeSolver, tx::AbstractAcousticSource, rxs::
262262
end
263263
end
264264

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)
266269
arr = arrivals(pm, tx, rx)
267270
isempty(arr) && return signal(ComplexF64[], fs)
268271
p1 = location(tx)
@@ -271,15 +274,15 @@ function impulse_response(pm::PekerisModeSolver, tx::AbstractAcousticSource, rx:
271274
N = ceil(Int, R / minimum(a -> a.v, arr) * fs)
272275
M = ceil(Int, R / maximum(a -> a.v, arr) * fs)
273276
N -= M
274-
N = nextfastfft(2N)
277+
N = nextfastfft(2N) # heuristic to ensure no aliasing
275278
Δf = fs / N
276279
X = map(0:N-1) do i
277280
i == 0 && return complex(0.0)
278281
tx1 = AcousticSource(location(tx), i * Δf)
279282
acoustic_field(pm, tx1, rx) |> conj
280283
end
281284
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
283286
if abstime
284287
absx = abs.(x)
285288
i = findfirst(>(maximum(absx) / 10), absx)

0 commit comments

Comments
 (0)