Skip to content

Instantly share code, notes, and snippets.

View smathot's full-sized avatar

Sebastiaan Mathot smathot

View GitHub Profile
@smathot
smathot / gist:2709074
Created May 16, 2012 09:33
OpenSesame script to draw mouse cursor
from openexp.mouse import mouse
from openexp.canvas import canvas
# Uncomment for 0.25 and earlier
# exp = self.experiment
# The name of the sketchpad item to draw the cursor on
src_sketchpad = 'my_sketchpad'
# The size of the cursor crosshair
@smathot
smathot / tutorial_forum.txt
Created August 28, 2012 21:01
Tutorial forum.cogsci.nl
For security reasons, the script-based embedding does
not work, but you can embed snippets using the
following syntax:
[gist:(your gist id)]
You can find your gist id in the URL of your
gist. If the URL is:
https://gist.github.com/2709074
The following code embeds the paste into your forum
@smathot
smathot / form_example_1.txt
Created August 31, 2012 13:02
Form example 1
# Margins are defined as "top;right;bottom;left". Each value corresponds to a
# margin in pixels.
set margins "50;100;50;100"
# The spacing is simply a value in pixels.
set spacing "25"
# The sizes of the rows are relative. "1;2;1" means that there are three rows,
# where the middle one is twice as large as the bottom and top ones. So "1;2;1"
@smathot
smathot / opensesame_script_syntax.txt
Created August 31, 2012 15:48
OpenSesame script syntax
OPENSESAME SCRIPT SYNTAX
========================
1 ABOUT OPENSESAME SCRIPT
=========================
OpenSesame script is a simple definitional language that defines an experiment. It is not a full fledged programming language. The OpenSesame script is interpreted by an OpenSesame runtime environment.
2 GENERAL REMARKS
=================
@smathot
smathot / opensesame_form_rating_scales.txt
Created August 31, 2012 16:28
OpenSesame form rating scales example
set rows "1;1;1;1;1"
set cols "1;1"
widget 0 0 2 1 label text="Indicate how much you agree with the following statements"
widget 0 1 1 1 label center="no" text="Forms are easy"
widget 1 1 1 1 rating_scale var="question1" nodes="Agree;Don't know;Disagree"
widget 0 2 1 1 label center="no" text="I like data"
widget 1 2 1 1 rating_scale var="question2" nodes="Agree;Don't know;Disagree"
widget 0 3 1 1 label center="no" text="I like questionnaires"
widget 1 3 1 1 rating_scale var="question3" nodes="Agree;Don't know;Disagree"
widget 0 4 2 1 button text="Next"
@smathot
smathot / trigger_test.py
Created September 2, 2012 11:59
Trigger test
# Create a canvas to show info on screen
from openexp.canvas import canvas
canvas = canvas(self.experiment)
from ctypes import windll, c_ubyte
io = windll.dlportio # requires dlportio.dll !!!
# Define port:
port = 0x4cf8
# Execute the script below twice, once in the old way, once in the
# newly-suggested way:
for change_to_ubyte in (False, True):
@smathot
smathot / text_formatting.html
Created September 3, 2012 17:05
Text formatting in OpenSesame
OpenSesame supports a sub-set of HTML tags:
- <b>Bold face</b>
- <i>Italic</i>
- <u>Underline</u>
In addition, you can pass 'color', 'size', and 'style' as keywords to a 'span' tag:
- <span color="red">Color</span>
- <span size="32">Font size</span>
- <span style="serif" mce_style="serif">Font style</span>
@smathot
smathot / forum_script.py
Created September 18, 2012 15:00
Forum help script
# Ref: <http://forum.cogsci.nl/discussion/198>
# This script should be placed in the prepare phase of an inline_script, before
# the open_question item.
#
# First retrieve the full path to a file called 'question.txt' in the file pool
path = exp.get_file('question.txt')
# Read the entire contents of the file.
question = open(path).read()
# Set the variable, so that the open_question item can use it.
exp.set('_question', question)
@smathot
smathot / gist:3840902
Created October 5, 2012 16:40
Expyriment presentation time test
from expyriment import stimuli, control, design
import time
from random import randint
control.defaults.initialize_delay = 0
control.defaults.open_gl = True
exp = design.Experiment()
control.initialize(exp)
l = []
@smathot
smathot / xpyriment_timing_check.opensesame
Created November 30, 2012 16:43
Expyriment timing check
# Generated by OpenSesame 0.27~pre31 (Frisky Freud)
# Fri Nov 30 17:42:30 2012 (posix)
# <http://www.cogsci.nl/opensesame>
set foreground "white"
set subject_parity "even"
set font_size "18"
set description "Default description"
set title "Xpyriment timing check"
set font_bold "no"