# "Set Device Gamma Ramp failed" error- Help

OS : Win10
PsychoPy version: 1.90
**Standard Standalone? Yes
**What are you trying to achieve?: Creating an N-back test. I am currently trying to create an N-back test. I would like the test to start with a 1-back, and upon the successful completion of a number of trials, I would like it to progressively increase in difficulty (2-back, 3-back, etc). I am very new to this software, and I attempted to use the builder. I will list the script below.

Everytime I run my exam (starting with just the 1-back) i get the following errors:

Traceback (most recent call last):
File “C:\Users\User 1\Documents\N-back\untitled1_lastrun.py”, line 72, in
pos=(0, 0), height=size, wrapWidth=None, ori=0,
NameError: name ‘size’ is not defined
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy2\lib\atexit.py”, line 24, in _run_exitfuncs
func(*targs, **kargs)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\window.py”, line 472, in close_on_exit
self.close()
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\window.py”, line 1124, in close
self.backend.close() # moved here, dereferencing the window prevents
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\backends\pygletbackend.py”, line 357, in close
self.gammaRamp = self._origGammaRampFile “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\tools\attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\backends\pygletbackend.py”, line 319, in gammaRamp
xDisplay=self.xDisplay)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\backends\gamma.py”, line 91, in setGammaRamp
assert success, ‘SetDeviceGammaRamp failed’
AssertionError: SetDeviceGammaRamp failed
Error in sys.exitfunc:
Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy2\lib\atexit.py”, line 24, in _run_exitfuncs
func(*targs, **kargs)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\window.py”, line 472, in close_on_exit
self.close()File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\window.py”, line 1124, in close
self.backend.close() # moved here, dereferencing the window prevents
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\backends\pygletbackend.py”, line 357, in close
self.gammaRamp = self._origGammaRamp
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\tools\attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\backends\pygletbackend.py”, line 319, in gammaRamp
xDisplay=self.xDisplay)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\visual\backends\gamma.py”, line 91, in setGammaRamp
assert success, ‘SetDeviceGammaRamp failed’
AssertionError: SetDeviceGammaRamp failed"

I have tried adjusting the monitors resolution, but it doesn’t seem to help. I even followed tutorials on youtube, and watched them successfully build the test, yet mine fails.

I think the relevant bit is this at the start, rather than the gamma messages:

File “C:\Users\User 1\Documents\N-back\untitled1_lastrun.py”, line 72, in
pos=(0, 0), height=size, wrapWidth=None, ori=0,
NameError: name ‘size’ is not defined


I’m not familiar with the builder interface, but it seems like a stimulus is looking for a size variable that hasn’t been set.

Yes, very likely you are trying to control the height of your text stimulus with a variable called size but you have set that field to be constant rather than set every repeat. Constant variables are set at the start of the experiment. I’m assuming your size variable is in a conditions file attached to a loop, and so that variable doesn’t become available until the loop operates. So tell that field to set every repeat.

Thank you both for taking the time to respond. I really appreciate the help.

Can I set the size variable using the \$ parameter? I have a spreadsheet with a number of variables listed, one of them being the size of the text stimulus.

Also, I am having another issue. When I attempt to display my stimulus, I am just getting a blank white screen. I have attempted to change the colors, but it doesn’t seem to work. Further, if I choose the “full-screen” option, then the computer completely freezes. I can end the stimulus, but when I try to run it, the computer just freezes.

I assume this has something to do with the monitor selection. I have looked at the manufacturer’s website and tried to enter the units as listed (with proper conversions), but I think one of the issues is the fact that I am unsure of how to calibrate the gamma properly. I split my reply into two posts, as it only allows me 2 pictures per post.

I have attached a sample image of my spreadsheet.

I split my reply, as I can only have 2 pictures per post.

If you look above you will see the first half of my reply. Thank you again.

When I insert the loop I get the gamma read error:

This is what it looks like when I try to run the test:

If I run it with the “Full screen” selected, I get a blank window and the computer freezes.