Skip to content

Commit

Permalink
Fix negative propagation distances
Browse files Browse the repository at this point in the history
  • Loading branch information
roflmaostc committed Jan 29, 2024
1 parent 0eedaaa commit 914aa55
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/angular_spectrum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ function _prepare_angular_spectrum(field::AbstractArray{CT}, z, λ, L;
(; k, f_x, f_y) = Zygote.@ignore _propagation_variables(field_new, λ, L_new)

# transfer function kernel of angular spectrum
H = exp.(1im .* k .* z .* sqrt.(CT(1) .- abs2.(f_x .* λ) .- abs2.(f_y .* λ)))

H = exp.(1im .* k .* abs.(z) .* sqrt.(CT(1) .- abs2.(f_x .* λ) .- abs2.(f_y .* λ)))

# take complex conjugate, for negative zs
H = real.(H) .+ sign.(z) .* 1im .* imag(H)

# bandlimit according to Matsushima
# as addition we introduce a smooth bandlimit with a Hann window
# and fuzzy logic
Expand Down

0 comments on commit 914aa55

Please sign in to comment.