我是新來的編碼,並希望幫助理解PsychoPy程序使用的腳本。Understanding PsychoPy codes for trialHandler and responses
更具體地說,我想了解第6行到第15行的代碼。我知道這用於管理多個試驗,但我希望有人能幫助我澄清這些問題?我還注意到,刪除第6-8行的代碼並不會改變實驗,但從第10-15行刪除代碼基本上會阻止實驗的運行。
trialsAll = data.TrialHandler(trialList=data.importConditions('trialType.xlsx'), nReps=10, method='random', name='trialsAll', dataTypes='corr')
thisExp = data.ExperimentHandler(name='Ours')
thisExp.addLoop(trialsAll) #adds a loop to the experiment
thisTrial = trialsAll.trialList[0]
if thisTrial != None:
for paramName in thisTrial.keys():
exec(paramName + '= thisTrial.' + paramName)
# Loop through trials
for thisTrial in trialsAll:
currentLoop=trialsAll
if thisTrial != None:
for paramName in thisTrial.keys():
exec(paramName + '=thisTrial.' + paramName)
我的第二個問題是關於獲取響應。這個ResRes等於None嗎?
#get response
thisResp=None
while thisResp==None:
allKeys=event.waitKeys()
非常感謝您的幫助。我很感激。
問候, 現金
嗨,Cashel,回覆郵件列表的人和這裏的內容大致相同。所以只要在一個地方問,避免重複工作。如果您在電子郵件列表中獲得滿意的答案,那麼請在此回答您自己的問題,作爲未來讀者的指南(回答您自己的問題是確定的,實際上是鼓勵)。 –