Commit 67fd5b00 authored by Julian Kirkeby Lysvik's avatar Julian Kirkeby Lysvik

Testing with pyo

parent 6286a789
......@@ -19,7 +19,7 @@
<Param name="Screen" updates="None" val="1" valType="num"/>
<Param name="Show info dlg" updates="None" val="False" valType="bool"/>
<Param name="Show mouse" updates="None" val="False" valType="bool"/>
<Param name="Units" updates="None" val="height" valType="str"/>
<Param name="Units" updates="None" val="norm" valType="str"/>
<Param name="Use version" updates="None" val="" valType="str"/>
<Param name="Window size (pixels)" updates="None" val="[1920, 1080]" valType="code"/>
<Param name="blendMode" updates="None" val="avg" valType="str"/>
......@@ -351,6 +351,16 @@
<Param name="storeCorrect" updates="constant" val="False" valType="bool"/>
<Param name="syncScreenRefresh" updates="constant" val="True" valType="bool"/>
</KeyboardComponent>
<MicrophoneComponent name="mic_1">
<Param name="durationEstim" updates="None" val="" valType="code"/>
<Param name="name" updates="None" val="mic_1" 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="5" valType="code"/>
<Param name="stereo" updates="None" val="False" valType="bool"/>
<Param name="stopType" updates="None" val="duration (s)" valType="str"/>
<Param name="stopVal" updates="constant" val="" valType="code"/>
</MicrophoneComponent>
</Routine>
<Routine name="ISI_1sec">
<StaticComponent name="ISI_2">
......@@ -754,7 +764,7 @@
<Routine name="Instruction_Intro"/>
<Routine name="ISI_Pre"/>
<LoopInitiator loopType="TrialHandler" name="trials">
<Param name="Selected rows" updates="None" val="1:10" valType="str"/>
<Param name="Selected rows" updates="None" val="1:3" valType="str"/>
<Param name="conditions" updates="None" val="None" valType="str"/>
<Param name="conditionsFile" updates="None" val="$&quot;Lists/Order&quot;+condition+&quot;.xlsx&quot;" valType="str"/>
<Param name="endPoints" updates="None" val="[0, 1]" valType="num"/>
......
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v3.0.7),
on april 11, 2019, at 16:19
on april 12, 2019, at 16:48
If you publish work using this script please cite the PsychoPy publications:
Peirce, JW (2007) PsychoPy - Psychophysics software in Python.
Journal of Neuroscience Methods, 162(1-2), 8-13.
......@@ -11,7 +11,7 @@ If you publish work using this script please cite the PsychoPy publications:
"""
from __future__ import absolute_import, division
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock, microphone
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
import numpy as np # whole numpy lib is available, prepend 'np.'
......@@ -50,13 +50,20 @@ logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a f
endExpNow = False # flag for 'escape' or other condition => quit the exp
# Start Code - component code to be run before the window creation
wavDirName = filename + '_wav'
if not os.path.isdir(wavDirName):
os.makedirs(wavDirName) # to hold .wav files
# Setup the Window
win = visual.Window(
size=[1920, 1080], fullscr=True, screen=0,
allowGUI=False, allowStencil=False,
monitor='testMonitor', color=[1.000,1.000,1.000], colorSpace='rgb',
blendMode='avg', useFBO=True)
blendMode='avg', useFBO=True,
units='height')
# Enable sound input/output:
microphone.switchOn()
# store frame rate of monitor if we can measure it
expInfo['frameRate'] = win.getActualFrameRate()
if expInfo['frameRate'] != None:
......@@ -68,7 +75,7 @@ else:
Instruction_IntroClock = core.Clock()
lub = visual.ImageStim(
win=win,
name='lub', units='norm',
name='lub',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(2, 2),
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -92,7 +99,7 @@ fixation = visual.ShapeStim(
ExposureClock = core.Clock()
Sing_img = visual.ImageStim(
win=win,
name='Sing_img', units='norm',
name='Sing_img',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -100,7 +107,7 @@ Sing_img = visual.ImageStim(
texRes=128, interpolate=True, depth=0.0)
Pl_img = visual.ImageStim(
win=win,
name='Pl_img', units='norm',
name='Pl_img',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -133,7 +140,7 @@ ISI_2 = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI_2')
Instruction_ProdClock = core.Clock()
image_3 = visual.ImageStim(
win=win,
name='image_3', units='norm',
name='image_3',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(2, 2),
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -162,7 +169,7 @@ Target_ins1 = visual.TextStim(win=win, name='Target_ins1',
depth=0.0);
Trigger_img1 = visual.ImageStim(
win=win,
name='Trigger_img1', units='norm',
name='Trigger_img1',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -170,7 +177,7 @@ Trigger_img1 = visual.ImageStim(
texRes=128, interpolate=True, depth=-1.0)
Target_img1 = visual.ImageStim(
win=win,
name='Target_img1', units='norm',
name='Target_img1',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -194,7 +201,7 @@ ISI_2 = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI_2')
Instruction_FCClock = core.Clock()
image_6 = visual.ImageStim(
win=win,
name='image_6', units='norm',
name='image_6',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(2, 2),
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -223,7 +230,7 @@ Target_ins2 = visual.TextStim(win=win, name='Target_ins2',
depth=0.0);
Trigger_img2 = visual.ImageStim(
win=win,
name='Trigger_img2', units='norm',
name='Trigger_img2',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -231,7 +238,7 @@ Trigger_img2 = visual.ImageStim(
texRes=128, interpolate=True, depth=-1.0)
Target_img2 = visual.ImageStim(
win=win,
name='Target_img2', units='norm',
name='Target_img2',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -440,7 +447,7 @@ for thisComponent in ISI_PreComponents:
# set up handler to look after randomisation of conditions etc
trials = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions("Lists/Order"+condition+".xlsx", selection='1:10'),
trialList=data.importConditions("Lists/Order"+condition+".xlsx", selection='1:3'),
seed=None, name='trials')
thisExp.addLoop(trials) # add the loop to the experiment
thisTrial = trials.trialList[0] # so we can initialise stimuli with some values
......@@ -763,7 +770,7 @@ for thisComponent in ISI_PreComponents:
# set up handler to look after randomisation of conditions etc
trials_2 = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions("Lists/OrderProd"+condition+".xlsx", selection='1:3'),
trialList=data.importConditions("Lists/OrderProd"+condition+".xlsx", selection='1:5'),
seed=None, name='trials_2')
thisExp.addLoop(trials_2) # add the loop to the experiment
thisTrial_2 = trials_2.trialList[0] # so we can initialise stimuli with some values
......@@ -792,8 +799,9 @@ for thisTrial_2 in trials_2:
audiotrig.setSound(trig_aud, secs=5)
audiotrig.setVolume(1, log=False)
key_resp_5 = event.BuilderKeyResponse()
mic_1 = microphone.AdvAudioCapture(name='mic_1', saveDir=wavDirName, stereo=False)
# keep track of which components have finished
Test_ProdComponents = [Target_ins1, Trigger_img1, Target_img1, Trigger_txt1, audiotrig, key_resp_5]
Test_ProdComponents = [Target_ins1, Trigger_img1, Target_img1, Trigger_txt1, audiotrig, key_resp_5, mic_1]
for thisComponent in Test_ProdComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
......@@ -869,6 +877,17 @@ for thisTrial_2 in trials_2:
# a response ends the routine
continueRoutine = False
# *mic_1* updates
if t >= 5 and mic_1.status == NOT_STARTED:
# keep track of start time/frame for later
mic_1.tStart = t
mic_1.frameNStart = frameN # exact frame index
mic_1.status = STARTED
mic_1.record(sec=0, block=False) # start the recording thread
if mic_1.status == STARTED and not mic_1.recorder.running:
mic_1.status = FINISHED
# check for quit (typically the Esc key)
if endExpNow or event.getKeys(keyList=["escape"]):
core.quit()
......@@ -897,6 +916,12 @@ for thisTrial_2 in trials_2:
trials_2.addData('key_resp_5.keys',key_resp_5.keys)
if key_resp_5.keys != None: # we had a response
trials_2.addData('key_resp_5.rt', key_resp_5.rt)
# mic_1 stop & responses
mic_1.stop() # sometimes helpful
if not mic_1.savedFile:
mic_1.savedFile = None
# store data for trials_2 (TrialHandler)
trials_2.addData('mic_1.filename', mic_1.savedFile)
# the Routine "Test_Prod" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
......@@ -1097,7 +1122,7 @@ for thisComponent in ISI_PreComponents:
# set up handler to look after randomisation of conditions etc
trials_3 = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions("Lists/OrderFC"+condition+".xlsx", selection='1:6'),
trialList=data.importConditions("Lists/OrderFC"+condition+".xlsx", selection='1:5'),
seed=None, name='trials_3')
thisExp.addLoop(trials_3) # add the loop to the experiment
thisTrial_3 = trials_3.trialList[0] # so we can initialise stimuli with some values
......
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v3.0.7),
on april 11, 2019, at 16:21
on april 12, 2019, at 16:41
If you publish work using this script please cite the PsychoPy publications:
Peirce, JW (2007) PsychoPy - Psychophysics software in Python.
Journal of Neuroscience Methods, 162(1-2), 8-13.
......@@ -11,7 +11,7 @@ If you publish work using this script please cite the PsychoPy publications:
"""
from __future__ import absolute_import, division
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock, microphone
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
import numpy as np # whole numpy lib is available, prepend 'np.'
......@@ -50,13 +50,20 @@ logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a f
endExpNow = False # flag for 'escape' or other condition => quit the exp
# Start Code - component code to be run before the window creation
wavDirName = filename + '_wav'
if not os.path.isdir(wavDirName):
os.makedirs(wavDirName) # to hold .wav files
# Setup the Window
win = visual.Window(
size=[1920, 1080], fullscr=True, screen=0,
allowGUI=False, allowStencil=False,
monitor='testMonitor', color=[1.000,1.000,1.000], colorSpace='rgb',
blendMode='avg', useFBO=True)
blendMode='avg', useFBO=True,
units='height')
# Enable sound input/output:
microphone.switchOn()
# store frame rate of monitor if we can measure it
expInfo['frameRate'] = win.getActualFrameRate()
if expInfo['frameRate'] != None:
......@@ -68,7 +75,7 @@ else:
Instruction_IntroClock = core.Clock()
lub = visual.ImageStim(
win=win,
name='lub', units='norm',
name='lub',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(2, 2),
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -92,7 +99,7 @@ fixation = visual.ShapeStim(
ExposureClock = core.Clock()
Sing_img = visual.ImageStim(
win=win,
name='Sing_img', units='norm',
name='Sing_img',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -100,7 +107,7 @@ Sing_img = visual.ImageStim(
texRes=128, interpolate=True, depth=0.0)
Pl_img = visual.ImageStim(
win=win,
name='Pl_img', units='norm',
name='Pl_img',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -133,7 +140,7 @@ ISI_2 = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI_2')
Instruction_ProdClock = core.Clock()
image_3 = visual.ImageStim(
win=win,
name='image_3', units='norm',
name='image_3',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(2, 2),
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -162,7 +169,7 @@ Target_ins1 = visual.TextStim(win=win, name='Target_ins1',
depth=0.0);
Trigger_img1 = visual.ImageStim(
win=win,
name='Trigger_img1', units='norm',
name='Trigger_img1',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -170,7 +177,7 @@ Trigger_img1 = visual.ImageStim(
texRes=128, interpolate=True, depth=-1.0)
Target_img1 = visual.ImageStim(
win=win,
name='Target_img1', units='norm',
name='Target_img1',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -194,7 +201,7 @@ ISI_2 = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI_2')
Instruction_FCClock = core.Clock()
image_6 = visual.ImageStim(
win=win,
name='image_6', units='norm',
name='image_6',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(2, 2),
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -223,7 +230,7 @@ Target_ins2 = visual.TextStim(win=win, name='Target_ins2',
depth=0.0);
Trigger_img2 = visual.ImageStim(
win=win,
name='Trigger_img2', units='norm',
name='Trigger_img2',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -231,7 +238,7 @@ Trigger_img2 = visual.ImageStim(
texRes=128, interpolate=True, depth=-1.0)
Target_img2 = visual.ImageStim(
win=win,
name='Target_img2', units='norm',
name='Target_img2',
image='sin', mask=None,
ori=0, pos=(0, 0.2), size=None,
color=[1,1,1], colorSpace='rgb', opacity=1,
......@@ -763,7 +770,7 @@ for thisComponent in ISI_PreComponents:
# set up handler to look after randomisation of conditions etc
trials_2 = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions("Lists/OrderProd"+condition+".xlsx", selection='1:3'),
trialList=data.importConditions("Lists/OrderProd"+condition+".xlsx", selection='1:5'),
seed=None, name='trials_2')
thisExp.addLoop(trials_2) # add the loop to the experiment
thisTrial_2 = trials_2.trialList[0] # so we can initialise stimuli with some values
......@@ -792,8 +799,9 @@ for thisTrial_2 in trials_2:
audiotrig.setSound(trig_aud, secs=5)
audiotrig.setVolume(1, log=False)
key_resp_5 = event.BuilderKeyResponse()
mic_1 = microphone.AdvAudioCapture(name='mic_1', saveDir=wavDirName, stereo=False)
# keep track of which components have finished
Test_ProdComponents = [Target_ins1, Trigger_img1, Target_img1, Trigger_txt1, audiotrig, key_resp_5]
Test_ProdComponents = [Target_ins1, Trigger_img1, Target_img1, Trigger_txt1, audiotrig, key_resp_5, mic_1]
for thisComponent in Test_ProdComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
......@@ -869,6 +877,17 @@ for thisTrial_2 in trials_2:
# a response ends the routine
continueRoutine = False
# *mic_1* updates
if t >= 5 and mic_1.status == NOT_STARTED:
# keep track of start time/frame for later
mic_1.tStart = t
mic_1.frameNStart = frameN # exact frame index
mic_1.status = STARTED
mic_1.record(sec=0, block=False) # start the recording thread
if mic_1.status == STARTED and not mic_1.recorder.running:
mic_1.status = FINISHED
# check for quit (typically the Esc key)
if endExpNow or event.getKeys(keyList=["escape"]):
core.quit()
......@@ -897,6 +916,12 @@ for thisTrial_2 in trials_2:
trials_2.addData('key_resp_5.keys',key_resp_5.keys)
if key_resp_5.keys != None: # we had a response
trials_2.addData('key_resp_5.rt', key_resp_5.rt)
# mic_1 stop & responses
mic_1.stop() # sometimes helpful
if not mic_1.savedFile:
mic_1.savedFile = None
# store data for trials_2 (TrialHandler)
trials_2.addData('mic_1.filename', mic_1.savedFile)
# the Routine "Test_Prod" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
......@@ -1097,7 +1122,7 @@ for thisComponent in ISI_PreComponents:
# set up handler to look after randomisation of conditions etc
trials_3 = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions("Lists/OrderFC"+condition+".xlsx", selection='1:6'),
trialList=data.importConditions("Lists/OrderFC"+condition+".xlsx", selection='1:5'),
seed=None, name='trials_3')
thisExp.addLoop(trials_3) # add the loop to the experiment
thisTrial_3 = trials_3.trialList[0] # so we can initialise stimuli with some values
......
trig,targ,type,filler,trig_img,targ_img,trig_aud,targ_aud,final_c,new,num,instr,a,k,corr,lang,phase,targ_aud_a,targ_aud_k,item,trials.thisRepN,trials.thisTrialN,trials.thisN,trials.thisIndex,trials_2.thisRepN,trials_2.thisTrialN,trials_2.thisN,trials_2.thisIndex,key_resp_1.keys,key_resp_1.rt,key_resp_2.keys,key_resp_2.rt,gender,age,participant,language,date,expName,psychopyVersion,frameRate,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,space,3.222231466170342,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
lit,lidu,alt,target,Images/bag.jpg,Images/bag_pl.jpg,Audio/Devoicing/bag.wav,Audio/Devoicing/bag_pl.wav,t,given,None,None,None,None,None,devoicing,exposure,None,None,bag,0,0,0,0,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
nup,nubu,alt,target,Images/bush.jpg,Images/bush_pl.jpg,Audio/Devoicing/bush.wav,Audio/Devoicing/bush_pl.wav,p,given,None,None,None,None,None,devoicing,exposure,None,None,bush,0,1,1,8,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
kubuk,kubuku,non_alt,target,Images/bottle.jpg,Images/bottle_pl.jpg,Audio/Devoicing/bottle.wav,Audio/Devoicing/bottle_pl.wav,k,given,None,None,None,None,None,devoicing,exposure,None,None,bottle,0,2,2,6,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
seluk,seluku,non_alt,target,Images/basketball.jpg,Images/basketball_pl.jpg,Audio/Devoicing/basketball.wav,Audio/Devoicing/basketball_pl.wav,k,given,None,None,None,None,None,devoicing,exposure,None,None,basketball,0,3,3,3,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
derot,derodu,alt,target,Images/bean.jpg,Images/bean_pl.jpg,Audio/Devoicing/bean.wav,Audio/Devoicing/bean_pl.wav,t,given,None,None,None,None,None,devoicing,exposure,None,None,bean,0,4,4,4,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
bisep,bisebu,alt,target,Images/box.jpg,Images/box_pl.jpg,Audio/Devoicing/box.wav,Audio/Devoicing/box_pl.wav,p,given,None,None,None,None,None,devoicing,exposure,None,None,box,0,5,5,7,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
nutik,nutigu,alt,target,Images/balloon.jpg,Images/balloon_pl.jpg,Audio/Devoicing/balloon.wav,Audio/Devoicing/balloon_pl.wav,k,given,None,None,None,None,None,devoicing,exposure,None,None,balloon,0,6,6,1,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
fasif,fasifu,None,filler,Images/bicycle.jpg,Images/bicycle_pl.jpg,Audio/Devoicing/bicycle.wav,Audio/Devoicing/bicycle_pl.wav,f,given,None,None,None,fasin,None,devoicing,exposure,None,None,bicycle,0,7,7,5,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
sesek,sesegu,alt,target,Images/banana.jpg,Images/banana_pl.jpg,Audio/Devoicing/banana.wav,Audio/Devoicing/banana_pl.wav,k,given,None,None,None,None,None,devoicing,exposure,None,None,banana,0,8,8,2,,,,,,,,,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,space,2.3114563227754843,,,001,,2019_Apr_12_1641,audio2,3.0.7,60.04195986947745,
This diff is collapsed.
gender,age,participant,language,date,expName,psychopyVersion,frameRate,
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment