Skip to content
/ slm Public
forked from danielruttley/slm

Python code for the generation, display, and analysis of SLM holograms.

Notifications You must be signed in to change notification settings

vallyw/slm

 
 

Repository files navigation

SLM

Python code for the generation and display of SLM holograms and the analysis of light shaping performed by the holograms.

Modules

holograms

Handles the generation of holograms to be sent to the SLM display that do not require measurement feedback from e.g. the camera. Organised into submodules by hologram type.

All holograms are returned as numpy float arrays with 0 - 2π phase modulation represented with values in the range 0 - 1.

holograms.gratings

Contains blazed gratings used to split SLM diffraction orders such that the +1 order can be spatially isolated. Gratings are defined by the period of a 0 - 2π linear phase modulation, in units of SLM pixels.

Typical usage:

import holograms as hg
grating = hg.gratings.grating(period,angle)

holograms.lenses

Contains lenses that can be used to either focus the light or apply a shift to the focal plane, depending on the optical setup following the SLM.

Typical usage:

import holograms as hg
lens = hg.lenses.lens(wavelength,f,(x0,y0))

holograms.apertures

Defines apertures which are applied to existing holograms and return modified copies. The most frequently used of these is the circular aperture which removes distortions caused when non-circular holograms are shown on the SLM screen (created by the corners giving sharp features in Fourier space).

Typical usage:

import holograms as hg
apertured = hg.apertures.circ(hologram)

holograms.zernike

Returns arrays containing Zernike polynomials which can be used to correct phase aberrations in the an imaging system due to them forming an orthogonal basis on a circle.

holograms.mixing

Produces composite holograms made from randomly sampling input holograms, which can be used to quickly and easily combine their effects in the Fourier plane.

holograms.complex_amp_mod

Module defining the ComplexAmpMod object which generates holograms which modulate both the amplitude and phase of a beam once the +1 diffraction order has been spatially filtered.

This technique can be used to create arbitrary intensity patterns in the focal plane; the code currently is written instead for easy generation of superpositions of Laguerre-Gauss modes.

The object is contained in the main holograms namespace and should be imported as so:

import holograms as hg
cam = hg.ComplexAmpMod()

holograms.misc

Contains other functions which have been useful occasionally. These include blank (generates a uniform hologram), load and save (read and write holograms from image files respectively), and translate (moves a hologram around in an array, padding empty pixels with zeros).

slm

Interfaces with the SLM display which appears in Windows as an additional monitor via an SLM object. Holograms are sent to the SLM by displaying a 24-bit RGB color image where the 2-byte 65536 voltage states of each SLM pixel are encoding using the G value as the most significant byte and the R value as the least significant byte (the B value is discarded).

All holograms should be sent to the SLM object as numpy float arrays with 0 - 2π phase modulation represented with values in the range 0 - 1 (such as those generated by the holograms module). Typically a time of around 0.5 seconds should be left to ensure that SLM display has updated.

When this object is initialised a custom lookup table can be applied which should be of the form in ScaledLutModel.txt, where the first column is the desired phase modulation in the range 0 - 65535 and the second column is the calibrated value that should be sent to the display.

Typical usage:

import time
from slm import SLM

slm = SLM(monitor=1)
slm.apply_hologram(holo)
time.sleep(0.5)

Acknowledgements

About

Python code for the generation, display, and analysis of SLM holograms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%