Advertisement
Guest User

Untitled

a guest
Feb 21st, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. # Generated by OpenSesame 0.27.1 (Frisky Freud)
  2. # Thu Feb 21 11:33:44 2013 (posix)
  3. # <http://www.cogsci.nl/opensesame>
  4.  
  5. set foreground "white"
  6. set subject_parity "even"
  7. set description "A template containing a practice and an experimental phase"
  8. set title "Extended template"
  9. set compensation "0"
  10. set coordinates "relative"
  11. set height "768"
  12. set mouse_backend "xpyriment"
  13. set width "1024"
  14. set sampler_backend "legacy"
  15. set keyboard_backend "legacy"
  16. set background "black"
  17. set subject_nr "0"
  18. set canvas_backend "xpyriment"
  19. set start "experiment"
  20. set synth_backend "legacy"
  21.  
  22. define inline_script create_block_list
  23. set _run ""
  24. ___prepare__
  25. # Import the built-in Python module 'random':
  26. import random
  27.  
  28. # Define constant variables. (Adapt those values
  29. # to your specific situation):
  30.  
  31. nTrials = 10 # nr of trials in one block
  32. pWanted = .7 # chance that the intended response effect occurs
  33. pDifferent = .3 # chance that another response effect occurs
  34.  
  35. # Create a list containing 10 items. 7 of the items have the value
  36. # 'desired', 3 of the items have the value 'different':
  37. blockList = ["desired"] * int(nTrials * pWanted) + ["different"] * int(nTrials * pDifferent)
  38.  
  39. # Next, use the random.shuffle() function to
  40. # randomize the order of the items in the list:
  41. random.shuffle(blockList)
  42.  
  43. # Finally, make the list global such that we
  44. # can use it in other inline_script items as well:
  45. global blockList
  46. __end__
  47. set description "Executes Python code"
  48.  
  49. define reset_feedback reset_feedback
  50.  
  51. define loop block_loop
  52. set repeat "1"
  53. set description "A single block of trials"
  54. set skip "0"
  55. set offset "no"
  56. set item "trial_sequence"
  57. set column_order ""
  58. set cycles "10"
  59. set order "random"
  60. run trial_sequence
  61.  
  62. define inline_script determine_sketchpad
  63. set _run ""
  64. ___prepare__
  65. # Determine which response effect will
  66. # appear after a keyboard response:
  67.  
  68. # We'll do this by 'popping' (i.e. drawing without replacement)
  69. # one item from the previously prepared blockList.
  70. responseEffect = blockList.pop()
  71.  
  72. # Set the variable using the exp.set() function.
  73. # By doing so, we make sure the variable is available
  74. # in the graphical interface as well. This enables us,
  75. # for example, to log the variable and to use the square-
  76. # bracket method.
  77. # See also:
  78. # http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements/
  79. exp.set("responseEffect", responseEffect)
  80. __end__
  81. set description "Executes Python code"
  82.  
  83. define sketchpad different_response_effect
  84. set duration "700"
  85. set description "Displays stimuli"
  86. 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"
  87. 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"
  88.  
  89. define sketchpad sketchpad
  90. set duration "0"
  91. set description "Displays stimuli"
  92. set start_response_interval "no"
  93. 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"
  94. 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"
  95.  
  96. define sequence experiment
  97. set flush_keyboard "yes"
  98. set description "The main sequence of the experiment"
  99. run experimental_loop "always"
  100.  
  101. define sequence trial_sequence
  102. set flush_keyboard "yes"
  103. set description "A single trial"
  104. run determine_sketchpad "always"
  105. run sketchpad "always"
  106. run keyboard_response "always"
  107. run desired_response_effect "[responseEffect] = desired"
  108. run different_response_effect "[responseEffect] = different"
  109. run logger "always"
  110.  
  111. define loop experimental_loop
  112. set repeat "1"
  113. set description "A loop containing one or more experimental blocks"
  114. set item "block_sequence"
  115. set column_order "practice"
  116. set cycles "1"
  117. set order "random"
  118. setcycle 0 practice "no"
  119. run block_sequence
  120.  
  121. define keyboard_response keyboard_response
  122. set correct_response "z"
  123. set allowed_responses "z"
  124. set description "Collects keyboard responses"
  125. set timeout "infinite"
  126. set flush "yes"
  127.  
  128. define logger logger
  129. set description "Logs experimental data"
  130.  
  131. define sketchpad desired_response_effect
  132. set duration "700"
  133. set description "Displays stimuli"
  134. 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"
  135. 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"
  136.  
  137. define sequence block_sequence
  138. set flush_keyboard "yes"
  139. set description "A sequence containing a single block of trials followed by feedback to the participant"
  140. run create_block_list "always"
  141. run reset_feedback "always"
  142. run block_loop "always"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement