---
API: 2
OpenSesame: 3.1.9b1
Platform: posix
---
set width 1024
set uniform_coordinates yes
set title "New experiment"
set subject_parity even
set subject_nr 0
set start experiment
set sound_sample_size -16
set sound_freq 48000
set sound_channels 2
set sound_buf_size 1024
set round_decimals 2
set height 768
set fullscreen no
set form_clicks no
set foreground white
set font_underline no
set font_size 18
set font_italic no
set font_family mono
set font_bold no
set experiment_path "/home/ede/Desktop"
set disable_garbage_collection yes
set description "The main experiment item"
set coordinates uniform
set compensation 0
set canvas_backend xpyriment
set bidi no
set background black
define sequence experiment
set flush_keyboard yes
set description "Runs a number of items in sequence"
run getting_started always
run welcome always
run new_inline_script always
run new_inline_script_1 always
run new_feedback always
define notepad getting_started
__note__
Welcome to OpenSesame 3.1 "Jazzy James"!
If you are new to OpenSesame, it is a good idea to follow one of the tutorials,
which can be found on the documentation site:
-
You can also check out the examples. These can be opened via:
- Menu -> Tools -> Example experiments.
And feel free to ask for help on the forum:
-
Have fun with OpenSesame!
__end__
set description "A simple notepad to document your experiment. This plug-in does nothing."
define feedback new_feedback
set reset_variables yes
set duration keypress
set description "Provides feedback to the participant"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="[Response]" x=0 y=-32 z_index=0
define inline_script new_inline_script
set description "Executes Python code"
___run__
import random
import numpy as np
from numpy import random as nprand
def create_matrix():
# determine the random number of ones and zeros to be put into the lists
c0_min = 20 # minimal number of zeros
c0_var = 5 # range of possible additional zeros
c0 = int(nprand.rand()*c0_var + c0_min) # count of zeros
c1_min = 20 # ones
c1_var = 20
c1 = int(nprand.rand()*c1_var + c1_min) # count of zeros
# construct a long list with ones and zeros of random order
# items
items = [0,]*c0 + [1,]*c1
random.shuffle(items)
# determine the length of the rows 1-4
# there is a minimal length + a variable length
# len of rows
lmin = 10
rowcount = 4
spacemax = 5
# determine the number of characters that are freely assignable (total number minus minimal length)
l_temp = c0+c1-lmin*rowcount # variable assignable characters
# divide residual characters with respect to random weights among the rows
l_weights = nprand.rand(4)
l_weights = l_temp*l_weights/sum(l_weights)
s_count = nprand.randint(0,spacemax,4)
# calculate the final lengths of the rows
r1 = lmin + int(l_weights[0])
r2 = lmin + int(l_weights[1])
r3 = lmin + int(l_weights[2])
r4 = lmin + int(l_weights[3])
# construct the strings by iterating the previously shuffled character list
s1 = ''.join([str(i) for i in [' ', ]*s_count[0] + items[:r1]]) + "\n"
s2 = ''.join([str(i) for i in [' ', ]*s_count[1] + items[r1:(r1+r2)]]) + "\n"
s3 = ''.join([str(i) for i in [' ', ]*s_count[2] + items[(r1+r2):(r1+r2+r3)]]) + "\n"
s4 = ''.join([str(i) for i in [' ', ]*s_count[3] + items[(r1+r2+r3):]])
# return row 1-4, number of zeros, number of ones.
return {"rows": s1+s2+s3+s4, "c0":c0, "c1":c1}
m = create_matrix()
print m["rows"]
var.grid = m["rows"]
# this is mockup code
tmarker = 10
timer = 5
print m['c0']
var.kbresponse = int()
# end of mockup code
var.h = str(m["c0"])
#m["c0"] = count zero,..
__end__
set _prepare ""
define inline_script new_inline_script_1
set description "Executes Python code"
___run__
from libopensesame import widgets
form = widgets.form(exp, cols=[1,1], rows=[1,1,1,1,1])
title = widgets.label(form,
text='Indicate how much you agree with the following statement')
question1 = widgets.label(form, text=var.grid, center=False)
nextButton = widgets.button(form, text='Next')
form.set_widget(title, (0,0), colspan=2)
form.set_widget(question1, (0,0))
form.set_widget(nextButton, (0,4), colspan=2)
form._exec
var.Q = widgets.label(form, text="Wieviele Nullen befinden sich in dem Zahlenblock:", center=False)
var.text_input = widgets.text_input(form, var='Response',
return_accepts=False)
form.set_widget(var.text_input, (0,3))
form.set_widget(var.Q, (0,2))
form._exec()
print 'hello' + str(var.Response)
__end__
set _prepare ""
define sketchpad welcome
set start_response_interval no
set reset_variables no
set duration keypress
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family=serif font_italic=no font_size=32 html=yes show_if=always text="OpenSesame 3.1 Jazzy James" x=0 y=0 z_index=0