Created
February 8, 2012 09:56
-
-
Save smathot/1767560 to your computer and use it in GitHub Desktop.
Timing check for OpenSesame Legacy Backend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generated by OpenSesame 0.25 (Dashy Darwin) | |
# Wed Feb 8 10:55:36 2012 (posix) | |
# | |
# Copyright Sebastiaan Mathot (2010-2011) | |
# <http://www.cogsci.nl> | |
# | |
set foreground "white" | |
set subject_parity "even" | |
set description "Default description" | |
set title "Legacy timing check" | |
set compensation "0" | |
set coordinates "relative" | |
set height "768" | |
set mouse_backend "legacy" | |
set width "1024" | |
set sampler_backend "legacy" | |
set keyboard_backend "legacy" | |
set background "black" | |
set subject_nr "0" | |
set canvas_backend "legacy" | |
set start "experiment" | |
set synth_backend "legacy" | |
define keyboard_response keyboard_response | |
set description "Collects keyboard responses" | |
set timeout "infinite" | |
set flush "yes" | |
define sequence experiment | |
set flush_keyboard "yes" | |
set description "Runs a number of items in sequence" | |
run timing_check "always" | |
run keyboard_response "always" | |
define inline_script timing_check | |
___run__ | |
from openexp.canvas import canvas | |
import numpy as np | |
speed = 2 # Rotation speed | |
soa = 50 # SOA | |
my_canvas1 = canvas(self.experiment) | |
my_canvas1.circle(my_canvas1.xcenter()+100, my_canvas1.ycenter(), 50) | |
my_canvas2 = canvas(self.experiment) | |
my_canvas2.circle(my_canvas2.xcenter()-100, my_canvas2.ycenter(), 50) | |
# Rotate the canvas and record timestamps | |
l = [] | |
for i in range(0, 100): | |
l.append(my_canvas1.show()) | |
self.sleep(soa) | |
l.append(my_canvas2.show()) | |
self.sleep(soa) | |
# Determine the actual SOA | |
_l = [] | |
for i in range(len(l)-1): | |
_l.append(l[i+1]-l[i]) | |
# Calculate the mean SOA and the standard deviation | |
a = np.array(_l) | |
m = a.mean() | |
std = a.std() | |
# Report the results | |
my_canvas1.clear() | |
my_canvas1.text('M=%.2f, STD=%.2f' % (m, std)) | |
my_canvas1.show() | |
__end__ | |
set _prepare "" | |
set description "Executes Python code" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment