Breaking out of a loop

Hello,

I currently have an experiment, where I have made the stimuli lists in code. I have it set so that every 54 stimuli, it breaks to a rest. There are 540 stimuli in total, in 10 blocks. This all runs perfectly great, however, I also need to re-calibrate and validate the eye-tracker after each of the breaks. The code for breaking the routine is:


if block1_trials.thisN == 0 or block1_trials.thisN % 54!= 0:
    continueRoutine = False

If I change my nReps to 54 instead of 540 it then plays the same stimuli again.

I have attached an image of how the routine and loops are currently displayed.

Is there a way for me to set it to break out of the routine, and run the loop back to calibration every 54 trials?

Thank you

Place the calibration routine and validation routines insede the block1_trials at the end, and have a code component inside the calibration/validation routines that skips them if the trial number is not a multiple of 54. You can also set a variable ad hoc that updates after every trial to determine the trial number.

The calibration/validation routines are hard set by psychopy, so you cannot add code components to them unfortunately. As far as I can see anyway.

Then you can place an inner loop around the calibration/validation routines, and set the nReps as a variable. Use a code component in a previous routine to set the nReps variable to be 0 when the trial number is not a multiple of 54

That’s got it. Thank you.