odak.wave.rayleigh_sommerfeld¶
Definition to compute beam propagation using Rayleigh-Sommerfeld's diffraction formula (Huygens-Fresnel Principle). For more see Section 3.5.2 in Goodman, Joseph W. Introduction to Fourier optics. Roberts and Company Publishers, 2005.
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 rayleigh_sommerfeld(field, k, distance, dx, wavelength):
"""
Definition to compute beam propagation using Rayleigh-Sommerfeld's diffraction formula (Huygens-Fresnel Principle). For more see Section 3.5.2 in Goodman, Joseph W. Introduction to Fourier optics. Roberts and Company Publishers, 2005.
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
x = np.linspace(-nv*dx/2, nv*dx/2, nv)
y = np.linspace(-nu*dx/2, nu*dx/2, nu)
X, Y = np.meshgrid(x, y)
Z = X**2+Y**2
result = np.zeros(field.shape, dtype=np.complex64)
direction = int(distance/np.abs(distance))
for i in range(nu):
for j in range(nv):
if field[i, j] != 0:
r01 = np.sqrt(
distance**2+(X-X[i, j])**2+(Y-Y[i, j])**2)*direction
cosnr01 = np.cos(distance/r01)
result += field[i, j]*np.exp(1j*k*r01)/r01*cosnr01
result *= 1./(1j*wavelength)
return result