心理学中的Gamma校正错误

时间:2013-11-09 03:41:55

标签: python python-2.7 psychopy

我正在尝试使用OceanOptics光谱仪对我的计算机显示器进行伽玛校正以收集数据,并使用Pyschopy的伽马校正模块来线性化曲线。

该程序似乎可以工作4/5次,但在我尝试setGammaRamp时偶尔会给我一个错误。我只是错误可能是什么。是否有可能使用ctypes进行32-64位转换?这是我得到的错误:

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

1 个答案:

答案 0 :(得分:2)

在ctypes / Pyglet / Psychopy中,GetDC()上似乎存在32/64符号扩展问题。

请参阅: https://github.com/psychopy/psychopy/issues/504

Windows似乎也不允许所有伽玛设置,请参阅: http://jonls.dk/2010/09/windows-gamma-adjustments/