From 536006c0880ef3a442ca9891b760eb06c53694aa Mon Sep 17 00:00:00 2001 From: miroox Date: Wed, 17 Jun 2020 17:03:25 +0800 Subject: [PATCH] detail doc string --- docs/src/index.md | 2 ++ src/angular_spectrum.jl | 12 ++++++++++++ src/fresnel_diffraction.jl | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/docs/src/index.md b/docs/src/index.md index 4e8cec3..a32ea39 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,5 +1,7 @@ # OpticalPropagation.jl +A package of useful optical propagation methods. + ```@index ``` diff --git a/src/angular_spectrum.jl b/src/angular_spectrum.jl index a61899e..0963036 100644 --- a/src/angular_spectrum.jl +++ b/src/angular_spectrum.jl @@ -2,6 +2,18 @@ angular_spectrum(Uin, d, λ, lx, ly) calculate the propagation light field based on the angular spectrum. + +## Parameters + +- `Uin::AbstractArray{<:Number,2}`: Complex array of input complex amplitude. +- `d::Real`: Distance to propagate in metres. +- `λ::Real`: Wavelength of light to propagate. +- `lx::Real`: The physical size of the input data along the x-axis. +- `ly::Real`: The physical size of the input data along the y-axis. + +## Returns + +- `::Array{<:Number,2}`: Complex amplitude data after propagation. """ function angular_spectrum(Uin::AbstractArray{<:Number,2}, d::Real, λ::Real, lx::Real, ly::Real) tf = (u, v) -> 1-u^2-v^2>=0 ? exp(2im*pi*d/λ*sqrt(1-u^2-v^2)) : 0 diff --git a/src/fresnel_diffraction.jl b/src/fresnel_diffraction.jl index bddbf75..3f793fa 100644 --- a/src/fresnel_diffraction.jl +++ b/src/fresnel_diffraction.jl @@ -2,6 +2,18 @@ fresnel_diffraction_double(Uin, d, λ, lx, ly) calculate the propagation light field based on the Fresnel diffraction with double Fourier transform. + +## Parameters + +- `Uin::AbstractArray{<:Number,2}`: Complex array of input complex amplitude. +- `d::Real`: Distance to propagate in metres. +- `λ::Real`: Wavelength of light to propagate. +- `lx::Real`: The physical size of the input data along the x-axis. +- `ly::Real`: The physical size of the input data along the y-axis. + +## Returns + +- `::Array{<:Number,2}`: Complex amplitude data after propagation. """ function fresnel_diffraction_double(Uin::AbstractArray{<:Number,2}, d::Real, λ::Real, lx::Real, ly::Real) tf = (u, v) -> exp(2im*pi*d/λ)*exp(-im*pi*d/λ*(u^2+v^2)) @@ -14,6 +26,22 @@ end fresnel_diffraction_single(Uin, d, λ, lx, ly) calculate the propagation light field based on the Fresnel diffraction with single Fourier transform. + +## Parameters + +- `Uin::AbstractArray{<:Number,2}`: Complex array of input complex amplitude. +- `d::Real`: Distance to propagate in metres. +- `λ::Real`: Wavelength of light to propagate. +- `lx::Real`: The physical size of the input data along the x-axis. +- `ly::Real`: The physical size of the input data along the y-axis. + +## Returns: + + (Uout, (lxo, lyo)) + +- `Uout::Array{<:Number,2}`: Complex amplitude data after propagation. +- `lxo::Real`: The physical size of the diffraction data along the x-axis. +- `lyo::Real`: The physical size of the diffraction data along the y-axis. """ function fresnel_diffraction_single(Uin::AbstractArray{<:Number,2}, d::Real, λ::Real, lx::Real, ly::Real) qp = (x, y) -> exp(im*pi/d/λ*(x^2+y^2))