Gamma isn't holding

My code was successfully in use numerous times for an experiment in June using Matlab R2014b and Psychtoolbox (PTB) 3.0.10 on a Mac OS X El Capitan Version 10.11.5. I have recently come back to it and the gamma correction isn't holding. It flashes onto the screen for just less than a second, and then goes away again. This is not activated by any input (keypress/mouse movement); the gamma simply flashes onto the screen and then leaves again in under a second.

I had thought that the problem was that I had recently updated to PTB 3.0.13. However, having uninstalled PTB 3.0.13 and reinstalled PTB 3.0.10, the problem is still there.

This is happening with all my codes that I gamma corrected. Other screen functions of psychtoolbox are working fine.

All these options have the same result; 

Screen('LoadNormalizedGammaTable',screenNumber,[GammaRed GammaGreen GammaBlue]);

Screen('LoadNormalizedGammaTable', screenNumber, [GammaRed GammaGreen GammaBlue]/255); 

WaitSecs(5);

Screen('LoadNormalizedGammaTable', screenNumber, [GammaRed GammaGreen GammaBlue]/255, 1);

Screen('Flip',w);

Screen('LoadCLUT', w, [RGB(1)*GammaRed RGB(2)*GammaGreen RGB(3)*GammaBlue]);

ClutAnimDemo and ClutAnimDemo (2) work so there is nothing wrong with the screen.

The other very odd thing is that this was initially only a problem on a second screen, and the gamma was working when I ran the code on my laptop alone, but now it is happening on my laptop too when I don't link up to another screen.

When I put 

Screen('LoadCLUT', w, [GammaRed GammaGreen GammaBlue]); 

into a loop, the gamma is kept on the screen. So my long winded solution is to re-code, or hack the demo. A more elegant solution would be much appreciated though.

Thanks.


Dear Jane,

please post a short script that demonstrates the problem. Also system specifications (Type of Mac, graphics card, OSX version). Psychtoolbox itself can't cause such a bug and the relevant gamma handling code hasn't changed in a long time. Did this possibly happen after an El Crapitan upgrade, e.g., one of their "bug fix" updates? Or did you install any 3rd party software related to color management or calibration that might be causing this?

If i understand correctly, the system only uses the gamma tables which you specified via LoadNormalizedGammaTable for a (few) seconds and then resets settings to whatever it thinks is best?

OSX has a similar bug since at least version 10.9, never fixed, that resets the gamma tables about 1-2 seconds after each switch of video mode (resolution or refresh rate), e.g., via SetResolution() or Screen('Resolution'). That one we can work around, but if your bug happens without any obvious trigger event then there isn't any sane way we could work around that, beyond what you do now.

best,
-mario