Adaptive Staircase with a fixed "trained" criteria

If this template helps then use it. If not then just delete and start from scratch.

OS OS X El Capitan 10.11.5
PsychoPy version 3.1.2
Standard Standalone? (y/n) y

What are you trying to achieve?

I am trying to make a toy demo for a class. In the demo case, the participant is going to hear two tones. One high tone and one low tone. If the participant hears a high tone, then s/he presses f; If the participant hears a low tone, then s/he presses j.

I want to have an adaptive staircase, in which only the participant makes the correct response 90% of the time can s/he proceeds to the next phase.

What did you try to make it work?:
I am very confused by the instruction given by the adaptive staircase procedure.
I have made a loop using the standard “random” and everything works just fine. But I have no clue how to get started with staircase. When I tried to use default setting, PsychoPy will crash and give me the error message:

Traceback (most recent call last):
  File "/Users/caoanjie/Desktop/FALL2019/IMCR/IMCR_minimum/soundDemo_lastrun.py", line 389, in <module>
    if (key_trial.keys == str(ANS)) or (key_trial.keys == ANS):
NameError: name 'ANS' is not defined

ANS is the column head in which I store my correct response in the condition file.
I assume this is due to the fact that in adaptive staircase scenario, psychopy doesn’t really read my condition excel file.
Is there a way for me to let PsychoPy know the correct response and make “adaptive staircase” based on the rate of correct response?

Thanks!
I’ve the flow of my experiment here:

You’re right, a staircase doesn’t read from a conditions file: it is by its very nature an adaptive technique, and so can’t use a fixed sequence of values. Hence you would have to write a small snippet of code to run on on each trial to determine if the response was correct or not, and then tell the staircase via trials.addResponse(True) or trials.addResponse(False) the result.

But the point of a staircase is generally to adaptively locate a threshold. If you simply want to advance once the rate of correct responses exceeds 90%, there are other, simpler ways to do this.

Thanks for the help! Could you elaborate on the other simple ways? I think all I need is “once the rate of correct responses exceeds 90%,”

Something like this:

thank you so much! will take a look !