Sending phase masks on SLM

Hi all,
I need matlab code for sending phase masks on SLM(after reducing resolution of SLM, to 40 by 40) for an image using phase variation of 0 and pi only. Can any one help please?

How to generate set of inputs and outputs on SLM and CCD

we want to reproduce the work in the paper:
All the codes as well as training and test data is given with the paper. The training and test data is given in form of matlab matrices.Do we have to generate our own training and test data to use this code? Can anyone guide, how can we generate calibration data( set of inputs at SLM) and measure multiple outputs on ccd to form matlab matrices like X-H and Y_train and test? We are using Holoeye's Pluto-2 SLM with softwares like pattern generator, as well as SLM display SDK for matlab, labview and python.

Thanks and best regards.

Measuring TM and apply SVD on the measured TM

Hi forum members,

Could you please shed some light for me on the measurement of TM, for the case of a multimode fibre?

  1. Is it absolutely critical to use a orthorgonal basis in the input? As for the case of a MMF, can I use random patterns as per the paper below. My thinking is along this
  2. Use some set of random patterns and measure a TM.
  3. Apply SVD on the TM, find SVs (say 98% of the total power)
  4. Use a bigger set of random patterns, measure again the TM
  5. Apply SVD again, check the SVs... when the number of SVs is stable it indicates that all of the modes has been activated (assuming large NA input)

Can it be done that way? Here the paper they used the random pattern but they just say that 900 patterns is enough.

  1. The TM for a multimode fibre should ideally has the rank of N (number of macro pixel on the SLM)? It is because I think the basic vectors of both left and right singular matrices are the same fibre modes, so that the TM would be an square vector of rank N.

My question is: After obtaining the TM, should I apply SVD on such TM and try to reduce it to a leaner version (less noisy) of the TM before testing the stuffs such as focusing or imaging?

  1. I was told that if I do the SVD directly on the intensities obtained from different input (basically not applying the 4-phase or off-axis technique to extract the complex field pattern but just use the intensity vectors as column of the "intensity TM"), the number of SVs will be roughly twice the number of modes. I could not find any paper which actually did this but just wonder if it is something obvious that someone here can give me some light on? For the case of TM matrix measured on the complex field pattern then the number of SVs is the number of modes as shown in this paper

Thank you very much for your help.

Need Matlab codes for stepwise sequential algorithm, or transmission-matrix algorithm for focusing light in scattering media.

I want to reproduce the results of "focusing light in scattering media by using iterative algorithms, Ivo M. Vellekoop."
Another paper for reference " feedback-based wavefront shaping, Ivo M. Vellekoop."

Please help me to find a Matlab code for this, whether someone put it on GitHub?
Or does anyone know where else I can find Matlab or Python code for this?
Or please share the Matlab code if anyone here tried to reproduce this using any kind of iterative algorithm.


Good evening,
I tried to communicate with the Vialux module V9501 (controller board V4395 ) following what written in this post and using the code available on

If I run the code, on line

DMD.SeqAlloc(nbImg = 2, bitDepth = bitDepth)

I get this error:

DMD.SeqAlloc(nbImg = 2, bitDepth = bitDepth)
File "---- \DMD\", line 445, in SeqAlloc
self._checkError(self._ALPLib.AlpSeqAlloc(self.ALP_ID, ct.c_long(bitDepth), ct.c_long(nbImg), ct.byref( SequenceId)),'Cannot allocate image sequence.')
File "---\DMD\", line 368, in _checkError
raise Exception(errorMsg)
Exception: Cannot allocate image sequence.
The requested memory is not available (full?).

Can you help me to fix this problem?

Simple way to test if SLM is working properly

Hi all,

I am new to SLM so got a Santec SLM-100 with dual windows (visible and 1550 nm). A graduate student has used the visible windows for a while and it seems to work ok. I am now trying to use this for some experiment in the 1550 nm region and want to test to make sure that the SLM is working fine for that wavelength? Atm I made up a simple line grating with a pitch of 60 um (6 pixel) and diffract the zero-order to the 1st order when the grating is On. I then changed the level of phase modulation at all lines (increase the value in the csv file) and observe increasing power at the 1st spot.

My expectation is that the power would gradually increase to a peak at Pi (something between 0 and 1024 values of the pixel), then gradually reduce to near zero when the phase change reaches 2pi (1024). However I have power fluctuating and increasing all the way to nearly 2Pi (1000 value). What did I do wrong here?

Your comments are highly appreciated.


Digital Optical Phase Conjugation SLM orientation

Hi I am working on reproducing DOPC in focusing light through scattering medium :
I am 4f imaging the surface of the phase only LCOS Holoeye SLM on to the back aperture of a objective lens and at the focal plane of the objective I have the scattering medium.
I have a confusion in the orientation of the SLM. Should we block the zero order of the SLM and work with the first order? If so I will need to put a aperture in the fourier plane that allows just +1 order to pass through. Is it the right way to do it ?

Or is there a mistake i am doing ?
Please cloud you help me understand the concept. Your tutorials are a great help for people working in this field

found a free slm program


I wanted to ask this forum about recommended SLM software. But I found an interesting one while waiting for my forum membership. It is called SLM tool box.

It is stand alone Windows program, unlike many SLM software I can find.

Just want to share, as it could also help others.

Question about PLUTO phase only SLM


I’m working on loading fresnel lens pattern (quadratic phase) onto PLUTO phase only SLM to see whether the SLM can really functions as lens. The SLM is reflective and illuminated by uniform light. However, when placing a camera to capture the modulated light, I found that the light reflected from SLM has same fresnel lens pattern as the one I load on SLM. It’s supposed to see no pattern since the SLM only modulate the phase of light. Does anyone know the reason for that?


how to construct the transmission matrix

I am a beginner in the field of wavefront shaping and I was attracted by your paper of LC-SLM-based transmission measurement.

Checking your paper ‘ controlling light through optical disordered media: transmission matrix approach’, the region of SLM is divided into two parts: one is reference part and the other is controlled part.

So my questions are:

1) the measurement is proceeded by sending the hadamard basis on the controlled part while the reference part remain unchanged and then get the signal from CCD. So once the measurement is completed, equation 7 can give us the observed transmission matrix directly, right? But the intensities are obtained from hadamard basis instead of canonical basis. So the equation 7 maybe is not for the hadamard basis so that a unitary transformation is needed? If so, how to reconstruce the transmission matrix by getting the signal generated by hadamard basis?

2) if I want to optimise for optical focusing, following equation 16 can calculate the corresponding optimised phase pattern, so is the phase pattern displayed on the controlled part of the SLM directly? if so, will there be a problem leaving the reference part unchanged? I am concern about that the reference part can still reflect light into the scattering medium, which will interference with the optimised phase pattern on the controlled part.

looking forward to your reply.

Transmission Matrix: Measuring and Utilizing

I'm attempting to reproduce the work of Popoff et al. (primarily "Controlling light through optical disordered media: transmission matrix approach" New Journal of Physics 13 (2011) 123021). Using roughly the same setup as depicted in Figure 1 of that paper (i.e. not using a reference arm and using the SLM in phase only modulation mode), I have measured the observed transmission matrix (TM) and then determined the actual TM via singular value decomposition.

However, I am now trying to use that TM to engineer a particular field at my detector (e.g. a focus) or sense (e.g. detect a pattern portrayed on the SLM) but am running into some trouble. My primary confusion seems to come from how to use this TM. Using Eq. 16 in said paper, I can calculate the the input field needed to yield a desired output field. The TM is a complex matrix, the field is complex and when I do this calculation, I yield another complex matrix (after reshaping). Since, I'm using an SLM to engineer the phase, then I extract the associated phase profile and display that on the SLM.

Unfortunately, this does not seem to yield the desired result at the detector plane. Any suggestions or tips would be greatly appreciated.


How to get a random phase mask on a sample


I am trying to project a random phase mask in which each pixel varies from 0-2pi.

I am using a phase only SLM. I understand that the if we need to get a phase pattern we need to use gerchberg saxton algorithm and back calculate that phase that would produce that, then match it with the gray levels of the SLM and inject the pattern on it. By pacing lens at f of the lens we get the required pattern.

But my question is what if Image SLM on to the sample. Will I get the same phase pattern

Questions about controlling SLM

I am using a SLM to do some imaging research right now and for me there are still several requirements for SLM control that are waiting to solve .
1 I hope to circularly display several images on SLM. Is it possible to set the circular frame number and frequency with Matlab?
2 When the images are refreshing on SLM, I need a
sync signal from SLM(or controlling program )to trigger other hardware. How to achieve this function with Matlab?
3 Is it possible to control SLM with Labview? Because I think Labview is more suitable to control other hardware in my system

Question about amplitude modulation

Hi I am using a HoloEye Phase only SLM. I would like to illuminate my scattering medium using a line illumination.

For which I made a collimated laser beam. Then used a cylindrical lens to get line illumination on the SLM. Out of 1920x1080 pixels I want the phase variation only in the 960th column. For I which I created a phase mask with only enteries in the 960th column and loaded ito to the SLM. And this is the illumination that I want on my scattering medium. Unfortuately I get the light reflected from the SLM completely. How can I make sure that SLM reflects only the line I loaded?

Please can you help me

Laser front instability?

Hi forum.

It may not be the best place to ask but I will give a try.
I tried to use 488nm diode OBIS laser with SLM, and got one problem.
Fringes in the light reflected from SLM were unstable.
On the beginning I was blaming SLM flickering, but I ruled it out.
If I replace the OBIS laser with HeNe 633 nm, fringes are dead stable.
It looks like OBIS laser becomes 'unstable' after a spatial filter.
If I look on fringes before spatial filter they are stable for both lasers.
I cannot come up with an explanation of the fact. Any hints?


calibration of experimental and simulation results


I am using Pluto SLM having resolution (1920 X 1080) of pixel size 8um. I want to generate a beam at Fourier Transform (FT) plane of a lens (focal length f=10cm) by displaying an amplitude grating mask on to the SLM. At FT plane I used a CCD camera to record the beam. I want to generate the same equal size and shape of the beam experimentally recorded beam in simulation using Matlab. CCD camera has the resolution of 1600 x 1200 and pixel size of 4.4um.

For this I make a mask of size equal to the resoLultion (1920 X 1080) of SLM with pixel size 8um. Then I took FFT of the generated mask which provide me FT profile at FT plane. I used relation for spatial coordinate at FT PLANE x2=lambdaffx, where, lambda= wavelength of laser beam, fx = spatial frequency.

so what should be the size of image at FT plane which give same size and shape of the beam as in experiment? Is FT PLANE coordinates should be equal to the camera resolutions and pixels ? How should I display the images in simulation?
Please give your suggestion.

SLM Instability

Hello community, I have an issue with the stability of SLM (Holoeye PLUTO - Phase Only SLM). On the attached video is catched what I see on my camera (ThorLabs DCC1545M).

I am using SLM as one mirror of Twyman-Green interferometer system. After application of simple phase mask, where one half of screen is black and the other one is white, there is obvious instability on the area with current (high grey value). It causes decrease of interference contrast seen by naked eye. And on the camera I can see some sort of stroboscopic effect (video).

Is that normal issue caused by Frame Rate of SLM? Have you had the similar problem before?

Question about use SLM

I am using a SLM to do some imaging research. And I want to use SLM as vertical incident. So I combined the SLM(Holoeye LETO) with PBS and HWP.
As I calculated, if HWP's direction is pi/8. And the GCH load to the SLM is 1-1 phase grating(0-pi/2). The polarization direction will rotate ±pi/2, so it can deflect from the PBS. But in my experiment. only half of the light reflect from the pbs, and the ± one order's power is just one/fourth of the 0 order light.
I want to ask is there something wrong in my setup?

First steps with an SLM: oblique incidence

Does anybody knows how to estimate the angular acceptance of the SLM? What are the problems if I use it at 10 deg? and at 30 deg?

This is a well-known issue but I would like to quantify the effect of oblique incidence.