. . .
#include <simple-rt1.py>
. . .
import pygame
pygame.init()
screen = pygame.display.set_mode((640, 400))
while True:
event = pygame.event.wait()
if event.type == pygame.QUIT:
break
print(pygame.event.event_name(event.type))
pygame.quit()
(you can skim through the tutorial at http://lorenzod8n.wordpress.com/2007/05/30/pygame-tutorial-3-mouse-events/ ) to understand pygame’s mouse events. Now, modify the previous code so that the dot remains on the screen until you press a mouse button.
. . .
#include <simple-rt2.py>
. . .
. . .
#include <simple-rt2b.py>
. . .
. . .
#include <simple-rt3.py>
. . .
Launch spyder. Go to the console window, in the options, set the working directory to the directory that contains reaction-times.csv. Type the following commands:
f = open('reaction-times.csv')
l = []
for line in f:
l.append(int(line))
l
plot(l)
hist(l)
mean(l)
median(l)
. . .
#include <simple-rt4.py>
. . .
Change the size of the dot so that it is 10 times bigger than previously. Rerun the experiment. How is your reaction times affected?
Now, change the contrast of the dot with the background (make it grey rather than white). How is your reaction times affected?
Modify the previous program so that the color of target is randomly chosen between blue and red (with equal probability) at each trial. You still use only one response button.
The task is to now to take a decision: one mouse button is assigned to blue and another one to red (if you only have one mouse button, use 2 keys and the KEYDOWN event). In the results file, save both the button pressed and the reaction times (on row per trial). Compare decision times to simple reaction times.
Modify the program so that the dot can appear (randomly) at one of two locations far on the left or far on the right of the center. How is your reaction time affected?
(advanced): Modify the simple detection program so that the contrast can be modified at each trial. Write the program to find the threshold of detection of the do.