Accessing trial number in MultiStair Handler?

Is there a convenient way of accessing the current trial number from a MultiStair handler object, in the same manner that you would get from a trialHanlder (trialHandler.thisN)? I have an experiment with multiple staircases and I want to impose short breaks. If I create an outer loop of “blocks” around my staircase, then the intensity resets at every block. To get around this, I’m creating a routine that only runs every X number of trials. I have a routine called “break” that just waits for a key press, and code component that has this:

if (trials.thisN %100) != 0:
    continueRoutine = False

The alternative is to create my own variable called trialnum and increment it manually, but I was wondering if there’s a built-in option I’m missing.

Thanks!

In general the solution to the problem is to find out what attributes your object has. In your case you could do: print(dir(trials))
Alternatively you could take a look at the source code to see what variables MultiStariHandler defines:
https://github.com/psychopy/psychopy/blob/master/psychopy/data.py

In your case I think you want trials. totalTrials

1 Like