Guest User

Untitled

a guest
Aug 30th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. # Generated by OpenSesame 0.27.3 (Frisky Freud)
  2. # Fri Aug 30 12:27:14 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 loop block_loop
  23. set repeat "1"
  24. set description "A single block of trials"
  25. set item "trial_sequence"
  26. set column_order ""
  27. set cycles "8"
  28. set order "random"
  29. run trial_sequence
  30.  
  31. define sequence experiment
  32. set flush_keyboard "yes"
  33. set description "The main sequence of the experiment"
  34. run experimental_loop "always"
  35.  
  36. define sequence trial_sequence
  37. set flush_keyboard "yes"
  38. set description "A single trial"
  39. run declare_trial_vars "always"
  40. run show_trial_vars "always"
  41. run keyboard_response "always"
  42. run logger "always"
  43.  
  44. define loop experimental_loop
  45. set repeat "1"
  46. set description "A loop containing one or more experimental blocks"
  47. set item "block_sequence"
  48. set column_order "practice"
  49. set cycles "1"
  50. set order "random"
  51. setcycle 0 practice "no"
  52. run block_sequence
  53.  
  54. define keyboard_response keyboard_response
  55. set description "Collects keyboard responses"
  56. set timeout "infinite"
  57. set flush "yes"
  58.  
  59. define inline_script declare_lists
  60. set _run ""
  61. ___prepare__
  62. # Your code:
  63. agency = [1,1,1,1,2,2,2,2]
  64. val = [1,1,2,2,1,1,2,2]
  65. names = [1,2,3,4,5,6,7,8]
  66. import random
  67. random.shuffle(names)
  68.  
  69. # Make lists global such that they are available
  70. # in future inline_script items as well:
  71. global agency, val, names
  72. __end__
  73. set description "Executes Python code"
  74.  
  75. define logger logger
  76. set description "Logs experimental data"
  77.  
  78. define sketchpad show_trial_vars
  79. set duration "0"
  80. set description "Displays stimuli"
  81. draw textline 0 -256 "Agency current trial = [trial_ag]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  82. draw textline 0 -100 "Valency current trial = [trial_val]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  83. draw textline 0 100 "Picture current trial = [trial_name]" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  84.  
  85. define inline_script declare_trial_vars
  86. set _run ""
  87. ___prepare__
  88. # Declare the variables of the current trial,
  89. # which is equivalent to readng trial
  90. # variables from the loop item.
  91.  
  92. # We use the pop() function to draw one item from
  93. # the previously-defined lists. 'Popping' means that
  94. # the item is drawn without replacement.
  95.  
  96. # Note that the pop() function starts drawing
  97. # items from the END of the lists, so we start
  98. # with agency = 2 and val = 2.
  99. # Simply re-order the lists in 'declare_lists'
  100. # to change this.
  101. trial_ag = agency.pop()
  102. trial_val = val.pop()
  103. trial_name = names.pop()
  104.  
  105. # Finally, we SET the trial variables
  106. # for future use in the interface (e.g. a sketchpad
  107. # item, the logger item, etc. - see 'show_trial_vars'
  108. # for an example)
  109.  
  110. # For more info, see:
  111. # http://osdoc.cogsci.nl/python-inline-code/experiment-functions/#experiment.set
  112.  
  113. exp.set("trial_ag", trial_ag)
  114. exp.set("trial_val", trial_val)
  115. exp.set("trial_name", trial_name)
  116. __end__
  117. set description "Executes Python code"
  118.  
  119. define sequence block_sequence
  120. set flush_keyboard "yes"
  121. set description "A sequence containing a single block of trials followed by feedback to the participant"
  122. run declare_lists "always"
  123. run block_loop "always"
Advertisement
Add Comment
Please, Sign In to add comment