Advertisement
Guest User

Untitled

a guest
Feb 17th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.60 KB | None | 0 0
  1. # Generated by OpenSesame 0.27.4 (Frisky Freud)
  2. # Mon Feb 17 14:37:19 2014 (nt)
  3. # <http://www.cogsci.nl/opensesame>
  4.  
  5. set mouse_backend "legacy"
  6. set subject_parity "even"
  7. set transparent_variables "no"
  8. set height "768"
  9. set font_italic "no"
  10. set custom_cursor "no"
  11. set synth_backend "legacy"
  12. set title "New experiment"
  13. set coordinates "relative"
  14. set start "experiment"
  15. set sampler_backend "legacy"
  16. set font_family "mono"
  17. set foreground "white"
  18. set font_bold "no"
  19. set description "Default description"
  20. set background "black"
  21. set font_size "18"
  22. set enable_escape "yes"
  23. set keyboard_backend "legacy"
  24. set canvas_backend "legacy"
  25. set compensation "0"
  26. set subject_nr "0"
  27. set width "1024"
  28.  
  29. define inline_script SetPosWords
  30. ___run__
  31. # Import the Python modules:
  32. import random
  33. from openexp.mouse import mouse
  34. from math import sqrt
  35. # Create a mouse object
  36. my_mouse = mouse(exp, visible=True)
  37. __end__
  38. ___prepare__
  39.  
  40. # Import the Python modules:
  41. import random
  42. from openexp.mouse import mouse
  43. from math import sqrt
  44. # Create a mouse object
  45. my_mouse = mouse(exp, visible=True)
  46. #Create random locations and word list
  47. coords= [[+184, +130], [-100, +172], [+271, -222], [+287, +39], [-87, -39] ]
  48. random.shuffle(coords)
  49. for i in range (1,6):
  50. xvar="x"+str(i)
  51. yvar="y"+str(i)
  52. c =coords.pop()
  53. x=c.pop(0)
  54. y=c.pop()
  55. exp.set(xvar,x)
  56. exp.set(yvar,y)
  57.  
  58. #create random word list
  59. Words= ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
  60. random.shuffle(Words)
  61. for a in range (1,6):
  62. Wordvar="Word"+str(a)
  63. z =Words.pop()
  64. exp.set(Wordvar,z)
  65. __end__
  66. set description "Executes Python code"
  67.  
  68. define sequence Trials
  69. set flush_keyboard "yes"
  70. set description "Runs a number of items in sequence"
  71. run SetPosWords "always"
  72. run DisplayScreen "always"
  73. run GetClicks "always"
  74. run Response "always"
  75.  
  76. define sketchpad welcome
  77. set duration "mouseclick"
  78. set start_response_interval "no"
  79. set description "Displays stimuli"
  80. draw textline 0 0 "Welcome to the experiment" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always" html="yes"
  81. draw textline -320 64 "Click all the words" center=0 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always" html="yes"
  82.  
  83. define inline_script GetClicks
  84. ___run__
  85. from openexp.mouse import mouse
  86. from math import sqrt
  87. # Create a mouse object
  88. my_mouse = mouse(exp, visible=True)
  89. # Define all valid target positions
  90. coords= [[+184, +130], [-100, +172], [+271, -222], [+287, +39], [-87, -39] ]
  91.  
  92. # The maximum distance in pixels that a click can be from a target position
  93. max_err = 10
  94. # The number of clicks to collect
  95. max_click = 4
  96. # Loop until we have collected all clicks
  97. n_click = 0
  98. while n_click < max_click:
  99. # Get a click and extract the position
  100. button, position, timestamp = my_mouse.get_click()
  101. cursor_x, cursor_y = position
  102. # Walk through all target positions to check if the click was on a target
  103.  
  104. for xvar, yvar in coords:
  105. err = sqrt((xvar-cursor_x)**2+(yvar-cursor_y)**2)
  106. if err <= max_err:
  107. # If the click was on a target, set the click coordinates and
  108. # decrease the number of clicks that we still need to collect
  109. exp.set('click_%d_x' % n_click, xvar)
  110. exp.set('click_%d_y' % n_click, yvar)
  111. exp.set ('click_%d_word' % n_click, Wordvar)
  112. n_click += 1
  113.  
  114. __end__
  115. set _prepare ""
  116. set description "Executes Python code"
  117.  
  118. define sequence experiment
  119. run welcome "always"
  120. run Words "always"
  121.  
  122. define loop Words
  123. set repeat "1"
  124. set description "Repeatedly runs another item"
  125. set item "Trials"
  126. set column_order "Word1;Word2;Word3;Word4;x1;y1;x2;x3;y3;y2;y4;x4;Word5;x5;y5"
  127. set cycles "2"
  128. set order "random"
  129. setcycle 0 Word5 ""
  130. setcycle 0 y2 ""
  131. setcycle 0 x2 ""
  132. setcycle 0 Word4 ""
  133. setcycle 0 Word1 ""
  134. setcycle 0 Word3 ""
  135. setcycle 0 Word2 ""
  136. setcycle 0 y1 ""
  137. setcycle 0 x3 ""
  138. setcycle 0 y3 ""
  139. setcycle 0 x1 ""
  140. setcycle 0 y5 ""
  141. setcycle 0 y4 ""
  142. setcycle 0 x4 ""
  143. setcycle 0 x5 ""
  144. setcycle 1 Word5 ""
  145. setcycle 1 y2 ""
  146. setcycle 1 x2 ""
  147. setcycle 1 Word4 ""
  148. setcycle 1 Word1 ""
  149. setcycle 1 Word3 ""
  150. setcycle 1 Word2 ""
  151. setcycle 1 y1 ""
  152. setcycle 1 x3 ""
  153. setcycle 1 y3 ""
  154. setcycle 1 x1 ""
  155. setcycle 1 y5 ""
  156. setcycle 1 y4 ""
  157. setcycle 1 x4 ""
  158. setcycle 1 x5 ""
  159. run Trials
  160.  
  161. define sketchpad DisplayScreen
  162. set duration "mouseclick"
  163. set show_cursor "yes"
  164. set description "Displays stimuli"
  165. draw textline [x1] [y1] "[Word1]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always" html="yes"
  166. draw textline [x2] [y2] "[Word2]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always" html="yes"
  167. draw textline [x3] [y3] "[Word3]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always" html="yes"
  168. draw textline [x4] [y4] "[Word4]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always" html="yes"
  169. draw textline [x5] [y5] "[Word5]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always" html="yes"
  170.  
  171. define logger Response
  172. set ignore_missing "yes"
  173. set description "Logs experimental data"
  174. set auto_log "no"
  175. set use_quotes "yes"
  176. log "x1"
  177. log "y1"
  178. log "Word5"
  179. log "Word4"
  180. log "Word1"
  181. log "Word3"
  182. log "Word2"
  183. log "x2"
  184. log "x3"
  185. log "y3"
  186. log "y2"
  187. log "y5"
  188. log "y4"
  189. log "x4"
  190. log "x5"
  191. log "Wordvar"
  192. log "xvar"
  193. log "yvar"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement