python - Psychopy 中的 Gamma 校正错误

标签 python python-2.7 psychopy

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

该程序似乎可以工作大约 4/5 次,但当我尝试设置 GammaRamp 时偶尔会出现错误。我就是这个错误可能是什么。有没有可能是使用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

最佳答案

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

参见: https://github.com/psychopy/psychopy/issues/504

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

关于python - Psychopy 中的 Gamma 校正错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19872107/

相关文章:

Python - 如何删除列表列表中的最后一个元素?

python - 使用自定义文本绘制 x 轴点

python - 尝试在 Django 中使用 `comments` contrib 实现连接时出现问题

python - 减少 py2exe 分布大小,同时包含一些 numpy 函数

javascript - javascript/node.js 中是否有与 python 的 inspect.getargspec 等效的东西?

python - 当我在 Python 2.7 中导入时,如何覆盖 OSX 的 numpy 版本?

python - 在python标准库中寻找方法

python - 如何从列表中以不同颜色打印单词,然后将其显示在python的窗口上?

python - 在 Windows 上执行 pip installpsychopy 时出现错误消息

python - 在 PsychoPy 中播放声音时出错 : Could not convert string to float