From 762b4ddcac0fd23c45ce9296ae42995cfda87581 Mon Sep 17 00:00:00 2001
From: tiborauer <tibor.auer@gmail.com>
Date: Mon, 24 Feb 2020 10:44:05 +0000
Subject: [PATCH] DEBUG: run loop

---
 rds_task.psyexp     | 14 +++++++-------
 rds_task.py         | 20 +++++++++++---------
 rds_task_lastrun.py | 18 ++++++++++--------
 3 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/rds_task.psyexp b/rds_task.psyexp
index 55d215e..ae17240 100644
--- a/rds_task.psyexp
+++ b/rds_task.psyexp
@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
-<PsychoPy2experiment encoding="utf-8" version="2020.1.0">
+<PsychoPy2experiment encoding="utf-8" version="2020.1.1">
   <Settings>
     <Param name="Audio latency priority" updates="None" val="use prefs" valType="str"/>
     <Param name="Audio lib" updates="None" val="use prefs" valType="str"/>
@@ -102,11 +102,11 @@
         <Param name="syncScreenRefresh" updates="constant" val="False" valType="bool"/>
       </KeyboardComponent>
       <CodeComponent name="init">
-        <Param name="Begin Experiment" updates="constant" val="from pyniexp import stimulation&amp;#10;&amp;#10;MINLEVEL=0&amp;#10;MAXLEVEL=9&amp;#10;shamAmp = [2,2]&amp;#10;&amp;#10;if expInfo['practice']:&amp;#10;    nTrial = 2&amp;#10;else:&amp;#10;    nTrial = 20&amp;#10;    stimulator = stimulation.TI(expInfo['config'])&amp;#10;    stimulator.port = expInfo['port']&amp;#10;    stimulator.connect()&amp;#10;    stimulator.load()&amp;#10;&amp;#10;" valType="extendedCode"/>
-        <Param name="Begin JS Experiment" updates="constant" val="import {stimulation} from 'pyniexp';&amp;#10;var MAXLEVEL, MINLEVEL, nTrial, shamAmp, stimulator;&amp;#10;MINLEVEL = 0;&amp;#10;MAXLEVEL = 9;&amp;#10;shamAmp = [2, 2];&amp;#10;if (expInfo[&quot;practice&quot;]) {&amp;#10;    nTrial = 2;&amp;#10;} else {&amp;#10;    nTrial = 20;&amp;#10;    stimulator = new stimulation.TI(expInfo[&quot;config&quot;]);&amp;#10;    stimulator.port = expInfo[&quot;port&quot;];&amp;#10;    stimulator.connect();&amp;#10;    stimulator.load();&amp;#10;}&amp;#10;" valType="extendedCode"/>
+        <Param name="Begin Experiment" updates="constant" val="from pyniexp import stimulation&amp;#10;&amp;#10;MINLEVEL=0&amp;#10;MAXLEVEL=9&amp;#10;shamAmp = [2,2]&amp;#10;&amp;#10;if expInfo['practice']:&amp;#10;    runs = list(range(1))&amp;#10;    nTrial = 2&amp;#10;else:&amp;#10;    runs = list(range(3))&amp;#10;    nTrial = 20&amp;#10;    stimulator = stimulation.TI(expInfo['config'])&amp;#10;    stimulator.port = expInfo['port']&amp;#10;    stimulator.connect()&amp;#10;    stimulator.load()&amp;#10;&amp;#10;" valType="extendedCode"/>
+        <Param name="Begin JS Experiment" updates="constant" val="import {stimulation} from 'pyniexp';&amp;#10;var MAXLEVEL, MINLEVEL, nRun, nTrial, shamAmp, stimulator;&amp;#10;MINLEVEL = 0;&amp;#10;MAXLEVEL = 9;&amp;#10;shamAmp = [2, 2];&amp;#10;if (expInfo[&quot;practice&quot;]) {&amp;#10;    nRun = 1;&amp;#10;    nTrial = 2;&amp;#10;} else {&amp;#10;    nRun = 3;&amp;#10;    nTrial = 20;&amp;#10;    stimulator = new stimulation.TI(expInfo[&quot;config&quot;]);&amp;#10;    stimulator.port = expInfo[&quot;port&quot;];&amp;#10;    stimulator.connect();&amp;#10;    stimulator.load();&amp;#10;}&amp;#10;" valType="extendedCode"/>
         <Param name="Begin JS Routine" updates="constant" val="if ((! expInfo[&quot;practice&quot;])) {&amp;#10;    stimulator.amplitude = function () {&amp;#10;    var _pj_a = [], _pj_b = thisRun[expInfo[&quot;participant&quot;]].split(&quot;_&quot;);&amp;#10;    for (var _pj_c = 0, _pj_d = _pj_b.length; (_pj_c &lt; _pj_d); _pj_c += 1) {&amp;#10;        var a = _pj_b[_pj_c];&amp;#10;        _pj_a.push(Number.parseInt(a));&amp;#10;    }&amp;#10;    return _pj_a;&amp;#10;}&amp;#10;.call(this);&amp;#10;}&amp;#10;" valType="extendedCode"/>
         <Param name="Begin Routine" updates="constant" val="if not(expInfo['practice']):&amp;#10;    stimulator.amplitude = [int(a) for a in thisRun[expInfo['participant']].split('_')]&amp;#10;" valType="extendedCode"/>
-        <Param name="Code Type" updates="None" val="Auto-&gt;JS" valType="str"/>
+        <Param name="Code Type" updates="None" val="Py" valType="str"/>
         <Param name="Each Frame" updates="constant" val="" valType="extendedCode"/>
         <Param name="Each JS Frame" updates="constant" val="" valType="extendedCode"/>
         <Param name="End Experiment" updates="constant" val="if not(expInfo['practice']):&amp;#10;    stimulator = None" valType="extendedCode"/>
@@ -290,7 +290,7 @@
         <Param name="Begin JS Experiment" updates="constant" val="" valType="extendedCode"/>
         <Param name="Begin JS Routine" updates="constant" val="if ((! expInfo[&quot;practice&quot;])) {&amp;#10;    if ((stimulator.amplitude === [0, 0])) {&amp;#10;        stimulator.amplitude = shamAmp;&amp;#10;        stimulator.start();&amp;#10;        stimulator.stop();&amp;#10;    } else {&amp;#10;        stimulator.start();&amp;#10;    }&amp;#10;}&amp;#10;" valType="extendedCode"/>
         <Param name="Begin Routine" updates="constant" val="if not(expInfo['practice']):&amp;#10;    if stimulator.amplitude == [0,0]:&amp;#10;        stimulator.amplitude = shamAmp&amp;#10;        stimulator.start()&amp;#10;        stimulator.stop()&amp;#10;    else:&amp;#10;        stimulator.start()" valType="extendedCode"/>
-        <Param name="Code Type" updates="None" val="Auto-&gt;JS" valType="str"/>
+        <Param name="Code Type" updates="None" val="Py" valType="str"/>
         <Param name="Each Frame" updates="constant" val="" valType="extendedCode"/>
         <Param name="Each JS Frame" updates="constant" val="" valType="extendedCode"/>
         <Param name="End Experiment" updates="constant" val="" valType="extendedCode"/>
@@ -321,13 +321,13 @@
   </Routines>
   <Flow>
     <LoopInitiator loopType="TrialHandler" name="runs">
-      <Param name="Selected rows" updates="None" val="" valType="str"/>
+      <Param name="Selected rows" updates="None" val="$runs" valType="str"/>
       <Param name="conditions" updates="None" val="[OrderedDict([('S01', 1), ('S02', 2), ('S03', 3)]), OrderedDict([('S01', 2), ('S02', 3), ('S03', 1)]), OrderedDict([('S01', 3), ('S02', 1), ('S03', 2)])]" valType="str"/>
       <Param name="conditionsFile" updates="None" val="conditions.xlsx" valType="str"/>
       <Param name="endPoints" updates="None" val="[0, 1]" valType="num"/>
       <Param name="isTrials" updates="None" val="False" valType="bool"/>
       <Param name="loopType" updates="None" val="sequential" valType="str"/>
-      <Param name="nReps" updates="None" val="3" valType="code"/>
+      <Param name="nReps" updates="None" val="1" valType="code"/>
       <Param name="name" updates="None" val="runs" valType="code"/>
       <Param name="random seed" updates="None" val="" valType="code"/>
     </LoopInitiator>
diff --git a/rds_task.py b/rds_task.py
index 974129f..ea13012 100644
--- a/rds_task.py
+++ b/rds_task.py
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-This experiment was created using PsychoPy3 Experiment Builder (v2020.1.0),
-    on February 18, 2020, at 14:57
+This experiment was created using PsychoPy3 Experiment Builder (v2020.1.1),
+    on February 24, 2020, at 10:17
 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) 
@@ -35,7 +35,7 @@ _thisDir = os.path.dirname(os.path.abspath(__file__))
 os.chdir(_thisDir)
 
 # Store info about the experiment session
-psychopyVersion = '2020.1.0'
+psychopyVersion = '2020.1.1'
 expName = 'rds_task'  # from the Builder filename that created this script
 expInfo = {'participant': '', 'session': '001', 'practice': False, 'config': 'config_TI.json', 'port': 'COM5'}
 dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName)
@@ -51,7 +51,7 @@ filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['participant'], expNa
 # An ExperimentHandler isn't essential but helps with data saving
 thisExp = data.ExperimentHandler(name=expName, version='',
     extraInfo=expInfo, runtimeInfo=None,
-    originPath='C:\\Users\\nemo\\Desktop\\NEMO\\Paradigms\\reverse-digit-span-task\\rds_task.py',
+    originPath='D:\\Projects\\reverse-digit-span-task\\rds_task.py',
     savePickle=True, saveWideText=True,
     dataFileName=filename)
 # save a log file for detail verbose info
@@ -94,12 +94,14 @@ from pyniexp import stimulation
 
 MINLEVEL=0
 MAXLEVEL=9
-shamAMp = [2,2]
+shamAmp = [2,2]
 
 if expInfo['practice']:
+    runs = list(range(1))
     nTrial = 2
 else:
-    nTrial = 2
+    runs = list(range(3))
+    nTrial = 20
     stimulator = stimulation.TI(expInfo['config'])
     stimulator.port = expInfo['port']
     stimulator.connect()
@@ -169,9 +171,9 @@ globalClock = core.Clock()  # to track the time since experiment started
 routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine 
 
 # set up handler to look after randomisation of conditions etc
-runs = data.TrialHandler(nReps=3, method='sequential', 
+runs = data.TrialHandler(nReps=1, method='sequential', 
     extraInfo=expInfo, originPath=-1,
-    trialList=data.importConditions('conditions.xlsx'),
+    trialList=data.importConditions('conditions.xlsx', selection=runs),
     seed=None, name='runs')
 thisExp.addLoop(runs)  # add the loop to the experiment
 thisRun = runs.trialList[0]  # so we can initialise stimuli with some values
@@ -860,7 +862,7 @@ for thisRun in runs:
             thisComponent.setAutoDraw(False)
     # the Routine "stimulation_stop" was not non-slip safe, so reset the non-slip timer
     routineTimer.reset()
-# completed 3 repeats of 'runs'
+# completed 1 repeats of 'runs'
 
 if not(expInfo['practice']):
     stimulator = None
diff --git a/rds_task_lastrun.py b/rds_task_lastrun.py
index 2ee96e4..981d0ac 100644
--- a/rds_task_lastrun.py
+++ b/rds_task_lastrun.py
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-This experiment was created using PsychoPy3 Experiment Builder (v2020.1.0),
-    on February 18, 2020, at 15:00
+This experiment was created using PsychoPy3 Experiment Builder (v2020.1.1),
+    on February 24, 2020, at 10:18
 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) 
@@ -35,7 +35,7 @@ _thisDir = os.path.dirname(os.path.abspath(__file__))
 os.chdir(_thisDir)
 
 # Store info about the experiment session
-psychopyVersion = '2020.1.0'
+psychopyVersion = '2020.1.1'
 expName = 'rds_task'  # from the Builder filename that created this script
 expInfo = {'participant': '', 'session': '001', 'practice': False, 'config': 'config_TI.json', 'port': 'COM5'}
 dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName)
@@ -51,7 +51,7 @@ filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['participant'], expNa
 # An ExperimentHandler isn't essential but helps with data saving
 thisExp = data.ExperimentHandler(name=expName, version='',
     extraInfo=expInfo, runtimeInfo=None,
-    originPath='C:\\Users\\nemo\\Desktop\\NEMO\\Paradigms\\reverse-digit-span-task\\rds_task_lastrun.py',
+    originPath='D:\\Projects\\reverse-digit-span-task\\rds_task_lastrun.py',
     savePickle=True, saveWideText=True,
     dataFileName=filename)
 # save a log file for detail verbose info
@@ -97,9 +97,11 @@ MAXLEVEL=9
 shamAmp = [2,2]
 
 if expInfo['practice']:
+    runs = list(range(1))
     nTrial = 2
 else:
-    nTrial = 2
+    runs = list(range(3))
+    nTrial = 20
     stimulator = stimulation.TI(expInfo['config'])
     stimulator.port = expInfo['port']
     stimulator.connect()
@@ -169,9 +171,9 @@ globalClock = core.Clock()  # to track the time since experiment started
 routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine 
 
 # set up handler to look after randomisation of conditions etc
-runs = data.TrialHandler(nReps=3, method='sequential', 
+runs = data.TrialHandler(nReps=1, method='sequential', 
     extraInfo=expInfo, originPath=-1,
-    trialList=data.importConditions('conditions.xlsx'),
+    trialList=data.importConditions('conditions.xlsx', selection=runs),
     seed=None, name='runs')
 thisExp.addLoop(runs)  # add the loop to the experiment
 thisRun = runs.trialList[0]  # so we can initialise stimuli with some values
@@ -860,7 +862,7 @@ for thisRun in runs:
             thisComponent.setAutoDraw(False)
     # the Routine "stimulation_stop" was not non-slip safe, so reset the non-slip timer
     routineTimer.reset()
-# completed 3 repeats of 'runs'
+# completed 1 repeats of 'runs'
 
 if not(expInfo['practice']):
     stimulator = None
-- 
GitLab