Reference
This page contains a detailed description of all exported methods.
SLM
SLMDisplay
A class to control a Spatial Light Modulator (SLM).
Attributes:
| Name | Type | Description |
|---|---|---|
monitor_id |
int
|
The ID of the monitor to use. |
slm |
SLM
|
The SLM instance. |
width |
int
|
The width of the SLM. |
height |
int
|
The height of the SLM. |
refreshrate |
int
|
The refresh rate of the SLM. |
Source code in src/slmcontrol/slm.py
__init__(monitor_id=jl.lastindex(jl.GetMonitors()) - 1)
Initialize the SLM instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
monitor_id
|
int
|
The ID of the monitor to use. Defaults to the last monitor. |
lastindex(GetMonitors()) - 1
|
Source code in src/slmcontrol/slm.py
updateArray(holo, sleep=0.15)
Update the hologram displayed on the SLM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
holo
|
NDArray[uint8]
|
A 2D matrix of UInt8 values representing the hologram. |
required |
Hologram
generate_hologram(relative, two_pi_modulation, x_period, y_period, method='BesselJ1')
Generate a hologram used to produce the desired output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relative
|
ArrayLike
|
The relative field. This is the desired output field divided by the input field. When the input field is a plane wave, this reduces to desired output field. |
required |
two_pi_modulation
|
int
|
The greyscale value corresponding to a 2 pi phase shift. |
required |
x_period
|
Union[int, float]
|
The period (in pixels) of the diffraction grating in the x direction. |
required |
y_period
|
Union[int, float]
|
The period (in pixels) of the diffraction grating in the y direction. |
required |
method
|
str
|
Hologram calculation method. Possible values are: |
'BesselJ1'
|
Returns:
| Type | Description |
|---|---|
NDArray[uint8]
|
NDArray[np.uint8]: The hologram. |
References:
[1] Victor Arrizón, Ulises Ruiz, Rosibel Carrada, and Luis A. González,
"Pixelated phase computer holograms for the accurate encoding of scalar complex fields,"
J. Opt. Soc. Am. A 24, 3500-3507 (2007)
[2] Thomas W. Clark, Rachel F. Offer, Sonja Franke-Arnold, Aidan S. Arnold, and Neal Radwell,
"Comparison of beam generation techniques using a phase only spatial light modulator,"
Opt. Express 24, 6249-6264 (2016)
Source code in src/slmcontrol/hologram.py
Structures
lg(x, y, p=0, l=0, w=1)
Compute the Laguerre-Gaussian mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
p
|
int
|
radial index |
0
|
l
|
int
|
azymutal index |
0
|
w
|
Union[int, float]
|
waist |
1
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
Laguerre-Gaussian mode. |
Source code in src/slmcontrol/structures.py
hg(x, y, m=0, n=0, w=1)
Compute the Hermite-Gaussian mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
m
|
int
|
vertical index |
0
|
n
|
int
|
horizontal index |
0
|
w
|
Union[int, float]
|
waist |
1
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
Hermite-Gaussian mode. |
Source code in src/slmcontrol/structures.py
diagonal_hg(x, y, m=0, n=0, w=1)
Compute the diagonal Hermite-Gaussian mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
m
|
int
|
diagonal index |
0
|
n
|
int
|
anti-diagonal index |
0
|
w
|
Union[int, float]
|
waist |
1
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
diagonal Hermite-Gaussian mode. |
Source code in src/slmcontrol/structures.py
lens(x, y, fx, fy, k=1)
Compute the phase imposed by a lens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
fx
|
Union[int, float]
|
focal length in the x direction |
required |
fy
|
Union[int, float]
|
focal length in the y direction |
required |
k
|
Union[int, float]
|
wavenumber of incoming beam |
1
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
phase imposed by the lens. |
Source code in src/slmcontrol/structures.py
tilted_lens(x, y, f, phi, k=1)
Compute the phase imposed by a tilted spherical lens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
f
|
Union[int, float]
|
focal length |
required |
phi
|
Union[int, float]
|
tilting angle |
required |
k
|
Union[int, float]
|
wavenumber of incoming beam |
1
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
phase imposed by the tilted spherical lens |
Source code in src/slmcontrol/structures.py
rectangular_aperture(x, y, a, b)
Rectangular aperture centered at the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
a
|
Union[int, float]
|
lenght in the horizontal direction |
required |
b
|
Union[int, float]
|
lenght in the vertical direction |
required |
Returns:
| Type | Description |
|---|---|
ArrayLike
|
True if the point is inside the aperture. False otherwise. |
Source code in src/slmcontrol/structures.py
square(x, y, l)
Square apperture centered at the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
l
|
Union[int, float]
|
side length |
required |
Returns:
| Type | Description |
|---|---|
ArrayLike
|
True if the point is inside the apperture. False otherwise. |
Source code in src/slmcontrol/structures.py
single_slit(x, y, a)
Single vertical slit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
a
|
Union[int, float]
|
slit widht |
required |
Returns:
| Type | Description |
|---|---|
ArrayLike
|
True if the point is inside the slit. False otherwise. |
Source code in src/slmcontrol/structures.py
double_slit(x, y, a, d)
Double vertical slit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
a
|
Union[int, float]
|
slit widht |
required |
d
|
Union[int, float]
|
slit separation |
required |
Returns:
| Type | Description |
|---|---|
ArrayLike
|
True if the point is inside the slits. False otherwise. |
Source code in src/slmcontrol/structures.py
pupil(x, y, radius)
Circular pupil centered at the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
radius
|
Union[int, float]
|
radius of the pupil |
required |
Returns:
| Type | Description |
|---|---|
ArrayLike
|
True if the point is inside the pupil. False otherwise. |
Source code in src/slmcontrol/structures.py
triangle(x, y, side_length)
Equilateral triangular apperture centered at the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
x argument |
required |
y
|
ArrayLike
|
y argument |
required |
side_length
|
Union[int, float]
|
side length |
required |
Returns:
| Type | Description |
|---|---|
ArrayLike
|
True if the point is inside the apperture. False otherwise. |
Source code in src/slmcontrol/structures.py
Wavefront Correction
zernike(x, y, n, m)
Compute the Zernike polynomial of order (n, m) at the points (x, y).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
array_like
|
x-coordinates. |
required |
y
|
array_like
|
y-coordinates. |
required |
n
|
int
|
Radial order of the Zernike polynomial. |
required |
m
|
int
|
Azimuthal order of the Zernike polynomial. |
required |
Returns:
| Type | Description |
|---|---|
array_like
|
The values of the Zernike polynomial at the points (x, y). |