2016-10-10 24 views
1

我已经在Psychopy中创建了一个任务,其中从一个jar中绘制了一个珠子。要绘制50个不同的珠子,每个珠子之后要求参与者进行概率评定。该任务是从excel文件中循环的,但要做50个评分需要很长的时间。我希望能够获得前10个珠子的评分。然后为第二个珠子绘制一个评级,直到绘制20个珠子。然后,对于接下来的30个珠子,直到第50个珠子只需要每5个珠子绘制一个评级(我对编码真的很陌生,对不起,这可能会提前不正确)。 我已经写了这样的代码,但不幸的是它不工作? (在没有分级圈我试图把键盘响应触发下一个事情的顺序出现) -我想在循环中的不同点触发一个响应

for row_index, row in (beads_params_pinkbluegreyratingparamters.xlsx): 
if row(0:10) and t >= 0.0 and rating.status == NOT_STARTED: 
    break 
    rating.tStart = t # underestimates by a little under one frame 
    rating.frameNStart = frameN # exact frame index 
    rating.setAutoDraw(True) 
continueRoutine &= rating.noResponse # a response ends the trial 

elif row(12:20:2) and t >= 0.0 and rating.status == NOT_STARTED: 
    break 
    rating.tStart = t # underestimates by a little under one frame 
    rating.frameNStart = frameN # exact frame index 
    rating.setAutoDraw(True) 
continueRoutine &= rating.noResponse 

elif rows.event.getkeys, row(11:19:2): 
    elif len(theseKeys) > 0: 
     break 
     key_resp_2.keys = theseKeys [-1] 
     key_resp_2.rt = key_resp_2.clock.getTime() 
    continueRoutine = False 
elif row(20:50:5) and t >= 0.0 and rating.status == NOT_STARTED: 
    break 
    rating.tStart = t # underestimates by a little under one frame 
    rating.frameNStart = frameN # exact frame index 
    rating.setAutoDraw(True) 
continueRoutine &= rating.noResponse 
     rows.event.getKeys, row[21, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 38 ,39, 41, 42, 43, 44, 46, 47, 48, 49]: 
     elif len(theseKeys) > 0: 
      key_resp_2.Keys = theseKeys [-1] 
      key_resp_2.rt = key_resp_2.clock.getTtime() 
     continueRoutine = False 
+0

请修复您的代码,这里有很多错别字! – MisterMiyagi

回答

1

你应该只循环一次,但执行中的所有检查那一个循环:

for row_index, rows in (beads_params_pinkbluegreyratingparamters.xlsx): 
    if (row_index < 10): 
     rows.ratingscale(0:10) 
    elif (row_index >=10 and row_index <20): 
     rows.ratingscale(12:20:2) 
     rows.key_resp_2(11:19:2) 
    elif (row_index >=20): 
     rows.ratingscale(25:50:5) 
     rows.key_resp_2[21, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49] 

请注意,在您的代码中有一些语法错误,例如rows.key_resp_2(11:19:2)没有意义。

+0

非常感谢你的回复MisterMiyagi。 –

+0

嘿!我试图改进我的语法,但我认为我已经变得更糟。当我运行它时,它说 –

+0

if row(0:10)and t> = 0.0 and rating.status == NOT_STARTED: ^ SyntaxError:invalid syntax –

相关问题