Advertisement
Guest User

Untitled

a guest
Mar 16th, 2013
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. # Generated by OpenSesame 0.27.2~pre1 (Frisky Freud)
  2. # Sat Mar 16 22:02:16 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 keyboard_response r4
  23. set description "Collects keyboard responses"
  24. set timeout "infinite"
  25. set flush "yes"
  26.  
  27. define inline_script set_correct_in_a_row
  28. set _run ""
  29. ___prepare__
  30. # Give the counter a starting value:
  31. # We do this by using the experiment funtion exp.set():
  32. correct_in_a_row = 0
  33.  
  34. # Make the variable available in other inline_script
  35. # items by making it global:
  36. global correct_in_a_row
  37.  
  38. # Correct response is 'space', in this example. But this
  39. # is of course not the case in your experiment, so you can
  40. # remove the line below:
  41. exp.set("correct_response", "space")
  42. __end__
  43. set description "Executes Python code"
  44.  
  45. define keyboard_response r1
  46. set description "Collects keyboard responses"
  47. set timeout "infinite"
  48. set flush "yes"
  49.  
  50. define keyboard_response r2
  51. set description "Collects keyboard responses"
  52. set timeout "infinite"
  53. set flush "yes"
  54.  
  55. define keyboard_response r3
  56. set description "Collects keyboard responses"
  57. set timeout "infinite"
  58. set flush "yes"
  59.  
  60. define sketchpad sketchpad3
  61. set duration "0"
  62. set description "Displays stimuli"
  63. draw textline 0 -256 "s3" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  64.  
  65. define sequence s2
  66. set flush_keyboard "yes"
  67. set description "Runs a number of items in sequence"
  68. run sketchpad2 "always"
  69. run r2 "always"
  70.  
  71. define sequence s1
  72. set flush_keyboard "yes"
  73. set description "Runs a number of items in sequence"
  74. run sketchpad1 "always"
  75. run r1 "always"
  76.  
  77. define sequence trial_sequence
  78. set flush_keyboard "yes"
  79. set description "Runs a number of items in sequence"
  80. run inline_script "always"
  81. run s1 "never"
  82. run s2 "never"
  83. run s3 "never"
  84. run s4 "never"
  85.  
  86. define sequence s4
  87. set flush_keyboard "yes"
  88. set description "Runs a number of items in sequence"
  89. run sketchpad "always"
  90. run r4 "always"
  91.  
  92. define sequence s3
  93. set flush_keyboard "yes"
  94. set description "Runs a number of items in sequence"
  95. run sketchpad3 "always"
  96. run r3 "always"
  97.  
  98. define sketchpad sketchpad
  99. set duration "0"
  100. set description "Displays stimuli"
  101. draw textline 0 -288 "s4" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  102.  
  103. define sequence experiment
  104. set flush_keyboard "yes"
  105. set description "The main sequence of the experiment"
  106. run set_correct_in_a_row "always"
  107. run practice_sequence "always"
  108. run goodbye "always"
  109.  
  110. define sketchpad goodbye
  111. set duration "keypress"
  112. set description "Displays stimuli"
  113. 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"
  114.  
  115. define sketchpad sketchpad2
  116. set duration "0"
  117. set description "Displays stimuli"
  118. draw textline 0 -256 "s2" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  119.  
  120. define loop practice_sequence
  121. set repeat "1"
  122. set description "A loop containing one or more experimental blocks"
  123. set skip "0"
  124. set offset "no"
  125. set item "Bigloop"
  126. set column_order "practice"
  127. set cycles "1"
  128. set order "random"
  129. setcycle 0 practice "no"
  130. run Bigloop
  131.  
  132. define inline_script inline_script
  133. set _run ""
  134. ___prepare__
  135. # Import the built-in Python module random.
  136. # See: http://docs.python.org/2/library/random.html#random.shuffle
  137. import random
  138.  
  139. # Make a list containing the names of the small sequence items:
  140. small_sequence_list = ['s1', 's2', 's3', 's4']
  141.  
  142. # Randomise the list by using the random.shuffle() function:
  143. random.shuffle(small_sequence_list)
  144.  
  145. # Walk through the (randomised) list:
  146. for sequence in small_sequence_list:
  147.  
  148. # Only continue if less than 10 responses in a row
  149. # were correct:
  150. if correct_in_a_row < 10:
  151.  
  152. # Prepare the sequence item:
  153. exp.items[sequence].prepare()
  154.  
  155. # Run the sequence item:
  156. exp.items[sequence].run()
  157.  
  158. else:
  159. break
  160.  
  161. # Check whether the previous response was correct.
  162. # If so, we add '1' to the counter:
  163. if self.get("correct") == 1:
  164. correct_in_a_row +=1
  165.  
  166. # If not, correct_in_a_row is reset to zero.
  167. else:
  168. correct_in_a_row = 0
  169.  
  170. # Finally, make the variable global again, for the next time
  171. # this inline_script is run.
  172. global correct_in_a_row
  173. __end__
  174. set description "Executes Python code"
  175.  
  176. define loop Bigloop
  177. set repeat "1"
  178. set description "Repeatedly runs another item"
  179. set skip "0"
  180. set offset "no"
  181. set item "trial_sequence"
  182. set column_order ""
  183. set cycles "10"
  184. set order "random"
  185. run trial_sequence
  186.  
  187. define sketchpad sketchpad1
  188. set duration "0"
  189. set description "Displays stimuli"
  190. 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