psychopy.org | Reference | Downloads | Github

Staircase handler

Hi,

I am trying to run a 2AFC staircase procedure. I have pre-generated images with different levels of scrambling put as a number in the image name (higher number - more scrambled). The code below works for the step (up & down) sizes but completely ignores the min and max values. So, for example when it gets to level 1 instead of stopping the procedure it looks for level 0, which doesn’t exist and the procedure quits.

“IOError: Couldn’t find image C:\Python Code\CandyCrush\stimuli\scrambleppt0\i29_t3_L00.jpg; check path?”

Any suggestions why this might be happening?

    # create the staircase handler
    stairCase = data.StairHandler(startVal= 10,
    stepType= 'lin',
    stepSizes=[-8,-4,-2,-1],
    minVal = 1,
    maxVal = 39,
    nUp = 3, nDown = 1,
    nReversals = 8,
    nTrials=40)   

UPDATE: It seems to work when I reverse the level of scrambling so the highest number represents the lowest amount of scrambling.

Any ideas why it works now but wouldn’t previously?

Ah. The problem is that your step size is negative and PsychoPy isn’t expecting that. It checks the maximum value after adding a step and checks the minimum value after subtracting a step. You’re “adding” something that’s causing the value of the staircase to go down, which is why PsychoPy’s confused.

We could change the staircase to handle a world in which steps “up” result in values going down, but I’m not sure what else that will break. Might be better if we raise an error if you try to set a step to be negative.