psychopy 2024.2.1__py3-none-any.whl → 2024.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of psychopy might be problematic. Click here for more details.

Files changed (276) hide show
  1. psychopy/.DS_Store +0 -0
  2. psychopy/GIT_SHA +1 -1
  3. psychopy/VERSION +1 -1
  4. psychopy/__init__.py +10 -1
  5. psychopy/__init__.py.orig +65 -0
  6. psychopy/app/{locale/ar_001/.DS_Store → .DS_Store} +0 -0
  7. psychopy/app/Resources/.DS_Store +0 -0
  8. psychopy/app/_psychopyApp.py +11 -3
  9. psychopy/app/appData.spec +1 -1
  10. psychopy/app/builder/builder.py +1 -1
  11. psychopy/app/builder/builder.py.orig +3932 -0
  12. psychopy/app/builder/dialogs/__init__.py.orig +1679 -0
  13. psychopy/app/builder/dialogs/paramCtrls.py +1 -1
  14. psychopy/app/builder/dialogs/paramCtrls.py.orig +713 -0
  15. psychopy/app/colorpicker/__init__.py.orig +411 -0
  16. psychopy/app/cortex.log +0 -0
  17. psychopy/app/jobs.py +8 -1
  18. psychopy/app/locale/ar_001/LC_MESSAGE/messages.po +2452 -1731
  19. psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN.mo +0 -0
  20. psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN.po +6127 -0
  21. psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN_allFlagged.mo +0 -0
  22. psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN_allFlagged.po +7366 -0
  23. psychopy/app/plugin_manager/dialog.py +9 -7
  24. psychopy/app/ribbon.py +2 -1
  25. psychopy/app/runner/runner.py +7 -5
  26. psychopy/clock.py +8 -4
  27. psychopy/core.py.orig +169 -0
  28. psychopy/demos/builder/Design Templates/randomisedBlocks/html/index.html +23 -0
  29. psychopy/demos/builder/Design Templates/randomisedBlocks/html/randomisedBlocks-legacy-browsers.js +423 -0
  30. psychopy/demos/builder/Design Templates/randomisedBlocks/html/randomisedBlocks.js +427 -0
  31. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/chooseBlock.xlsx +0 -0
  32. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/facesBlock.xlsx +0 -0
  33. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/housesBlock.xlsx +0 -0
  34. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face01.jpg +0 -0
  35. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face02.jpg +0 -0
  36. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face03.jpg +0 -0
  37. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house01.jpg +0 -0
  38. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house02.jpg +0 -0
  39. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house03.jpg +0 -0
  40. psychopy/demos/builder/Design Templates/randomisedBlocks/randomisedBlocks.py +330 -0
  41. psychopy/demos/builder/Design Templates/randomisedBlocks/randomisedBlocks_lastrun.py +330 -0
  42. psychopy/demos/builder/Feature Demos/eyetracking/eyetracking.xml +298 -0
  43. psychopy/demos/builder/Feature Demos/eyetracking/eyetracking.xsd +120 -0
  44. psychopy/demos/builder/Tools/.DS_Store +0 -0
  45. psychopy/demos/builder/Tools/gammaCalibration/.DS_Store +0 -0
  46. psychopy/demos/builder/Tools/gammaCalibration/data/_gamma_correction_visual_2022-05-18_14h18.29.439.csv +38 -0
  47. psychopy/demos/builder/Tools/gammaCalibration/data/_gamma_correction_visual_2022-05-18_14h18.29.439.log +3418 -0
  48. psychopy/demos/builder/Tools/gammaCalibration/data/_gamma_correction_visual_2022-05-18_14h18.29.439.psydat +0 -0
  49. psychopy/demos/builder/Tools/gammaCalibration/data/x1_gamma_correction_visual_2022-05-17_13h59.42.928.csv +2 -0
  50. psychopy/demos/builder/Tools/gammaCalibration/data/x1_gamma_correction_visual_2022-05-17_13h59.42.928.log +15 -0
  51. psychopy/demos/builder/Tools/gammaCalibration/data/x1_gamma_correction_visual_2022-05-17_13h59.42.928.psydat +0 -0
  52. psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual.psyexp +323 -0
  53. psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual.py +562 -0
  54. psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual_lastrun.py +562 -0
  55. psychopy/demos/builder/Tools/gammaCalibration/questStairs.xlsx +0 -0
  56. psychopy/demos/builder/Tools/gammaCalibration/readme.md +0 -0
  57. psychopy/demos/builder/Tools/gammaCalibration/resources/low_contrast.png +0 -0
  58. psychopy/demos/builder/Tools/gammaCalibration/resources/make_2nd_order_tex.py +59 -0
  59. psychopy/demos/builder/Tools/gammaCalibration/resources/second_order_tex.png +0 -0
  60. psychopy/demos/coder/.DS_Store +0 -0
  61. psychopy/demos/coder/experiment control/info_gamma.pickle +0 -0
  62. psychopy/demos/coder/iohub/.iohpid +1 -0
  63. psychopy/demos/coder/iohub/eyetracking/.iohpid +1 -0
  64. psychopy/demos/coder/iohub/wintab/.DS_Store +0 -0
  65. psychopy/demos/coder/stimuli/.DS_Store +0 -0
  66. psychopy/demos/coder/stimuli/radialGratingContracting.py +29 -0
  67. psychopy/experiment/_experiment.py.orig +1032 -0
  68. psychopy/experiment/components/.DS_Store +0 -0
  69. psychopy/experiment/components/_base.py +13 -4
  70. psychopy/experiment/components/_base.py.orig +823 -0
  71. psychopy/experiment/components/form/.DS_Store +0 -0
  72. psychopy/experiment/components/microphone/__init__.py +10 -1
  73. psychopy/experiment/components/microphone/__init__.py.orig +490 -0
  74. psychopy/experiment/components/polygon/__init__.py +21 -22
  75. psychopy/experiment/components/settings/__init__.py +13 -14
  76. psychopy/experiment/components/settings/__init__.py.orig +1337 -0
  77. psychopy/experiment/components/textbox/__init__.py.orig +310 -0
  78. psychopy/experiment/components/webcam/.DS_Store +0 -0
  79. psychopy/experiment/components/webcam/light/.DS_Store +0 -0
  80. psychopy/experiment/flow.py +10 -8
  81. psychopy/experiment/loops.py.orig +829 -0
  82. psychopy/experiment/params.py +8 -3
  83. psychopy/experiment/params.py.orig +408 -0
  84. psychopy/experiment/routine.py.orig +503 -0
  85. psychopy/experiment/routines/_base.py +15 -6
  86. psychopy/experiment/routines/counterbalance/__init__.py +1 -0
  87. psychopy/gui/qtgui.py +14 -7
  88. psychopy/gui/util.py +10 -14
  89. psychopy/gui/wxgui.py +10 -4
  90. psychopy/hardware/.DS_Store +0 -0
  91. psychopy/hardware/brainproducts.py.orig +680 -0
  92. psychopy/hardware/iolab.py.orig +238 -0
  93. psychopy/hardware/manager.py +1 -1
  94. psychopy/hardware/photodiode.py +59 -27
  95. psychopy/hardware/serialport.py +51 -0
  96. psychopy/hardware/speaker.py +4 -4
  97. psychopy/iohub/datastore/__init__.py.orig +443 -0
  98. psychopy/iohub/datastore/util.py.orig +692 -0
  99. psychopy/iohub/devices/mouse/darwin.py.orig +427 -0
  100. psychopy/iohub/devices/mouse/linux2.py.orig +198 -0
  101. psychopy/preferences/.DS_Store +0 -0
  102. psychopy/projects/pavlovia.py +10 -3
  103. psychopy/projects/pavlovia.py.orig +1295 -0
  104. psychopy/sound/backend_ptb.py +22 -5
  105. psychopy/sound/transcribe.py +24 -4
  106. psychopy/tests/.DS_Store +0 -0
  107. psychopy/tests/data/.DS_Store +0 -0
  108. psychopy/tests/data/TestCircle_fill_local.png +0 -0
  109. psychopy/tests/data/__test.png +0 -0
  110. psychopy/tests/data/aperture1_normHexbackground_local.png +0 -0
  111. psychopy/tests/data/aperture1_norm_local.png +0 -0
  112. psychopy/tests/data/aperture2_normHexbackground_local.png +0 -0
  113. psychopy/tests/data/beatandrcos_height_local.png +0 -0
  114. psychopy/tests/data/beatandrcos_normAddBlend_local.png +0 -0
  115. psychopy/tests/data/beatandrcos_normHexbackground_local.png +0 -0
  116. psychopy/tests/data/beatandrcos_norm_local.png +0 -0
  117. psychopy/tests/data/beatandrcos_stencil_local.png +0 -0
  118. psychopy/tests/data/blend_add_height_local.png +0 -0
  119. psychopy/tests/data/blend_add_normAddBlend_local.png +0 -0
  120. psychopy/tests/data/blend_add_normHexbackground_local.png +0 -0
  121. psychopy/tests/data/blend_add_normNoShade_local.png +0 -0
  122. psychopy/tests/data/blend_add_norm_local.png +0 -0
  123. psychopy/tests/data/blend_add_stencil_local.png +0 -0
  124. psychopy/tests/data/bufferimg_gabor_height_local.png +0 -0
  125. psychopy/tests/data/bufferimg_gabor_normAddBlend_local.png +0 -0
  126. psychopy/tests/data/bufferimg_gabor_normHexbackground_local.png +0 -0
  127. psychopy/tests/data/bufferimg_gabor_normNoShade_local.png +0 -0
  128. psychopy/tests/data/bufferimg_gabor_norm_local.png +0 -0
  129. psychopy/tests/data/bufferimg_gabor_stencil_local.png +0 -0
  130. psychopy/tests/data/circleHex_height_local.png +0 -0
  131. psychopy/tests/data/circleHex_normAddBlend_local.png +0 -0
  132. psychopy/tests/data/circleHex_normHexbackground_local.png +0 -0
  133. psychopy/tests/data/circleHex_normNoShade_local.png +0 -0
  134. psychopy/tests/data/circleHex_norm_local.png +0 -0
  135. psychopy/tests/data/circleHex_stencil_local.png +0 -0
  136. psychopy/tests/data/color_comparison_local.png +0 -0
  137. psychopy/tests/data/corrFullRandom_local.csv +16 -0
  138. psychopy/tests/data/corrFullRandom_local.tsv +6 -0
  139. psychopy/tests/data/correctScript/.DS_Store +0 -0
  140. psychopy/tests/data/dots_height_local.png +0 -0
  141. psychopy/tests/data/dots_normAddBlend_local.png +0 -0
  142. psychopy/tests/data/dots_normHexbackground_local.png +0 -0
  143. psychopy/tests/data/dots_normNoShade_local.png +0 -0
  144. psychopy/tests/data/dots_norm_local.png +0 -0
  145. psychopy/tests/data/dots_stencil_local.png +0 -0
  146. psychopy/tests/data/elarray1_height_local.png +0 -0
  147. psychopy/tests/data/elarray1_normAddBlend_local.png +0 -0
  148. psychopy/tests/data/elarray1_normHexbackground_local.png +0 -0
  149. psychopy/tests/data/elarray1_norm_local.png +0 -0
  150. psychopy/tests/data/elarray1_stencil_local.png +0 -0
  151. psychopy/tests/data/envelopeandrcos_height_local.png +0 -0
  152. psychopy/tests/data/envelopeandrcos_normAddBlend_local.png +0 -0
  153. psychopy/tests/data/envelopeandrcos_normHexbackground_local.png +0 -0
  154. psychopy/tests/data/envelopeandrcos_norm_local.png +0 -0
  155. psychopy/tests/data/envelopeandrcos_stencil_local.png +0 -0
  156. psychopy/tests/data/envelopepowerandrcos_height_local.png +0 -0
  157. psychopy/tests/data/envelopepowerandrcos_normAddBlend_local.png +0 -0
  158. psychopy/tests/data/envelopepowerandrcos_normHexbackground_local.png +0 -0
  159. psychopy/tests/data/envelopepowerandrcos_norm_local.png +0 -0
  160. psychopy/tests/data/envelopepowerandrcos_stencil_local.png +0 -0
  161. psychopy/tests/data/gabor1_height_local.png +0 -0
  162. psychopy/tests/data/gabor1_normAddBlend_local.png +0 -0
  163. psychopy/tests/data/gabor1_normHexbackground_local.png +0 -0
  164. psychopy/tests/data/gabor1_normNoShade_local.png +0 -0
  165. psychopy/tests/data/gabor1_norm_local.png +0 -0
  166. psychopy/tests/data/gabor1_stencil_local.png +0 -0
  167. psychopy/tests/data/greyscale_normHexbackground_local.png +0 -0
  168. psychopy/tests/data/imageAndGauss_height_local.png +0 -0
  169. psychopy/tests/data/imageAndGauss_normAddBlend_local.png +0 -0
  170. psychopy/tests/data/imageAndGauss_normHexbackground_local.png +0 -0
  171. psychopy/tests/data/imageAndGauss_normNoShade_local.png +0 -0
  172. psychopy/tests/data/imageAndGauss_norm_local.png +0 -0
  173. psychopy/tests/data/imageAndGauss_stencil_local.png +0 -0
  174. psychopy/tests/data/movFrame1_stencil_local.png +0 -0
  175. psychopy/tests/data/noiseAndRcos_height_local.png +0 -0
  176. psychopy/tests/data/noiseAndRcos_normAddBlend_local.png +0 -0
  177. psychopy/tests/data/noiseAndRcos_normHexbackground_local.png +0 -0
  178. psychopy/tests/data/noiseAndRcos_normNoShade_local.png +0 -0
  179. psychopy/tests/data/noiseAndRcos_norm_local.png +0 -0
  180. psychopy/tests/data/noiseAndRcos_stencil_local.png +0 -0
  181. psychopy/tests/data/noiseFiltersAndRcos_height_local.png +0 -0
  182. psychopy/tests/data/noiseFiltersAndRcos_normAddBlend_local.png +0 -0
  183. psychopy/tests/data/noiseFiltersAndRcos_normHexbackground_local.png +0 -0
  184. psychopy/tests/data/noiseFiltersAndRcos_normNoShade_local.png +0 -0
  185. psychopy/tests/data/noiseFiltersAndRcos_norm_local.png +0 -0
  186. psychopy/tests/data/noiseFiltersAndRcos_stencil_local.png +0 -0
  187. psychopy/tests/data/numpyImage_height_local.png +0 -0
  188. psychopy/tests/data/numpyImage_normAddBlend_local.png +0 -0
  189. psychopy/tests/data/numpyImage_normHexbackground_local.png +0 -0
  190. psychopy/tests/data/numpyImage_normNoShade_local.png +0 -0
  191. psychopy/tests/data/numpyImage_norm_local.png +0 -0
  192. psychopy/tests/data/numpyImage_stencil_local.png +0 -0
  193. psychopy/tests/data/shape2_1_normAddBlend_local.png +0 -0
  194. psychopy/tests/data/shape2_1_normHexbackground_local.png +0 -0
  195. psychopy/tests/data/shape2_1_normNoShade_local.png +0 -0
  196. psychopy/tests/data/shape2_1_norm_local.png +0 -0
  197. psychopy/tests/data/shape2_1_stencil_local.png +0 -0
  198. psychopy/tests/data/testLoopsBlocks.psyexp_local.py +328 -0
  199. psychopy/tests/data/text1_height_local.png +0 -0
  200. psychopy/tests/data/text1_normAddBlend_local.png +0 -0
  201. psychopy/tests/data/text1_normHexbackground_local.png +0 -0
  202. psychopy/tests/data/text1_norm_local.png +0 -0
  203. psychopy/tests/data/text1_stencil_local.png +0 -0
  204. psychopy/tests/data/text2_height.png +0 -0
  205. psychopy/tests/data/text2_normAddBlend.png +0 -0
  206. psychopy/tests/data/text2_normHexbackground.png +0 -0
  207. psychopy/tests/data/text2_stencil.png +0 -0
  208. psychopy/tests/data/wedge1_height_local.png +0 -0
  209. psychopy/tests/data/wedge1_normAddBlend_local.png +0 -0
  210. psychopy/tests/data/wedge1_normHexbackground_local.png +0 -0
  211. psychopy/tests/data/wedge1_normNoShade_local.png +0 -0
  212. psychopy/tests/data/wedge1_norm_local.png +0 -0
  213. psychopy/tests/data/wedge1_stencil_local.png +0 -0
  214. psychopy/tests/test_app/.DS_Store +0 -0
  215. psychopy/tests/test_app/test_builder/.DS_Store +0 -0
  216. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.csv +9 -0
  217. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.log +177 -0
  218. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.psydat +0 -0
  219. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.xlsx +0 -0
  220. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.csv +9 -0
  221. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.log +168 -0
  222. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.psydat +0 -0
  223. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.xlsx +0 -0
  224. psychopy/tests/test_data/.DS_Store +0 -0
  225. psychopy/tests/test_hardware/test_CRS_BitsSharp.py.orig +68 -0
  226. psychopy/tests/test_tools/test_arraytools.py +112 -0
  227. psychopy/tests/test_visual/test_image.py.orig +219 -0
  228. psychopy/tools/arraytools.py +47 -0
  229. psychopy/tools/versionchooser.py +1 -1
  230. psychopy/visual/backends/pygletbackend.py +26 -8
  231. psychopy/visual/basevisual.py.orig +1723 -0
  232. psychopy/visual/form.py.orig +1181 -0
  233. psychopy/visual/text.py.orig +752 -0
  234. psychopy/visual/textbox2/textbox2.py.orig +1315 -0
  235. psychopy/visual/window.py +13 -5
  236. psychopy/visual/windowwarp.py.orig +463 -0
  237. {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/METADATA +9 -9
  238. {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/RECORD +244 -78
  239. {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/WHEEL +1 -1
  240. {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/entry_points.txt +2 -0
  241. psychopy/app/locale/ar_001/LC_MESSAGE/messages.mo +0 -0
  242. psychopy/app/locale/cs_CZ/LC_MESSAGE/messages.mo +0 -0
  243. psychopy/app/locale/da_DK/LC_MESSAGE/messages.mo +0 -0
  244. psychopy/app/locale/de_DE/LC_MESSAGE/messages.mo +0 -0
  245. psychopy/app/locale/el_GR/LC_MESSAGE/messages.mo +0 -0
  246. psychopy/app/locale/en_NZ/LC_MESSAGE/messages.mo +0 -0
  247. psychopy/app/locale/en_US/LC_MESSAGE/messages.mo +0 -0
  248. psychopy/app/locale/es_CO/LC_MESSAGE/messages.mo +0 -0
  249. psychopy/app/locale/es_ES/LC_MESSAGE/messages.mo +0 -0
  250. psychopy/app/locale/es_US/LC_MESSAGE/messages.mo +0 -0
  251. psychopy/app/locale/et_EE/LC_MESSAGE/messages.mo +0 -0
  252. psychopy/app/locale/fa_IR/LC_MESSAGE/messages.mo +0 -0
  253. psychopy/app/locale/fi_FI/LC_MESSAGE/messages.mo +0 -0
  254. psychopy/app/locale/fr_FR/LC_MESSAGE/messages.mo +0 -0
  255. psychopy/app/locale/he_IL/LC_MESSAGE/messages.mo +0 -0
  256. psychopy/app/locale/hi_IN/LC_MESSAGE/messages.mo +0 -0
  257. psychopy/app/locale/hu_HU/LC_MESSAGE/messages.mo +0 -0
  258. psychopy/app/locale/it_IT/LC_MESSAGE/messages.mo +0 -0
  259. psychopy/app/locale/ja_JP/LC_MESSAGE/messages.mo +0 -0
  260. psychopy/app/locale/ko_KR/LC_MESSAGE/messages.mo +0 -0
  261. psychopy/app/locale/ms_MY/LC_MESSAGE/messages.mo +0 -0
  262. psychopy/app/locale/nl_NL/LC_MESSAGE/messages.mo +0 -0
  263. psychopy/app/locale/nn_NO/LC_MESSAGE/messages.mo +0 -0
  264. psychopy/app/locale/pl_PL/LC_MESSAGE/messages.mo +0 -0
  265. psychopy/app/locale/pt_PT/LC_MESSAGE/messages.mo +0 -0
  266. psychopy/app/locale/ro_RO/LC_MESSAGE/messages.mo +0 -0
  267. psychopy/app/locale/ru_RU/LC_MESSAGE/messages.mo +0 -0
  268. psychopy/app/locale/sv_SE/LC_MESSAGE/messages.mo +0 -0
  269. psychopy/app/locale/tr_TR/LC_MESSAGE/messages.mo +0 -0
  270. psychopy/app/locale/zh_CN/LC_MESSAGE/messages.mo +0 -0
  271. psychopy/app/locale/zh_TW/LC_MESSAGE/messages.mo +0 -0
  272. psychopy-2024.2.1.dist-info/licenses/AUTHORS.md +0 -138
  273. /psychopy/{app/locale/ar_001/LC_MESSAGE → demos/builder}/.DS_Store +0 -0
  274. /psychopy/{app/locale/es_ES/LC_MESSAGE → demos/builder/Experiments}/.DS_Store +0 -0
  275. /psychopy/{visual → demos/builder/Tools/gammaCalibration/data}/.DS_Store +0 -0
  276. {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,423 @@
1
+ /*************************
2
+ * Randomisedblocks Test *
3
+ *************************/
4
+
5
+
6
+ // store info about the experiment session:
7
+ let expName = 'randomisedBlocks'; // from the Builder filename that created this script
8
+ let expInfo = {'session': '001', 'participant': `subj${(Math.random() * 100000)}`};
9
+
10
+ // Start code blocks for 'Before Experiment'
11
+ // init psychoJS:
12
+ const psychoJS = new PsychoJS({
13
+ debug: true
14
+ });
15
+
16
+ // open window:
17
+ psychoJS.openWindow({
18
+ fullscr: true,
19
+ color: new util.Color([0, 0, 0]),
20
+ units: 'height',
21
+ waitBlanking: true
22
+ });
23
+ // schedule the experiment:
24
+ psychoJS.schedule(psychoJS.gui.DlgFromDict({
25
+ dictionary: expInfo,
26
+ title: expName
27
+ }));
28
+
29
+ const flowScheduler = new Scheduler(psychoJS);
30
+ const dialogCancelScheduler = new Scheduler(psychoJS);
31
+ psychoJS.scheduleCondition(function() { return (psychoJS.gui.dialogComponent.button === 'OK'); }, flowScheduler, dialogCancelScheduler);
32
+
33
+ // flowScheduler gets run if the participants presses OK
34
+ flowScheduler.add(updateInfo); // add timeStamp
35
+ flowScheduler.add(experimentInit);
36
+ const blocksLoopScheduler = new Scheduler(psychoJS);
37
+ flowScheduler.add(blocksLoopBegin(blocksLoopScheduler));
38
+ flowScheduler.add(blocksLoopScheduler);
39
+ flowScheduler.add(blocksLoopEnd);
40
+ flowScheduler.add(quitPsychoJS, '', true);
41
+
42
+ // quit if user presses Cancel in dialog box:
43
+ dialogCancelScheduler.add(quitPsychoJS, '', false);
44
+
45
+ psychoJS.start({
46
+ expName: expName,
47
+ expInfo: expInfo,
48
+ });
49
+
50
+ psychoJS.experimentLogger.setLevel(core.Logger.ServerLevel.EXP);
51
+
52
+
53
+ var frameDur;
54
+ async function updateInfo() {
55
+ expInfo['date'] = util.MonotonicClock.getDateStr(); // add a simple timestamp
56
+ expInfo['expName'] = expName;
57
+ expInfo['psychopyVersion'] = '2022.2.0dev3';
58
+ expInfo['OS'] = window.navigator.platform;
59
+
60
+ psychoJS.experiment.dataFileName = (("." + "/") + `data/${expInfo["participant"]}_${expName}_${expInfo["date"]}`);
61
+
62
+ // store frame rate of monitor if we can measure it successfully
63
+ expInfo['frameRate'] = psychoJS.window.getActualFrameRate();
64
+ if (typeof expInfo['frameRate'] !== 'undefined')
65
+ frameDur = 1.0 / Math.round(expInfo['frameRate']);
66
+ else
67
+ frameDur = 1.0 / 60.0; // couldn't get a reliable measure so guess
68
+
69
+ // add info from the URL:
70
+ util.addInfoFromUrl(expInfo);
71
+
72
+ return Scheduler.Event.NEXT;
73
+ }
74
+
75
+
76
+ var readyMessageClock;
77
+ var textbox;
78
+ var trialClock;
79
+ var image;
80
+ var globalClock;
81
+ var routineTimer;
82
+ async function experimentInit() {
83
+ // Initialize components for Routine "readyMessage"
84
+ readyMessageClock = new util.Clock();
85
+ textbox = new visual.TextBox({
86
+ win: psychoJS.window,
87
+ name: 'textbox',
88
+ text: '',
89
+ font: 'Open Sans',
90
+ pos: [0, 0], letterHeight: 0.05,
91
+ size: [0.4, 0.4], units: undefined,
92
+ color: 'white', colorSpace: 'rgb',
93
+ fillColor: undefined, borderColor: undefined,
94
+ bold: false, italic: false,
95
+ opacity: 1.0,
96
+ padding: undefined,
97
+ editable: false,
98
+ multiline: true,
99
+ anchor: 'center',
100
+ depth: 0.0
101
+ });
102
+
103
+ // Initialize components for Routine "trial"
104
+ trialClock = new util.Clock();
105
+ image = new visual.ImageStim({
106
+ win : psychoJS.window,
107
+ name : 'image', units : 'height',
108
+ image : undefined, mask : undefined,
109
+ ori : 0, pos : [0, 0], size : [0.5, 0.5],
110
+ color : new util.Color([1, 1, 1]), opacity : 1,
111
+ flipHoriz : false, flipVert : false,
112
+ texRes : 128, interpolate : true, depth : 0.0
113
+ });
114
+ // Create some handy timers
115
+ globalClock = new util.Clock(); // to track the time since experiment started
116
+ routineTimer = new util.CountdownTimer(); // to track time remaining of each (non-slip) routine
117
+
118
+ return Scheduler.Event.NEXT;
119
+ }
120
+
121
+
122
+ var blocks;
123
+ var currentLoop;
124
+ function blocksLoopBegin(blocksLoopScheduler, snapshot) {
125
+ return async function() {
126
+ TrialHandler.fromSnapshot(snapshot); // update internal variables (.thisN etc) of the loop
127
+
128
+ // set up handler to look after randomisation of conditions etc
129
+ blocks = new TrialHandler({
130
+ psychoJS: psychoJS,
131
+ nReps: 2, method: TrialHandler.Method.RANDOM,
132
+ extraInfo: expInfo, originPath: undefined,
133
+ trialList: 'chooseBlock.xlsx',
134
+ seed: undefined, name: 'blocks'
135
+ });
136
+ psychoJS.experiment.addLoop(blocks); // add the loop to the experiment
137
+ currentLoop = blocks; // we're now the current loop
138
+
139
+ // Schedule all the trials in the trialList:
140
+ blocks.forEach(function() {
141
+ const snapshot = blocks.getSnapshot();
142
+
143
+ blocksLoopScheduler.add(importConditions(snapshot));
144
+ blocksLoopScheduler.add(readyMessageRoutineBegin(snapshot));
145
+ blocksLoopScheduler.add(readyMessageRoutineEachFrame());
146
+ blocksLoopScheduler.add(readyMessageRoutineEnd());
147
+ const trialsLoopScheduler = new Scheduler(psychoJS);
148
+ blocksLoopScheduler.add(trialsLoopBegin(trialsLoopScheduler, snapshot));
149
+ blocksLoopScheduler.add(trialsLoopScheduler);
150
+ blocksLoopScheduler.add(trialsLoopEnd);
151
+ blocksLoopScheduler.add(endLoopIteration(blocksLoopScheduler, snapshot));
152
+ });
153
+
154
+ return Scheduler.Event.NEXT;
155
+ }
156
+ }
157
+
158
+
159
+ var trials;
160
+ function trialsLoopBegin(trialsLoopScheduler, snapshot) {
161
+ return async function() {
162
+ TrialHandler.fromSnapshot(snapshot); // update internal variables (.thisN etc) of the loop
163
+
164
+ // set up handler to look after randomisation of conditions etc
165
+ trials = new TrialHandler({
166
+ psychoJS: psychoJS,
167
+ nReps: 1, method: TrialHandler.Method.RANDOM,
168
+ extraInfo: expInfo, originPath: undefined,
169
+ trialList: condsFile,
170
+ seed: undefined, name: 'trials'
171
+ });
172
+ psychoJS.experiment.addLoop(trials); // add the loop to the experiment
173
+ currentLoop = trials; // we're now the current loop
174
+
175
+ // Schedule all the trials in the trialList:
176
+ trials.forEach(function() {
177
+ const snapshot = trials.getSnapshot();
178
+
179
+ trialsLoopScheduler.add(importConditions(snapshot));
180
+ trialsLoopScheduler.add(trialRoutineBegin(snapshot));
181
+ trialsLoopScheduler.add(trialRoutineEachFrame());
182
+ trialsLoopScheduler.add(trialRoutineEnd());
183
+ trialsLoopScheduler.add(endLoopIteration(trialsLoopScheduler, snapshot));
184
+ });
185
+
186
+ return Scheduler.Event.NEXT;
187
+ }
188
+ }
189
+
190
+
191
+ async function trialsLoopEnd() {
192
+ psychoJS.experiment.removeLoop(trials);
193
+
194
+ return Scheduler.Event.NEXT;
195
+ }
196
+
197
+
198
+ async function blocksLoopEnd() {
199
+ psychoJS.experiment.removeLoop(blocks);
200
+
201
+ return Scheduler.Event.NEXT;
202
+ }
203
+
204
+
205
+ var t;
206
+ var frameN;
207
+ var continueRoutine;
208
+ var readyMessageComponents;
209
+ function readyMessageRoutineBegin(snapshot) {
210
+ return async function () {
211
+ TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
212
+
213
+ //--- Prepare to start Routine 'readyMessage' ---
214
+ t = 0;
215
+ readyMessageClock.reset(); // clock
216
+ frameN = -1;
217
+ continueRoutine = true; // until we're told otherwise
218
+ routineTimer.add(1.000000);
219
+ // update component parameters for each repeat
220
+ textbox.setText(readyMsg);
221
+ // keep track of which components have finished
222
+ readyMessageComponents = [];
223
+ readyMessageComponents.push(textbox);
224
+
225
+ readyMessageComponents.forEach( function(thisComponent) {
226
+ if ('status' in thisComponent)
227
+ thisComponent.status = PsychoJS.Status.NOT_STARTED;
228
+ });
229
+ return Scheduler.Event.NEXT;
230
+ }
231
+ }
232
+
233
+
234
+ var frameRemains;
235
+ function readyMessageRoutineEachFrame() {
236
+ return async function () {
237
+ //--- Loop for each frame of Routine 'readyMessage' ---
238
+ // get current time
239
+ t = readyMessageClock.getTime();
240
+ frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
241
+ // update/draw components on each frame
242
+
243
+ // *textbox* updates
244
+ if (t >= 0.0 && textbox.status === PsychoJS.Status.NOT_STARTED) {
245
+ // keep track of start time/frame for later
246
+ textbox.tStart = t; // (not accounting for frame time here)
247
+ textbox.frameNStart = frameN; // exact frame index
248
+
249
+ textbox.setAutoDraw(true);
250
+ }
251
+
252
+ frameRemains = 0.0 + 1.0 - psychoJS.window.monitorFramePeriod * 0.75; // most of one frame period left
253
+ if (textbox.status === PsychoJS.Status.STARTED && t >= frameRemains) {
254
+ textbox.setAutoDraw(false);
255
+ }
256
+ // check for quit (typically the Esc key)
257
+ if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
258
+ return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
259
+ }
260
+
261
+ // check if the Routine should terminate
262
+ if (!continueRoutine) { // a component has requested a forced-end of Routine
263
+ return Scheduler.Event.NEXT;
264
+ }
265
+
266
+ continueRoutine = false; // reverts to True if at least one component still running
267
+ readyMessageComponents.forEach( function(thisComponent) {
268
+ if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
269
+ continueRoutine = true;
270
+ }
271
+ });
272
+
273
+ // refresh the screen if continuing
274
+ if (continueRoutine && routineTimer.getTime() > 0) {
275
+ return Scheduler.Event.FLIP_REPEAT;
276
+ } else {
277
+ return Scheduler.Event.NEXT;
278
+ }
279
+ };
280
+ }
281
+
282
+
283
+ function readyMessageRoutineEnd() {
284
+ return async function () {
285
+ //--- Ending Routine 'readyMessage' ---
286
+ readyMessageComponents.forEach( function(thisComponent) {
287
+ if (typeof thisComponent.setAutoDraw === 'function') {
288
+ thisComponent.setAutoDraw(false);
289
+ }
290
+ });
291
+ return Scheduler.Event.NEXT;
292
+ };
293
+ }
294
+
295
+
296
+ var trialComponents;
297
+ function trialRoutineBegin(snapshot) {
298
+ return async function () {
299
+ TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
300
+
301
+ //--- Prepare to start Routine 'trial' ---
302
+ t = 0;
303
+ trialClock.reset(); // clock
304
+ frameN = -1;
305
+ continueRoutine = true; // until we're told otherwise
306
+ routineTimer.add(1.500000);
307
+ // update component parameters for each repeat
308
+ image.setImage(stimFile);
309
+ // keep track of which components have finished
310
+ trialComponents = [];
311
+ trialComponents.push(image);
312
+
313
+ trialComponents.forEach( function(thisComponent) {
314
+ if ('status' in thisComponent)
315
+ thisComponent.status = PsychoJS.Status.NOT_STARTED;
316
+ });
317
+ return Scheduler.Event.NEXT;
318
+ }
319
+ }
320
+
321
+
322
+ function trialRoutineEachFrame() {
323
+ return async function () {
324
+ //--- Loop for each frame of Routine 'trial' ---
325
+ // get current time
326
+ t = trialClock.getTime();
327
+ frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
328
+ // update/draw components on each frame
329
+
330
+ // *image* updates
331
+ if (t >= 0.5 && image.status === PsychoJS.Status.NOT_STARTED) {
332
+ // keep track of start time/frame for later
333
+ image.tStart = t; // (not accounting for frame time here)
334
+ image.frameNStart = frameN; // exact frame index
335
+
336
+ image.setAutoDraw(true);
337
+ }
338
+
339
+ frameRemains = 0.5 + 1.0 - psychoJS.window.monitorFramePeriod * 0.75; // most of one frame period left
340
+ if (image.status === PsychoJS.Status.STARTED && t >= frameRemains) {
341
+ image.setAutoDraw(false);
342
+ }
343
+ // check for quit (typically the Esc key)
344
+ if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
345
+ return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
346
+ }
347
+
348
+ // check if the Routine should terminate
349
+ if (!continueRoutine) { // a component has requested a forced-end of Routine
350
+ return Scheduler.Event.NEXT;
351
+ }
352
+
353
+ continueRoutine = false; // reverts to True if at least one component still running
354
+ trialComponents.forEach( function(thisComponent) {
355
+ if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
356
+ continueRoutine = true;
357
+ }
358
+ });
359
+
360
+ // refresh the screen if continuing
361
+ if (continueRoutine && routineTimer.getTime() > 0) {
362
+ return Scheduler.Event.FLIP_REPEAT;
363
+ } else {
364
+ return Scheduler.Event.NEXT;
365
+ }
366
+ };
367
+ }
368
+
369
+
370
+ function trialRoutineEnd() {
371
+ return async function () {
372
+ //--- Ending Routine 'trial' ---
373
+ trialComponents.forEach( function(thisComponent) {
374
+ if (typeof thisComponent.setAutoDraw === 'function') {
375
+ thisComponent.setAutoDraw(false);
376
+ }
377
+ });
378
+ return Scheduler.Event.NEXT;
379
+ };
380
+ }
381
+
382
+
383
+ function endLoopIteration(scheduler, snapshot) {
384
+ // ------Prepare for next entry------
385
+ return async function () {
386
+ if (typeof snapshot !== 'undefined') {
387
+ // ------Check if user ended loop early------
388
+ if (snapshot.finished) {
389
+ // Check for and save orphaned data
390
+ if (psychoJS.experiment.isEntryEmpty()) {
391
+ psychoJS.experiment.nextEntry(snapshot);
392
+ }
393
+ scheduler.stop();
394
+ } else {
395
+ const thisTrial = snapshot.getCurrentTrial();
396
+ if (typeof thisTrial === 'undefined' || !('isTrials' in thisTrial) || thisTrial.isTrials) {
397
+ psychoJS.experiment.nextEntry(snapshot);
398
+ }
399
+ }
400
+ return Scheduler.Event.NEXT;
401
+ }
402
+ };
403
+ }
404
+
405
+
406
+ function importConditions(currentLoop) {
407
+ return async function () {
408
+ psychoJS.importAttributes(currentLoop.getCurrentTrial());
409
+ return Scheduler.Event.NEXT;
410
+ };
411
+ }
412
+
413
+
414
+ async function quitPsychoJS(message, isCompleted) {
415
+ // Check for and save orphaned data
416
+ if (psychoJS.experiment.isEntryEmpty()) {
417
+ psychoJS.experiment.nextEntry();
418
+ }
419
+ psychoJS.window.close();
420
+ psychoJS.quit({message: message, isCompleted: isCompleted});
421
+
422
+ return Scheduler.Event.QUIT;
423
+ }