odak.wave.band_limited_angular_spectrum¶
A definition to calculate bandlimited angular spectrum based beam propagation. For more Matsushima, Kyoji, and Tomoyoshi Shimobaba. "Band-limited angular spectrum method for numerical simulation of free-space propagation in far and near fields." Optics express 17.22 (2009): 19662-19673.
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 band_limited_angular_spectrum(field, k, distance, dx, wavelength):
"""
A definition to calculate bandlimited angular spectrum based beam propagation. For more Matsushima, Kyoji, and Tomoyoshi Shimobaba. "Band-limited angular spectrum method for numerical simulation of free-space propagation in far and near fields." Optics express 17.22 (2009): 19662-19673.
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(-nu/2*dx, nu/2*dx, nu)
y = np.linspace(-nv/2*dx, nv/2*dx, nv)
X, Y = np.meshgrid(x, y)
Z = X**2+Y**2
h = 1./(1j*wavelength*distance)*np.exp(1j*k*(distance+Z/2/distance))
h = np.fft.fft2(np.fft.fftshift(h))*dx**2
flimx = np.ceil(1/(((2*distance*(1./(nu)))**2+1)**0.5*wavelength))
flimy = np.ceil(1/(((2*distance*(1./(nv)))**2+1)**0.5*wavelength))
mask = np.zeros((nu, nv), dtype=np.complex64)
mask = (np.abs(X) < flimx) & (np.abs(Y) < flimy)
mask = set_amplitude(h, mask)
U1 = np.fft.fft2(np.fft.fftshift(field))
U2 = mask*U1
result = np.fft.ifftshift(np.fft.ifft2(U2))
return result