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