Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
N-back task with visual stimuli
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Andrew Vu
N-back task with visual stimuli
Commits
21044815
Commit
21044815
authored
May 14, 2020
by
Ryan Cortez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_
parent
a3ef6e61
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
914 additions
and
11 deletions
+914
-11
N-back.psyexp
N-back.psyexp
+20
-7
N-back.py
N-back.py
+1
-1
N-backtest.psyexp
N-backtest.psyexp
+144
-0
N-backtest-legacy-browsers.js
html/N-backtest-legacy-browsers.js
+370
-0
N-backtest.js
html/N-backtest.js
+376
-0
index.html
html/index.html
+3
-3
No files found.
N-back.psyexp
View file @
21044815
...
...
@@ -140,7 +140,7 @@
<Param
name=
"interpolate"
updates=
"constant"
val=
"linear"
valType=
"str"
/>
<Param
name=
"mask"
updates=
"constant"
val=
"None"
valType=
"str"
/>
<Param
name=
"name"
updates=
"None"
val=
"grid_lines"
valType=
"code"
/>
<Param
name=
"opacity"
updates=
"constant"
val=
"1
.0
"
valType=
"code"
/>
<Param
name=
"opacity"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"ori"
updates=
"constant"
val=
"0.0"
valType=
"code"
/>
<Param
name=
"pos"
updates=
"constant"
val=
"[0, 0]"
valType=
"code"
/>
<Param
name=
"saveStartStop"
updates=
"None"
val=
"True"
valType=
"bool"
/>
...
...
@@ -149,7 +149,7 @@
<Param
name=
"startType"
updates=
"None"
val=
"time (s)"
valType=
"str"
/>
<Param
name=
"startVal"
updates=
"None"
val=
"0.0"
valType=
"code"
/>
<Param
name=
"stopType"
updates=
"None"
val=
"duration (s)"
valType=
"str"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"2
.0
"
valType=
"code"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"2"
valType=
"code"
/>
<Param
name=
"syncScreenRefresh"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"texture resolution"
updates=
"constant"
val=
"128"
valType=
"code"
/>
<Param
name=
"units"
updates=
"None"
val=
"from exp settings"
valType=
"str"
/>
...
...
@@ -162,10 +162,10 @@
<Param
name=
"interpolate"
updates=
"constant"
val=
"linear"
valType=
"str"
/>
<Param
name=
"lineColor"
updates=
"constant"
val=
""
valType=
"str"
/>
<Param
name=
"lineColorSpace"
updates=
"constant"
val=
"rgb"
valType=
"str"
/>
<Param
name=
"lineWidth"
updates=
"constant"
val=
"1
.0
"
valType=
"code"
/>
<Param
name=
"lineWidth"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"nVertices"
updates=
"constant"
val=
"4"
valType=
"int"
/>
<Param
name=
"name"
updates=
"None"
val=
"target_square"
valType=
"code"
/>
<Param
name=
"opacity"
updates=
"constant"
val=
"1
.0
"
valType=
"code"
/>
<Param
name=
"opacity"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"ori"
updates=
"constant"
val=
"0.0"
valType=
"code"
/>
<Param
name=
"pos"
updates=
"set every repeat"
val=
"$location"
valType=
"code"
/>
<Param
name=
"saveStartStop"
updates=
"None"
val=
"True"
valType=
"bool"
/>
...
...
@@ -175,7 +175,7 @@
<Param
name=
"startType"
updates=
"None"
val=
"time (s)"
valType=
"str"
/>
<Param
name=
"startVal"
updates=
"None"
val=
"0.0"
valType=
"code"
/>
<Param
name=
"stopType"
updates=
"None"
val=
"duration (s)"
valType=
"str"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"1
.0
"
valType=
"code"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"syncScreenRefresh"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"units"
updates=
"None"
val=
"from exp settings"
valType=
"str"
/>
</PolygonComponent>
...
...
@@ -190,12 +190,12 @@
<Param
name=
"letterHeight"
updates=
"constant"
val=
"0.05"
valType=
"code"
/>
<Param
name=
"name"
updates=
"None"
val=
"fixation_2"
valType=
"code"
/>
<Param
name=
"opacity"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"ori"
updates=
"constant"
val=
"0
.0
"
valType=
"code"
/>
<Param
name=
"ori"
updates=
"constant"
val=
"0"
valType=
"code"
/>
<Param
name=
"pos"
updates=
"constant"
val=
"[0, 0]"
valType=
"code"
/>
<Param
name=
"saveStartStop"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"startEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"startType"
updates=
"None"
val=
"time (s)"
valType=
"str"
/>
<Param
name=
"startVal"
updates=
"None"
val=
"
0.0
"
valType=
"code"
/>
<Param
name=
"startVal"
updates=
"None"
val=
"
1
"
valType=
"code"
/>
<Param
name=
"stopType"
updates=
"None"
val=
"duration (s)"
valType=
"str"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"1.0"
valType=
"code"
/>
<Param
name=
"syncScreenRefresh"
updates=
"None"
val=
"True"
valType=
"bool"
/>
...
...
@@ -364,6 +364,19 @@
<Flow>
<Routine
name=
"Instructions"
/>
<Routine
name=
"Fixation"
/>
<LoopInitiator
loopType=
"TrialHandler"
name=
"trials"
>
<Param
name=
"Selected rows"
updates=
"None"
val=
""
valType=
"str"
/>
<Param
name=
"conditions"
updates=
"None"
val=
"[OrderedDict([('square', 6), ('location', [0.2, 0]), ('corrAns', None)]), OrderedDict([('square', 6), ('location', [0.2, 0]), ('corrAns', 'space')]), OrderedDict([('square', 2), ('location', [0, 0.2]), ('corrAns', None)]), OrderedDict([('square', 9), ('location', [0.2, -0.2]), ('corrAns', None)]), OrderedDict([('square', 9), ('location', [0.2, -0.2]), ('corrAns', 'space')]), OrderedDict([('square', 6), ('location', [0.2, 0]), ('corrAns', None)]), OrderedDict([('square', 4), ('location', [-0.2, 0]), ('corrAns', None)]), OrderedDict([('square', 3), ('location', [0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 3), ('location', [0.2, 0.2]), ('corrAns', 'space')]), OrderedDict([('square', 8), ('location', [0, -0.2]), ('corrAns', None)]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 2), ('location', [0, 0.2]), ('corrAns', None)]), OrderedDict([('square', 4), ('location', [-0.2, 0]), ('corrAns', None)]), OrderedDict([('square', 4), ('location', [-0.2, 0]), ('corrAns', 'space')]), OrderedDict([('square', 8), ('location', [0, -0.2]), ('corrAns', None)]), OrderedDict([('square', 5), ('location', [0, 0]), ('corrAns', None)]), OrderedDict([('square', 5), ('location', [0, 0]), ('corrAns', 'space')]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 3), ('location', [0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 6), ('location', [0.2, 0]), ('corrAns', None)]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', 'space')]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', 'space')]), OrderedDict([('square', 3), ('location', [0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 2), ('location', [0, 0.2]), ('corrAns', None)]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 7), ('location', [-0.2, -0.2]), ('corrAns', None)]), OrderedDict([('square', 7), ('location', [-0.2, -0.2]), ('corrAns', 'space')]), OrderedDict([('square', 2), ('location', [0, 0.2]), ('corrAns', None)]), OrderedDict([('square', 6), ('location', [0.2, 0]), ('corrAns', None)])]"
valType=
"str"
/>
<Param
name=
"conditionsFile"
updates=
"None"
val=
"N-back-1.xlsx"
valType=
"str"
/>
<Param
name=
"endPoints"
updates=
"None"
val=
"[0, 1]"
valType=
"num"
/>
<Param
name=
"isTrials"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"loopType"
updates=
"None"
val=
"sequential"
valType=
"str"
/>
<Param
name=
"nReps"
updates=
"None"
val=
"1"
valType=
"code"
/>
<Param
name=
"name"
updates=
"None"
val=
"trials"
valType=
"code"
/>
<Param
name=
"random seed"
updates=
"None"
val=
""
valType=
"code"
/>
</LoopInitiator>
<Routine
name=
"N_back_1_Trial"
/>
<LoopTerminator
name=
"trials"
/>
<Routine
name=
"Instructions_2"
/>
<Routine
name=
"Fixation"
/>
<LoopInitiator
loopType=
"TrialHandler"
name=
"trials_2"
>
...
...
N-back.py
View file @
21044815
...
...
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v2020.1.3),
on May 13, 2020, at 14:
12
on May 13, 2020, at 14:
27
If you publish work using this script the most relevant publication is:
Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019)
...
...
N-backtest.psyexp
0 → 100644
View file @
21044815
<?xml version="1.0" ?>
<PsychoPy2experiment
encoding=
"utf-8"
version=
"2020.1.3"
>
<Settings>
<Param
name=
"Audio latency priority"
updates=
"None"
val=
"use prefs"
valType=
"str"
/>
<Param
name=
"Audio lib"
updates=
"None"
val=
"use prefs"
valType=
"str"
/>
<Param
name=
"Completed URL"
updates=
"None"
val=
""
valType=
"str"
/>
<Param
name=
"Data filename"
updates=
"None"
val=
"u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date'])"
valType=
"code"
/>
<Param
name=
"Enable Escape"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"Experiment info"
updates=
"None"
val=
"{'participant':'', 'session':'001'}"
valType=
"code"
/>
<Param
name=
"Force stereo"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"Full-screen window"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"HTML path"
updates=
"None"
val=
"html"
valType=
"str"
/>
<Param
name=
"Incomplete URL"
updates=
"None"
val=
""
valType=
"str"
/>
<Param
name=
"Monitor"
updates=
"None"
val=
"testMonitor"
valType=
"str"
/>
<Param
name=
"Save csv file"
updates=
"None"
val=
"False"
valType=
"bool"
/>
<Param
name=
"Save excel file"
updates=
"None"
val=
"False"
valType=
"bool"
/>
<Param
name=
"Save log file"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"Save psydat file"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"Save wide csv file"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"Screen"
updates=
"None"
val=
"1"
valType=
"num"
/>
<Param
name=
"Show info dlg"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"Show mouse"
updates=
"None"
val=
"False"
valType=
"bool"
/>
<Param
name=
"Units"
updates=
"None"
val=
"height"
valType=
"str"
/>
<Param
name=
"Use version"
updates=
"None"
val=
""
valType=
"str"
/>
<Param
name=
"Window size (pixels)"
updates=
"None"
val=
"(1024, 768)"
valType=
"code"
/>
<Param
name=
"blendMode"
updates=
"None"
val=
"avg"
valType=
"str"
/>
<Param
name=
"color"
updates=
"None"
val=
"$[0,0,0]"
valType=
"str"
/>
<Param
name=
"colorSpace"
updates=
"None"
val=
"rgb"
valType=
"str"
/>
<Param
name=
"expName"
updates=
"None"
val=
"N-backtest"
valType=
"str"
/>
<Param
name=
"exportHTML"
updates=
"None"
val=
"on Sync"
valType=
"str"
/>
<Param
name=
"logging level"
updates=
"None"
val=
"exp"
valType=
"code"
/>
</Settings>
<Routines>
<Routine
name=
"trial"
>
<ImageComponent
name=
"grid_lines"
>
<Param
name=
"color"
updates=
"constant"
val=
"$[1,1,1]"
valType=
"str"
/>
<Param
name=
"colorSpace"
updates=
"constant"
val=
"rgb"
valType=
"str"
/>
<Param
name=
"disabled"
updates=
"None"
val=
"False"
valType=
"bool"
/>
<Param
name=
"durationEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"flipHoriz"
updates=
"constant"
val=
"False"
valType=
"bool"
/>
<Param
name=
"flipVert"
updates=
"constant"
val=
"False"
valType=
"bool"
/>
<Param
name=
"image"
updates=
"constant"
val=
"grid.png"
valType=
"str"
/>
<Param
name=
"interpolate"
updates=
"constant"
val=
"linear"
valType=
"str"
/>
<Param
name=
"mask"
updates=
"constant"
val=
"None"
valType=
"str"
/>
<Param
name=
"name"
updates=
"None"
val=
"grid_lines"
valType=
"code"
/>
<Param
name=
"opacity"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"ori"
updates=
"constant"
val=
"0"
valType=
"code"
/>
<Param
name=
"pos"
updates=
"constant"
val=
"(0, 0)"
valType=
"code"
/>
<Param
name=
"saveStartStop"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"size"
updates=
"constant"
val=
"(0.5, 0.5)"
valType=
"code"
/>
<Param
name=
"startEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"startType"
updates=
"None"
val=
"time (s)"
valType=
"str"
/>
<Param
name=
"startVal"
updates=
"None"
val=
"0.0"
valType=
"code"
/>
<Param
name=
"stopType"
updates=
"None"
val=
"duration (s)"
valType=
"str"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"2.0"
valType=
"code"
/>
<Param
name=
"syncScreenRefresh"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"texture resolution"
updates=
"constant"
val=
"128"
valType=
"code"
/>
<Param
name=
"units"
updates=
"None"
val=
"from exp settings"
valType=
"str"
/>
</ImageComponent>
<PolygonComponent
name=
"target_square"
>
<Param
name=
"disabled"
updates=
"None"
val=
"False"
valType=
"bool"
/>
<Param
name=
"durationEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"fillColor"
updates=
"constant"
val=
"$[1,1,1]"
valType=
"str"
/>
<Param
name=
"fillColorSpace"
updates=
"constant"
val=
"rgb"
valType=
"str"
/>
<Param
name=
"interpolate"
updates=
"constant"
val=
"linear"
valType=
"str"
/>
<Param
name=
"lineColor"
updates=
"constant"
val=
"$[1,1,1]"
valType=
"str"
/>
<Param
name=
"lineColorSpace"
updates=
"constant"
val=
"rgb"
valType=
"str"
/>
<Param
name=
"lineWidth"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"nVertices"
updates=
"constant"
val=
"4"
valType=
"int"
/>
<Param
name=
"name"
updates=
"None"
val=
"target_square"
valType=
"code"
/>
<Param
name=
"opacity"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"ori"
updates=
"constant"
val=
"0"
valType=
"code"
/>
<Param
name=
"pos"
updates=
"set every repeat"
val=
"location"
valType=
"code"
/>
<Param
name=
"saveStartStop"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"shape"
updates=
"constant"
val=
"rectangle"
valType=
"str"
/>
<Param
name=
"size"
updates=
"constant"
val=
"(0.15, 0.15)"
valType=
"code"
/>
<Param
name=
"startEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"startType"
updates=
"None"
val=
"time (s)"
valType=
"str"
/>
<Param
name=
"startVal"
updates=
"None"
val=
"0.0"
valType=
"code"
/>
<Param
name=
"stopType"
updates=
"None"
val=
"duration (s)"
valType=
"str"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"1.0"
valType=
"code"
/>
<Param
name=
"syncScreenRefresh"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"units"
updates=
"None"
val=
"from exp settings"
valType=
"str"
/>
</PolygonComponent>
<TextComponent
name=
"fixation_2"
>
<Param
name=
"color"
updates=
"constant"
val=
"white"
valType=
"str"
/>
<Param
name=
"colorSpace"
updates=
"constant"
val=
"rgb"
valType=
"str"
/>
<Param
name=
"disabled"
updates=
"None"
val=
"False"
valType=
"bool"
/>
<Param
name=
"durationEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"flip"
updates=
"constant"
val=
""
valType=
"str"
/>
<Param
name=
"font"
updates=
"constant"
val=
"Arial"
valType=
"str"
/>
<Param
name=
"languageStyle"
updates=
"None"
val=
"LTR"
valType=
"str"
/>
<Param
name=
"letterHeight"
updates=
"constant"
val=
"0.05"
valType=
"code"
/>
<Param
name=
"name"
updates=
"None"
val=
"fixation_2"
valType=
"code"
/>
<Param
name=
"opacity"
updates=
"constant"
val=
"1"
valType=
"code"
/>
<Param
name=
"ori"
updates=
"constant"
val=
"0"
valType=
"code"
/>
<Param
name=
"pos"
updates=
"constant"
val=
"(0, 0)"
valType=
"code"
/>
<Param
name=
"saveStartStop"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"startEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"startType"
updates=
"None"
val=
"time (s)"
valType=
"str"
/>
<Param
name=
"startVal"
updates=
"None"
val=
"1.0"
valType=
"code"
/>
<Param
name=
"stopType"
updates=
"None"
val=
"duration (s)"
valType=
"str"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"1.0"
valType=
"code"
/>
<Param
name=
"syncScreenRefresh"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"text"
updates=
"constant"
val=
"+"
valType=
"str"
/>
<Param
name=
"units"
updates=
"None"
val=
"from exp settings"
valType=
"str"
/>
<Param
name=
"wrapWidth"
updates=
"constant"
val=
""
valType=
"code"
/>
</TextComponent>
<KeyboardComponent
name=
"response"
>
<Param
name=
"allowedKeys"
updates=
"constant"
val=
"'space'"
valType=
"code"
/>
<Param
name=
"correctAns"
updates=
"constant"
val=
"$corrAns"
valType=
"str"
/>
<Param
name=
"disabled"
updates=
"None"
val=
"False"
valType=
"bool"
/>
<Param
name=
"discard previous"
updates=
"constant"
val=
"True"
valType=
"bool"
/>
<Param
name=
"durationEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"forceEndRoutine"
updates=
"constant"
val=
"False"
valType=
"bool"
/>
<Param
name=
"name"
updates=
"None"
val=
"response"
valType=
"code"
/>
<Param
name=
"saveStartStop"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"startEstim"
updates=
"None"
val=
""
valType=
"code"
/>
<Param
name=
"startType"
updates=
"None"
val=
"time (s)"
valType=
"str"
/>
<Param
name=
"startVal"
updates=
"None"
val=
"0.0"
valType=
"code"
/>
<Param
name=
"stopType"
updates=
"None"
val=
"duration (s)"
valType=
"str"
/>
<Param
name=
"stopVal"
updates=
"constant"
val=
"2.0"
valType=
"code"
/>
<Param
name=
"store"
updates=
"constant"
val=
"last key"
valType=
"str"
/>
<Param
name=
"storeCorrect"
updates=
"constant"
val=
"True"
valType=
"bool"
/>
<Param
name=
"syncScreenRefresh"
updates=
"constant"
val=
"True"
valType=
"bool"
/>
</KeyboardComponent>
</Routine>
</Routines>
<Flow>
<LoopInitiator
loopType=
"TrialHandler"
name=
"trials"
>
<Param
name=
"Selected rows"
updates=
"None"
val=
""
valType=
"str"
/>
<Param
name=
"conditions"
updates=
"None"
val=
"[OrderedDict([('square', 6), ('location', [0.2, 0.0]), ('corrAns', None)]), OrderedDict([('square', 6), ('location', [0.2, 0.0]), ('corrAns', 'space')]), OrderedDict([('square', 2), ('location', [0.0, 0.2]), ('corrAns', None)]), OrderedDict([('square', 9), ('location', [0.2, -0.2]), ('corrAns', None)]), OrderedDict([('square', 9), ('location', [0.2, -0.2]), ('corrAns', 'space')]), OrderedDict([('square', 6), ('location', [0.2, 0.0]), ('corrAns', None)]), OrderedDict([('square', 4), ('location', [-0.2, 0.0]), ('corrAns', None)]), OrderedDict([('square', 3), ('location', [0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 3), ('location', [0.2, 0.2]), ('corrAns', 'space')]), OrderedDict([('square', 8), ('location', [0.0, -0.2]), ('corrAns', None)]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 2), ('location', [0.0, 0.2]), ('corrAns', None)]), OrderedDict([('square', 4), ('location', [-0.2, 0.0]), ('corrAns', None)]), OrderedDict([('square', 4), ('location', [-0.2, 0.0]), ('corrAns', 'space')]), OrderedDict([('square', 8), ('location', [0.0, -0.2]), ('corrAns', None)]), OrderedDict([('square', 5), ('location', [0.0, 0.0]), ('corrAns', None)]), OrderedDict([('square', 5), ('location', [0.0, 0.0]), ('corrAns', 'space')]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 3), ('location', [0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 6), ('location', [0.2, 0.0]), ('corrAns', None)]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', 'space')]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', 'space')]), OrderedDict([('square', 3), ('location', [0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 2), ('location', [0.0, 0.2]), ('corrAns', None)]), OrderedDict([('square', 1), ('location', [-0.2, 0.2]), ('corrAns', None)]), OrderedDict([('square', 7), ('location', [-0.2, -0.2]), ('corrAns', None)]), OrderedDict([('square', 7), ('location', [-0.2, -0.2]), ('corrAns', 'space')]), OrderedDict([('square', 2), ('location', [0.0, 0.2]), ('corrAns', None)]), OrderedDict([('square', 6), ('location', [0.2, 0.0]), ('corrAns', None)])]"
valType=
"str"
/>
<Param
name=
"conditionsFile"
updates=
"None"
val=
"..\..\Users\Ryan\Downloads\PavloviaNback\N-back-1.xlsx"
valType=
"str"
/>
<Param
name=
"endPoints"
updates=
"None"
val=
"[0, 1]"
valType=
"num"
/>
<Param
name=
"isTrials"
updates=
"None"
val=
"True"
valType=
"bool"
/>
<Param
name=
"loopType"
updates=
"None"
val=
"random"
valType=
"str"
/>
<Param
name=
"nReps"
updates=
"None"
val=
"5"
valType=
"code"
/>
<Param
name=
"name"
updates=
"None"
val=
"trials"
valType=
"code"
/>
<Param
name=
"random seed"
updates=
"None"
val=
""
valType=
"code"
/>
</LoopInitiator>
<Routine
name=
"trial"
/>
<LoopTerminator
name=
"trials"
/>
</Flow>
</PsychoPy2experiment>
html/N-backtest-legacy-browsers.js
0 → 100644
View file @
21044815
/*******************
* N-Backtest Test *
*******************/
// init psychoJS:
const
psychoJS
=
new
PsychoJS
({
debug
:
true
});
// open window:
psychoJS
.
openWindow
({
fullscr
:
true
,
color
:
new
util
.
Color
([
0
,
0
,
0
]),
units
:
'height'
,
waitBlanking
:
true
});
// store info about the experiment session:
let
expName
=
'N-backtest'
;
// from the Builder filename that created this script
let
expInfo
=
{
'participant'
:
''
,
'session'
:
'001'
};
// schedule the experiment:
psychoJS
.
schedule
(
psychoJS
.
gui
.
DlgFromDict
({
dictionary
:
expInfo
,
title
:
expName
}));
const
flowScheduler
=
new
Scheduler
(
psychoJS
);
const
dialogCancelScheduler
=
new
Scheduler
(
psychoJS
);
psychoJS
.
scheduleCondition
(
function
()
{
return
(
psychoJS
.
gui
.
dialogComponent
.
button
===
'OK'
);
},
flowScheduler
,
dialogCancelScheduler
);
// flowScheduler gets run if the participants presses OK
flowScheduler
.
add
(
updateInfo
);
// add timeStamp
flowScheduler
.
add
(
experimentInit
);
const
trialsLoopScheduler
=
new
Scheduler
(
psychoJS
);
flowScheduler
.
add
(
trialsLoopBegin
,
trialsLoopScheduler
);
flowScheduler
.
add
(
trialsLoopScheduler
);
flowScheduler
.
add
(
trialsLoopEnd
);
flowScheduler
.
add
(
quitPsychoJS
,
''
,
true
);
// quit if user presses Cancel in dialog box:
dialogCancelScheduler
.
add
(
quitPsychoJS
,
''
,
false
);
psychoJS
.
start
({
expName
:
expName
,
expInfo
:
expInfo
,
});
var
frameDur
;
function
updateInfo
()
{
expInfo
[
'date'
]
=
util
.
MonotonicClock
.
getDateStr
();
// add a simple timestamp
expInfo
[
'expName'
]
=
expName
;
expInfo
[
'psychopyVersion'
]
=
'2020.1.3'
;
expInfo
[
'OS'
]
=
window
.
navigator
.
platform
;
// store frame rate of monitor if we can measure it successfully
expInfo
[
'frameRate'
]
=
psychoJS
.
window
.
getActualFrameRate
();
if
(
typeof
expInfo
[
'frameRate'
]
!==
'undefined'
)
frameDur
=
1.0
/
Math
.
round
(
expInfo
[
'frameRate'
]);
else
frameDur
=
1.0
/
60.0
;
// couldn't get a reliable measure so guess
// add info from the URL:
util
.
addInfoFromUrl
(
expInfo
);
return
Scheduler
.
Event
.
NEXT
;
}
var
trialClock
;
var
grid_lines
;
var
target_square
;
var
fixation_2
;
var
response
;
var
globalClock
;
var
routineTimer
;
function
experimentInit
()
{
// Initialize components for Routine "trial"
trialClock
=
new
util
.
Clock
();
grid_lines
=
new
visual
.
ImageStim
({
win
:
psychoJS
.
window
,
name
:
'grid_lines'
,
units
:
undefined
,
image
:
'grid.png'
,
mask
:
undefined
,
ori
:
0
,
pos
:
[
0
,
0
],
size
:
[
0.5
,
0.5
],
color
:
new
util
.
Color
([
1
,
1
,
1
]),
opacity
:
1
,
flipHoriz
:
false
,
flipVert
:
false
,
texRes
:
128
,
interpolate
:
true
,
depth
:
0.0
});
target_square
=
new
visual
.
Rect
({
win
:
psychoJS
.
window
,
name
:
'target_square'
,
width
:
[
0.15
,
0.15
][
0
],
height
:
[
0.15
,
0.15
][
1
],
ori
:
0
,
pos
:
[
0
,
0
],
lineWidth
:
1
,
lineColor
:
new
util
.
Color
([
1
,
1
,
1
]),
fillColor
:
new
util
.
Color
([
1
,
1
,
1
]),
opacity
:
1
,
depth
:
-
1
,
interpolate
:
true
,
});
fixation_2
=
new
visual
.
TextStim
({
win
:
psychoJS
.
window
,
name
:
'fixation_2'
,
text
:
'+'
,
font
:
'Arial'
,
units
:
undefined
,
pos
:
[
0
,
0
],
height
:
0.05
,
wrapWidth
:
undefined
,
ori
:
0
,
color
:
new
util
.
Color
(
'white'
),
opacity
:
1
,
depth
:
-
2.0
});
response
=
new
core
.
Keyboard
({
psychoJS
:
psychoJS
,
clock
:
new
util
.
Clock
(),
waitForStart
:
true
});
// Create some handy timers
globalClock
=
new
util
.
Clock
();
// to track the time since experiment started
routineTimer
=
new
util
.
CountdownTimer
();
// to track time remaining of each (non-slip) routine
return
Scheduler
.
Event
.
NEXT
;
}
var
trials
;
var
currentLoop
;
function
trialsLoopBegin
(
thisScheduler
)
{
// set up handler to look after randomisation of conditions etc
trials
=
new
TrialHandler
({
psychoJS
:
psychoJS
,
nReps
:
5
,
method
:
TrialHandler
.
Method
.
RANDOM
,
extraInfo
:
expInfo
,
originPath
:
undefined
,
trialList
:
'../../Users/Ryan/Downloads/PavloviaNback/N-back-1.xlsx'
,
seed
:
undefined
,
name
:
'trials'
});
psychoJS
.
experiment
.
addLoop
(
trials
);
// add the loop to the experiment
currentLoop
=
trials
;
// we're now the current loop
// Schedule all the trials in the trialList:
trials
.
forEach
(
function
()
{
const
snapshot
=
trials
.
getSnapshot
();
thisScheduler
.
add
(
importConditions
(
snapshot
));
thisScheduler
.
add
(
trialRoutineBegin
(
snapshot
));
thisScheduler
.
add
(
trialRoutineEachFrame
(
snapshot
));
thisScheduler
.
add
(
trialRoutineEnd
(
snapshot
));
thisScheduler
.
add
(
endLoopIteration
(
thisScheduler
,
snapshot
));
});
return
Scheduler
.
Event
.
NEXT
;
}
function
trialsLoopEnd
()
{
psychoJS
.
experiment
.
removeLoop
(
trials
);
return
Scheduler
.
Event
.
NEXT
;
}
var
t
;
var
frameN
;
var
_response_allKeys
;
var
trialComponents
;
function
trialRoutineBegin
(
trials
)
{
return
function
()
{
//------Prepare to start Routine 'trial'-------
t
=
0
;
trialClock
.
reset
();
// clock
frameN
=
-
1
;
routineTimer
.
add
(
2.000000
);
// update component parameters for each repeat
target_square
.
setPos
(
location
);
response
.
keys
=
undefined
;
response
.
rt
=
undefined
;
_response_allKeys
=
[];
// keep track of which components have finished
trialComponents
=
[];
trialComponents
.
push
(
grid_lines
);
trialComponents
.
push
(
target_square
);
trialComponents
.
push
(
fixation_2
);
trialComponents
.
push
(
response
);
trialComponents
.
forEach
(
function
(
thisComponent
)
{
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
});
return
Scheduler
.
Event
.
NEXT
;
};
}
var
frameRemains
;
var
continueRoutine
;
function
trialRoutineEachFrame
(
trials
)
{
return
function
()
{
//------Loop for each frame of Routine 'trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
// update/draw components on each frame
// *grid_lines* updates
if
(
t
>=
0.0
&&
grid_lines
.
status
===
PsychoJS
.
Status
.
NOT_STARTED
)
{
// keep track of start time/frame for later
grid_lines
.
tStart
=
t
;
// (not accounting for frame time here)
grid_lines
.
frameNStart
=
frameN
;
// exact frame index
grid_lines
.
setAutoDraw
(
true
);
}
frameRemains
=
0.0
+
2.0
-
psychoJS
.
window
.
monitorFramePeriod
*
0.75
;
// most of one frame period left
if
(
grid_lines
.
status
===
PsychoJS
.
Status
.
STARTED
&&
t
>=
frameRemains
)
{
grid_lines
.
setAutoDraw
(
false
);
}
// *target_square* updates
if
(
t
>=
0.0
&&
target_square
.
status
===
PsychoJS
.
Status
.
NOT_STARTED
)
{
// keep track of start time/frame for later
target_square
.
tStart
=
t
;
// (not accounting for frame time here)
target_square
.
frameNStart
=
frameN
;
// exact frame index
target_square
.
setAutoDraw
(
true
);
}
frameRemains
=
0.0
+
1.0
-
psychoJS
.
window
.
monitorFramePeriod
*
0.75
;
// most of one frame period left
if
(
target_square
.
status
===
PsychoJS
.
Status
.
STARTED
&&
t
>=
frameRemains
)
{
target_square
.
setAutoDraw
(
false
);
}
// *fixation_2* updates
if
(
t
>=
1.0
&&
fixation_2
.
status
===
PsychoJS
.
Status
.
NOT_STARTED
)
{
// keep track of start time/frame for later
fixation_2
.
tStart
=
t
;
// (not accounting for frame time here)
fixation_2
.
frameNStart
=
frameN
;
// exact frame index
fixation_2
.
setAutoDraw
(
true
);
}
frameRemains
=
1.0
+
1.0
-
psychoJS
.
window
.
monitorFramePeriod
*
0.75
;
// most of one frame period left
if
(
fixation_2
.
status
===
PsychoJS
.
Status
.
STARTED
&&
t
>=
frameRemains
)
{
fixation_2
.
setAutoDraw
(
false
);
}
// *response* updates
if
(
t
>=
0.0
&&
response
.
status
===
PsychoJS
.
Status
.
NOT_STARTED
)
{
// keep track of start time/frame for later
response
.
tStart
=
t
;
// (not accounting for frame time here)
response
.
frameNStart
=
frameN
;
// exact frame index
// keyboard checking is just starting
psychoJS
.
window
.
callOnFlip
(
function
()
{
response
.
clock
.
reset
();
});
// t=0 on next screen flip
psychoJS
.
window
.
callOnFlip
(
function
()
{
response
.
start
();
});
// start on screen flip
psychoJS
.
window
.
callOnFlip
(
function
()
{
response
.
clearEvents
();
});
}
frameRemains
=
0.0
+
2.0
-
psychoJS
.
window
.
monitorFramePeriod
*
0.75
;
// most of one frame period left
if
(
response
.
status
===
PsychoJS
.
Status
.
STARTED
&&
t
>=
frameRemains
)
{
response
.
status
=
PsychoJS
.
Status
.
FINISHED
;
}
if
(
response
.
status
===
PsychoJS
.
Status
.
STARTED
)
{
let
theseKeys
=
response
.
getKeys
({
keyList
:
[
'space'
],
waitRelease
:
false
});
_response_allKeys
=
_response_allKeys
.
concat
(
theseKeys
);
if
(
_response_allKeys
.
length
>
0
)
{
response
.
keys
=
_response_allKeys
[
_response_allKeys
.
length
-
1
].
name
;
// just the last key pressed
response
.
rt
=
_response_allKeys
[
_response_allKeys
.
length
-
1
].
rt
;
// was this correct?
if
(
response
.
keys
==
corrAns
)
{
response
.
corr
=
1
;
}
else
{
response
.
corr
=
0
;
}
}
}
// check for quit (typically the Esc key)
if
(
psychoJS
.
experiment
.
experimentEnded
||
psychoJS
.
eventManager
.
getKeys
({
keyList
:[
'escape'
]}).
length
>
0
)
{
return
quitPsychoJS
(
'The [Escape] key was pressed. Goodbye!'
,
false
);
}
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
continueRoutine
=
false
;
// reverts to True if at least one component still running
trialComponents
.
forEach
(
function
(
thisComponent
)
{
if
(
'status'
in
thisComponent
&&
thisComponent
.
status
!==
PsychoJS
.
Status
.
FINISHED
)
{
continueRoutine
=
true
;
}
});
// refresh the screen if continuing
if
(
continueRoutine
&&
routineTimer
.
getTime
()
>
0
)
{
return
Scheduler
.
Event
.
FLIP_REPEAT
;
}
else
{
return
Scheduler
.
Event
.
NEXT
;
}
};
}
function
trialRoutineEnd
(
trials
)
{
return
function
()
{
//------Ending Routine 'trial'-------
trialComponents
.
forEach
(
function
(
thisComponent
)
{
if
(
typeof
thisComponent
.
setAutoDraw
===
'function'
)
{
thisComponent
.
setAutoDraw
(
false
);
}
});
// was no response the correct answer?!
if
(
response
.
keys
===
undefined
)
{
if
([
'None'
,
'none'
,
undefined
].
includes
(
corrAns
))
{
response
.
corr
=
1
;
// correct non-response
}
else
{
response
.
corr
=
0
;
// failed to respond (incorrectly)
}
}
// store data for thisExp (ExperimentHandler)
psychoJS
.
experiment
.
addData
(
'response.keys'
,
response
.
keys
);
psychoJS
.
experiment
.
addData
(
'response.corr'
,
response
.
corr
);
if
(
typeof
response
.
keys
!==
'undefined'
)
{
// we had a response
psychoJS
.
experiment
.
addData
(
'response.rt'
,
response
.
rt
);
}
response
.
stop
();
return
Scheduler
.
Event
.
NEXT
;
};
}
function
endLoopIteration
(
thisScheduler
,
loop
)
{
// ------Prepare for next entry------
return
function
()
{
if
(
typeof
loop
!==
'undefined'
)
{
// ------Check if user ended loop early------
if
(
loop
.
finished
)
{
// Check for and save orphaned data
if
(
psychoJS
.
experiment
.
isEntryEmpty
())
{
psychoJS
.
experiment
.
nextEntry
(
loop
);
}
thisScheduler
.
stop
();
}
else
{
const
thisTrial
=
loop
.
getCurrentTrial
();
if
(
typeof
thisTrial
===
'undefined'
||
!
(
'isTrials'
in
thisTrial
)
||
thisTrial
.
isTrials
)
{
psychoJS
.
experiment
.
nextEntry
(
loop
);
}
}
return
Scheduler
.
Event
.
NEXT
;
}
};
}
function
importConditions
(
trials
)
{
return
function
()
{
psychoJS
.
importAttributes
(
trials
.
getCurrentTrial
());
return
Scheduler
.
Event
.
NEXT
;
};
}
function
quitPsychoJS
(
message
,
isCompleted
)
{
// Check for and save orphaned data
if
(
psychoJS
.
experiment
.
isEntryEmpty
())
{
psychoJS
.
experiment
.
nextEntry
();
}
psychoJS
.
window
.
close
();
psychoJS
.
quit
({
message
:
message
,
isCompleted
:
isCompleted
});
return
Scheduler
.
Event
.
QUIT
;
}
html/N-backtest.js
0 → 100644
View file @
21044815
/*******************
* N-Backtest Test *
*******************/
import
{
PsychoJS
}
from
'./lib/core-2020.1.js'
;
import
*
as
core
from
'./lib/core-2020.1.js'
;
import
{
TrialHandler
}
from
'./lib/data-2020.1.js'
;
import
{
Scheduler
}
from
'./lib/util-2020.1.js'
;
import
*
as
util
from
'./lib/util-2020.1.js'
;
import
*
as
visual
from
'./lib/visual-2020.1.js'
;
import
*
as
sound
from
'./lib/sound-2020.1.js'
;
// init psychoJS:
const
psychoJS
=
new
PsychoJS
({
debug
:
true
});
// open window:
psychoJS
.
openWindow
({
fullscr
:
true
,
color
:
new
util
.
Color
([
0
,
0
,
0
]),
units
:
'height'
,
waitBlanking
:
true
});
// store info about the experiment session:
let
expName
=
'N-backtest'
;
// from the Builder filename that created this script
let
expInfo
=
{
'participant'
:
''
,
'session'
:
'001'
};
// schedule the experiment:
psychoJS
.
schedule
(
psychoJS
.
gui
.
DlgFromDict
({
dictionary
:
expInfo
,
title
:
expName
}));
const
flowScheduler
=
new
Scheduler
(
psychoJS
);
const
dialogCancelScheduler
=
new
Scheduler
(
psychoJS
);
psychoJS
.
scheduleCondition
(
function
()
{
return
(
psychoJS
.
gui
.
dialogComponent
.
button
===
'OK'
);
},
flowScheduler
,
dialogCancelScheduler
);
// flowScheduler gets run if the participants presses OK
flowScheduler
.
add
(
updateInfo
);
// add timeStamp
flowScheduler
.
add
(
experimentInit
);
const
trialsLoopScheduler
=
new
Scheduler
(
psychoJS
);
flowScheduler
.
add
(
trialsLoopBegin
,
trialsLoopScheduler
);
flowScheduler
.
add
(
trialsLoopScheduler
);
flowScheduler
.
add
(
trialsLoopEnd
);
flowScheduler
.
add
(
quitPsychoJS
,
''
,
true
);
// quit if user presses Cancel in dialog box:
dialogCancelScheduler
.
add
(
quitPsychoJS
,
''
,
false
);
psychoJS
.
start
({
expName
:
expName
,
expInfo
:
expInfo
,
});
var
frameDur
;
function
updateInfo
()
{
expInfo
[
'date'
]
=
util
.
MonotonicClock
.
getDateStr
();
// add a simple timestamp
expInfo
[
'expName'
]
=
expName
;
expInfo
[
'psychopyVersion'
]
=
'2020.1.3'
;
expInfo
[
'OS'
]
=
window
.
navigator
.
platform
;
// store frame rate of monitor if we can measure it successfully
expInfo
[
'frameRate'
]
=
psychoJS
.
window
.
getActualFrameRate
();
if
(
typeof
expInfo
[
'frameRate'
]
!==
'undefined'
)
frameDur
=
1.0
/
Math
.
round
(
expInfo
[
'frameRate'
]);
else
frameDur
=
1.0
/
60.0
;
// couldn't get a reliable measure so guess
// add info from the URL:
util
.
addInfoFromUrl
(
expInfo
);
return
Scheduler
.
Event
.
NEXT
;
}
var
trialClock
;
var
grid_lines
;
var
target_square
;
var
fixation_2
;
var
response
;
var
globalClock
;
var
routineTimer
;
function
experimentInit
()
{
// Initialize components for Routine "trial"
trialClock
=
new
util
.
Clock
();
grid_lines
=
new
visual
.
ImageStim
({
win
:
psychoJS
.
window
,
name
:
'grid_lines'
,
units
:
undefined
,
image
:
'grid.png'
,
mask
:
undefined
,
ori
:
0
,
pos
:
[
0
,
0
],
size
:
[
0.5
,
0.5
],
color
:
new
util
.
Color
([
1
,
1
,
1
]),
opacity
:
1
,