Advertisement
Guest User

Untitled

a guest
Mar 4th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. # Generated by OpenSesame 0.27.1 (Frisky Freud)
  2. # Mon Mar 4 12:23:57 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 sampler_backend "legacy"
  10. set coordinates "relative"
  11. set height "768"
  12. set mouse_backend "xpyriment"
  13. set width "1024"
  14. set compensation "0"
  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 define_dictionary
  23. set _run ""
  24. ___prepare__
  25. # Make a dictionary containing probability of sketchpad1
  26. # for every possible keyboard response.
  27.  
  28. # See also:
  29. # http://docs.python.org/2/tutorial/datastructures.html#dictionaries
  30.  
  31. dict = {}
  32.  
  33. dict["s"] = .3
  34. dict["d"] = .6
  35. dict["b"] = .9
  36. dict["l"] = .1
  37.  
  38. # Make the dictionary global such that it is available in
  39. # future inline_script items as well:
  40. global dict
  41. __end__
  42. set description "Executes Python code"
  43.  
  44. define reset_feedback reset_feedback
  45.  
  46. define sketchpad sketchpad2
  47. set duration "1000"
  48. set description "Displays stimuli"
  49. draw textline 0 -160 "This is sketchpad2" center=1 color=red font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  50.  
  51. define sketchpad sketchpad1
  52. set duration "1000"
  53. set description "Displays stimuli"
  54. draw textline 0 -192 "This is sketchpad1" center=1 color=green font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  55.  
  56. define loop block_loop
  57. set repeat "1"
  58. set description "A single block of trials"
  59. set skip "0"
  60. set offset "no"
  61. set item "trial_sequence"
  62. set column_order ""
  63. set cycles "10"
  64. set order "random"
  65. run trial_sequence
  66.  
  67. define inline_script determine_sketchpad
  68. ___run__
  69. # Here we determine which response effect will appear
  70. # after a keyboard response:
  71.  
  72. # Import the built-in Python module random()
  73. # See also: http://docs.python.org/2/library/random.html
  74. import random
  75.  
  76. # Determine the given keyboard response by using the self.get() function.
  77. # See also:
  78. # http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements/
  79. key = self.get("response")
  80.  
  81. # 'Look up' in the dictionary what the probability of sketchpad1 is
  82. # for this response:
  83. pSketchpad1 = dict[key]
  84.  
  85. # Draw a random float and see whether the float is higher or lower than
  86. # as the probability that sketchpad1 will appear.
  87. # This probability depends the keyboard response.
  88. randomChoice = random.random()
  89.  
  90. if randomChoice <= pSketchpad1:
  91. responseEffect = "sketchpad1"
  92. else:
  93. responseEffect = "sketchpad2"
  94.  
  95. print pSketchpad1
  96. print randomChoice
  97. print responseEffect
  98.  
  99. # Set the variable using the exp.set() function.
  100. # By doing so, we make sure the variable is available
  101. # in the graphical interface as well. This enables us,
  102. # for example, to log the variable and to use the square-
  103. # bracket method.
  104. # See also:
  105. # http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements/
  106. exp.set("responseEffect", responseEffect)
  107.  
  108. # Also use some other variables for potential use in the GUI:
  109. exp.set("randomChoice", randomChoice)
  110. exp.set("pSketchpad1", pSketchpad1)
  111. exp.set("pSketchpad2", 1-pSketchpad1)
  112. __end__
  113. set _prepare ""
  114. set description "Executes Python code"
  115.  
  116. define keyboard_response keyboard_response
  117. set description "Collects keyboard responses"
  118. set timeout "infinite"
  119. set flush "yes"
  120.  
  121. define sequence experiment
  122. set flush_keyboard "yes"
  123. set description "The main sequence of the experiment"
  124. run define_dictionary "always"
  125. run experimental_loop "always"
  126.  
  127. define sequence trial_sequence
  128. set flush_keyboard "yes"
  129. set description "A single trial"
  130. run sketchpad "always"
  131. run keyboard_response "always"
  132. run determine_sketchpad "always"
  133. run sketchpad1 "[responseEffect] = sketchpad1"
  134. run sketchpad2 "[responseEffect] = sketchpad2"
  135. run logger "always"
  136.  
  137. define loop experimental_loop
  138. set repeat "1"
  139. set description "A loop containing one or more experimental blocks"
  140. set skip "0"
  141. set offset "no"
  142. set item "block_sequence"
  143. set column_order ""
  144. set cycles "4"
  145. set order "random"
  146. run block_sequence
  147.  
  148. define logger logger
  149. set description "Logs experimental data"
  150.  
  151. define sketchpad sketchpad
  152. set duration "0"
  153. set description "Displays stimuli"
  154. set start_response_interval "no"
  155. draw textline 0 -96 "" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  156. draw textline 0.0 -224.0 "Press s, d, b, or l" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  157.  
  158. define sequence block_sequence
  159. set flush_keyboard "yes"
  160. set description "A sequence containing a single block of trials followed by feedback to the participant"
  161. run reset_feedback "always"
  162. run block_loop "always"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement