Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Generated by OpenSesame 0.27.2~pre1 (Frisky Freud)
- # Sat Mar 16 22:02:16 2013 (posix)
- # <http://www.cogsci.nl/opensesame>
- set foreground "white"
- set subject_parity "even"
- set description "A template containing a practice and an experimental phase"
- set title "Extended template"
- set compensation "0"
- set coordinates "relative"
- set height "768"
- set mouse_backend "xpyriment"
- set width "1024"
- set sampler_backend "legacy"
- set keyboard_backend "legacy"
- set background "black"
- set subject_nr "0"
- set canvas_backend "xpyriment"
- set start "experiment"
- set synth_backend "legacy"
- define keyboard_response r4
- set description "Collects keyboard responses"
- set timeout "infinite"
- set flush "yes"
- define inline_script set_correct_in_a_row
- set _run ""
- ___prepare__
- # Give the counter a starting value:
- # We do this by using the experiment funtion exp.set():
- correct_in_a_row = 0
- # Make the variable available in other inline_script
- # items by making it global:
- global correct_in_a_row
- # Correct response is 'space', in this example. But this
- # is of course not the case in your experiment, so you can
- # remove the line below:
- exp.set("correct_response", "space")
- __end__
- set description "Executes Python code"
- define keyboard_response r1
- set description "Collects keyboard responses"
- set timeout "infinite"
- set flush "yes"
- define keyboard_response r2
- set description "Collects keyboard responses"
- set timeout "infinite"
- set flush "yes"
- define keyboard_response r3
- set description "Collects keyboard responses"
- set timeout "infinite"
- set flush "yes"
- define sketchpad sketchpad3
- set duration "0"
- set description "Displays stimuli"
- draw textline 0 -256 "s3" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- define sequence s2
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run sketchpad2 "always"
- run r2 "always"
- define sequence s1
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run sketchpad1 "always"
- run r1 "always"
- define sequence trial_sequence
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run inline_script "always"
- run s1 "never"
- run s2 "never"
- run s3 "never"
- run s4 "never"
- define sequence s4
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run sketchpad "always"
- run r4 "always"
- define sequence s3
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run sketchpad3 "always"
- run r3 "always"
- define sketchpad sketchpad
- set duration "0"
- set description "Displays stimuli"
- draw textline 0 -288 "s4" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- define sequence experiment
- set flush_keyboard "yes"
- set description "The main sequence of the experiment"
- run set_correct_in_a_row "always"
- run practice_sequence "always"
- run goodbye "always"
- define sketchpad goodbye
- set duration "keypress"
- set description "Displays stimuli"
- draw textline 0 -128 "The experiment is finished" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- define sketchpad sketchpad2
- set duration "0"
- set description "Displays stimuli"
- draw textline 0 -256 "s2" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- define loop practice_sequence
- set repeat "1"
- set description "A loop containing one or more experimental blocks"
- set skip "0"
- set offset "no"
- set item "Bigloop"
- set column_order "practice"
- set cycles "1"
- set order "random"
- setcycle 0 practice "no"
- run Bigloop
- define inline_script inline_script
- set _run ""
- ___prepare__
- # Import the built-in Python module random.
- # See: http://docs.python.org/2/library/random.html#random.shuffle
- import random
- # Make a list containing the names of the small sequence items:
- small_sequence_list = ['s1', 's2', 's3', 's4']
- # Randomise the list by using the random.shuffle() function:
- random.shuffle(small_sequence_list)
- # Walk through the (randomised) list:
- for sequence in small_sequence_list:
- # Only continue if less than 10 responses in a row
- # were correct:
- if correct_in_a_row < 10:
- # Prepare the sequence item:
- exp.items[sequence].prepare()
- # Run the sequence item:
- exp.items[sequence].run()
- else:
- break
- # Check whether the previous response was correct.
- # If so, we add '1' to the counter:
- if self.get("correct") == 1:
- correct_in_a_row +=1
- # If not, correct_in_a_row is reset to zero.
- else:
- correct_in_a_row = 0
- # Finally, make the variable global again, for the next time
- # this inline_script is run.
- global correct_in_a_row
- __end__
- set description "Executes Python code"
- define loop Bigloop
- set repeat "1"
- set description "Repeatedly runs another item"
- set skip "0"
- set offset "no"
- set item "trial_sequence"
- set column_order ""
- set cycles "10"
- set order "random"
- run trial_sequence
- define sketchpad sketchpad1
- set duration "0"
- set description "Displays stimuli"
- draw textline 0 -256 "s1" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement