odak.wave.transfer_function_fresnel¶
A definition to calculate convolution based Fresnel approximation for beam propagation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
np.complex |
Complex field (MxN). |
required |
k |
odak.wave.wavenumber |
Wave number of a wave, see odak.wave.wavenumber for more. |
required |
distance |
float |
Propagation distance. |
required |
dx |
float |
Size of one single pixel in the field grid (in meters). |
required |
wavelength |
float |
Wavelength of the electric field. |
required |
Returns:
Type | Description |
---|---|
np.complex |
Final complex field (MxN). |
Source code in odak/wave/classical.py
def transfer_function_fresnel(field, k, distance, dx, wavelength):
"""
A definition to calculate convolution based Fresnel approximation for beam propagation.
Parameters
----------
field : np.complex
Complex field (MxN).
k : odak.wave.wavenumber
Wave number of a wave, see odak.wave.wavenumber for more.
distance : float
Propagation distance.
dx : float
Size of one single pixel in the field grid (in meters).
wavelength : float
Wavelength of the electric field.
Returns
-------
result : np.complex
Final complex field (MxN).
"""
nv, nu = field.shape
fx = np.linspace(-1./2./dx, 1./2./dx, nu)
fy = np.linspace(-1./2./dx, 1./2./dx, nv)
FX, FY = np.meshgrid(fx, fy)
H = np.exp(1j*k*distance*(1-(FX*wavelength)**2-(FY*wavelength)**2)**0.5)
U1 = np.fft.fftshift(np.fft.fft2(np.fft.fftshift(field)))
U2 = H*U1
result = np.fft.ifftshift(np.fft.ifft2(np.fft.ifftshift(U2)))
return result