psychopy 2024.2.4__py3-none-any.whl → 2024.2.5__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/CHANGELOG.txt +204 -0
- psychopy/GIT_SHA +1 -1
- psychopy/VERSION +1 -1
- psychopy/app/locale/ar_001/.DS_Store +0 -0
- psychopy/app/locale/ar_001/LC_MESSAGE/.DS_Store +0 -0
- psychopy/app/locale/ar_001/LC_MESSAGE/messages.po +1511 -3256
- psychopy/app/runner/runner.py +18 -8
- psychopy/experiment/_experiment.py +32 -7
- psychopy/iohub/client/__init__.py +17 -0
- psychopy/iohub/client/keyboard.py +5 -0
- psychopy/iohub/devices/mouse/linux2.py +4 -0
- psychopy/iohub/devices/mouse/win32.py +5 -0
- psychopy/tests/data/test_loaded_namespace/test_counterbalance.psyexp +142 -0
- psychopy/tests/data/test_loaded_namespace/test_custom_missing.psyexp +129 -0
- psychopy/tests/data/test_loaded_namespace/test_missing_counterbalance.psyexp +116 -0
- psychopy/tests/data/test_loaded_namespace/test_mix_exp.psyexp +181 -0
- psychopy/tests/data/test_loaded_namespace/test_mix_missing.psyexp +140 -0
- psychopy/tests/data/test_loaded_namespace/test_mix_name_calibration.psyexp +164 -0
- psychopy/tests/test_experiment/test_experiment.py +96 -0
- {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/METADATA +1 -1
- {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/RECORD +25 -55
- psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN.mo +0 -0
- psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN.po +0 -6127
- psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN_allFlagged.mo +0 -0
- psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN_allFlagged.po +0 -7366
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/index.html +0 -23
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/randomisedBlocks-legacy-browsers.js +0 -423
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/randomisedBlocks.js +0 -427
- 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 +0 -330
- psychopy/demos/builder/Feature Demos/eyetracking/eyetracking.xml +0 -298
- psychopy/demos/builder/Feature Demos/eyetracking/eyetracking.xsd +0 -120
- psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual.psyexp +0 -323
- psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual.py +0 -562
- 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 +0 -59
- psychopy/demos/builder/Tools/gammaCalibration/resources/second_order_tex.png +0 -0
- psychopy/demos/coder/stimuli/radialGratingContracting.py +0 -29
- psychopy/hardware/serialport.py +0 -51
- psychopy/tests/data/__test.png +0 -0
- psychopy/tests/data/corrFullRandom_local.csv +0 -16
- psychopy/tests/data/corrFullRandom_local.tsv +0 -6
- psychopy/tests/data/testLoopsBlocks.psyexp_local.py +0 -328
- 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/test_app/test_builder/data/_2021_ 5_03_1206.csv +0 -9
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.csv +0 -9
- {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/WHEEL +0 -0
- {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/entry_points.txt +0 -0
- {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/licenses/LICENSE +0 -0
psychopy/hardware/serialport.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
# Part of the PsychoPy library
|
|
5
|
-
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2022 Open Science Tools Ltd.
|
|
6
|
-
# Distributed under the terms of the GNU General Public License (GPL).
|
|
7
|
-
|
|
8
|
-
"""To connect to serial ports, e.g. to send/receive trigger pulses
|
|
9
|
-
|
|
10
|
-
This is really just a subclass of the Serial class from the pyserial lib, with
|
|
11
|
-
added functions for the purpose of detecting triggers.
|
|
12
|
-
|
|
13
|
-
Also note that to interact with serial port *devices* with APIs such as
|
|
14
|
-
photometers etc then you might be better using the psychopy.hardware.SerialDevice
|
|
15
|
-
base class.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
import time
|
|
19
|
-
import serial
|
|
20
|
-
|
|
21
|
-
"""
|
|
22
|
-
Note that py serial.Serial has announced deprecating camelCase for
|
|
23
|
-
snake_case as of version 3.0 but not clear when this will actually
|
|
24
|
-
be removed. We're currently sticking with camelCase since that meets
|
|
25
|
-
our own style guide.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class SerialPort(serial.Serial):
|
|
30
|
-
"""
|
|
31
|
-
"""
|
|
32
|
-
def waitTriggers(self, triggers=None, maxWait=None):
|
|
33
|
-
"""Waits for one of the trigger characters to be detected
|
|
34
|
-
|
|
35
|
-
If none of the characters are detected within the maxWait
|
|
36
|
-
then None is returned. Otherwise the value of the detected
|
|
37
|
-
trigger is returned.
|
|
38
|
-
|
|
39
|
-
Params
|
|
40
|
-
------
|
|
41
|
-
|
|
42
|
-
"""
|
|
43
|
-
if type(triggers) in [bytes, str]:
|
|
44
|
-
triggers = {triggers}
|
|
45
|
-
t0 = time.time()
|
|
46
|
-
# can't just use serial port timeout because check for char
|
|
47
|
-
while maxWait is None or (time.time()-t0 < maxWait):
|
|
48
|
-
chars = self.read(self.inWaiting())
|
|
49
|
-
for thisTrigger in triggers:
|
|
50
|
-
if thisTrigger in chars:
|
|
51
|
-
return thisTrigger
|
psychopy/tests/data/__test.png
DELETED
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
TrialNumber,trialType,ran,order,resp,rand
|
|
2
|
-
1,1,1.0,0.0,resp1,0.54340494
|
|
3
|
-
2,2,1.0,1.0,resp2,0.2783694
|
|
4
|
-
3,4,1.0,2.0,resp4,0.4245176
|
|
5
|
-
4,3,1.0,3.0,resp3,0.84477615
|
|
6
|
-
5,0,1.0,4.0,resp0,0.0047188564
|
|
7
|
-
6,1,1.0,5.0,resp1,0.12156912
|
|
8
|
-
7,2,1.0,6.0,resp2,0.67074907
|
|
9
|
-
8,4,1.0,7.0,resp4,0.82585275
|
|
10
|
-
9,3,1.0,8.0,resp3,0.13670659
|
|
11
|
-
10,0,1.0,9.0,resp0,0.5750933
|
|
12
|
-
11,1,1.0,10.0,resp1,0.89132196
|
|
13
|
-
12,2,1.0,11.0,resp2,0.20920213
|
|
14
|
-
13,4,1.0,12.0,resp4,0.18532822
|
|
15
|
-
14,3,1.0,13.0,resp3,0.10837689
|
|
16
|
-
15,0,1.0,14.0,resp0,0.21969749
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
trialType n rand_mean rand_raw rand_std resp_raw order
|
|
2
|
-
0 3.0 0.2665032148361206 0.004718856420367956 0.5750933289527893 0.2196974903345108 0.2880535407591846 'resp0' 'resp0' 'resp0' 4.0 9.0 14.0
|
|
3
|
-
1 3.0 0.5187653303146362 0.5434049367904663 0.12156911939382553 0.8913219571113586 0.3854674956123312 'resp1' 'resp1' 'resp1' 0.0 5.0 10.0
|
|
4
|
-
2 3.0 0.3861068884531657 0.27836939692497253 0.6707490682601929 0.2092021256685257 0.24892150640510474 'resp2' 'resp2' 'resp2' 1.0 6.0 11.0
|
|
5
|
-
3 3.0 0.3632865349451701 0.8447761535644531 0.13670659065246582 0.1083768904209137 0.4172227527744084 'resp3' 'resp3' 'resp3' 3.0 8.0 13.0
|
|
6
|
-
4 3.0 0.4785662094751994 0.42451760172843933 0.8258527517318726 0.18532821536064148 0.3236647305656647 'resp4' 'resp4' 'resp4' 2.0 7.0 12.0
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
This experiment was created using PsychoPy3 Experiment Builder (v2022.1.0rc1),
|
|
5
|
-
on 火 12/21 13:10:40 2021
|
|
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
|
-
from psychopy import locale_setup
|
|
15
|
-
from psychopy import prefs
|
|
16
|
-
from psychopy import sound, gui, visual, core, data, event, logging, clock, colors, iohub, hardware
|
|
17
|
-
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
|
|
18
|
-
STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
|
|
19
|
-
|
|
20
|
-
import numpy as np # whole numpy lib is available, prepend 'np.'
|
|
21
|
-
from numpy import (sin, cos, tan, log, log10, pi, average,
|
|
22
|
-
sqrt, std, deg2rad, rad2deg, linspace, asarray)
|
|
23
|
-
from numpy.random import random, randint, normal, shuffle, choice as randchoice
|
|
24
|
-
import os # handy system and path functions
|
|
25
|
-
import sys # to get file system encoding
|
|
26
|
-
|
|
27
|
-
from psychopy.hardware import keyboard
|
|
28
|
-
from psychopy.hardware import qmix
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# Ensure that relative paths start from the same directory as this script
|
|
33
|
-
_thisDir = os.path.dirname(os.path.abspath(__file__))
|
|
34
|
-
os.chdir(_thisDir)
|
|
35
|
-
# Store info about the experiment session
|
|
36
|
-
psychopyVersion = '2022.1.0rc1'
|
|
37
|
-
expName = 'testLoopsBlocks' # from the Builder filename that created this script
|
|
38
|
-
expInfo = {'session': '001', 'participant': ''}
|
|
39
|
-
expInfo['date'] = data.getDateStr() # add a simple timestamp
|
|
40
|
-
expInfo['expName'] = expName
|
|
41
|
-
expInfo['psychopyVersion'] = psychopyVersion
|
|
42
|
-
|
|
43
|
-
# Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc
|
|
44
|
-
filename = _thisDir + os.sep + 'data' + os.sep + '%s_%s' % (expInfo['participant'], expInfo['date'])
|
|
45
|
-
|
|
46
|
-
# An ExperimentHandler isn't essential but helps with data saving
|
|
47
|
-
thisExp = data.ExperimentHandler(name=expName, version='',
|
|
48
|
-
extraInfo=expInfo, runtimeInfo=None,
|
|
49
|
-
originPath='/Users/lpzjwp/code/psychopy/git/psychopy/tests/data/testLoopsBlocks.psyexp',
|
|
50
|
-
savePickle=True, saveWideText=True,
|
|
51
|
-
dataFileName=filename)
|
|
52
|
-
# save a log file for detail verbose info
|
|
53
|
-
logFile = logging.LogFile(filename+'.log', level=logging.EXP)
|
|
54
|
-
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file
|
|
55
|
-
|
|
56
|
-
endExpNow = False # flag for 'escape' or other condition => quit the exp
|
|
57
|
-
frameTolerance = 0.001 # how close to onset before 'same' frame
|
|
58
|
-
|
|
59
|
-
# Start Code - component code to be run after the window creation
|
|
60
|
-
|
|
61
|
-
# Setup the Window
|
|
62
|
-
win = visual.Window(
|
|
63
|
-
size=[800,600], fullscr=False, screen=0,
|
|
64
|
-
winType='pyglet', allowGUI=True, allowStencil=False,
|
|
65
|
-
monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
|
|
66
|
-
blendMode='avg', useFBO=True)
|
|
67
|
-
# store frame rate of monitor if we can measure it
|
|
68
|
-
expInfo['frameRate'] = win.getActualFrameRate()
|
|
69
|
-
if expInfo['frameRate'] != None:
|
|
70
|
-
frameDur = 1.0 / round(expInfo['frameRate'])
|
|
71
|
-
else:
|
|
72
|
-
frameDur = 1.0 / 60.0 # could not measure, so guess
|
|
73
|
-
|
|
74
|
-
# Setup eyetracking
|
|
75
|
-
ioDevice = ioConfig = ioSession = ioServer = eyetracker = None
|
|
76
|
-
|
|
77
|
-
# create a default keyboard (e.g. to check for escape)
|
|
78
|
-
defaultKeyboard = keyboard.Keyboard()
|
|
79
|
-
|
|
80
|
-
# Initialize components for Routine "blockIntro"
|
|
81
|
-
blockIntroClock = core.Clock()
|
|
82
|
-
blockIntroText = visual.TextStim(win=win, name='blockIntroText',
|
|
83
|
-
text="You're about to start a new block",
|
|
84
|
-
font='Arial',
|
|
85
|
-
pos=[0, 0], height=0.1, wrapWidth=None, ori=0,
|
|
86
|
-
color='white', colorSpace='rgb', opacity=1,
|
|
87
|
-
languageStyle='LTR',
|
|
88
|
-
depth=0.0);
|
|
89
|
-
|
|
90
|
-
# Initialize components for Routine "presentOneStim"
|
|
91
|
-
presentOneStimClock = core.Clock()
|
|
92
|
-
stimInfo = visual.TextStim(win=win, name='stimInfo',
|
|
93
|
-
text='',
|
|
94
|
-
font='Arial',
|
|
95
|
-
pos=[0, 0], height=0.1, wrapWidth=None, ori=0,
|
|
96
|
-
color='white', colorSpace='rgb', opacity=1,
|
|
97
|
-
languageStyle='LTR',
|
|
98
|
-
depth=0.0);
|
|
99
|
-
|
|
100
|
-
# Create some handy timers
|
|
101
|
-
globalClock = core.Clock() # to track the time since experiment started
|
|
102
|
-
routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine
|
|
103
|
-
|
|
104
|
-
# set up handler to look after randomisation of conditions etc
|
|
105
|
-
blocks = data.TrialHandler(nReps=4, method='random',
|
|
106
|
-
extraInfo=expInfo, originPath=-1,
|
|
107
|
-
trialList=[None],
|
|
108
|
-
seed=None, name='blocks')
|
|
109
|
-
thisExp.addLoop(blocks) # add the loop to the experiment
|
|
110
|
-
thisBlock = blocks.trialList[0] # so we can initialise stimuli with some values
|
|
111
|
-
# abbreviate parameter names if possible (e.g. rgb = thisBlock.rgb)
|
|
112
|
-
if thisBlock != None:
|
|
113
|
-
for paramName in thisBlock:
|
|
114
|
-
exec('{} = thisBlock[paramName]'.format(paramName))
|
|
115
|
-
|
|
116
|
-
for thisBlock in blocks:
|
|
117
|
-
currentLoop = blocks
|
|
118
|
-
# abbreviate parameter names if possible (e.g. rgb = thisBlock.rgb)
|
|
119
|
-
if thisBlock != None:
|
|
120
|
-
for paramName in thisBlock:
|
|
121
|
-
exec('{} = thisBlock[paramName]'.format(paramName))
|
|
122
|
-
|
|
123
|
-
# ------Prepare to start Routine "blockIntro"-------
|
|
124
|
-
continueRoutine = True
|
|
125
|
-
routineTimer.add(0.500000)
|
|
126
|
-
# update component parameters for each repeat
|
|
127
|
-
# keep track of which components have finished
|
|
128
|
-
blockIntroComponents = [blockIntroText]
|
|
129
|
-
for thisComponent in blockIntroComponents:
|
|
130
|
-
thisComponent.tStart = None
|
|
131
|
-
thisComponent.tStop = None
|
|
132
|
-
thisComponent.tStartRefresh = None
|
|
133
|
-
thisComponent.tStopRefresh = None
|
|
134
|
-
if hasattr(thisComponent, 'status'):
|
|
135
|
-
thisComponent.status = NOT_STARTED
|
|
136
|
-
# reset timers
|
|
137
|
-
t = 0
|
|
138
|
-
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
|
|
139
|
-
blockIntroClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
|
|
140
|
-
frameN = -1
|
|
141
|
-
|
|
142
|
-
# -------Run Routine "blockIntro"-------
|
|
143
|
-
while continueRoutine and routineTimer.getTime() > 0:
|
|
144
|
-
# get current time
|
|
145
|
-
t = blockIntroClock.getTime()
|
|
146
|
-
tThisFlip = win.getFutureFlipTime(clock=blockIntroClock)
|
|
147
|
-
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
|
|
148
|
-
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
|
|
149
|
-
# update/draw components on each frame
|
|
150
|
-
|
|
151
|
-
# *blockIntroText* updates
|
|
152
|
-
if blockIntroText.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
|
|
153
|
-
# keep track of start time/frame for later
|
|
154
|
-
blockIntroText.frameNStart = frameN # exact frame index
|
|
155
|
-
blockIntroText.tStart = t # local t and not account for scr refresh
|
|
156
|
-
blockIntroText.tStartRefresh = tThisFlipGlobal # on global time
|
|
157
|
-
win.timeOnFlip(blockIntroText, 'tStartRefresh') # time at next scr refresh
|
|
158
|
-
blockIntroText.setAutoDraw(True)
|
|
159
|
-
if blockIntroText.status == STARTED:
|
|
160
|
-
# is it time to stop? (based on global clock, using actual start)
|
|
161
|
-
if tThisFlipGlobal > blockIntroText.tStartRefresh + 0.5-frameTolerance:
|
|
162
|
-
# keep track of stop time/frame for later
|
|
163
|
-
blockIntroText.tStop = t # not accounting for scr refresh
|
|
164
|
-
blockIntroText.frameNStop = frameN # exact frame index
|
|
165
|
-
win.timeOnFlip(blockIntroText, 'tStopRefresh') # time at next scr refresh
|
|
166
|
-
blockIntroText.setAutoDraw(False)
|
|
167
|
-
|
|
168
|
-
# check for quit (typically the Esc key)
|
|
169
|
-
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
|
|
170
|
-
core.quit()
|
|
171
|
-
|
|
172
|
-
# check if all components have finished
|
|
173
|
-
if not continueRoutine: # a component has requested a forced-end of Routine
|
|
174
|
-
break
|
|
175
|
-
continueRoutine = False # will revert to True if at least one component still running
|
|
176
|
-
for thisComponent in blockIntroComponents:
|
|
177
|
-
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
|
|
178
|
-
continueRoutine = True
|
|
179
|
-
break # at least one component has not yet finished
|
|
180
|
-
|
|
181
|
-
# refresh the screen
|
|
182
|
-
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
|
|
183
|
-
win.flip()
|
|
184
|
-
|
|
185
|
-
# -------Ending Routine "blockIntro"-------
|
|
186
|
-
for thisComponent in blockIntroComponents:
|
|
187
|
-
if hasattr(thisComponent, "setAutoDraw"):
|
|
188
|
-
thisComponent.setAutoDraw(False)
|
|
189
|
-
blocks.addData('blockIntroText.started', blockIntroText.tStartRefresh)
|
|
190
|
-
blocks.addData('blockIntroText.stopped', blockIntroText.tStopRefresh)
|
|
191
|
-
|
|
192
|
-
# set up handler to look after randomisation of conditions etc
|
|
193
|
-
trials = data.TrialHandler(nReps=2, method='random',
|
|
194
|
-
extraInfo=expInfo, originPath=-1,
|
|
195
|
-
trialList=[None],
|
|
196
|
-
seed=None, name='trials')
|
|
197
|
-
thisExp.addLoop(trials) # add the loop to the experiment
|
|
198
|
-
thisTrial = trials.trialList[0] # so we can initialise stimuli with some values
|
|
199
|
-
# abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
|
|
200
|
-
if thisTrial != None:
|
|
201
|
-
for paramName in thisTrial:
|
|
202
|
-
exec('{} = thisTrial[paramName]'.format(paramName))
|
|
203
|
-
|
|
204
|
-
for thisTrial in trials:
|
|
205
|
-
currentLoop = trials
|
|
206
|
-
# abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
|
|
207
|
-
if thisTrial != None:
|
|
208
|
-
for paramName in thisTrial:
|
|
209
|
-
exec('{} = thisTrial[paramName]'.format(paramName))
|
|
210
|
-
|
|
211
|
-
# set up handler to look after randomisation of conditions etc
|
|
212
|
-
stimulusLoop = data.TrialHandler(nReps=3, method='random',
|
|
213
|
-
extraInfo=expInfo, originPath=-1,
|
|
214
|
-
trialList=[None],
|
|
215
|
-
seed=None, name='stimulusLoop')
|
|
216
|
-
thisExp.addLoop(stimulusLoop) # add the loop to the experiment
|
|
217
|
-
thisStimulusLoop = stimulusLoop.trialList[0] # so we can initialise stimuli with some values
|
|
218
|
-
# abbreviate parameter names if possible (e.g. rgb = thisStimulusLoop.rgb)
|
|
219
|
-
if thisStimulusLoop != None:
|
|
220
|
-
for paramName in thisStimulusLoop:
|
|
221
|
-
exec('{} = thisStimulusLoop[paramName]'.format(paramName))
|
|
222
|
-
|
|
223
|
-
for thisStimulusLoop in stimulusLoop:
|
|
224
|
-
currentLoop = stimulusLoop
|
|
225
|
-
# abbreviate parameter names if possible (e.g. rgb = thisStimulusLoop.rgb)
|
|
226
|
-
if thisStimulusLoop != None:
|
|
227
|
-
for paramName in thisStimulusLoop:
|
|
228
|
-
exec('{} = thisStimulusLoop[paramName]'.format(paramName))
|
|
229
|
-
|
|
230
|
-
# ------Prepare to start Routine "presentOneStim"-------
|
|
231
|
-
continueRoutine = True
|
|
232
|
-
routineTimer.add(0.200000)
|
|
233
|
-
# update component parameters for each repeat
|
|
234
|
-
stimInfo.setText("stim %i" %currentLoop.thisN)
|
|
235
|
-
# keep track of which components have finished
|
|
236
|
-
presentOneStimComponents = [stimInfo]
|
|
237
|
-
for thisComponent in presentOneStimComponents:
|
|
238
|
-
thisComponent.tStart = None
|
|
239
|
-
thisComponent.tStop = None
|
|
240
|
-
thisComponent.tStartRefresh = None
|
|
241
|
-
thisComponent.tStopRefresh = None
|
|
242
|
-
if hasattr(thisComponent, 'status'):
|
|
243
|
-
thisComponent.status = NOT_STARTED
|
|
244
|
-
# reset timers
|
|
245
|
-
t = 0
|
|
246
|
-
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
|
|
247
|
-
presentOneStimClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
|
|
248
|
-
frameN = -1
|
|
249
|
-
|
|
250
|
-
# -------Run Routine "presentOneStim"-------
|
|
251
|
-
while continueRoutine and routineTimer.getTime() > 0:
|
|
252
|
-
# get current time
|
|
253
|
-
t = presentOneStimClock.getTime()
|
|
254
|
-
tThisFlip = win.getFutureFlipTime(clock=presentOneStimClock)
|
|
255
|
-
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
|
|
256
|
-
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
|
|
257
|
-
# update/draw components on each frame
|
|
258
|
-
|
|
259
|
-
# *stimInfo* updates
|
|
260
|
-
if stimInfo.status == NOT_STARTED and tThisFlip >= 0.1-frameTolerance:
|
|
261
|
-
# keep track of start time/frame for later
|
|
262
|
-
stimInfo.frameNStart = frameN # exact frame index
|
|
263
|
-
stimInfo.tStart = t # local t and not account for scr refresh
|
|
264
|
-
stimInfo.tStartRefresh = tThisFlipGlobal # on global time
|
|
265
|
-
win.timeOnFlip(stimInfo, 'tStartRefresh') # time at next scr refresh
|
|
266
|
-
stimInfo.setAutoDraw(True)
|
|
267
|
-
if stimInfo.status == STARTED:
|
|
268
|
-
# is it time to stop? (based on global clock, using actual start)
|
|
269
|
-
if tThisFlipGlobal > stimInfo.tStartRefresh + 0.1-frameTolerance:
|
|
270
|
-
# keep track of stop time/frame for later
|
|
271
|
-
stimInfo.tStop = t # not accounting for scr refresh
|
|
272
|
-
stimInfo.frameNStop = frameN # exact frame index
|
|
273
|
-
win.timeOnFlip(stimInfo, 'tStopRefresh') # time at next scr refresh
|
|
274
|
-
stimInfo.setAutoDraw(False)
|
|
275
|
-
|
|
276
|
-
# check for quit (typically the Esc key)
|
|
277
|
-
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
|
|
278
|
-
core.quit()
|
|
279
|
-
|
|
280
|
-
# check if all components have finished
|
|
281
|
-
if not continueRoutine: # a component has requested a forced-end of Routine
|
|
282
|
-
break
|
|
283
|
-
continueRoutine = False # will revert to True if at least one component still running
|
|
284
|
-
for thisComponent in presentOneStimComponents:
|
|
285
|
-
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
|
|
286
|
-
continueRoutine = True
|
|
287
|
-
break # at least one component has not yet finished
|
|
288
|
-
|
|
289
|
-
# refresh the screen
|
|
290
|
-
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
|
|
291
|
-
win.flip()
|
|
292
|
-
|
|
293
|
-
# -------Ending Routine "presentOneStim"-------
|
|
294
|
-
for thisComponent in presentOneStimComponents:
|
|
295
|
-
if hasattr(thisComponent, "setAutoDraw"):
|
|
296
|
-
thisComponent.setAutoDraw(False)
|
|
297
|
-
stimulusLoop.addData('stimInfo.started', stimInfo.tStartRefresh)
|
|
298
|
-
stimulusLoop.addData('stimInfo.stopped', stimInfo.tStopRefresh)
|
|
299
|
-
# completed 3 repeats of 'stimulusLoop'
|
|
300
|
-
|
|
301
|
-
thisExp.nextEntry()
|
|
302
|
-
|
|
303
|
-
# completed 2 repeats of 'trials'
|
|
304
|
-
|
|
305
|
-
# get names of stimulus parameters
|
|
306
|
-
if trials.trialList in ([], [None], None):
|
|
307
|
-
params = []
|
|
308
|
-
else:
|
|
309
|
-
params = trials.trialList[0].keys()
|
|
310
|
-
# save data for this loop
|
|
311
|
-
trials.saveAsExcel(filename + '.xlsx', sheetName='trials',
|
|
312
|
-
stimOut=params,
|
|
313
|
-
dataOut=['n','all_mean','all_std', 'all_raw'])
|
|
314
|
-
# completed 4 repeats of 'blocks'
|
|
315
|
-
|
|
316
|
-
|
|
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
|
-
thisExp.abort() # or data files will save again on exit
|
|
327
|
-
win.close()
|
|
328
|
-
core.quit()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
blocks.thisRepN,blocks.thisTrialN,blocks.thisN,blocks.thisIndex,trials.thisRepN,trials.thisTrialN,trials.thisN,trials.thisIndex,stimulusLoop.thisRepN,stimulusLoop.thisTrialN,stimulusLoop.thisN,stimulusLoop.thisIndex,blockIntroText.started,blockIntroText.stopped,stimInfo.started,stimInfo.stopped,session,participant,date,expName,psychopyVersion,frameRate,
|
|
2
|
-
0,0,0,0,0,0,0,0,,,,,65.29191892199742,None,66.25894002700079,66.17298291599946,001,,2021_ 5_03_1206,testLoopsBlocks,2021.1.4,59.205658053815995,
|
|
3
|
-
0,0,0,0,1,0,1,0,,,,,,,66.82375188799779,66.74240606799867,001,,2021_ 5_03_1206,testLoopsBlocks,2021.1.4,59.205658053815995,
|
|
4
|
-
1,0,1,0,0,0,0,0,,,,,66.94632864699815,None,67.90619809599957,67.82343141999809,001,,2021_ 5_03_1206,testLoopsBlocks,2021.1.4,59.205658053815995,
|
|
5
|
-
1,0,1,0,1,0,1,0,,,,,,,68.4905092609988,68.40617813900099,001,,2021_ 5_03_1206,testLoopsBlocks,2021.1.4,59.205658053815995,
|
|
6
|
-
2,0,2,0,0,0,0,0,,,,,68.64550475899887,None,69.62322328599839,69.53983068099842,001,,2021_ 5_03_1206,testLoopsBlocks,2021.1.4,59.205658053815995,
|
|
7
|
-
2,0,2,0,1,0,1,0,,,,,,,70.19054533899907,70.10580221599957,001,,2021_ 5_03_1206,testLoopsBlocks,2021.1.4,59.205658053815995,
|
|
8
|
-
3,0,3,0,0,0,0,0,,,,,70.35472819899951,None,71.30609307600025,71.22726159800004,001,,2021_ 5_03_1206,testLoopsBlocks,2021.1.4,59.205658053815995,
|
|
9
|
-
3,0,3,0,1,0,1,0,,,,,,,71.8568327819994,71.77335973499794,001,,2021_ 5_03_1206,testLoopsBlocks,2021.1.4,59.205658053815995,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
blocks.thisRepN,blocks.thisTrialN,blocks.thisN,blocks.thisIndex,trials.thisRepN,trials.thisTrialN,trials.thisN,trials.thisIndex,stimulusLoop.thisRepN,stimulusLoop.thisTrialN,stimulusLoop.thisN,stimulusLoop.thisIndex,blockIntroText.started,blockIntroText.stopped,stimInfo.started,stimInfo.stopped,session,participant,date,expName,psychopyVersion,frameRate,
|
|
2
|
-
0,0,0,0,0,0,0,0,,,,,35.64092961799906,None,36.53197220099901,36.46018599599847,001,,2021_ 5_03_1324,testLoopsBlocks,2021.1.4,60.3228579489649,
|
|
3
|
-
0,0,0,0,1,0,1,0,,,,,,,37.026421831000334,36.9581391089996,001,,2021_ 5_03_1324,testLoopsBlocks,2021.1.4,60.3228579489649,
|
|
4
|
-
1,0,1,0,0,0,0,0,,,,,37.144647338998766,None,38.02494392099834,37.956143577997864,001,,2021_ 5_03_1324,testLoopsBlocks,2021.1.4,60.3228579489649,
|
|
5
|
-
1,0,1,0,1,0,1,0,,,,,,,38.48955451599977,38.42139802800011,001,,2021_ 5_03_1324,testLoopsBlocks,2021.1.4,60.3228579489649,
|
|
6
|
-
2,0,2,0,0,0,0,0,,,,,38.62150937699698,None,39.490225479999935,39.421062761997746,001,,2021_ 5_03_1324,testLoopsBlocks,2021.1.4,60.3228579489649,
|
|
7
|
-
2,0,2,0,1,0,1,0,,,,,,,39.956308781998814,39.887982683998416,001,,2021_ 5_03_1324,testLoopsBlocks,2021.1.4,60.3228579489649,
|
|
8
|
-
3,0,3,0,0,0,0,0,,,,,40.07236192699929,None,40.93996434699875,40.87120142999993,001,,2021_ 5_03_1324,testLoopsBlocks,2021.1.4,60.3228579489649,
|
|
9
|
-
3,0,3,0,1,0,1,0,,,,,,,41.405941351000365,41.33707405699897,001,,2021_ 5_03_1324,testLoopsBlocks,2021.1.4,60.3228579489649,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|