Skip to content

Commit

Permalink
Example update
Browse files Browse the repository at this point in the history
  • Loading branch information
roflmaostc committed Jul 5, 2023
1 parent 4d9f5ca commit d083cff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 39 deletions.
3 changes: 0 additions & 3 deletions examples/gaussian_beam_SLM_propagation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ typeof(x)
# ╠═e362673e-dbe9-4ad6-ba7a-d1f22da3f191
# ╠═d6e11fcc-18ef-4c64-82b8-20abbb26d339
# ╠═f0cd85d6-b8a4-4be5-8e99-0eebadc0d27b
# ╠═5ed910a9-b79f-46a4-a78f-fce572a08fe2
# ╠═5b586b1e-e785-4980-815f-0534f997ea41
# ╠═25916008-4a44-4140-9558-6f055d01b101
# ╠═3ee91f4c-83a5-4e33-948f-88b36cf1828c
Expand All @@ -172,11 +171,9 @@ typeof(x)
# ╠═641e4caa-3d4a-46b1-af8f-a6ef8d246723
# ╠═b6db3c81-e960-4a29-b955-43721b3af769
# ╠═3df00e4a-89f1-4ef3-a101-e02113fa471d
# ╠═b7684276-2099-417d-aa57-573d98c61f2d
# ╠═6f31315a-f545-4989-91c9-b58db0e4ba18
# ╠═8e4c91eb-ed58-4d1f-9a43-48d2c262e4ea
# ╠═661541a4-84f4-4f74-bbe7-3aab62fb52ce
# ╠═2341052a-c5fc-4ef1-9623-138c2781fde8
# ╠═3b90e7f5-daef-4181-81b7-db3d0a9a922b
# ╠═09ca6d0b-fbe0-4ff4-a900-2dd2179ab6bd
# ╠═8397198e-3b49-49db-af87-a932d4967a63
Expand Down
47 changes: 11 additions & 36 deletions examples/propagation_over_distance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,22 @@ end
N = 256

# ╔═╡ 7ef68ddb-474d-49ea-9510-91c0ab4d073d
field_img = togoc(ComplexF32.((rr2(Float32, (N, N), offset=(120, 200)) .< 10^2) .+ (rr2(Float32, (N, N), offset=(100, 100)) .< 40^2) .+ (rr2(Float32, (N, N), offset=(120, 170)) .< 5^2) ));
field_img = togoc(ComplexF32.((rr2(Float32, (N, N), offset=(120, 200)) .< 10^2) .+ (rr2(Float32, (N, N), offset=(100, 100)) .< 40^2) .+ (rr2(Float32, (N, N), offset=(120, 170)) .< 3^2) ));

# ╔═╡ e5fcbd81-c4f5-4bbc-8f22-dd248be8ec01
L = 1f-3
L = 2f-3

# ╔═╡ 92d96248-06e5-446b-b856-163cbe8b4f45

L / N

# ╔═╡ da4d0740-46c4-460a-83ef-d78db575a3a4
λ = 405f-9 / 1.5

# ╔═╡ 182fd5d8-857c-44d2-9451-8b6e8a9114e9
zs = togoc(range(-5e-3, 5e-3, 256));
zs = togoc(fftpos(16e-3, 256, CenterFT));

# ╔═╡ 38041742-1d46-4fa3-97b4-e5614f39ac33
CUDA.@allowscalar zs[129]

# ╔═╡ 851accf9-ea26-41f7-a2a5-4f0b9e53ad9c
@mytime field_img_p, tt = angular_spectrum(togoc(field_img), zs, λ, L);
Expand All @@ -78,8 +81,8 @@ simshow((toc(abs2.(selectdim(field_img_p, 3, iz)))), γ=0.5)

# ╔═╡ 4218847d-9a0c-4e4e-a8b6-6c76e0c3564e
begin
plot(fftpos(L, N, CenterFT), abs2.(toc(selectdim(field_img_p, 3, iz)))[120, :], title="z=$(1000 * toc(zs)[iz])mm", ticks=:native)
plot!(fftpos(L, N, CenterFT), abs2.(toc(field_img)[120, :]))
plot(fftpos(L, N, CenterFT), abs2.(toc(selectdim(field_img_p, 3, iz)))[120, :], title="z=$(1000 * toc(zs)[iz])mm", ticks=:native, marker=(:circle,1))
plot!(fftpos(L, N, CenterFT), abs2.(toc(field_img)[120, :]), marker=(:circle,1))
end

# ╔═╡ 5fb47911-28b4-456c-b647-eed4af09f5e3
Expand All @@ -88,44 +91,14 @@ sum(abs2.(field_img_p[:, :, 2]))
# ╔═╡ a7325c95-d653-4e7e-ad9c-736a50ba9ea8
sum(abs2.(field_img))

# ╔═╡ a8fb4cfa-61c1-4477-a4e8-af6f8e631a7e
# ╠═╡ disabled = true
#=╠═╡
@mytime rs_kernel = WaveOpticsPropagation._real_space_kernel(pad(field_img, 2), togoc(reshape(range(10e-6, 1000e-6, 100), (1,1,:))), 405e-9, 4e-3);
╠═╡ =#

# ╔═╡ 4f585a19-fd50-40d3-8e60-27ebf080bce6
# ╠═╡ disabled = true
#=╠═╡
field_img_conv= WaveOpticsPropagation.conv(field_img, ifftshift(rs_kernel));
╠═╡ =#

# ╔═╡ 03002431-9a33-4a6b-bb1a-d30f47c3bb45


# ╔═╡ 94e1e172-a807-44cf-8f3f-b98262f3f895
#=╠═╡
simshow(toc(abs2.(selectdim(field_img_conv, 3, iz))), γ=0.1)
╠═╡ =#

# ╔═╡ 6dc5b732-f121-465a-9dd9-fdf27fb73e90
simshow(ffts(toc(selectdim(tt.H, 3, iz))), γ=1)

# ╔═╡ 09954458-5659-46e2-9711-cae7dfac8e36
# ╠═╡ disabled = true
#=╠═╡
@view_image real.(ffts(toc(selectdim(tt.H, 3, iz))))
╠═╡ =#

# ╔═╡ 5bb71ea0-cf7d-4be9-8df3-4d8bdab830d3
#=╠═╡
simshow(togoc(selectdim(rs_kernel, 3, iz)), γ=0.1)
╠═╡ =#

# ╔═╡ 9cd1b7fd-d262-4ccc-8a2c-b82f0368ce35
#=╠═╡
extrema(abs2.(rs_kernel))
╠═╡ =#

# ╔═╡ 1b1144fe-b732-40bc-8382-727381f69b85
size(field_img)
Expand Down Expand Up @@ -195,12 +168,14 @@ NDTools.expand_dims
# ╠═e5fcbd81-c4f5-4bbc-8f22-dd248be8ec01
# ╠═92d96248-06e5-446b-b856-163cbe8b4f45
# ╠═da4d0740-46c4-460a-83ef-d78db575a3a4
# ╠═38041742-1d46-4fa3-97b4-e5614f39ac33
# ╠═182fd5d8-857c-44d2-9451-8b6e8a9114e9
# ╠═851accf9-ea26-41f7-a2a5-4f0b9e53ad9c
# ╠═62acd577-3402-4aee-9c62-4cc424b61758
# ╠═f9837f4a-e134-4d92-8984-51836bb89f74
# ╠═ddbe7f52-57dc-42d5-9edc-6377eb0bf31d
# ╠═4218847d-9a0c-4e4e-a8b6-6c76e0c3564e
# ╠═0d275418-1393-41c4-b29a-6b56cb25f728
# ╠═5fb47911-28b4-456c-b647-eed4af09f5e3
# ╠═a7325c95-d653-4e7e-ad9c-736a50ba9ea8
# ╠═a8fb4cfa-61c1-4477-a4e8-af6f8e631a7e
Expand Down

0 comments on commit d083cff

Please sign in to comment.