Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Generated by OpenSesame 0.27.1 (Frisky Freud)
- # Thu Feb 21 11:33:44 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 inline_script create_block_list
- set _run ""
- ___prepare__
- # Import the built-in Python module 'random':
- import random
- # Define constant variables. (Adapt those values
- # to your specific situation):
- nTrials = 10 # nr of trials in one block
- pWanted = .7 # chance that the intended response effect occurs
- pDifferent = .3 # chance that another response effect occurs
- # Create a list containing 10 items. 7 of the items have the value
- # 'desired', 3 of the items have the value 'different':
- blockList = ["desired"] * int(nTrials * pWanted) + ["different"] * int(nTrials * pDifferent)
- # Next, use the random.shuffle() function to
- # randomize the order of the items in the list:
- random.shuffle(blockList)
- # Finally, make the list global such that we
- # can use it in other inline_script items as well:
- global blockList
- __end__
- set description "Executes Python code"
- define reset_feedback reset_feedback
- define loop block_loop
- set repeat "1"
- set description "A single block of trials"
- set skip "0"
- set offset "no"
- set item "trial_sequence"
- set column_order ""
- set cycles "10"
- set order "random"
- run trial_sequence
- define inline_script determine_sketchpad
- set _run ""
- ___prepare__
- # Determine which response effect will
- # appear after a keyboard response:
- # We'll do this by 'popping' (i.e. drawing without replacement)
- # one item from the previously prepared blockList.
- responseEffect = blockList.pop()
- # Set the variable using the exp.set() function.
- # By doing so, we make sure the variable is available
- # in the graphical interface as well. This enables us,
- # for example, to log the variable and to use the square-
- # bracket method.
- # See also:
- # http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements/
- exp.set("responseEffect", responseEffect)
- __end__
- set description "Executes Python code"
- define sketchpad different_response_effect
- set duration "700"
- set description "Displays stimuli"
- draw textline 0.0 -160.0 "different response effect" center=1 color=red font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- draw textline 0.0 -96.0 "appears with a probability of 30%" center=1 color=red font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- define sketchpad sketchpad
- set duration "0"
- set description "Displays stimuli"
- set start_response_interval "no"
- draw textline 0.0 -96.0 "" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- draw textline 0.0 -224.0 "Press 'z'" 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 experimental_loop "always"
- define sequence trial_sequence
- set flush_keyboard "yes"
- set description "A single trial"
- run determine_sketchpad "always"
- run sketchpad "always"
- run keyboard_response "always"
- run desired_response_effect "[responseEffect] = desired"
- run different_response_effect "[responseEffect] = different"
- run logger "always"
- define loop experimental_loop
- set repeat "1"
- set description "A loop containing one or more experimental blocks"
- set item "block_sequence"
- set column_order "practice"
- set cycles "1"
- set order "random"
- setcycle 0 practice "no"
- run block_sequence
- define keyboard_response keyboard_response
- set correct_response "z"
- set allowed_responses "z"
- set description "Collects keyboard responses"
- set timeout "infinite"
- set flush "yes"
- define logger logger
- set description "Logs experimental data"
- define sketchpad desired_response_effect
- set duration "700"
- set description "Displays stimuli"
- draw textline 0.0 -128.0 "desired response effect" center=1 color=green font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- draw textline 0.0 -64.0 "appears with a probability of 70%" center=1 color=green font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
- define sequence block_sequence
- set flush_keyboard "yes"
- set description "A sequence containing a single block of trials followed by feedback to the participant"
- run create_block_list "always"
- run reset_feedback "always"
- run block_loop "always"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement