psychopy.org | Reference | Downloads | Github

Divide by zero in double_scalars; display lag of 8 seconds!

OS: Windows 10
PsychoPy version: 3.2.x
Standard Standalone?: Yes
What are you trying to achieve?: A simple Lexical Decision Task. Participant sees a fixation cross, then a word, then presses one of two buttons, then there’s an ISI.

What did you try to make it work?: I built it in Builder. It worked for a while on some machines. You can try my program here: https://github.com/Joe-Hilgard/psychopy-ldt

What specifically went wrong when you tried that?: It takes several minutes to start the display, after which it takes several seconds to respond to keypresses. Additionally, it displays the fixation cross and stimulus simultaneously rather than in series.

Here’s the error log:
LexicalDecisionTask.py:73: RuntimeWarning: divide by zero encountered in double_scalars
frameDur = 1.0 / round(expInfo[‘frameRate’])
59.5731 WARNING t of last frame was 4301.35ms (=1/0)
63.8754 WARNING t of last frame was 4302.35ms (=1/0)
68.1778 WARNING t of last frame was 4302.36ms (=1/0)
72.4801 WARNING t of last frame was 4302.35ms (=1/0)
76.7825 WARNING Multiple dropped frames have occurred - I’ll stop bothering you about them!
250.3049 WARNING We overshot the intended duration of ISI by 8.1096s. The intervening code took too long to execute.
258.9385 WARNING We overshot the intended duration of ISI by 8.1107s. The intervening code took too long to execute.

It worked for a little while after I reinstalled on one computer and replaced another computer. Now today it has suddenly stopped working on 3 out of 4 computers.

Another thread suggests it might be a display resolution issue, but the error here only seemed to get resolved by falling back to an older version: Every psychopy script takes 90 seconds to start

I’d be really grateful for some help. It really wrecks me when this suddenly stops working on most my lab computers.

Here’s that line 73 of the code that throws the divide by zero error:

# Setup the Window
win = visual.Window(
    size=[1680, 1050], fullscr=True, screen=0, 
    winType='glfw', allowGUI=False, allowStencil=False,
    monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
    blendMode='avg', useFBO=True)
# store frame rate of monitor if we can measure it
expInfo['frameRate'] = win.getActualFrameRate()
if expInfo['frameRate'] != None:
    frameDur = 1.0 / round(expInfo['frameRate']) # !!!ERROR HERE!!!
else:
    frameDur = 1.0 / 60.0  # could not measure, so guess

I’m going to guess that somehow win.getActualFrameRate() is returning 0 instead of None or 59 or 60.

I guess I can just hardcode the framerate to 59 Hz. Does anybody see a problem with that?

It’d be useful if the developers could diagnose and prevent this bug in the future.

Well, what’s weird is that your frame rate seems to be so shocking. I can’t imagine what would cause that. I’ll try your task on my own laptop but my guess is that there’s something about the machine(s) that’s unusual.

Could you open the coder view and run the sysInfo.py in the demos menu so we can find out a bit about yoru machine?

Sure. Let me go do that now.

Here’s the output of sysInfo.py. You can see it’s struggling to find the monitor specification:

Welcome to PsychoPy3!
v3.2.3

Problem compiling: [Errno 13] Permission denied: 'C:\\Program Files\\PsychoPy3\\lib\\site-packages\\psychopy\\demos\\coder\\__pycache__\\sysInfo.cpython-36.pyc.2483645333256'
##### Running: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos\coder\sysInfo.py #####
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Paths to files on the system:
    userPrefsFile: C:\Users\jbhilga\AppData\Roaming\psychopy3\userPrefs.cfg
    appDataFile: C:\Users\jbhilga\AppData\Roaming\psychopy3\appData.cfg
    demos: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos
    appFile: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\PsychoPy.py

System info:
Windows-10-10.0.18362-SP0

Python info
C:\Program Files\PsychoPy3\pythonw.exe
3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)]
numpy 1.15.0
scipy 1.1.0
matplotlib 2.2.2
pyglet 1.3.2
pyo 0.9.7

PsychoPy 3.2.3
have shaders: True

OpenGL info:
vendor: Intel
rendering engine: Intel(R) HD Graphics 2500
OpenGL version: 4.0.0 - Build 10.18.10.4276
(Selected) Extensions:
     True GL_ARB_multitexture
     True GL_EXT_framebuffer_object
     True GL_ARB_fragment_program
     True GL_ARB_shader_objects
     True GL_ARB_vertex_shader
     True GL_ARB_texture_non_power_of_two
     True GL_ARB_texture_float
     False GL_STEREO
    max vertices in vertex array: 1048576
4.6599     WARNING     Monitor specification not found. Creating a temporary one...
57.5643     WARNING     t of last frame was 4300.36ms (=1/0)
61.8647     WARNING     t of last frame was 4300.35ms (=1/0)
66.1651     WARNING     t of last frame was 4300.36ms (=1/0)
70.4644     WARNING     t of last frame was 4299.35ms (=1/0)
74.7658     WARNING     Multiple dropped frames have occurred - I'll stop bothering you about them!

I’ve had a look at your project and there are potential problems there too.

  1. You’ve got a Static Component (the pink box) on your trial spanning the onset of the stimulus. That Static Period is to tell PsychoPy that nothing will change during this period (so it’s safe to do things like load stimuli). But in your case it isn’t static - you’re asking PsychoPy to change a visual stimulus while the screen is static.
  2. You’ve put your files into a folder called psychopy. Now when your script tries to import the psychopy library it might try and look inside that folder. I’m not sure this is actually a problem here because I think you’d see an error if that were happening, but it’s certainly a bad idea to call the folder the same thing as the psychopy lib (or any other libs that might be imported like numpy, pyglet…)

Meanwhile, on the terminal that the task still works on, it looks like it’s also having trouble with monitor specification but is not dropping frames / experiencing 4s frames.

Welcome to PsychoPy3!
v3.2.4

Problem compiling: [Errno 13] Permission denied: 'C:\\Program Files\\PsychoPy3\\lib\\site-packages\\psychopy\\demos\\coder\\__pycache__\\sysInfo.cpython-36.pyc.1786945928360'
##### Running: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos\coder\sysInfo.py #####
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Paths to files on the system:
    userPrefsFile: C:\Users\hjung15\AppData\Roaming\psychopy3\userPrefs.cfg
    appDataFile: C:\Users\hjung15\AppData\Roaming\psychopy3\appData.cfg
    demos: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos
    appFile: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\PsychoPy.py

System info:
Windows-10-10.0.18362-SP0

Python info
C:\Program Files\PsychoPy3\pythonw.exe
3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)]
numpy 1.15.0
scipy 1.1.0
matplotlib 2.2.2
pyglet 1.3.2
pyo 0.9.7

PsychoPy 3.2.4
have shaders: True

OpenGL info:
vendor: Intel
rendering engine: Intel(R) HD Graphics 4600
OpenGL version: 4.3.0 - Build 20.19.15.4835
(Selected) Extensions:
     True GL_ARB_multitexture
     True GL_EXT_framebuffer_object
     True GL_ARB_fragment_program
     True GL_ARB_shader_objects
     True GL_ARB_vertex_shader
     True GL_ARB_texture_non_power_of_two
     True GL_ARB_texture_float
     False GL_STEREO
    max vertices in vertex array: 1048576
3.2986     WARNING     Monitor specification not found. Creating a temporary one...

I didn’t realize I had a static component! Let me try the changes you’ve suggested.

Okay, I’ve tried several things now that haven’t worked:

  1. I adjusted the start times on the trial object so that everything’s onset comes after the ISI (static component). Changing this did not fix the broken terminals, and the working terminal continued to work with or without this fix.
  2. I renamed the folder from psychopy to task_program. Again, this didn’t fix or break anything.
  3. I commented out win.getActualFramerate() and replaced it with a hardcoded value of 60. This removed the error message from line 73, but I still get the other error messages regarding 4s frames:
Running: C:\Users\Public\Documents\aggressive-thought\study3\task_program\LexicalDecisionTask.py

pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
57.7211 WARNING t of last frame was 4316.34ms (=1/0)
62.0374 WARNING t of last frame was 4316.34ms (=1/0)
66.3548 WARNING t of last frame was 4317.34ms (=1/0)
70.6711 WARNING t of last frame was 4316.33ms (=1/0)
74.9885 WARNING Multiple dropped frames have occurred - I’ll stop bothering you about them!
118.4947 WARNING We overshot the intended duration of ISI by 3.8412s. The intervening code took too long to execute.

I’m going to try falling back to PsychoPy 1.85.4 now…

Yes, the thing we need to work out is why your computers have this low refresh rate. They’re taking 4 seconds to flip the screen which is just insane. I’ve never seen this happen, even on crumby old laptops.

Can you think of anything that’s unusual about the machines (especially anything that differs with the one that works)?

  • Are they running PsychoPy running across a network installation (i.e. your IT people have installed it in a network location rather than on the machines)? That would explain the slow load time (although I don’t think it would cause the slow flip speed).
  • I presume it isn’t some virtual machine running on another? If so then OpenGL would most likely switch to a software implementation and that would break.
  • Actually, you described them as “terminals”. You aren’t doing this through something like X11 connection to a remot machine are you (where the screen is actually rendered elsewhere and then passed back to the local screen)?
  • What sort of screens are on the computers? Your graphics card (Intel 2500) is kinda old so if you’ve connected a fancy HD display then you’d definitely get horrible timing (but even then I think it wouldn’t be this bad)!

Basically, this really isn’t normal, so anything that might be “different” about the setup (from they way that most people use their computers) would be helpful to know about.

cheers,
Jon

The computers appear to be Dell Optiplex 7010s. They were working for several weeks until they stopped today. The one that is still working is a Dell Optiplex 7020. As you can see in the sysInfo output above, they have AMD64 processors and Intel HD Graphics 2500 (or 4600 on the Optiplex 7020).

PsychoPy 3.6.6 is installed locally at C:\Program Files\Psychopy3\python.exe (pythonw.exe, python64.exe…)

I misspoke when I described them as terminals. They’re local computers. They just do that goofy Win 10 workplace thing wherein my RAs and I have to log in with our school ID and password. They’re running everything locally, except sometimes they do stick important things in a “roaming” folder (e.g., my R packages, if I’m not careful).

The screens describe themselves as DELL E228WFP. They’re connected over VGA, running at a resolution of 1680×1050 at 60Hz.

I think falling back to PsychoPy 1.84 is working, so I might just do that.

I could run some other non-psychopy display benchmarking tool…

I ran a free, legacy version of 3D Mark Vantage for benchmarking the graphics hardware. The 7010 was only able to maintain about 4 fps while the 7020 was able to maintain about 15fps, so it does look like a big difference in GPU power. But then, I’d be pretty surprised if it took a lot of GPU power to print a single word on a black screen.

I’m going to finish falling back to PsychoPy 1.84. Thanks for your attention, and I’d like to help you debug, but for now I need to be able to collect my data.

Well, one possibility that springs to mind is that I think we now turn on “Frame Buffer Objects” by default whereas I think that was off by default back in 1.84. Although FBOs aren’t exactly fancy by modern graphics card standards, they might be something that your card doesn’t support very well (intel graphics chips were shocking and only recently became usable at all). I could believe that the card has come across the FBO and been crippled.

I’m afraid we haven’t given an option to turn that off in the builder interface directly, but you could test by exporting your exp to a python script and then tweaking the line where the Window is created. Search for useFBO and set that to False.

Version 1.84 and versions 3.x can be installed simultaneously so if 1.84 works on these machines that would be easy enough to test/use. i.e. you won’t need to remove 3.2 in order to downgrade.

Then, if we can confirm that the FBO is the source of the issue, I’ll add in some way to turn it off more easily

Okay. I’ll try reinstalling 3.x, toggling FBO, and running the tasks when I return from Thanksgiving break in a week and a half. I’ll let you know what happens!

1 Like

Yep, it looks like FBO is the cause of my issue. When I set useFBO = False, things work just fine, and when I set useFBO = True, I get the massive display lag. Thanks for following up, and I hope this is useful info.