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,330 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
This experiment was created using PsychoPy3 Experiment Builder (v2022.2.0dev3),
|
|
5
|
+
on Thu May 26 16:57:34 2022
|
|
6
|
+
If you publish work using this script the most relevant publication is:
|
|
7
|
+
|
|
8
|
+
Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019)
|
|
9
|
+
PsychoPy2: Experiments in behavior made easy Behav Res 51: 195.
|
|
10
|
+
https://doi.org/10.3758/s13428-018-01193-y
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
# --- Import packages ---
|
|
15
|
+
from psychopy import locale_setup
|
|
16
|
+
from psychopy import prefs
|
|
17
|
+
from psychopy import sound, gui, visual, core, data, event, logging, clock, colors, layout
|
|
18
|
+
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
|
|
19
|
+
STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
|
|
20
|
+
|
|
21
|
+
import numpy as np # whole numpy lib is available, prepend 'np.'
|
|
22
|
+
from numpy import (sin, cos, tan, log, log10, pi, average,
|
|
23
|
+
sqrt, std, deg2rad, rad2deg, linspace, asarray)
|
|
24
|
+
from numpy.random import random, randint, normal, shuffle, choice as randchoice
|
|
25
|
+
import os # handy system and path functions
|
|
26
|
+
import sys # to get file system encoding
|
|
27
|
+
|
|
28
|
+
import psychopy.iohub as io
|
|
29
|
+
from psychopy.hardware import keyboard
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Ensure that relative paths start from the same directory as this script
|
|
34
|
+
_thisDir = os.path.dirname(os.path.abspath(__file__))
|
|
35
|
+
os.chdir(_thisDir)
|
|
36
|
+
# Store info about the experiment session
|
|
37
|
+
psychopyVersion = '2022.2.0dev3'
|
|
38
|
+
expName = 'blockedTrials' # from the Builder filename that created this script
|
|
39
|
+
expInfo = {
|
|
40
|
+
'session': '001',
|
|
41
|
+
'participant': "subj%06.0f" %(random()*100000),
|
|
42
|
+
}
|
|
43
|
+
# --- Show participant info dialog --
|
|
44
|
+
dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName)
|
|
45
|
+
if dlg.OK == False:
|
|
46
|
+
core.quit() # user pressed cancel
|
|
47
|
+
expInfo['date'] = data.getDateStr() # add a simple timestamp
|
|
48
|
+
expInfo['expName'] = expName
|
|
49
|
+
expInfo['psychopyVersion'] = psychopyVersion
|
|
50
|
+
|
|
51
|
+
# Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc
|
|
52
|
+
filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date'])
|
|
53
|
+
|
|
54
|
+
# An ExperimentHandler isn't essential but helps with data saving
|
|
55
|
+
thisExp = data.ExperimentHandler(name=expName, version='',
|
|
56
|
+
extraInfo=expInfo, runtimeInfo=None,
|
|
57
|
+
originPath='psychopy/demos/builder/Design Templates/randomisedBlocks/randomisedBlocks.py',
|
|
58
|
+
savePickle=True, saveWideText=True,
|
|
59
|
+
dataFileName=filename)
|
|
60
|
+
# save a log file for detail verbose info
|
|
61
|
+
logFile = logging.LogFile(filename+'.log', level=logging.EXP)
|
|
62
|
+
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file
|
|
63
|
+
|
|
64
|
+
endExpNow = False # flag for 'escape' or other condition => quit the exp
|
|
65
|
+
frameTolerance = 0.001 # how close to onset before 'same' frame
|
|
66
|
+
|
|
67
|
+
# Start Code - component code to be run after the window creation
|
|
68
|
+
|
|
69
|
+
# --- Setup the Window ---
|
|
70
|
+
win = visual.Window(
|
|
71
|
+
size=[1440, 900], fullscr=True, screen=0,
|
|
72
|
+
winType='pyglet', allowGUI=False, allowStencil=False,
|
|
73
|
+
monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
|
|
74
|
+
blendMode='avg', useFBO=True,
|
|
75
|
+
units='height')
|
|
76
|
+
# store frame rate of monitor if we can measure it
|
|
77
|
+
expInfo['frameRate'] = win.getActualFrameRate()
|
|
78
|
+
if expInfo['frameRate'] != None:
|
|
79
|
+
frameDur = 1.0 / round(expInfo['frameRate'])
|
|
80
|
+
else:
|
|
81
|
+
frameDur = 1.0 / 60.0 # could not measure, so guess
|
|
82
|
+
# --- Setup input devices ---
|
|
83
|
+
ioConfig = {}
|
|
84
|
+
|
|
85
|
+
# Setup iohub keyboard
|
|
86
|
+
ioConfig['Keyboard'] = dict(use_keymap='psychopy')
|
|
87
|
+
|
|
88
|
+
ioSession = '1'
|
|
89
|
+
if 'session' in expInfo:
|
|
90
|
+
ioSession = str(expInfo['session'])
|
|
91
|
+
ioServer = io.launchHubServer(window=win, **ioConfig)
|
|
92
|
+
eyetracker = None
|
|
93
|
+
|
|
94
|
+
# create a default keyboard (e.g. to check for escape)
|
|
95
|
+
defaultKeyboard = keyboard.Keyboard(backend='iohub')
|
|
96
|
+
|
|
97
|
+
# --- Initialize components for Routine "readyMessage" ---
|
|
98
|
+
readyMessageClock = core.Clock()
|
|
99
|
+
textbox = visual.TextBox2(
|
|
100
|
+
win, text='', font='Open Sans',
|
|
101
|
+
pos=(0, 0), letterHeight=0.05,
|
|
102
|
+
size=(0.4, 0.4), borderWidth=2.0,
|
|
103
|
+
color='white', colorSpace='rgb',
|
|
104
|
+
opacity=1.0,
|
|
105
|
+
bold=False, italic=False,
|
|
106
|
+
lineSpacing=1.0,
|
|
107
|
+
padding=None, alignment='center',
|
|
108
|
+
anchor='center',
|
|
109
|
+
fillColor=None, borderColor=None,
|
|
110
|
+
flipHoriz=False, flipVert=False, languageStyle='LTR',
|
|
111
|
+
editable=False,
|
|
112
|
+
name='textbox',
|
|
113
|
+
autoLog=True,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
# --- Initialize components for Routine "trial" ---
|
|
117
|
+
trialClock = core.Clock()
|
|
118
|
+
image = visual.ImageStim(
|
|
119
|
+
win=win,
|
|
120
|
+
name='image', units='height',
|
|
121
|
+
image='sin', mask=None, anchor='center',
|
|
122
|
+
ori=0, pos=(0, 0), size=(0.5,0.5),
|
|
123
|
+
color=[1,1,1], colorSpace='rgb', opacity=1,
|
|
124
|
+
flipHoriz=False, flipVert=False,
|
|
125
|
+
texRes=128, interpolate=True, depth=0.0)
|
|
126
|
+
|
|
127
|
+
# Create some handy timers
|
|
128
|
+
globalClock = core.Clock() # to track the time since experiment started
|
|
129
|
+
routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine
|
|
130
|
+
|
|
131
|
+
# set up handler to look after randomisation of conditions etc
|
|
132
|
+
blocks = data.TrialHandler(nReps=2, method='random',
|
|
133
|
+
extraInfo=expInfo, originPath=-1,
|
|
134
|
+
trialList=data.importConditions('chooseBlock.xlsx'),
|
|
135
|
+
seed=None, name='blocks')
|
|
136
|
+
thisExp.addLoop(blocks) # add the loop to the experiment
|
|
137
|
+
thisBlock = blocks.trialList[0] # so we can initialise stimuli with some values
|
|
138
|
+
# abbreviate parameter names if possible (e.g. rgb = thisBlock.rgb)
|
|
139
|
+
if thisBlock != None:
|
|
140
|
+
for paramName in thisBlock:
|
|
141
|
+
exec('{} = thisBlock[paramName]'.format(paramName))
|
|
142
|
+
|
|
143
|
+
for thisBlock in blocks:
|
|
144
|
+
currentLoop = blocks
|
|
145
|
+
# abbreviate parameter names if possible (e.g. rgb = thisBlock.rgb)
|
|
146
|
+
if thisBlock != None:
|
|
147
|
+
for paramName in thisBlock:
|
|
148
|
+
exec('{} = thisBlock[paramName]'.format(paramName))
|
|
149
|
+
|
|
150
|
+
# --- Prepare to start Routine "readyMessage" ---
|
|
151
|
+
continueRoutine = True
|
|
152
|
+
routineTimer.add(1.000000)
|
|
153
|
+
# update component parameters for each repeat
|
|
154
|
+
textbox.reset()
|
|
155
|
+
textbox.setText(readyMsg)
|
|
156
|
+
# keep track of which components have finished
|
|
157
|
+
readyMessageComponents = [textbox]
|
|
158
|
+
for thisComponent in readyMessageComponents:
|
|
159
|
+
thisComponent.tStart = None
|
|
160
|
+
thisComponent.tStop = None
|
|
161
|
+
thisComponent.tStartRefresh = None
|
|
162
|
+
thisComponent.tStopRefresh = None
|
|
163
|
+
if hasattr(thisComponent, 'status'):
|
|
164
|
+
thisComponent.status = NOT_STARTED
|
|
165
|
+
# reset timers
|
|
166
|
+
t = 0
|
|
167
|
+
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
|
|
168
|
+
readyMessageClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
|
|
169
|
+
frameN = -1
|
|
170
|
+
|
|
171
|
+
# --- Run Routine "readyMessage" ---
|
|
172
|
+
while continueRoutine and routineTimer.getTime() > 0:
|
|
173
|
+
# get current time
|
|
174
|
+
t = readyMessageClock.getTime()
|
|
175
|
+
tThisFlip = win.getFutureFlipTime(clock=readyMessageClock)
|
|
176
|
+
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
|
|
177
|
+
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
|
|
178
|
+
# update/draw components on each frame
|
|
179
|
+
|
|
180
|
+
# *textbox* updates
|
|
181
|
+
if textbox.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
|
|
182
|
+
# keep track of start time/frame for later
|
|
183
|
+
textbox.frameNStart = frameN # exact frame index
|
|
184
|
+
textbox.tStart = t # local t and not account for scr refresh
|
|
185
|
+
textbox.tStartRefresh = tThisFlipGlobal # on global time
|
|
186
|
+
win.timeOnFlip(textbox, 'tStartRefresh') # time at next scr refresh
|
|
187
|
+
textbox.setAutoDraw(True)
|
|
188
|
+
if textbox.status == STARTED:
|
|
189
|
+
# is it time to stop? (based on global clock, using actual start)
|
|
190
|
+
if tThisFlipGlobal > textbox.tStartRefresh + 1.0-frameTolerance:
|
|
191
|
+
# keep track of stop time/frame for later
|
|
192
|
+
textbox.tStop = t # not accounting for scr refresh
|
|
193
|
+
textbox.frameNStop = frameN # exact frame index
|
|
194
|
+
win.timeOnFlip(textbox, 'tStopRefresh') # time at next scr refresh
|
|
195
|
+
textbox.setAutoDraw(False)
|
|
196
|
+
|
|
197
|
+
# check for quit (typically the Esc key)
|
|
198
|
+
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
|
|
199
|
+
core.quit()
|
|
200
|
+
|
|
201
|
+
# check if all components have finished
|
|
202
|
+
if not continueRoutine: # a component has requested a forced-end of Routine
|
|
203
|
+
break
|
|
204
|
+
continueRoutine = False # will revert to True if at least one component still running
|
|
205
|
+
for thisComponent in readyMessageComponents:
|
|
206
|
+
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
|
|
207
|
+
continueRoutine = True
|
|
208
|
+
break # at least one component has not yet finished
|
|
209
|
+
|
|
210
|
+
# refresh the screen
|
|
211
|
+
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
|
|
212
|
+
win.flip()
|
|
213
|
+
|
|
214
|
+
# --- Ending Routine "readyMessage" ---
|
|
215
|
+
for thisComponent in readyMessageComponents:
|
|
216
|
+
if hasattr(thisComponent, "setAutoDraw"):
|
|
217
|
+
thisComponent.setAutoDraw(False)
|
|
218
|
+
blocks.addData('textbox.started', textbox.tStartRefresh)
|
|
219
|
+
blocks.addData('textbox.stopped', textbox.tStopRefresh)
|
|
220
|
+
|
|
221
|
+
# set up handler to look after randomisation of conditions etc
|
|
222
|
+
trials = data.TrialHandler(nReps=1, method='random',
|
|
223
|
+
extraInfo=expInfo, originPath=-1,
|
|
224
|
+
trialList=data.importConditions(condsFile),
|
|
225
|
+
seed=None, name='trials')
|
|
226
|
+
thisExp.addLoop(trials) # add the loop to the experiment
|
|
227
|
+
thisTrial = trials.trialList[0] # so we can initialise stimuli with some values
|
|
228
|
+
# abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
|
|
229
|
+
if thisTrial != None:
|
|
230
|
+
for paramName in thisTrial:
|
|
231
|
+
exec('{} = thisTrial[paramName]'.format(paramName))
|
|
232
|
+
|
|
233
|
+
for thisTrial in trials:
|
|
234
|
+
currentLoop = trials
|
|
235
|
+
# abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
|
|
236
|
+
if thisTrial != None:
|
|
237
|
+
for paramName in thisTrial:
|
|
238
|
+
exec('{} = thisTrial[paramName]'.format(paramName))
|
|
239
|
+
|
|
240
|
+
# --- Prepare to start Routine "trial" ---
|
|
241
|
+
continueRoutine = True
|
|
242
|
+
routineTimer.add(1.500000)
|
|
243
|
+
# update component parameters for each repeat
|
|
244
|
+
image.setImage(stimFile)
|
|
245
|
+
# keep track of which components have finished
|
|
246
|
+
trialComponents = [image]
|
|
247
|
+
for thisComponent in trialComponents:
|
|
248
|
+
thisComponent.tStart = None
|
|
249
|
+
thisComponent.tStop = None
|
|
250
|
+
thisComponent.tStartRefresh = None
|
|
251
|
+
thisComponent.tStopRefresh = None
|
|
252
|
+
if hasattr(thisComponent, 'status'):
|
|
253
|
+
thisComponent.status = NOT_STARTED
|
|
254
|
+
# reset timers
|
|
255
|
+
t = 0
|
|
256
|
+
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
|
|
257
|
+
trialClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
|
|
258
|
+
frameN = -1
|
|
259
|
+
|
|
260
|
+
# --- Run Routine "trial" ---
|
|
261
|
+
while continueRoutine and routineTimer.getTime() > 0:
|
|
262
|
+
# get current time
|
|
263
|
+
t = trialClock.getTime()
|
|
264
|
+
tThisFlip = win.getFutureFlipTime(clock=trialClock)
|
|
265
|
+
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
|
|
266
|
+
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
|
|
267
|
+
# update/draw components on each frame
|
|
268
|
+
|
|
269
|
+
# *image* updates
|
|
270
|
+
if image.status == NOT_STARTED and tThisFlip >= 0.5-frameTolerance:
|
|
271
|
+
# keep track of start time/frame for later
|
|
272
|
+
image.frameNStart = frameN # exact frame index
|
|
273
|
+
image.tStart = t # local t and not account for scr refresh
|
|
274
|
+
image.tStartRefresh = tThisFlipGlobal # on global time
|
|
275
|
+
win.timeOnFlip(image, 'tStartRefresh') # time at next scr refresh
|
|
276
|
+
image.setAutoDraw(True)
|
|
277
|
+
if image.status == STARTED:
|
|
278
|
+
# is it time to stop? (based on global clock, using actual start)
|
|
279
|
+
if tThisFlipGlobal > image.tStartRefresh + 1.0-frameTolerance:
|
|
280
|
+
# keep track of stop time/frame for later
|
|
281
|
+
image.tStop = t # not accounting for scr refresh
|
|
282
|
+
image.frameNStop = frameN # exact frame index
|
|
283
|
+
win.timeOnFlip(image, 'tStopRefresh') # time at next scr refresh
|
|
284
|
+
image.setAutoDraw(False)
|
|
285
|
+
|
|
286
|
+
# check for quit (typically the Esc key)
|
|
287
|
+
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
|
|
288
|
+
core.quit()
|
|
289
|
+
|
|
290
|
+
# check if all components have finished
|
|
291
|
+
if not continueRoutine: # a component has requested a forced-end of Routine
|
|
292
|
+
break
|
|
293
|
+
continueRoutine = False # will revert to True if at least one component still running
|
|
294
|
+
for thisComponent in trialComponents:
|
|
295
|
+
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
|
|
296
|
+
continueRoutine = True
|
|
297
|
+
break # at least one component has not yet finished
|
|
298
|
+
|
|
299
|
+
# refresh the screen
|
|
300
|
+
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
|
|
301
|
+
win.flip()
|
|
302
|
+
|
|
303
|
+
# --- Ending Routine "trial" ---
|
|
304
|
+
for thisComponent in trialComponents:
|
|
305
|
+
if hasattr(thisComponent, "setAutoDraw"):
|
|
306
|
+
thisComponent.setAutoDraw(False)
|
|
307
|
+
trials.addData('image.started', image.tStartRefresh)
|
|
308
|
+
trials.addData('image.stopped', image.tStopRefresh)
|
|
309
|
+
thisExp.nextEntry()
|
|
310
|
+
|
|
311
|
+
# completed 1 repeats of 'trials'
|
|
312
|
+
|
|
313
|
+
# completed 2 repeats of 'blocks'
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
# --- End experiment ---
|
|
317
|
+
# Flip one final time so any remaining win.callOnFlip()
|
|
318
|
+
# and win.timeOnFlip() tasks get executed before quitting
|
|
319
|
+
win.flip()
|
|
320
|
+
|
|
321
|
+
# these shouldn't be strictly necessary (should auto-save)
|
|
322
|
+
thisExp.saveAsWideText(filename+'.csv', delim='auto')
|
|
323
|
+
thisExp.saveAsPickle(filename)
|
|
324
|
+
logging.flush()
|
|
325
|
+
# make sure everything is closed down
|
|
326
|
+
if eyetracker:
|
|
327
|
+
eyetracker.setConnectionState(False)
|
|
328
|
+
thisExp.abort() # or data files will save again on exit
|
|
329
|
+
win.close()
|
|
330
|
+
core.quit()
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
This experiment was created using PsychoPy3 Experiment Builder (v2022.2.0dev3),
|
|
5
|
+
on Thu May 26 17:00:03 2022
|
|
6
|
+
If you publish work using this script the most relevant publication is:
|
|
7
|
+
|
|
8
|
+
Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019)
|
|
9
|
+
PsychoPy2: Experiments in behavior made easy Behav Res 51: 195.
|
|
10
|
+
https://doi.org/10.3758/s13428-018-01193-y
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
# --- Import packages ---
|
|
15
|
+
from psychopy import locale_setup
|
|
16
|
+
from psychopy import prefs
|
|
17
|
+
from psychopy import sound, gui, visual, core, data, event, logging, clock, colors, layout
|
|
18
|
+
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
|
|
19
|
+
STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
|
|
20
|
+
|
|
21
|
+
import numpy as np # whole numpy lib is available, prepend 'np.'
|
|
22
|
+
from numpy import (sin, cos, tan, log, log10, pi, average,
|
|
23
|
+
sqrt, std, deg2rad, rad2deg, linspace, asarray)
|
|
24
|
+
from numpy.random import random, randint, normal, shuffle, choice as randchoice
|
|
25
|
+
import os # handy system and path functions
|
|
26
|
+
import sys # to get file system encoding
|
|
27
|
+
|
|
28
|
+
import psychopy.iohub as io
|
|
29
|
+
from psychopy.hardware import keyboard
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Ensure that relative paths start from the same directory as this script
|
|
34
|
+
_thisDir = os.path.dirname(os.path.abspath(__file__))
|
|
35
|
+
os.chdir(_thisDir)
|
|
36
|
+
# Store info about the experiment session
|
|
37
|
+
psychopyVersion = '2022.2.0dev3'
|
|
38
|
+
expName = 'blockedTrials' # from the Builder filename that created this script
|
|
39
|
+
expInfo = {
|
|
40
|
+
'session': '001',
|
|
41
|
+
'participant': "subj%06.0f" %(random()*100000),
|
|
42
|
+
}
|
|
43
|
+
# --- Show participant info dialog --
|
|
44
|
+
dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName)
|
|
45
|
+
if dlg.OK == False:
|
|
46
|
+
core.quit() # user pressed cancel
|
|
47
|
+
expInfo['date'] = data.getDateStr() # add a simple timestamp
|
|
48
|
+
expInfo['expName'] = expName
|
|
49
|
+
expInfo['psychopyVersion'] = psychopyVersion
|
|
50
|
+
|
|
51
|
+
# Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc
|
|
52
|
+
filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date'])
|
|
53
|
+
|
|
54
|
+
# An ExperimentHandler isn't essential but helps with data saving
|
|
55
|
+
thisExp = data.ExperimentHandler(name=expName, version='',
|
|
56
|
+
extraInfo=expInfo, runtimeInfo=None,
|
|
57
|
+
originPath='psychopy/demos/builder/Design Templates/randomisedBlocks/randomisedBlocks_lastrun.py',
|
|
58
|
+
savePickle=True, saveWideText=True,
|
|
59
|
+
dataFileName=filename)
|
|
60
|
+
# save a log file for detail verbose info
|
|
61
|
+
logFile = logging.LogFile(filename+'.log', level=logging.EXP)
|
|
62
|
+
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file
|
|
63
|
+
|
|
64
|
+
endExpNow = False # flag for 'escape' or other condition => quit the exp
|
|
65
|
+
frameTolerance = 0.001 # how close to onset before 'same' frame
|
|
66
|
+
|
|
67
|
+
# Start Code - component code to be run after the window creation
|
|
68
|
+
|
|
69
|
+
# --- Setup the Window ---
|
|
70
|
+
win = visual.Window(
|
|
71
|
+
size=[1440, 900], fullscr=True, screen=0,
|
|
72
|
+
winType='pyglet', allowGUI=False, allowStencil=False,
|
|
73
|
+
monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
|
|
74
|
+
blendMode='avg', useFBO=True,
|
|
75
|
+
units='height')
|
|
76
|
+
# store frame rate of monitor if we can measure it
|
|
77
|
+
expInfo['frameRate'] = win.getActualFrameRate()
|
|
78
|
+
if expInfo['frameRate'] != None:
|
|
79
|
+
frameDur = 1.0 / round(expInfo['frameRate'])
|
|
80
|
+
else:
|
|
81
|
+
frameDur = 1.0 / 60.0 # could not measure, so guess
|
|
82
|
+
# --- Setup input devices ---
|
|
83
|
+
ioConfig = {}
|
|
84
|
+
|
|
85
|
+
# Setup iohub keyboard
|
|
86
|
+
ioConfig['Keyboard'] = dict(use_keymap='psychopy')
|
|
87
|
+
|
|
88
|
+
ioSession = '1'
|
|
89
|
+
if 'session' in expInfo:
|
|
90
|
+
ioSession = str(expInfo['session'])
|
|
91
|
+
ioServer = io.launchHubServer(window=win, **ioConfig)
|
|
92
|
+
eyetracker = None
|
|
93
|
+
|
|
94
|
+
# create a default keyboard (e.g. to check for escape)
|
|
95
|
+
defaultKeyboard = keyboard.Keyboard(backend='iohub')
|
|
96
|
+
|
|
97
|
+
# --- Initialize components for Routine "readyMessage" ---
|
|
98
|
+
readyMessageClock = core.Clock()
|
|
99
|
+
textbox = visual.TextBox2(
|
|
100
|
+
win, text='', font='Open Sans',
|
|
101
|
+
pos=(0, 0), letterHeight=0.05,
|
|
102
|
+
size=(0.4, 0.4), borderWidth=2.0,
|
|
103
|
+
color='white', colorSpace='rgb',
|
|
104
|
+
opacity=1.0,
|
|
105
|
+
bold=False, italic=False,
|
|
106
|
+
lineSpacing=1.0,
|
|
107
|
+
padding=None, alignment='center',
|
|
108
|
+
anchor='center',
|
|
109
|
+
fillColor=None, borderColor=None,
|
|
110
|
+
flipHoriz=False, flipVert=False, languageStyle='LTR',
|
|
111
|
+
editable=False,
|
|
112
|
+
name='textbox',
|
|
113
|
+
autoLog=True,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
# --- Initialize components for Routine "trial" ---
|
|
117
|
+
trialClock = core.Clock()
|
|
118
|
+
image = visual.ImageStim(
|
|
119
|
+
win=win,
|
|
120
|
+
name='image', units='height',
|
|
121
|
+
image='sin', mask=None, anchor='center',
|
|
122
|
+
ori=0, pos=(0, 0), size=(0.5,0.5),
|
|
123
|
+
color=[1,1,1], colorSpace='rgb', opacity=1,
|
|
124
|
+
flipHoriz=False, flipVert=False,
|
|
125
|
+
texRes=128, interpolate=True, depth=0.0)
|
|
126
|
+
|
|
127
|
+
# Create some handy timers
|
|
128
|
+
globalClock = core.Clock() # to track the time since experiment started
|
|
129
|
+
routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine
|
|
130
|
+
|
|
131
|
+
# set up handler to look after randomisation of conditions etc
|
|
132
|
+
blocks = data.TrialHandler(nReps=2, method='random',
|
|
133
|
+
extraInfo=expInfo, originPath=-1,
|
|
134
|
+
trialList=data.importConditions('chooseBlock.xlsx'),
|
|
135
|
+
seed=None, name='blocks')
|
|
136
|
+
thisExp.addLoop(blocks) # add the loop to the experiment
|
|
137
|
+
thisBlock = blocks.trialList[0] # so we can initialise stimuli with some values
|
|
138
|
+
# abbreviate parameter names if possible (e.g. rgb = thisBlock.rgb)
|
|
139
|
+
if thisBlock != None:
|
|
140
|
+
for paramName in thisBlock:
|
|
141
|
+
exec('{} = thisBlock[paramName]'.format(paramName))
|
|
142
|
+
|
|
143
|
+
for thisBlock in blocks:
|
|
144
|
+
currentLoop = blocks
|
|
145
|
+
# abbreviate parameter names if possible (e.g. rgb = thisBlock.rgb)
|
|
146
|
+
if thisBlock != None:
|
|
147
|
+
for paramName in thisBlock:
|
|
148
|
+
exec('{} = thisBlock[paramName]'.format(paramName))
|
|
149
|
+
|
|
150
|
+
# --- Prepare to start Routine "readyMessage" ---
|
|
151
|
+
continueRoutine = True
|
|
152
|
+
routineTimer.add(1.000000)
|
|
153
|
+
# update component parameters for each repeat
|
|
154
|
+
textbox.reset()
|
|
155
|
+
textbox.setText(readyMsg)
|
|
156
|
+
# keep track of which components have finished
|
|
157
|
+
readyMessageComponents = [textbox]
|
|
158
|
+
for thisComponent in readyMessageComponents:
|
|
159
|
+
thisComponent.tStart = None
|
|
160
|
+
thisComponent.tStop = None
|
|
161
|
+
thisComponent.tStartRefresh = None
|
|
162
|
+
thisComponent.tStopRefresh = None
|
|
163
|
+
if hasattr(thisComponent, 'status'):
|
|
164
|
+
thisComponent.status = NOT_STARTED
|
|
165
|
+
# reset timers
|
|
166
|
+
t = 0
|
|
167
|
+
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
|
|
168
|
+
readyMessageClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
|
|
169
|
+
frameN = -1
|
|
170
|
+
|
|
171
|
+
# --- Run Routine "readyMessage" ---
|
|
172
|
+
while continueRoutine and routineTimer.getTime() > 0:
|
|
173
|
+
# get current time
|
|
174
|
+
t = readyMessageClock.getTime()
|
|
175
|
+
tThisFlip = win.getFutureFlipTime(clock=readyMessageClock)
|
|
176
|
+
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
|
|
177
|
+
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
|
|
178
|
+
# update/draw components on each frame
|
|
179
|
+
|
|
180
|
+
# *textbox* updates
|
|
181
|
+
if textbox.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
|
|
182
|
+
# keep track of start time/frame for later
|
|
183
|
+
textbox.frameNStart = frameN # exact frame index
|
|
184
|
+
textbox.tStart = t # local t and not account for scr refresh
|
|
185
|
+
textbox.tStartRefresh = tThisFlipGlobal # on global time
|
|
186
|
+
win.timeOnFlip(textbox, 'tStartRefresh') # time at next scr refresh
|
|
187
|
+
textbox.setAutoDraw(True)
|
|
188
|
+
if textbox.status == STARTED:
|
|
189
|
+
# is it time to stop? (based on global clock, using actual start)
|
|
190
|
+
if tThisFlipGlobal > textbox.tStartRefresh + 1.0-frameTolerance:
|
|
191
|
+
# keep track of stop time/frame for later
|
|
192
|
+
textbox.tStop = t # not accounting for scr refresh
|
|
193
|
+
textbox.frameNStop = frameN # exact frame index
|
|
194
|
+
win.timeOnFlip(textbox, 'tStopRefresh') # time at next scr refresh
|
|
195
|
+
textbox.setAutoDraw(False)
|
|
196
|
+
|
|
197
|
+
# check for quit (typically the Esc key)
|
|
198
|
+
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
|
|
199
|
+
core.quit()
|
|
200
|
+
|
|
201
|
+
# check if all components have finished
|
|
202
|
+
if not continueRoutine: # a component has requested a forced-end of Routine
|
|
203
|
+
break
|
|
204
|
+
continueRoutine = False # will revert to True if at least one component still running
|
|
205
|
+
for thisComponent in readyMessageComponents:
|
|
206
|
+
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
|
|
207
|
+
continueRoutine = True
|
|
208
|
+
break # at least one component has not yet finished
|
|
209
|
+
|
|
210
|
+
# refresh the screen
|
|
211
|
+
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
|
|
212
|
+
win.flip()
|
|
213
|
+
|
|
214
|
+
# --- Ending Routine "readyMessage" ---
|
|
215
|
+
for thisComponent in readyMessageComponents:
|
|
216
|
+
if hasattr(thisComponent, "setAutoDraw"):
|
|
217
|
+
thisComponent.setAutoDraw(False)
|
|
218
|
+
blocks.addData('textbox.started', textbox.tStartRefresh)
|
|
219
|
+
blocks.addData('textbox.stopped', textbox.tStopRefresh)
|
|
220
|
+
|
|
221
|
+
# set up handler to look after randomisation of conditions etc
|
|
222
|
+
trials = data.TrialHandler(nReps=1, method='random',
|
|
223
|
+
extraInfo=expInfo, originPath=-1,
|
|
224
|
+
trialList=data.importConditions(condsFile),
|
|
225
|
+
seed=None, name='trials')
|
|
226
|
+
thisExp.addLoop(trials) # add the loop to the experiment
|
|
227
|
+
thisTrial = trials.trialList[0] # so we can initialise stimuli with some values
|
|
228
|
+
# abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
|
|
229
|
+
if thisTrial != None:
|
|
230
|
+
for paramName in thisTrial:
|
|
231
|
+
exec('{} = thisTrial[paramName]'.format(paramName))
|
|
232
|
+
|
|
233
|
+
for thisTrial in trials:
|
|
234
|
+
currentLoop = trials
|
|
235
|
+
# abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
|
|
236
|
+
if thisTrial != None:
|
|
237
|
+
for paramName in thisTrial:
|
|
238
|
+
exec('{} = thisTrial[paramName]'.format(paramName))
|
|
239
|
+
|
|
240
|
+
# --- Prepare to start Routine "trial" ---
|
|
241
|
+
continueRoutine = True
|
|
242
|
+
routineTimer.add(1.500000)
|
|
243
|
+
# update component parameters for each repeat
|
|
244
|
+
image.setImage(stimFile)
|
|
245
|
+
# keep track of which components have finished
|
|
246
|
+
trialComponents = [image]
|
|
247
|
+
for thisComponent in trialComponents:
|
|
248
|
+
thisComponent.tStart = None
|
|
249
|
+
thisComponent.tStop = None
|
|
250
|
+
thisComponent.tStartRefresh = None
|
|
251
|
+
thisComponent.tStopRefresh = None
|
|
252
|
+
if hasattr(thisComponent, 'status'):
|
|
253
|
+
thisComponent.status = NOT_STARTED
|
|
254
|
+
# reset timers
|
|
255
|
+
t = 0
|
|
256
|
+
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
|
|
257
|
+
trialClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
|
|
258
|
+
frameN = -1
|
|
259
|
+
|
|
260
|
+
# --- Run Routine "trial" ---
|
|
261
|
+
while continueRoutine and routineTimer.getTime() > 0:
|
|
262
|
+
# get current time
|
|
263
|
+
t = trialClock.getTime()
|
|
264
|
+
tThisFlip = win.getFutureFlipTime(clock=trialClock)
|
|
265
|
+
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
|
|
266
|
+
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
|
|
267
|
+
# update/draw components on each frame
|
|
268
|
+
|
|
269
|
+
# *image* updates
|
|
270
|
+
if image.status == NOT_STARTED and tThisFlip >= 0.5-frameTolerance:
|
|
271
|
+
# keep track of start time/frame for later
|
|
272
|
+
image.frameNStart = frameN # exact frame index
|
|
273
|
+
image.tStart = t # local t and not account for scr refresh
|
|
274
|
+
image.tStartRefresh = tThisFlipGlobal # on global time
|
|
275
|
+
win.timeOnFlip(image, 'tStartRefresh') # time at next scr refresh
|
|
276
|
+
image.setAutoDraw(True)
|
|
277
|
+
if image.status == STARTED:
|
|
278
|
+
# is it time to stop? (based on global clock, using actual start)
|
|
279
|
+
if tThisFlipGlobal > image.tStartRefresh + 1.0-frameTolerance:
|
|
280
|
+
# keep track of stop time/frame for later
|
|
281
|
+
image.tStop = t # not accounting for scr refresh
|
|
282
|
+
image.frameNStop = frameN # exact frame index
|
|
283
|
+
win.timeOnFlip(image, 'tStopRefresh') # time at next scr refresh
|
|
284
|
+
image.setAutoDraw(False)
|
|
285
|
+
|
|
286
|
+
# check for quit (typically the Esc key)
|
|
287
|
+
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
|
|
288
|
+
core.quit()
|
|
289
|
+
|
|
290
|
+
# check if all components have finished
|
|
291
|
+
if not continueRoutine: # a component has requested a forced-end of Routine
|
|
292
|
+
break
|
|
293
|
+
continueRoutine = False # will revert to True if at least one component still running
|
|
294
|
+
for thisComponent in trialComponents:
|
|
295
|
+
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
|
|
296
|
+
continueRoutine = True
|
|
297
|
+
break # at least one component has not yet finished
|
|
298
|
+
|
|
299
|
+
# refresh the screen
|
|
300
|
+
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
|
|
301
|
+
win.flip()
|
|
302
|
+
|
|
303
|
+
# --- Ending Routine "trial" ---
|
|
304
|
+
for thisComponent in trialComponents:
|
|
305
|
+
if hasattr(thisComponent, "setAutoDraw"):
|
|
306
|
+
thisComponent.setAutoDraw(False)
|
|
307
|
+
trials.addData('image.started', image.tStartRefresh)
|
|
308
|
+
trials.addData('image.stopped', image.tStopRefresh)
|
|
309
|
+
thisExp.nextEntry()
|
|
310
|
+
|
|
311
|
+
# completed 1 repeats of 'trials'
|
|
312
|
+
|
|
313
|
+
# completed 2 repeats of 'blocks'
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
# --- End experiment ---
|
|
317
|
+
# Flip one final time so any remaining win.callOnFlip()
|
|
318
|
+
# and win.timeOnFlip() tasks get executed before quitting
|
|
319
|
+
win.flip()
|
|
320
|
+
|
|
321
|
+
# these shouldn't be strictly necessary (should auto-save)
|
|
322
|
+
thisExp.saveAsWideText(filename+'.csv', delim='auto')
|
|
323
|
+
thisExp.saveAsPickle(filename)
|
|
324
|
+
logging.flush()
|
|
325
|
+
# make sure everything is closed down
|
|
326
|
+
if eyetracker:
|
|
327
|
+
eyetracker.setConnectionState(False)
|
|
328
|
+
thisExp.abort() # or data files will save again on exit
|
|
329
|
+
win.close()
|
|
330
|
+
core.quit()
|