I'm trying to gamma correct my computer monitor using an OceanOptics Spectrometer to gather the data and Pyschopy's gamma correction module to linearize the curve.
The program appears to work around 4/5 times but will occasionally give me an error when I attempt to setGammaRamp. I was just what the error might be. Is it possible that it is a problem with 32-64 bit conversion using ctypes? Here's the error that I get:
Traceback (most recent call last):
File "C:\WinPython-64bit-2.7.5.3\python-2.7.5.amd64\Lib\site-packages\aibs\chrisgammatest.py", line 139, in <module>
Calib=GammaTest()
File "C:\WinPython-64bit-2.7.5.3\python-2.7.5.amd64\Lib\site-packages\aibs\chrisgammatest.py", line 22, in __init__
self.monitorcal()
File "C:\WinPython-64bit-2.7.5.3\python-2.7.5.amd64\Lib\site-packages\aibs\chrisgammatest.py", line 81, in monitorcal
sample=self.gammaTest()
File "C:\WinPython-64bit-2.7.5.3\python-2.7.5.amd64\Lib\site-packages\aibs\chrisgammatest.py", line 42, in gammaTest
window=visual.Window(units='norm',monitor=monitortype, fullscr = True, screen = screennumber, waitBlanking=True)
File "C:\WinPython-64bit-2.7.5.3\python-2.7.5.amd64\lib\site-packages\psychopy\visual.py", line 334, in __init__
self.setGamma(self.gamma)#using either pygame or bits++
File "C:\WinPython-64bit-2.7.5.3\python-2.7.5.amd64\lib\site-packages\psychopy\visual.py", line 935, in setGamma
self.winHandle.setGamma(self.winHandle, self.gamma)
File "C:\WinPython-64bit-2.7.5.3\python-2.7.5.amd64\lib\site-packages\psychopy\gamma.py", line 34, in setGamma
setGammaRamp(pygletWindow, newLUT)
File "C:\WinPython-64bit-2.7.5.3\python-2.7.5.amd64\lib\site-packages\psychopy\gamma.py", line 51, in setGammaRamp
success = windll.gdi32.SetDeviceGammaRamp(pygletWindow._dc, newRamp.ctypes)
ctypes.ArgumentError: argument 1: <type 'exceptions.OverflowError'>: long int too long to convert
There seems to be a 32/64 sign extension problem on GetDC() in ctypes / Pyglet / Psychopy.
See: https://github.com/psychopy/psychopy/issues/504
It also appears that Windows doesn't allow all gamma settings, see: http://jonls.dk/2010/09/windows-gamma-adjustments/