# Determining Characteristics of Spatial Light Modulator (SLM)

im quite lost somehow. I know this is a really basic thing and I know I should be able to do it, but something is going on with me and I tend to have problems with everything these days. Anyway:

I want to determine the characteristics of a Spatial Light Modulator (SLM). Linear Polarized light was pointed on the SLM. After the SLM an anylyzer was put between the SLM and a photo diode which was used to measure the intensity. In the lab, a program changed the gray value A periodically from 0-255, which was translated, by the same program, to change the crystal orientation. One cycle took 4.1s Since the orientation determines the phase difference between ordinary and extraordinary beam, this results in different polarizations of the exiting light. Because of the analyzer the Intensity of the light, hitting the diode, changes as a consequence.

The diode was then connected to an oscilloscope, recording voltage over time.

The fit-function should be $$I(A)=(I_{max}-I_{min})*cos^2(sA+\delta)+I_{min}$$

The point where A=0 could be seen in the data, because when the crystals reach the position corresponding to A=255 there is a small "dead time" before its orientation reaches the A=0 position again.

The left horizontal line in the picture above.(And also visible at 1.5-ish).

However when I try to fit the data with curve_fit(...) the it doesn't work at all.

The x data used in both pictures above are the recored times by the oscilloscope. The y date used for the fit are the measured voltages.

If I generate a vector A(t) which holds values of Grayvalue determined by the position of the x(A=0) and the knowledge of one cycle being 4.1s long. I get even worse results.

Does anyone have an advice what to do?

Hope you'll have a great weekend!

1. your data aren't perfect, in particular, there are two vertical jumps in them, one at approx -2.6 and another at approx 1.5 (not sure if this is what you refer to as "dead time"). These vertical jumps are in fact phase jumps of your oscillations. You won't be able to fit the entire data set with a $$\cos^2$$ function like that. My suggestion would be to cut off the data parts on both sides and leave in only the part between -2.6 and 1.5, where no phase jumps are seen. Then try to fit this part only.
2. Regarding the fit, a lot depends on the initial values of the fit parameters. When fitting an oscillatory function to the data, it's always a good idea to set the right frequency first. You write that you know the period it 4.1 seconds; from this, you can calculate the frequency ($$s$$ in your formula, I suppose) and "fix" it as a fit parameter. Then do the fit to find out the amplitudes and the phase, and only then release the frequency for the sake of fine tuning.