| Reference | Downloads | Github

Gradient Staircase experiment: narrowing to non-zero angles

I’ve created a program that runs an interleaved staircase where a gradient (sin; gauss) is flashed upon the screen at a particular angle. The ‘BaseGrating’ is at a .05 opacity, so it should appear below the visual threshold.

Following the invisible base gradient, a second gradient (‘ChangeGrating’) is flashed at a different angle, starting value is 45 degree difference on either side from the preceding base gradient.

The participant must then select either the right or left arrow key, in response to whether the ChangeGrating was clockwise or counterclockwise, respectively, from the base gradient. If they answer correctly, they get a high tone/green plus sign; and if wrong–a low tone/red minus symbol.

As the participant answers correctly, the angles of the ChangeGrating works its way inwards towards the angle of the angle of the base gradient. If they answer incorrectly, the angle should go back outward. (A design I’m assuming you may be familiar with)

Here are my issues:

  1. I am still not sure what to make my stepSizes. What is the difference between having [2,2,2,2,2,1] and [8,6,6,4,4,2,2,1] ? Is it that the prior goes down in steps at a consistent pace, while the latter decreases exponentially? Also, what is the difference between using decimal numbers, for example, [0.8,0.6,.0.4,0.2] versus whole numbers, [8,6,4…]? Finally, what is the difference between skipping values [9,7,5…] and not skipping values [9,8,7,6]?

  2. This interleaved system works fine when my base gradient is at 0 degrees. However, when I set the base gradient to say, 60 or 90 degrees, it appears that right answers are not triggering the narrowing effect. It seems to just be changing degrees at random. Or I will get the effect where the counterclockwise angles will narrow but the clockwise side does not.

Here is what I am wondering: If my startVal is 45 degrees, and my base gradient is zero, then it narrows down appropriately. If my base gradient is at 90 degrees, and I still wanted a 45 degree difference, then would I make my startVal 135 degrees for it to narrow down on the 90 degree marker in the same fashion as it does for 0 degrees?

Attached are screenshots of the settings for the experiment.Trial_setup


Think what value your staircase procedure is aiming to converge upon. If your detector (i.e. participant) was perfect, then he/she would be able to discriminate any target stimulus attribute right down to just above a level of zero difference from the equivalent attribute of the reference stimulus (whether that be in degrees, Hertz, grams, etc). i.e. you are interested in the difference between stimulus values, not their absolute values.

At the moment you are setting the orientation of your stimulus to be the current output of the staircase (level). But what you actually want is that the orientation of the stimulus should be the orientation of the reference stimulus ± level

This is why it appears to work for you if the reference stimulus is at 0 deg orientation, because that term effectively drops out of the equation at that specific orientation.

This tutorial is based on the coding approach but still perhaps worth reading so that you understand what is happening under the hood:

But hopefully if you simply incorporate the orientation of the reference stimulus in your equation for setting the value of the target stimulus, you’ll be able to answer the other questions just through trial and error.

Thank you Michael. I will give this a shot before I watch the tutorial. Just to be clear, did you suggest inserting a plus sign before ‘level’, or did you suggest putting a plus/minus sign? I’m assuming it’s a plus sign that you just underlined but I thought I’d clarify.

That was shorthand as I can’t copy and paste your code from the screen shots. Yes I mean ± conceptually but that isn’t valid Python code. You should explicitly either add level or subtract level as appropriate from the reference value in your code that begins if random() > 0.5:

i.e. all that needs to alter in that code is that you insert the variable that contains the orientation of the reference stimulus in each line where you control the orientation of Ori_Grat

Thank you again!

I have not had any luck by altering the code to include “+ level” along with “- level”. I made the alteration as suggested but when I set my base grating to 90 degrees, as opposed to zero, the interleaved staircase does not work its way inward toward 90 degrees like its supposed to. However, when I set the base grating to 0 degrees, the code works properly: narrowing on both sides toward 0 upon correct answers, and angling away from 0 with wrong answers.

I am still missing something. I would like to get the same effect going for other angles, such as 60 degrees or 90 degrees. Does my problem lie in my excel file? If my base value is 90 degrees, should my start value be higher than 90 degrees?

For example, with the base grating set to 0 degrees, my starting value in my spreadsheet is 45 degrees. My max value is set to 60 degrees and my min value is set to .05 degrees. What this means is that the Change grating will begin at a 45 degree angle either to the left or right of 0. If participant answers wrong, the angle will broaden outward to a max of 60 degrees. When they start answering correctly, it narrows inward until it reaches .05 degrees on either side.

What I want, is to be able to change my base grating to 60 degrees instead of zero. Then my change grating will begin at a 45 degree difference and work its way inward toward the 60 degree mark. Should I adjust the values of my start value, max value, and min value? Instead of a start value of 45 degrees, a max value of 60 degrees, and a min value of .05 degrees, should I instead set them to 105 degrees, 120 degrees, and 60.05 degrees, respectively?

Or are the values that I set in the excel file representative of the difference away from whatever base grating angle I set? Like, if my base grating angle is set to 60, and my start value for the change grating is set to 45, should the first angle of the first change grating automatically appear at a 45 degree difference from 60 degrees?

The whole point of this interleaved staircase is for the participant to narrow the angles inward toward the desired angle, as opposed to merely comparing minor differences at random from the base angle. The link Michael provided seemed to provide coding info for the latter instead of the prior. There is likely just a few small errors I am making and I basically just need help troubleshooting.

Yes. In theory, you are always working towards some threshold difference that is close to zero. It is only meaningful to think of the threshold as being a difference from some reference value. There is nothing magical about the absolute rotation angle.

Please just provide the code you are currently using to change the Ori_grat variable, pasted into a message rather than as a screenshot, and please:


  • Staircases are by nature adaptive. They don’t just present random variations. So I’m not sure what to make of this.
  • I don’t think you need to use an interleaved staircase at all. Aren’t you just measuring a single threshold (the relative orientation of the stimuli)?