[visionegg] Re: timing of button responses in visionegg

  • From: "Christophe Pallier" <christophe@xxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Thu, 2 Aug 2007 12:59:12 +0200

Hello,

On 8/2/07, alxwhite@xxxxxxxxxxxxxxxxx <alxwhite@xxxxxxxxxxxxxxxxx> wrote:
>
> Hello visionegg experts,
>
> I am starting an experiment programmed in Python in which I need to
> precisely measure the time of a response made by the subject. We fear that
> with the mouse button or keyboard button of our macintosh G4 powerbook,
> timing variability will be too high. Has anyone struggled with this issue?
> We have a Cedrus response pad but no idea how to integrate it with our
> python program using the USB port. Any advice on that? We're also
> considering using a joystick.


With pygame, you can detect when a button is pressed on a gamepad.
Small example:

###
import sys, pygame
from pygame.locals import *

pygame.init()

size = 800, 600

screen = pygame.display.set_mode(size)

njoy = pygame.joystick.get_count()
print "Number of joysticks connected to the computer = ",njoy

for j in range(njoy):
    gamepad = pygame.joystick.Joystick(j)
    gamepad.init()
    print "Joystick #",j+1,"(",gamepad.get_name(),")"
    print " nb of buttons = ", gamepad.get_numbuttons()
    print " nb of mini joysticks = ", gamepad.get_numhats()
    print " nb of trackballs = ", gamepad.get_numballs()


while 1:
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()
        if event.type == JOYBUTTONDOWN: print "clic"

pygame.quit()
##########



This should be an issue that many have dealt with when measuring RTs and
> the like, so I hope someone out there knows the answer and that when it
> comes it will be of use to the rest.



Indeed,you will find papers in Behavior Research Method Instruments and
Computer about the precision of RT measure with keyboards and mouses. The
accuracy depends on the maker, the drivers, the operating system, the
program, the other programs running,...

In many cases, the human response time variance is much larger (e.g. ~150 ms
in some detection tasks) than the variance due to errors of measurment.
Therefore, you do not need millisecond precision to estimate the average RT
of a human subject in an experimental condition.

Yet, if you really need/want to check the timing of your equipment, you may
be interested in an apparatus like the blackbox toolkit (
http://www.blackboxtoolkit.co.uk/).


Christophe


-- 
Christophe Pallier (http://www.pallier.org)

Other related posts: