Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Program for Visual Reaction Time

Tags:

python

I'm not a programmer. I am doing a project for Biology where I will be conducting an experiment on reaction times. Briefly, the subject should click anywhere on the screen as soon as a dot or circle (some graphic) appears on the screen.

Details:

  1. Program must start at a set clock time (e.g. 16:03:00) which will be typed in every time
  2. Timer must start when program starts (t=0)
  3. Graphics will appear at the same point (coordinates) according to pre-determined times relative to start (e.g., 1.5s, 2s, 3.5s, ...) for 2 minutes.
  4. Each time the subject presses the mouse, the time relative to the timer must be recorded.

Afterward, I will just tabulate the data on a spreadsheet and calculate the time differences between the time the graphic appears and the time the subject presses the mouse.

I have very limited knowledge of Python. I've never done anything with graphics on Python. This is the best set up I can think of for my needs.

I did some research and this is what I've found so far:

  • For the graphics: Pyglet has a built in scheduling function (pyglet.clock.schedule_interval)
  • I can use either time.time or time.clock for measuring reaction times. I am kind of confused over which one to use. It seems there is some subtle difference that I'm not understanding.

Please also not that the program may be run on a windows 7 PC or a MacBook.

I don't need a complete answer. Just some suggestions and tips to point me in the right direction for further research. Thanks.

like image 395
Jey Avatar asked Nov 12 '12 19:11

Jey


1 Answers

You can use Pygame for graphics (drawing a dot on screen etc).

You can use datetime to capture the start time:

from datetime import datetime

Time = datetime.now()

print(Time)

Pyhook will capture mouse movements.

like image 174
Ank Avatar answered Oct 20 '22 23:10

Ank