odak.wave
odak.wave
Provides necessary definitions for merging geometric optics with wave theory and classical approaches in the wave theory as well. See "Introduction to Fourier Optcs" from Joseph Goodman for the theoratical explanation.
adaptive_sampling_angular_spectrum(field, k, distance, dx, wavelength)
¶
A definition to calculate adaptive sampling angular spectrum based beam propagation. For more Zhang, Wenhui, Hao Zhang, and Guofan Jin. "Adaptive-sampling angular spectrum method with full utilization of space-bandwidth product." Optics Letters 45.16 (2020): 4416-4419.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
add_phase(field, new_phase)
¶
Definition for adding a phase to a given complex field.
Parameters:
-
field
–Complex field.
-
new_phase
–Complex phase.
Returns:
-
new_field
(complex64
) –Complex field.
Source code in odak/wave/__init__.py
add_random_phase(field)
¶
Definition for adding a random phase to a given complex field.
Parameters:
-
field
–Complex field.
Returns:
-
new_field
(complex64
) –Complex field.
Source code in odak/wave/__init__.py
adjust_phase_only_slm_range(native_range, working_wavelength, native_wavelength)
¶
Definition for calculating the phase range of the Spatial Light Modulator (SLM) for a given wavelength. Here you prove maximum angle as the lower bound is typically zero. If the lower bound isn't zero in angles, you can use this very same definition for calculating lower angular bound as well.
Parameters:
-
native_range
–Native range of the phase only SLM in radians (i.e. two pi).
-
working_wavelength
(float
) –Wavelength of the illumination source or some working wavelength.
-
native_wavelength
–Wavelength which the SLM is designed for.
Returns:
-
new_range
(float
) –Calculated phase range in radians.
Source code in odak/wave/__init__.py
angular_spectrum(field, k, distance, dx, wavelength)
¶
A definition to calculate angular spectrum based beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
band_extended_angular_spectrum(field, k, distance, dx, wavelength)
¶
A definition to calculate bandextended angular spectrum based beam propagation. For more Zhang, Wenhui, Hao Zhang, and Guofan Jin. "Band-extended angular spectrum method for accurate diffraction calculation in a wide propagation range." Optics Letters 45.6 (2020): 1543-1546.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
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
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
calculate_intensity(field)
¶
Definition to calculate intensity of a single or multiple given electric field(s).
Parameters:
-
field
–Electric fields or an electric field.
Returns:
-
intensity
(float
) –Intensity or intensities of electric field(s).
Source code in odak/wave/__init__.py
distance_between_two_points(point1, point2)
¶
Definition to calculate distance between two given points.
Parameters:
-
point1
–First point in X,Y,Z.
-
point2
–Second point in X,Y,Z.
Returns:
-
distance
(float
) –Distance in between given two points.
Source code in odak/tools/vector.py
double_convergence(nx, ny, k, r, dx)
¶
A definition to generate initial phase for a Gerchberg-Saxton method. For more details consult Sun, Peng, et al. "Holographic near-eye display system based on double-convergence light Gerchberg-Saxton algorithm." Optics express 26.8 (2018): 10140-10151.
Parameters:
-
nx
–Size of the output along X.
-
ny
–Size of the output along Y.
-
k
–See odak.wave.wavenumber for more.
-
r
–The distance between location of a light source and an image plane.
-
dx
–Pixel pitch.
Returns:
-
function
(ndarray
) –Generated phase pattern for a Gerchberg-Saxton method.
Source code in odak/wave/lens.py
electric_field_per_plane_wave(amplitude, opd, k, phase=0, w=0, t=0)
¶
Definition to return state of a plane wave at a particular distance and time.
Parameters:
-
amplitude
–Amplitude of a wave.
-
opd
–Optical path difference in mm.
-
k
–Wave number of a wave, see odak.wave.parameters.wavenumber for more.
-
phase
–Initial phase of a wave.
-
w
–Rotation speed of a wave, see odak.wave.parameters.rotationspeed for more.
-
t
–Time in seconds.
Returns:
-
field
(complex
) –A complex number that provides the resultant field in the complex form A*e^(j(wt+phi)).
Source code in odak/wave/vector.py
fraunhofer(field, k, distance, dx, wavelength)
¶
A definition to calculate Fraunhofer based beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
fraunhofer_equal_size_adjust(field, distance, dx, wavelength)
¶
A definition to match the physical size of the original field with the propagated field.
Parameters:
-
field
–Complex field (MxN).
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
new_field
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
fraunhofer_inverse(field, k, distance, dx, wavelength)
¶
A definition to calculate Inverse Fraunhofer based beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
generate_complex_field(amplitude, phase)
¶
Definition to generate a complex field with a given amplitude and phase.
Parameters:
-
amplitude
–Amplitude of the field.
-
phase
–Phase of the field.
Returns:
-
field
(ndarray
) –Complex field.
Source code in odak/wave/__init__.py
gerchberg_saxton(field, n_iterations, distance, dx, wavelength, slm_range=6.28, propagation_type='IR Fresnel', initial_phase=None)
¶
Definition to compute a hologram using an iterative method called Gerchberg-Saxton phase retrieval algorithm. For more on the method, see: Gerchberg, Ralph W. "A practical algorithm for the determination of phase from image and diffraction plane pictures." Optik 35 (1972): 237-246.
Parameters:
-
field
–Complex field (MxN).
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
-
slm_range
–Typically this is equal to two pi. See odak.wave.adjust_phase_only_slm_range() for more.
-
propagation_type
(str
, default:'IR Fresnel'
) –Type of the propagation (IR Fresnel, TR Fresnel, Fraunhofer).
-
initial_phase
–Phase to be added to the initial value.
Returns:
-
hologram
(complex
) –Calculated complex hologram.
-
reconstruction
(complex
) –Calculated reconstruction using calculated hologram.
Source code in odak/wave/classical.py
gerchberg_saxton_3d(fields, n_iterations, distances, dx, wavelength, slm_range=6.28, propagation_type='IR Fresnel', initial_phase=None, target_type='no constraint', coefficients=None)
¶
Definition to compute a multi plane hologram using an iterative method called Gerchberg-Saxton phase retrieval algorithm. For more on the method, see: Zhou, Pengcheng, et al. "30.4: Multi‐plane holographic display with a uniform 3D Gerchberg‐Saxton algorithm." SID Symposium Digest of Technical Papers. Vol. 46. No. 1. 2015.
Parameters:
-
fields
–Complex fields (MxN).
-
distances
–Propagation distances.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
-
slm_range
–Typically this is equal to two pi. See odak.wave.adjust_phase_only_slm_range() for more.
-
propagation_type
(str
, default:'IR Fresnel'
) –Type of the propagation (IR Fresnel, TR Fresnel, Fraunhofer).
-
initial_phase
–Phase to be added to the initial value.
-
target_type
–Target type. `No constraint` targets the input target as is. `Double constraint` follows the idea in this paper, which claims to suppress speckle: Chang, Chenliang, et al. "Speckle-suppressed phase-only holographic three-dimensional display based on double-constraint Gerchberg–Saxton algorithm." Applied optics 54.23 (2015): 6994-7001.
Returns:
-
hologram
(complex
) –Calculated complex hologram.
Source code in odak/wave/classical.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
|
impulse_response_fresnel(field, k, distance, dx, wavelength)
¶
A definition to calculate impulse response based Fresnel approximation for beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
linear_grating(nx, ny, every=2, add=3.14, axis='x')
¶
A definition to generate a linear grating.
Parameters:
-
nx
–Size of the output along X.
-
ny
–Size of the output along Y.
-
every
–Add the add value at every given number.
-
add
–Angle to be added.
-
axis
–Axis eiter X,Y or both.
Returns:
-
field
(ndarray
) –Linear grating term.
Source code in odak/wave/lens.py
nufft2(field, fx, fy, size=None, sign=1, eps=10 ** -12)
¶
A definition to take 2D Non-Uniform Fast Fourier Transform (NUFFT).
Parameters:
-
field
–Input field.
-
fx
–Frequencies along x axis.
-
fy
–Frequencies along y axis.
-
size
–Size.
-
sign
–Sign of the exponential used in NUFFT kernel.
-
eps
–Accuracy of NUFFT.
Returns:
-
result
(ndarray
) –Inverse NUFFT of the input field.
Source code in odak/tools/matrix.py
nuifft2(field, fx, fy, size=None, sign=1, eps=10 ** -12)
¶
A definition to take 2D Adjoint Non-Uniform Fast Fourier Transform (NUFFT).
Parameters:
-
field
–Input field.
-
fx
–Frequencies along x axis.
-
fy
–Frequencies along y axis.
-
size
–Shape of the NUFFT calculated for an input field.
-
sign
–Sign of the exponential used in NUFFT kernel.
-
eps
–Accuracy of NUFFT.
Returns:
-
result
(ndarray
) –NUFFT of the input field.
Source code in odak/tools/matrix.py
prism_phase_function(nx, ny, k, angle, dx=0.001, axis='x')
¶
A definition to generate 2D phase function that represents a prism. See Goodman's Introduction to Fourier Optics book for more.
Parameters:
-
nx
–Size of the output along X.
-
ny
–Size of the output along Y.
-
k
–See odak.wave.wavenumber for more.
-
angle
–Tilt angle of the prism in degrees.
-
dx
–Pixel pitch.
-
axis
–Axis of the prism.
Returns:
-
prism
(ndarray
) –Generated phase function for a prism.
Source code in odak/wave/lens.py
produce_phase_only_slm_pattern(hologram, slm_range, filename=None, bits=8, default_range=6.28, illumination=None)
¶
Definition for producing a pattern for a phase only Spatial Light Modulator (SLM) using a given field.
Parameters:
-
hologram
–Input holographic field.
-
slm_range
–Range of the phase only SLM in radians for a working wavelength (i.e. two pi). See odak.wave.adjust_phase_only_slm_range() for more.
-
filename
–Optional variable, if provided the patterns will be save to given location.
-
bits
–Quantization bits.
-
default_range
–Default range of phase only SLM.
-
illumination
–Spatial illumination distribution.
Returns:
-
pattern
(complex64
) –Adjusted phase only pattern.
-
hologram_digital
(int
) –Digital representation of the hologram.
Source code in odak/wave/__init__.py
propagate_beam(field, k, distance, dx, wavelength, propagation_type='IR Fresnel')
¶
Definitions for Fresnel Impulse Response (IR), Angular Spectrum (AS), Bandlimited Angular Spectrum (BAS), Fresnel Transfer Function (TF), Fraunhofer diffraction in accordence with "Computational Fourier Optics" by David Vuelz. For more on Bandlimited Fresnel impulse response also known as Bandlimited Angular Spectrum method see "Band-limited Angular Spectrum Method for Numerical Simulation of Free-Space Propagation in Far and Near Fields".
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
-
propagation_type
(str
, default:'IR Fresnel'
) –Type of the propagation (IR Fresnel, Angular Spectrum, Bandlimited Angular Spectrum, TR Fresnel, Fraunhofer).
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
propagate_field(points0, points1, field0, wave_number, direction=1)
¶
Definition to propagate a field from points to an another points in space: propagate a given array of spherical sources to given set of points in space.
Parameters:
-
points0
–Start points (i.e. odak.tools.grid_sample).
-
points1
–End points (ie. odak.tools.grid_sample).
-
field0
–Field for given starting points.
-
wave_number
–Wave number of a wave, see odak.wave.wavenumber for more.
-
direction
–For propagating in forward direction set as 1, otherwise -1.
Returns:
-
field1
(ndarray
) –Field for given end points.
Source code in odak/wave/vector.py
propagate_plane_waves(field, opd, k, w=0, t=0)
¶
Definition to propagate a field representing a plane wave at a particular distance and time.
Parameters:
-
field
–Complex field.
-
opd
–Optical path difference in mm.
-
k
–Wave number of a wave, see odak.wave.parameters.wavenumber for more.
-
w
–Rotation speed of a wave, see odak.wave.parameters.rotationspeed for more.
-
t
–Time in seconds.
Returns:
-
new_field
(complex
) –A complex number that provides the resultant field in the complex form A*e^(j(wt+phi)).
Source code in odak/wave/vector.py
quadratic_phase_function(nx, ny, k, focal=0.4, dx=0.001, offset=[0, 0])
¶
A definition to generate 2D quadratic phase function, which is typically use to represent lenses.
Parameters:
-
nx
–Size of the output along X.
-
ny
–Size of the output along Y.
-
k
–See odak.wave.wavenumber for more.
-
focal
–Focal length of the quadratic phase function.
-
dx
–Pixel pitch.
-
offset
–Deviation from the center along X and Y axes.
Returns:
-
function
(ndarray
) –Generated quadratic phase function.
Source code in odak/wave/lens.py
rayleigh_resolution(diameter, focal=None, wavelength=0.0005)
¶
Definition to calculate rayleigh resolution limit of a lens with a certain focal length and an aperture. Lens is assumed to be focusing a plane wave at a focal distance.
Parameter
diameter : float Diameter of a lens. focal : float Focal length of a lens, when focal length is provided, spatial resolution is provided at the focal plane. When focal length isn't provided angular resolution is provided. wavelength : float Wavelength of light.
Returns:
-
resolution
(float
) –Resolvable angular or spatial spot size, see focal in parameters to know what to expect.
Source code in odak/wave/__init__.py
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
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
rotationspeed(wavelength, c=3 * 10 ** 11)
¶
Definition for calculating rotation speed of a wave (w in A*e^(j(wt+phi))).
Parameters:
-
wavelength
–Wavelength of a wave in mm.
-
c
–Speed of wave in mm/seconds. Default is the speed of light in the void!
Returns:
-
w
(float
) –Rotation speed.
Source code in odak/wave/__init__.py
set_amplitude(field, amplitude)
¶
Definition to keep phase as is and change the amplitude of a given field.
Parameters:
-
field
–Complex field.
-
amplitude
–Amplitudes.
Returns:
-
new_field
(complex64
) –Complex field.
Source code in odak/wave/__init__.py
transfer_function_fresnel(field, k, distance, dx, wavelength)
¶
A definition to calculate convolution based Fresnel approximation for beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
wavenumber(wavelength)
¶
Definition for calculating the wavenumber of a plane wave.
Parameters:
-
wavelength
–Wavelength of a wave in mm.
Returns:
-
k
(float
) –Wave number for a given wavelength.
Source code in odak/wave/__init__.py
zero_pad(field, size=None, method='center')
¶
Definition to zero pad a MxN array to 2Mx2N array.
Parameters:
-
field
–Input field MxN array.
-
size
–Size to be zeropadded.
-
method
–Zeropad either by placing the content to center or to the left.
Returns:
-
field_zero_padded
(ndarray
) –Zeropadded version of the input field.
Source code in odak/tools/matrix.py
adaptive_sampling_angular_spectrum(field, k, distance, dx, wavelength)
¶
A definition to calculate adaptive sampling angular spectrum based beam propagation. For more Zhang, Wenhui, Hao Zhang, and Guofan Jin. "Adaptive-sampling angular spectrum method with full utilization of space-bandwidth product." Optics Letters 45.16 (2020): 4416-4419.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
angular_spectrum(field, k, distance, dx, wavelength)
¶
A definition to calculate angular spectrum based beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
band_extended_angular_spectrum(field, k, distance, dx, wavelength)
¶
A definition to calculate bandextended angular spectrum based beam propagation. For more Zhang, Wenhui, Hao Zhang, and Guofan Jin. "Band-extended angular spectrum method for accurate diffraction calculation in a wide propagation range." Optics Letters 45.6 (2020): 1543-1546.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
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
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
fraunhofer(field, k, distance, dx, wavelength)
¶
A definition to calculate Fraunhofer based beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
fraunhofer_equal_size_adjust(field, distance, dx, wavelength)
¶
A definition to match the physical size of the original field with the propagated field.
Parameters:
-
field
–Complex field (MxN).
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
new_field
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
fraunhofer_inverse(field, k, distance, dx, wavelength)
¶
A definition to calculate Inverse Fraunhofer based beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
gerchberg_saxton(field, n_iterations, distance, dx, wavelength, slm_range=6.28, propagation_type='IR Fresnel', initial_phase=None)
¶
Definition to compute a hologram using an iterative method called Gerchberg-Saxton phase retrieval algorithm. For more on the method, see: Gerchberg, Ralph W. "A practical algorithm for the determination of phase from image and diffraction plane pictures." Optik 35 (1972): 237-246.
Parameters:
-
field
–Complex field (MxN).
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
-
slm_range
–Typically this is equal to two pi. See odak.wave.adjust_phase_only_slm_range() for more.
-
propagation_type
(str
, default:'IR Fresnel'
) –Type of the propagation (IR Fresnel, TR Fresnel, Fraunhofer).
-
initial_phase
–Phase to be added to the initial value.
Returns:
-
hologram
(complex
) –Calculated complex hologram.
-
reconstruction
(complex
) –Calculated reconstruction using calculated hologram.
Source code in odak/wave/classical.py
gerchberg_saxton_3d(fields, n_iterations, distances, dx, wavelength, slm_range=6.28, propagation_type='IR Fresnel', initial_phase=None, target_type='no constraint', coefficients=None)
¶
Definition to compute a multi plane hologram using an iterative method called Gerchberg-Saxton phase retrieval algorithm. For more on the method, see: Zhou, Pengcheng, et al. "30.4: Multi‐plane holographic display with a uniform 3D Gerchberg‐Saxton algorithm." SID Symposium Digest of Technical Papers. Vol. 46. No. 1. 2015.
Parameters:
-
fields
–Complex fields (MxN).
-
distances
–Propagation distances.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
-
slm_range
–Typically this is equal to two pi. See odak.wave.adjust_phase_only_slm_range() for more.
-
propagation_type
(str
, default:'IR Fresnel'
) –Type of the propagation (IR Fresnel, TR Fresnel, Fraunhofer).
-
initial_phase
–Phase to be added to the initial value.
-
target_type
–Target type. `No constraint` targets the input target as is. `Double constraint` follows the idea in this paper, which claims to suppress speckle: Chang, Chenliang, et al. "Speckle-suppressed phase-only holographic three-dimensional display based on double-constraint Gerchberg–Saxton algorithm." Applied optics 54.23 (2015): 6994-7001.
Returns:
-
hologram
(complex
) –Calculated complex hologram.
Source code in odak/wave/classical.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
|
impulse_response_fresnel(field, k, distance, dx, wavelength)
¶
A definition to calculate impulse response based Fresnel approximation for beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
propagate_beam(field, k, distance, dx, wavelength, propagation_type='IR Fresnel')
¶
Definitions for Fresnel Impulse Response (IR), Angular Spectrum (AS), Bandlimited Angular Spectrum (BAS), Fresnel Transfer Function (TF), Fraunhofer diffraction in accordence with "Computational Fourier Optics" by David Vuelz. For more on Bandlimited Fresnel impulse response also known as Bandlimited Angular Spectrum method see "Band-limited Angular Spectrum Method for Numerical Simulation of Free-Space Propagation in Far and Near Fields".
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
-
propagation_type
(str
, default:'IR Fresnel'
) –Type of the propagation (IR Fresnel, Angular Spectrum, Bandlimited Angular Spectrum, TR Fresnel, Fraunhofer).
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
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
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
transfer_function_fresnel(field, k, distance, dx, wavelength)
¶
A definition to calculate convolution based Fresnel approximation for beam propagation.
Parameters:
-
field
–Complex field (MxN).
-
k
–Wave number of a wave, see odak.wave.wavenumber for more.
-
distance
–Propagation distance.
-
dx
–Size of one single pixel in the field grid (in meters).
-
wavelength
–Wavelength of the electric field.
Returns:
-
result
(complex
) –Final complex field (MxN).
Source code in odak/wave/classical.py
double_convergence(nx, ny, k, r, dx)
¶
A definition to generate initial phase for a Gerchberg-Saxton method. For more details consult Sun, Peng, et al. "Holographic near-eye display system based on double-convergence light Gerchberg-Saxton algorithm." Optics express 26.8 (2018): 10140-10151.
Parameters:
-
nx
–Size of the output along X.
-
ny
–Size of the output along Y.
-
k
–See odak.wave.wavenumber for more.
-
r
–The distance between location of a light source and an image plane.
-
dx
–Pixel pitch.
Returns:
-
function
(ndarray
) –Generated phase pattern for a Gerchberg-Saxton method.
Source code in odak/wave/lens.py
linear_grating(nx, ny, every=2, add=3.14, axis='x')
¶
A definition to generate a linear grating.
Parameters:
-
nx
–Size of the output along X.
-
ny
–Size of the output along Y.
-
every
–Add the add value at every given number.
-
add
–Angle to be added.
-
axis
–Axis eiter X,Y or both.
Returns:
-
field
(ndarray
) –Linear grating term.
Source code in odak/wave/lens.py
prism_phase_function(nx, ny, k, angle, dx=0.001, axis='x')
¶
A definition to generate 2D phase function that represents a prism. See Goodman's Introduction to Fourier Optics book for more.
Parameters:
-
nx
–Size of the output along X.
-
ny
–Size of the output along Y.
-
k
–See odak.wave.wavenumber for more.
-
angle
–Tilt angle of the prism in degrees.
-
dx
–Pixel pitch.
-
axis
–Axis of the prism.
Returns:
-
prism
(ndarray
) –Generated phase function for a prism.
Source code in odak/wave/lens.py
quadratic_phase_function(nx, ny, k, focal=0.4, dx=0.001, offset=[0, 0])
¶
A definition to generate 2D quadratic phase function, which is typically use to represent lenses.
Parameters:
-
nx
–Size of the output along X.
-
ny
–Size of the output along Y.
-
k
–See odak.wave.wavenumber for more.
-
focal
–Focal length of the quadratic phase function.
-
dx
–Pixel pitch.
-
offset
–Deviation from the center along X and Y axes.
Returns:
-
function
(ndarray
) –Generated quadratic phase function.
Source code in odak/wave/lens.py
calculate_amplitude(field)
¶
Definition to calculate amplitude of a single or multiple given electric field(s).
Parameters:
-
field
–Electric fields or an electric field.
Returns:
-
amplitude
(float
) –Amplitude or amplitudes of electric field(s).
Source code in odak/wave/utils.py
calculate_phase(field, deg=False)
¶
Definition to calculate phase of a single or multiple given electric field(s).
Parameters:
-
field
–Electric fields or an electric field.
-
deg
–If set True, the angles will be returned in degrees.
Returns:
-
phase
(float
) –Phase or phases of electric field(s) in radians.
Source code in odak/wave/utils.py
electric_field_per_plane_wave(amplitude, opd, k, phase=0, w=0, t=0)
¶
Definition to return state of a plane wave at a particular distance and time.
Parameters:
-
amplitude
–Amplitude of a wave.
-
opd
–Optical path difference in mm.
-
k
–Wave number of a wave, see odak.wave.parameters.wavenumber for more.
-
phase
–Initial phase of a wave.
-
w
–Rotation speed of a wave, see odak.wave.parameters.rotationspeed for more.
-
t
–Time in seconds.
Returns:
-
field
(complex
) –A complex number that provides the resultant field in the complex form A*e^(j(wt+phi)).
Source code in odak/wave/vector.py
propagate_field(points0, points1, field0, wave_number, direction=1)
¶
Definition to propagate a field from points to an another points in space: propagate a given array of spherical sources to given set of points in space.
Parameters:
-
points0
–Start points (i.e. odak.tools.grid_sample).
-
points1
–End points (ie. odak.tools.grid_sample).
-
field0
–Field for given starting points.
-
wave_number
–Wave number of a wave, see odak.wave.wavenumber for more.
-
direction
–For propagating in forward direction set as 1, otherwise -1.
Returns:
-
field1
(ndarray
) –Field for given end points.
Source code in odak/wave/vector.py
propagate_plane_waves(field, opd, k, w=0, t=0)
¶
Definition to propagate a field representing a plane wave at a particular distance and time.
Parameters:
-
field
–Complex field.
-
opd
–Optical path difference in mm.
-
k
–Wave number of a wave, see odak.wave.parameters.wavenumber for more.
-
w
–Rotation speed of a wave, see odak.wave.parameters.rotationspeed for more.
-
t
–Time in seconds.
Returns:
-
new_field
(complex
) –A complex number that provides the resultant field in the complex form A*e^(j(wt+phi)).