Controlling ISI using frame rate

Hi There,

I usually control for stimulus presentation using frame rate with no problem but have been having an issue using the following code. I am using psychopy version 1.82.02.

I have tried using a trial clock to double check the timings are what I expect them to be - and they certainly are not - its like there is no ISI at all. I think this is just a silly coding error so any help at all would be appreciated !

import numpy as np
from psychopy import core

trialClock=core.Clock()#use a clock to double check the timings are what I expect them to be 

onset_range=range(65, 200)#in frames so should be between 765ms and 2352ms on my 85Hz monitor
trials=5

for i in range(trials):
    onset=np.random.choice(onset_range)#randomly select an onset from the range
    print 'trial Start:', trialClock.getTime()
    for frameN in range(onset+10):#say the duration of your stimulus should be 10 frames make it so you work through enough frames for the ISI + stimulus duration
        if frameN==onset:
            print 'onset frame:', onset, 'onset time:', trialClock.getTime()

Thanks in advance !
Becca

Awkwardly realised I needed to flip the window (and now can’t remove this post)… never code at the end of the day…

1 Like