psychopy.org | Reference | Downloads | Github

Complete refresh rate cycle done in miliseconds

timing
#1

The refresh rate of my laptop’s monitor is 60Hz (running ‘’‘xrandr’’’ on the terminal), however, 60 iterations using win.flip() are done in ~ 0.04 seconds. I’m using a Dell 15 N5110 laptop running Ubuntu 16.04. The GPU is an NVIDIA GeForce GT 525M/PCIe/SSE2. Python 2.7.16 and Psychopy 3.0.7.

Unchecking ‘Sync to Vblank’ on NVIDIA X SERVER Settings does not solve the problem. Adding waitBlanking=False to the Window() call neither.

The final getTime() of the following code outputs around 0.04.

from psychopy.core import Clock
from psychopy.visual import Window

win = Window()

timer = Clock()
for frameN in range(60):
    win.flip()
    print 'Frame: ' + str(frameN)
    print 'Time: ' + str(timer.getTime())
    
print 'Final time: ' + str(timer.getTime())
0 Likes

#2

And that is with the print() statements slowing everything down… it would presumably be even faster if you were storing these values in memory or using logging commands.

I guess this is the perennial issues of graphics driver support on Linux.
What are the results of running PsychoPy’s benchmark wizard and the timeByFrames.py demo?

0 Likes

#3

Here’s the output:

Console output:
‘’’
pygame 1.9.5

Hello from the pygame community. https://www.pygame.org/contribute.html

main:19: UserWarning:

This call to matplotlib.use() has no effect because the backend has already

been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot,

or matplotlib.backends is imported for the first time.

The backend was originally set to ‘module://ipykernel.pylab.backend_inline’ by the following code:

File "/home/nic/anaconda3/envs/py27/lib/python2.7/runpy.py", line 174, in _run_module_as_main

"main", fname, loader, pkg_name)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/runpy.py", line 72, in _run_code

exec code in run_globals

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/spyder_kernels/console/main.py", line 11, in <module>

start.main()

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/spyder_kernels/console/start.py", line 298, in main

kernel.initialize()

File "</home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/decorator.pyc:decorator-gen-121>", line 2, in initialize

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error

return method(app, *args, **kwargs)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 485, in initialize

self.init_code()

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/IPython/core/shellapp.py", line 266, in init_code

self._run_exec_lines()

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/IPython/core/shellapp.py", line 292, in _run_exec_lines

self.shell.run_cell(line, store_history=False)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/ipykernel/zmqshell.py", line 537, in run_cell

return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2724, in run_cell

self.events.trigger(‘post_run_cell’)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/IPython/core/events.py", line 74, in trigger

func(*args, **kwargs)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/ipykernel/pylab/backend_inline.py", line 164, in configure_once

activate_matplotlib(backend)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/IPython/core/pylabtools.py", line 315, in activate_matplotlib

matplotlib.pyplot.switch_backend(backend)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/pyplot.py", line 231, in switch_backend

matplotlib.use(newbackend, warn=False, force=True)

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/init.py", line 1422, in use

reload(sys.modules[‘matplotlib.backends’])

File "/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/backends/init.py", line 16, in <module>

line for line in traceback.format_stack()

0.4625 WARNING Monitor specification not found. Creating a temporary one…
0.4634 WARNING User requested fullscreen with size [1280 1024], but screen is actually [1366, 768]. Using actual size
0.9447 WARNING t of last frame was 2.08ms (=1/481)
0.9462 WARNING t of last frame was 1.49ms (=1/669)
0.9476 WARNING t of last frame was 1.41ms (=1/711)
0.9490 WARNING t of last frame was 1.41ms (=1/709)
0.9505 WARNING Multiple dropped frames have occurred - I’ll stop bothering you about them!

/home/nic/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/axes/_axes.py:6571: UserWarning: The ‘normed’ kwarg is deprecated, and has been replaced by the ‘density’ kwarg.

warnings.warn("The ‘normed’ kwarg is deprecated, and has been "
‘’’

0 Likes

#4

Unless your screen is running at > 500 Hz, your graphics card is not successfully set to sync to the vertical blank. PsychoPy requires this to be set, and the window should be created with waitBlanking set to True (the default).

0 Likes