Skip to content

Instantly share code, notes, and snippets.

@smathot
Created March 15, 2016 09:47
Show Gist options
  • Save smathot/4c207d509dd7e078680d to your computer and use it in GitHub Desktop.
Save smathot/4c207d509dd7e078680d to your computer and use it in GitHub Desktop.
Version KO
---
API: 2
OpenSesame: 3.0.6
Platform: posix
---
set width 1024
set transparent_variables "no"
set title "KidsTest"
set synth_backend "legacy"
set subject_parity "even"
set subject_nr 0
set start "experiment"
set sampler_backend "legacy"
set mouse_backend "legacy"
set keyboard_backend "legacy"
set height 768
set foreground "white"
set font_size 18
set font_italic "no"
set font_family "serif"
set font_bold "no"
set experiment_path "/Users/Nicolas/Desktop"
set description "Default description"
set coordinates "relative"
set compensation 0
set canvas_backend "legacy"
set background "#ffffff"
define inline_script Code1
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
trigger = serial.Serial('/dev/tty.usbmodem1421') # port serie mac
cpt=0
t0 = self.time()
img=exp.get('image')
xpos=exp.get('position')
condition=exp.get('condition')
ypos=0
response=exp.get('reponse')
if condition=='cong':
trig_value='B'
else:
trig_value='C'
trigger.write(trig_value) # pousse le trigger sur le boitier arduino
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
__end__
set _prepare ""
define sketchpad Fixation
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define inline_script Start
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur')
fleur = widgets.button(form, text='fleur')
both = widgets.button(form, text='random')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define sketchpad StimulationRandom
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="fix.png" scale=0.2 show_if=always x=0 y=0 z_index=0
draw image center=1 file="[image]" scale=0.2 show_if=always x="[position].0" y=0 z_index=0
define sketchpad ____________________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ____________________________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ____________________________________sketchpad_1_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ___________________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ___________________________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ___________________________________sketchpad_1_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad __________________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad __________________________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad __________________________________sketchpad_1_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _________________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne3.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _________________________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne3.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _________________________________sketchpad_1_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne3.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ________________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ________________________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ________________________________sketchpad_1_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _______________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _______________________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ______________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne2.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ______________________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne2.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _____________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _____________________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ____________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ___________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad __________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ________________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _______________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne3.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ______________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad _____________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne2.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ____________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad ___________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_presentation.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad __________________sketchpad
set reset_variables "no"
set duration 500
set description "Displays stimuli"
define sketchpad _________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_mix_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad _________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_mix_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad _________________sketchpad_1_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_mix_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad ________________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_flower_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad ________________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_flower_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad ________________sketchpad_1_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_flower_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad _______________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_heart_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad _______________sketchpad_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_heart_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad ______________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_mix_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define inline_script _____________inline_script
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
condition=exp.get('condition')
bloc=exp.get('bloc')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('None W%s W%d W%s W%d W%d WNC WNC'\
% (response, response_time, condition, bloc, xpos))
__end__
set _prepare ""
define inline_script _____________inline_script_1
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
condition=exp.get('condition')
bloc=exp.get('bloc')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('None W%s W%d W%s W%d W%d WNC WNC'\
% (response, response_time, condition, bloc, xpos))
__end__
set _prepare ""
define inline_script _____________inline_script_1_1
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
condition=exp.get('condition')
bloc=exp.get('bloc')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('None W%s W%d W%s W%d W%d WNC WNC'\
% (response, response_time, condition, bloc, xpos))
__end__
set _prepare ""
define sketchpad _____________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_flower_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define inline_script ____________inline_script
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur')
fleur = widgets.button(form, text='fleur3')
both = widgets.button(form, text='random')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define inline_script ____________inline_script_1
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur')
fleur = widgets.button(form, text='fleur4')
both = widgets.button(form, text='random')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define inline_script ____________inline_script_1_1
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur')
fleur = widgets.button(form, text='fleur')
both = widgets.button(form, text='random')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define sketchpad ____________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_heart_end.jpg" scale=1 show_if=always x=0 y=0 z_index=0
define inline_script ___________inline_script
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
condition=exp.get('condition')
bloc=exp.get('bloc')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('None W%s W%d W%s W%d W%d WNC WNC'\
% (response, response_time,condition, bloc, xpos))
__end__
set _prepare ""
define inline_script ___________inline_script_1
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
condition=exp.get('condition')
bloc=exp.get('bloc')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('None W%s W%d W%s W%d W%d WNC WNC'\
% (response, response_time,condition, bloc, xpos))
__end__
set _prepare ""
define inline_script ___________inline_script_1_1
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
condition=exp.get('condition')
bloc=exp.get('bloc')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('None W%s W%d W%s W%d W%d WNC WNC'\
% (response, response_time,condition, bloc, xpos))
__end__
set _prepare ""
define sketchpad ___________sketchpad
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define sketchpad ___________sketchpad_1
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define sketchpad ___________sketchpad_1_1
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define inline_script __________inline_script
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur3')
fleur = widgets.button(form, text='fleur')
both = widgets.button(form, text='random')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define inline_script __________inline_script_1
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur')
fleur = widgets.button(form, text='fleur')
both = widgets.button(form, text='random')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define sketchpad __________sketchpad
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define sketchpad __________sketchpad_1
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define sketchpad __________sketchpad_1_1
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define inline_script _________inline_script
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur')
fleur = widgets.button(form, text='fleur')
both = widgets.button(form, text='random2')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define sketchpad _________sketchpad
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define sketchpad _________sketchpad_1
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define inline_script ________inline_script
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
condition=exp.get('condition')
bloc=exp.get('bloc')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('None W%s W%d W%s W%d W%d WNC WNC' \
% (response, response_time,condition, bloc, xpos))
__end__
set _prepare ""
define inline_script ________inline_script_1
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
condition=exp.get('condition')
bloc=exp.get('bloc')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
if response==pygame.key.name(event.key):
exact=1
else:
exact=0
if response_time<200:
anticip='ant'
else:
anticip='ok'
exp.log('%s W%s W%d W%s W%d W%d W%d W%s'\
% (pygame.key.name(event.key),response, response_time,condition, bloc, xpos, exact, anticip))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('None W%s W%d W%s W%d W%d WNC WNC' \
% (response, response_time,condition, bloc, xpos))
__end__
set _prepare ""
define sketchpad ________sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_ready.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define inline_script _______inline_script
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur2')
fleur = widgets.button(form, text='fleur2')
both = widgets.button(form, text='random')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define sequence _______sequence
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_5 always
run ___________sketchpad always
run _____________inline_script always
define sequence _______sequence_1
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_5_1 always
run ___________sketchpad_1 always
run _____________inline_script_1 always
define sequence _______sequence_1_1
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_5_1_1 always
run ___________sketchpad_1_1 always
run _____________inline_script_1_1 always
define sketchpad _______sketchpad
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define inline_script ______inline_script
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur2')
fleur = widgets.button(form, text='fleur')
both = widgets.button(form, text='random')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define sequence ______sequence
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_3 always
run __________sketchpad always
run ___________inline_script always
define sequence ______sequence_1
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_3_1 always
run __________sketchpad_1 always
run ___________inline_script_1 always
define sequence ______sequence_1_1
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_3_1_1 always
run __________sketchpad_1_1 always
run ___________inline_script_1_1 always
define sketchpad ______sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
define sequence _____sequence
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_1 always
run _________sketchpad always
run ________inline_script always
define sequence _____sequence_1
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_1_1 always
run _________sketchpad_1 always
run ________inline_script_1 always
define sketchpad _____sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne3.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define inline_script ____inline_script
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
xpos=exp.get('position')
condition=exp.get('condition')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_'+img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
#exp.log('key=%s wanted=%s rt=%d img=%s'\
#% (pygame.key.name(event.key),response, response_time,img))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
#exp.log('key=%s wanted=%s rt=%d img=%s'\
#% (pygame.key.name(event.key),response, response_time,img))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
#if rep_flag==0:
#exp.log('None %s %d %s'\
#% (response, response_time,img))
#if rep_flag==0:
#exp.log('key=0 wanted=%s rt=%d img=%s'\
#% (response, response_time,img))
__end__
set _prepare ""
define sequence ____sequence
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script always
run _______sketchpad always
run Code1 always
define sketchpad ____sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne2.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define inline_script ___inline_script
set description "Executes Python code"
___run__
import pygame
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
xpos=exp.get('position')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfb=exp.get_file('feedback_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
while totaltime<1700:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='left':
rep_flag=1
exp.log('key=%s wanted=%s rt=%d img=%s'\
% (pygame.key.name(event.key),response, response_time,img))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfb,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
badson.play()
if pygame.key.name(event.key)=='right':
rep_flag=1
exp.log('key=%s wanted=%s rt=%d img=%s'\
% (pygame.key.name(event.key),response, response_time,img))
if response == pygame.key.name(event.key):
fbson.play()
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfb,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
else:
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
if rep_flag==0:
exp.log('key=0 wanted=%s rt=%d img=%s'\
% (response, response_time,img))
__end__
set _prepare ""
define sequence ___sequence
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
define sketchpad ___sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne1.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad __affichage
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne4.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad __affichage_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne4.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sketchpad __affichage_1_1
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne4.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define inline_script __inline_script
set description "Executes Python code"
___run__
import pygame
import serial
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
xpos=exp.get('position')
condition=exp.get('condition')
ypos=0
response=exp.get('reponse')
son_ok=exp.get_file('pos_feedback.wav')
son_ko=exp.get_file('neg_feedback.wav')
fbson=pygame.mixer.Sound(son_ok)
badson=pygame.mixer.Sound(son_ko)
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path=exp.get_file(img)
imgfbok=exp.get_file('feedbackok_' +img)
imgfbko=exp.get_file('feedbackko_' +img)
cross=exp.get_file('cross150bis.png')
my_canvas.image(cross,x=my_canvas.xcenter(),scale=1)
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.rect(0, 0, 40, 40, fill=True,color=u'black')
my_canvas.rect(10, 10, 20, 20, fill=True,color=u'white')
my_canvas.show()
totaltime=self.time()-t0
rep_flag=0
pygame.event.clear()
while totaltime<2500:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN and rep_flag==0:
if pygame.key.name(event.key)=='l':
rep_flag=1
#exp.log('key=%s wanted=%s rt=%d img=%s'\
#% (pygame.key.name(event.key),response, response_time,img))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if pygame.key.name(event.key)=='r':
rep_flag=1
#exp.log('key=%s wanted=%s rt=%d img=%s'\
#% (pygame.key.name(event.key),response, response_time,img))
if response == pygame.key.name(event.key):
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbok,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
fbson.play()
else:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
if response_time >=2500 and rep_flag==0:
my_canvas.image(cross,x=my_canvas.xcenter(),scale=0.2)
my_canvas.image(imgfbko,x=my_canvas.xcenter()+xpos,scale=0.30)
my_canvas.show()
badson.play()
timedown=self.time()
#t0=9500
#pygame.quit()
#if rep_flag==0:
#exp.log('None %s %d %s'\
#% (response, response_time,img))
#if rep_flag==0:
#exp.log('key=0 wanted=%s rt=%d img=%s'\
#% (response, response_time,img))
__end__
set _prepare ""
define sequence __sequence
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run _sketchpad always
run ___inline_script always
define sketchpad __sketchpad
set reset_variables "no"
set duration "[stim_duration]"
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
draw rect color="#000000" fill=1 h=40 penwidth=1 show_if=always w=40 x=-512 y=-384 z_index=0
define sketchpad _affichage
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne4.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define inline_script _inline_script
set description "Executes Python code"
___run__
import pygame
from openexp.keyboard import keyboard
from openexp.canvas import canvas
my_canvas = canvas(exp)
pygame.init()
#my_canvas.fixdot()
cpt=0
t0 = self.time()
img=exp.get('image')
xpos=exp.get('position')
# Determine the absolute path:
my_canvas.text('<font size="100"> +</font>',color='black',x=my_canvas.xcenter(),html=True)
#my_canvas.fixdot(x=my_canvas.xcenter(),style=str('large-cross'))
path = exp.get_file(img)
cross=exp.get_file('cross150.png')
my_canvas.image(cross,x=my_canvas.xcenter())
my_canvas.image(path,x=my_canvas.xcenter()+xpos,scale=0.2)
my_canvas.show()
totaltime=self.time()-t0
while totaltime<10000:
#my_canvas.clear()
#fenetre.fill(BLACK)
n=0
totaltime=self.time()-t0
response_time=self.time()-t0
for event in pygame.event.get():
# Print KEYDOWN and KEYUP events, including the key name
# and the RT.
if event.type == pygame.KEYDOWN:
if pygame.key.name(event.key)=='left':
exp.log('KEYDOWN key=%s rt=%d img=%s'\
% (pygame.key.name(event.key), response_time,path))
if pygame.key.name(event.key)=='right':
exp.log('KEYDOWN key=%s rt=%d img=%s'\
% (pygame.key.name(event.key), response_time,path))
#timedown=self.time()
t0=9500
__end__
set _prepare ""
define sequence _sequence
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_2 always
run __sketchpad always
run ____inline_script always
define sketchpad _sketchpad
set reset_variables "no"
set duration 1000
set description "Displays stimuli"
draw image center=1 file="cross150bis.png" scale=1 show_if=always x=0 y=0 z_index=0
define sketchpad affichage
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne4.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
define sequence coeur
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ____________________sketchpad always
run _____________________sketchpad always
run _________________________sketchpad always
run coeur_boucle "[next_Start]=coeur"
run ____________sketchpad always
run ______inline_script always
define sequence coeur2
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run _____________________________sketchpad always
run ______________________________sketchpad always
run _______________________________sketchpad always
run coeur2_boucle "[next_Start]=coeur2"
run _______________sketchpad always
run __________inline_script always
define loop coeur2_boucle
set skip 0
set repeat 12
set order "random"
set offset "no"
set item "_____sequence"
set description "Repeatedly runs another item"
set cycles 2
set column_order "position;image;reponse;condition;bloc"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "heart.png"
setcycle 0 bloc "1"
setcycle 0 reponse "r"
setcycle 0 condition "cong"
setcycle 1 position "-160"
setcycle 1 image "heart.png"
setcycle 1 bloc "1"
setcycle 1 reponse "l"
setcycle 1 condition "cong"
run _____sequence
define sequence coeur3
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run _____________________________sketchpad_1 always
run ______________________________sketchpad_1 always
run _______________________________sketchpad_1 always
run coeur3_boucle "[next_Start]=coeur3"
run _______________sketchpad_1 always
run __________inline_script_1 always
define loop coeur3_boucle
set skip 0
set repeat 12
set order "random"
set offset "no"
set item "_____sequence_1"
set description "Repeatedly runs another item"
set cycles 2
set column_order "position;image;reponse;condition;bloc"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "heart.png"
setcycle 0 bloc "1"
setcycle 0 reponse "r"
setcycle 0 condition "cong"
setcycle 1 position "-160"
setcycle 1 image "heart.png"
setcycle 1 bloc "1"
setcycle 1 reponse "l"
setcycle 1 condition "cong"
run _____sequence_1
define loop coeur_boucle
set skip 0
set repeat 6
set order "random"
set offset "no"
set item "____sequence"
set description "Repeatedly runs another item"
set cycles 2
set column_order "position;image;reponse;condition"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "heart.png"
setcycle 0 reponse "r"
setcycle 0 condition "cong"
setcycle 1 position "-160"
setcycle 1 image "heart.png"
setcycle 1 reponse "l"
setcycle 1 condition "cong"
run ____sequence
define sequence coeuritemtypelooptype2_boucle
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
define sequence experiment
set flush_keyboard "no"
set description "Runs a number of items in sequence"
run sketchpad always
run Start always
run coeur "[next_Start]=coeur"
run coeur2 "[next_Start]=coeur2"
run fleur "[next_Start]=fleur"
run fleur2 "[next_Start]=fleur2"
run fleur3 "[next_Start]=fleur3"
run fleur4 "[next_Start]=fleur4"
run random "[next_Start]=random"
run random2 "[next_Start]=random2"
run random3 "[next_Start]=random3"
run random4 "[next_Start]=random4"
define sequence fleur
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ______________________sketchpad always
run _______________________sketchpad always
run __________________________sketchpad always
run fleur_boucle "[next_Start]=fleur"
run _____________sketchpad always
run _______inline_script always
define sequence fleur2
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ________________________________sketchpad always
run _________________________________sketchpad always
run __________________________________sketchpad always
run fleur2_boucle "[next_Start]=fleur2"
run ________________sketchpad always
run ____________inline_script always
define loop fleur2_boucle
set skip 0
set repeat 16
set order "random"
set offset "no"
set item "______sequence"
set description "Repeatedly runs another item"
set cycles 2
set column_order "position;image;reponse;condition;bloc"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "flower.png"
setcycle 0 bloc "2"
setcycle 0 reponse "l"
setcycle 0 condition "incong"
setcycle 1 position "-160"
setcycle 1 image "flower.png"
setcycle 1 bloc "2"
setcycle 1 reponse "r"
setcycle 1 condition "incong"
run ______sequence
define sequence fleur3
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ________________________________sketchpad_1 always
run _________________________________sketchpad_1 always
run __________________________________sketchpad_1 always
run fleur3_boucle "[next_Start]=fleur3"
run ________________sketchpad_1 always
run ____________inline_script_1 always
define loop fleur3_boucle
set skip 0
set repeat 16
set order "random"
set offset "no"
set item "______sequence_1"
set description "Repeatedly runs another item"
set cycles 2
set column_order "position;image;reponse;condition;bloc"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "flower.png"
setcycle 0 bloc "2"
setcycle 0 reponse "l"
setcycle 0 condition "incong"
setcycle 1 position "-160"
setcycle 1 image "flower.png"
setcycle 1 bloc "2"
setcycle 1 reponse "r"
setcycle 1 condition "incong"
run ______sequence_1
define sequence fleur4
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ________________________________sketchpad_1_1 always
run _________________________________sketchpad_1_1 always
run __________________________________sketchpad_1_1 always
run fleur4_boucle "[next_Start]=fleur4"
run ________________sketchpad_1_1 always
run ____________inline_script_1_1 always
define loop fleur4_boucle
set skip 0
set repeat 16
set order "random"
set offset "no"
set item "______sequence_1_1"
set description "Repeatedly runs another item"
set cycles 2
set column_order "position;image;reponse;condition;bloc"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "flower.png"
setcycle 0 bloc "2"
setcycle 0 reponse "l"
setcycle 0 condition "incong"
setcycle 1 position "-160"
setcycle 1 image "flower.png"
setcycle 1 bloc "2"
setcycle 1 reponse "r"
setcycle 1 condition "incong"
run ______sequence_1_1
define loop fleur_boucle
set skip 0
set repeat 6
set order "random"
set offset "no"
set item "_sequence"
set description "Repeatedly runs another item"
set cycles 2
set column_order "position;image;reponse;condition"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "flower.png"
setcycle 0 reponse "l"
setcycle 0 condition "incong"
setcycle 1 position "-160"
setcycle 1 image "flower.png"
setcycle 1 reponse "r"
setcycle 1 condition "incong"
run _sequence
define inline_script inline_script
set description "Executes Python code"
___run__
print self.get("next")
__end__
set _prepare ""
define logger logger
set use_quotes "no"
set ignore_missing "no"
set description "Logs experimental data"
set auto_log "no"
log position
log image
log reponse
log count_sequence
log response
log response_time
log response_time_StimulationRandom
log count_experiment
define inline_script new_inline_script
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_1
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_1_1
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_2
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_3
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_3_1
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_3_1_1
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_4
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_5
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_5_1
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_5_1_1
set description "Executes Python code"
set _run ""
___prepare__
import random
exp.stim_duration = random.randint(400,1600)
__end__
define inline_script new_inline_script_6
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur')
fleur = widgets.button(form, text='fleur')
both = widgets.button(form, text='random3')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define inline_script new_inline_script_7
set description "Executes Python code"
___run__
# Import the widgets library
from libopensesame import widgets
# Create a form
form = widgets.form(self.experiment, cols=[1,1,1], rows=[1,2,1],
margins=(50,100,50,100), spacing=25)
# Create four widgets
labelTitle = widgets.label(form, text='Start Page')
image = widgets.image(form, path=self.experiment.get_file('mix.png'))
form.set_widget(image, (0,1),colspan=3)
coeur = widgets.button(form, text='coeur')
fleur = widgets.button(form, text='fleur')
both = widgets.button(form, text='random4')
# Add the widgets to the form. The position in the form is indicated as a
# (column, row) tuple.
form.set_widget(labelTitle, (0,0), colspan=3)
form.set_widget(coeur, (0,2))
form.set_widget(fleur, (1,2))
form.set_widget(both, (2,2))
# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
#t1 = self.time()
button_clicked = form._exec()
#tnow = self.time() - t1
exp.set('next_Start',button_clicked)
#exp.set('response_time', tnow)
__end__
set _prepare ""
define sequence random
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ________________________sketchpad always
run _affichage always
run ___________________________sketchpad always
run random_boucle "[next_Start]=random"
run ______________sketchpad always
run _________inline_script always
define sequence random2
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ___________________________________sketchpad always
run __affichage always
run ____________________________________sketchpad always
run random2_boucle "[next_Start]=random2"
run _________________sketchpad always
run new_inline_script_6 always
define loop random2_boucle
set skip 0
set repeat 8
set order "random"
set offset "no"
set item "_______sequence"
set description "Repeatedly runs another item"
set cycles 4
set column_order "position;image;reponse;condition;bloc"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "heart.png"
setcycle 0 bloc "3"
setcycle 0 reponse "r"
setcycle 0 condition "cong"
setcycle 1 position "-160"
setcycle 1 image "heart.png"
setcycle 1 bloc "3"
setcycle 1 reponse "l"
setcycle 1 condition "cong"
setcycle 2 position "160"
setcycle 2 image "flower.png"
setcycle 2 bloc "3"
setcycle 2 reponse "l"
setcycle 2 condition "incong"
setcycle 3 position "-160"
setcycle 3 image "flower.png"
setcycle 3 bloc "3"
setcycle 3 reponse "r"
setcycle 3 condition "incong"
run _______sequence
define sequence random3
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ___________________________________sketchpad_1 always
run __affichage_1 always
run ____________________________________sketchpad_1 always
run random3_boucle "[next_Start]=random3"
run _________________sketchpad_1 always
run new_inline_script_7 always
define loop random3_boucle
set skip 0
set repeat 8
set order "random"
set offset "no"
set item "_______sequence_1"
set description "Repeatedly runs another item"
set cycles 4
set column_order "position;image;reponse;condition;bloc"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "heart.png"
setcycle 0 bloc "3"
setcycle 0 reponse "r"
setcycle 0 condition "cong"
setcycle 1 position "-160"
setcycle 1 image "heart.png"
setcycle 1 bloc "3"
setcycle 1 reponse "l"
setcycle 1 condition "cong"
setcycle 2 position "160"
setcycle 2 image "flower.png"
setcycle 2 bloc "3"
setcycle 2 reponse "l"
setcycle 2 condition "incong"
setcycle 3 position "-160"
setcycle 3 image "flower.png"
setcycle 3 bloc "3"
setcycle 3 reponse "r"
setcycle 3 condition "incong"
run _______sequence_1
define sequence random4
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run ___________________________________sketchpad_1_1 always
run __affichage_1_1 always
run ____________________________________sketchpad_1_1 always
run random4_boucle "[next_Start]=random4"
run _________________sketchpad_1_1 always
define loop random4_boucle
set skip 0
set repeat 8
set order "random"
set offset "no"
set item "_______sequence_1_1"
set description "Repeatedly runs another item"
set cycles 4
set column_order "position;image;reponse;condition;bloc"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "heart.png"
setcycle 0 bloc "3"
setcycle 0 reponse "r"
setcycle 0 condition "cong"
setcycle 1 position "-160"
setcycle 1 image "heart.png"
setcycle 1 bloc "3"
setcycle 1 reponse "l"
setcycle 1 condition "cong"
setcycle 2 position "160"
setcycle 2 image "flower.png"
setcycle 2 bloc "3"
setcycle 2 reponse "l"
setcycle 2 condition "incong"
setcycle 3 position "-160"
setcycle 3 image "flower.png"
setcycle 3 bloc "3"
setcycle 3 reponse "r"
setcycle 3 condition "incong"
run _______sequence_1_1
define loop random_boucle
set skip 0
set repeat 6
set order "random"
set offset "no"
set item "sequence"
set description "Repeatedly runs another item"
set cycles 4
set column_order "position;image;reponse;condition"
set break_if "never"
setcycle 0 position "160"
setcycle 0 image "heart.png"
setcycle 0 reponse "r"
setcycle 0 condition "cong"
setcycle 1 position "-160"
setcycle 1 image "heart.png"
setcycle 1 reponse "l"
setcycle 1 condition "cong"
setcycle 2 position "160"
setcycle 2 image "flower.png"
setcycle 2 reponse "l"
setcycle 2 condition "incong"
setcycle 3 position "-160"
setcycle 3 image "flower.png"
setcycle 3 reponse "r"
setcycle 3 condition "incong"
run sequence
define sequence sequence
set flush_keyboard "yes"
set description "Runs a number of items in sequence"
run new_inline_script_4 always
run Fixation always
run __inline_script always
define sketchpad sketchpad
set reset_variables "no"
set duration "keypress"
set description "Displays stimuli"
draw image center=1 file="Dots_consigne_presentation.jpg" scale=1.2 show_if=always x=0 y=0 z_index=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment