diff --git a/rds_task.psyexp b/rds_task.psyexp index 55d215e215557646adb0751810dbadcfc928004c..ae172406c306afc0ff0dc6ec01fab312cd432758 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&#10;&#10;MINLEVEL=0&#10;MAXLEVEL=9&#10;shamAmp = [2,2]&#10;&#10;if expInfo['practice']:&#10; nTrial = 2&#10;else:&#10; nTrial = 20&#10; stimulator = stimulation.TI(expInfo['config'])&#10; stimulator.port = expInfo['port']&#10; stimulator.connect()&#10; stimulator.load()&#10;&#10;" valType="extendedCode"/> - <Param name="Begin JS Experiment" updates="constant" val="import {stimulation} from 'pyniexp';&#10;var MAXLEVEL, MINLEVEL, nTrial, shamAmp, stimulator;&#10;MINLEVEL = 0;&#10;MAXLEVEL = 9;&#10;shamAmp = [2, 2];&#10;if (expInfo["practice"]) {&#10; nTrial = 2;&#10;} else {&#10; nTrial = 20;&#10; stimulator = new stimulation.TI(expInfo["config"]);&#10; stimulator.port = expInfo["port"];&#10; stimulator.connect();&#10; stimulator.load();&#10;}&#10;" valType="extendedCode"/> + <Param name="Begin Experiment" updates="constant" val="from pyniexp import stimulation&#10;&#10;MINLEVEL=0&#10;MAXLEVEL=9&#10;shamAmp = [2,2]&#10;&#10;if expInfo['practice']:&#10; runs = list(range(1))&#10; nTrial = 2&#10;else:&#10; runs = list(range(3))&#10; nTrial = 20&#10; stimulator = stimulation.TI(expInfo['config'])&#10; stimulator.port = expInfo['port']&#10; stimulator.connect()&#10; stimulator.load()&#10;&#10;" valType="extendedCode"/> + <Param name="Begin JS Experiment" updates="constant" val="import {stimulation} from 'pyniexp';&#10;var MAXLEVEL, MINLEVEL, nRun, nTrial, shamAmp, stimulator;&#10;MINLEVEL = 0;&#10;MAXLEVEL = 9;&#10;shamAmp = [2, 2];&#10;if (expInfo["practice"]) {&#10; nRun = 1;&#10; nTrial = 2;&#10;} else {&#10; nRun = 3;&#10; nTrial = 20;&#10; stimulator = new stimulation.TI(expInfo["config"]);&#10; stimulator.port = expInfo["port"];&#10; stimulator.connect();&#10; stimulator.load();&#10;}&#10;" valType="extendedCode"/> <Param name="Begin JS Routine" updates="constant" val="if ((! expInfo["practice"])) {&#10; stimulator.amplitude = function () {&#10; var _pj_a = [], _pj_b = thisRun[expInfo["participant"]].split("_");&#10; for (var _pj_c = 0, _pj_d = _pj_b.length; (_pj_c < _pj_d); _pj_c += 1) {&#10; var a = _pj_b[_pj_c];&#10; _pj_a.push(Number.parseInt(a));&#10; }&#10; return _pj_a;&#10;}&#10;.call(this);&#10;}&#10;" valType="extendedCode"/> <Param name="Begin Routine" updates="constant" val="if not(expInfo['practice']):&#10; stimulator.amplitude = [int(a) for a in thisRun[expInfo['participant']].split('_')]&#10;" valType="extendedCode"/> - <Param name="Code Type" updates="None" val="Auto->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']):&#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["practice"])) {&#10; if ((stimulator.amplitude === [0, 0])) {&#10; stimulator.amplitude = shamAmp;&#10; stimulator.start();&#10; stimulator.stop();&#10; } else {&#10; stimulator.start();&#10; }&#10;}&#10;" valType="extendedCode"/> <Param name="Begin Routine" updates="constant" val="if not(expInfo['practice']):&#10; if stimulator.amplitude == [0,0]:&#10; stimulator.amplitude = shamAmp&#10; stimulator.start()&#10; stimulator.stop()&#10; else:&#10; stimulator.start()" valType="extendedCode"/> - <Param name="Code Type" updates="None" val="Auto->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 974129f3e951522533ea09a86d646ea59211ab5a..ea13012f66a38043fef92ad9d3a92d866fbb3f2b 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 2ee96e48d87118dbc3027af7a0e1cb1478c9603c..981d0ac2ec4796cc15a356890165282beaa5d85a 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