Non-slip timing for routines with variable duration

Dear community,

I would like to get a suggestion from you concerning the non-slip timing issue in fMRI issues.

As you can see from the structure of my experiment I have both green and blue routines. However, also blue routines are actually defined in their timing at the beginning of the “fixation” routine. Timing is specified in the csv file with all the conditions, so it doesn’t depend on the participant or on any other feature.

Since this experiment has been developed for fMRI, I would like to know if according to you this solution here below will avoid the experiment from drifting relative to the fMRI TR.

In the “fixation” routine I have the following code:

#begin Routine
#define how long this trial will last
time_trial = 3 + Jitter_Fix + Jitter_ICI  
#start the countdown according to the trial duration
timer = core.CountdownTimer(time_trial) 

# specifications
# 3 = duration of word1 + word2 + press1 + press2 + press3
# Jitter_Fix and Jitter_ICI are defined in "fixation"

In all other routines, I have the following code:

#each Frame
while timer.getTime() > 0:
    continueRoutine = True
while timer.getTime() <= 0:
        continueRoutine = False

Do you think this could be an appropriate solution?

I finally managed to try the experiment - also using the timer above described. Unfortunately the timer doesn’t seem to work according to my needs.

Subtracting the expected value of the trial to the real value of it, I get that every trial is delayed of ca. 0.02. The longer the trial the longer the delay. Overall this leads me to have an accumulation of delay equal to ca. 5.5 seconds in ca. 45 minutes of experiment.

How should I implement the non-slip timing function here described: https://www.psychopy.org/general/timing/nonSlipTiming.html? Is there an example somewhere?

Hi, Did you ever find a workable solution to this? I am running into a similar issue in a study my team and I are trying to program.

Hi, I couldn’t find a real solution. What I’m doing to circumvent the issue is to have the trial to end with a blank screen which will terminate only when the timing of the trial reaches a multiple of 2 seconds (which is also my TR). At least this way, even if the trials are gonna be a bit longer than expected, there should be minimum shift from the beginning of a trial and the TR.

ok thanks for following up! Much appreciated.