• Alex Holcombe
• Testing Booth Calendar
• Skills Checklist
Precautions to avoid timing problems
- Having a USB external hard drive connected as OSX's TimeMachine drive can take about 3 ms every 10-20 trials.
- Best to disconnect one's Ethernet cable
- When using two screens, the presence of the mouse polling and other things for the second screen can also cause timing hiccups. Try to use one screen- on a laptop, close the main LCD screen and wake the machine from sleep with just the second screen by connecting an external keyboard or mouse and clicking.
- May want to quit finder. To do so manually, you can enable Quit in the Finder menu by entering this at the terminal:
defaults write com.apple.Finder QuitMenuItem 1
Then, include these lines in a python script to quit the Finder automatically before you execute your program:
import os applescript="\'tell application \"Finder\" to quit\'" shellCmd = 'osascript -e '+applescript os.system(shellCmd)
- Give your process a higher unix kernel priority
Put this in your psychopy code:
new_nice = -20 sysErr = os.system("sudo renice -n %s %s" % (new_nice, os.getpid())) if sysErr: print 'Warning: Failed to renice, probably you arent authorized as superuser'
With new_nice set to -20 you'll get maximum priority (negative niceness means not very nice for other processes). Unfortunately, you need be sudo for this so you need to type in the password each time. For most cases I doubt that's worth the hassle.
Read the tips on the psychopy wiki here also , also 
To create custom resolutions and refresh rate modes for the screen if not available in System Preferences->Displays, use DisplayConfigX
Ideally, your program synchronizes drawing of the stimulus with the refresh of the CRT. To do this, you have to use particular techniques for drawing. Psychopy has some code included for checking interframe intervals with the system clock, see this page on the psychopy wiki
Once you think you've done it properly, best to further verify that stim drawing is synchronized with the CRT.
- Use the tachometer (after extensive - and somewhat repetitive - testing of the tachometer, it looks like it is not a very useful tool for this task. It simply measures the refresh rate of the screen as a function of the non-white frames that are displayed).
- It lives in a box on the shelf of the lab
- If you still want to use the Tachometer, insert the batteries (AA, 1.5V), slide the switch on the front to 'RPM' and press the square button on the side to turn on the laser.
- If you aim the laser at the flickering object (In this case the stimulus on the screen) it will automatically give you a reading in revolutions per minute. This is equivalent to frames per minute (I.e. 3600 rpm is 60fps). Note that black frames are effectively ignored (for some unknown reason).
- Pressing the mem button on the front will give you the highest, lowest and last readings that the tachometer made (you need to press it three times).
- Please remove the batteries from the tachometer once you've finished using it. There is a white-handled screw driver in the tool tray, otherwise, ask ICT staff for one.
- Use an oscilloscope
- Visually verify that no screen refreshes are missed
- e.g. my screenRefreshTest.py program exchanges the location of a black and white circle, one off screen and one on screen, every frame. Viewing the display, if any frames are missed, screen flicker should visibly stutter. Fortunately even at 160 Hz 800 by 600, frames are never missed until I try to draw about 10 circles every frame
Here Media:AudioAndUSBnotesWithPython.oo3 is the file with all my notes on different ways to play a sound in Python and the associated latencies and standard deviations of the latencies--Alex O. Holcombe 05:15, 25 June 2008 (UTC)
We used the oscilloscope to measure audiovisual synchrony using this stimulus: The results are in this table:File:CheckingSynchr.xls