Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Timing check for OpenSesame Psycho Backend
# Generated by OpenSesame 0.25 (Dashy Darwin)
# Wed Jan 25 11:28:24 2012 (posix)
# Copyright Sebastiaan Mathot (2010-2011)
# <>
set foreground "white"
set subject_parity "even"
set description "Default description"
set title "New experiment"
set sampler_backend "legacy"
set coordinates "relative"
set height "768"
set mouse_backend "psycho"
set width "1024"
set compensation "0"
set keyboard_backend "psycho"
set background "black"
set subject_nr "0"
set canvas_backend "psycho"
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
from openexp.canvas import canvas
from psychopy import visual
import numpy as np
speed = 2 # Rotation speed
soa = 50 # SOA
# Create a canvas with a simple sinusoid grating
stim = visual.PatchStim(self.experiment.window, sf=.05, size=100)
my_canvas = canvas(self.experiment)
# Rotate the canvas and record timestamps
l = []
for ori in range(0, 360, speed):
# Determine the actual SOA
_l = []
for i in range(len(l)-1):
# Calculate the mean SOA and the standard deviation
a = np.array(_l)
m = a.mean()
std = a.std()
# Report the results
txt = visual.TextStim(self.experiment.window, 'M=%.2f, STD=%.2f' % (m, std))
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