Forcing staircase to present values from a list

I want to run a simple staircase to handle a 2AFC test. The user should differentiate velocities between the two moving dot fields presented to them. based on the correct or wrong answer, staircase uses the stepSizes to determine the next velocity.

I have a list of velocities: [+/- 5,10,20,40,80] and I only want to present these values at every test. However the stepsize should change, the final value presented should be one of those values in the velocity list.

How can that be achieved?

I’m not experienced with staircase myself but perhaps this thread will help.

Also

Thanks for your response, I went through those two threads but still couldn’t find any answer to my problem.
The stairHandler class starts with an initial value and uses predefined step sizes to increment/decrement the intensity. In my case, I want only specific intensities to be presented for the 2AFC task i.e. the stepsize should be changing in every iteration I guess (not sure).

so is there any way to force stairHandler to only present values from this list [+/- 5,10,20,40,80]?

Hello @Ali_shirali

I also do not use the staircase-loops but take a look here Flow — PsychoPy v2024.2.5

Best wishes Jens

Hi @Ali_shirali,

Do you mean that you only ever want to use the velocities from that list? If so, I’m wondering if you need to use a staircase at all? Instead, you could just cycle through the velocities and set the next one based on whether the response is correct or not? Then end the loop after a given number of incorrect responses at a certain velocity?

Something like:

## BEGIN EXPERIMENT ##

vel_list = [5,10,20,40,80] # Initialise your list of velocities
vel_idx = 2 # Start in the middle of the list (for example)
consecutive_correct = 0  # Track correct answers at current velocity
consecutive_incorrect = 0  # Track incorrect answers at current velocity
threshold_correct = 5  # End after 5 correct responses at the same velocity (for example)
threshold_incorrect = 3  # End after 3 incorrect responses at the same velocity (for example)
## BEGIN ROUTINE ##
# Use the current velocity for your stimulus
this_vel = vel_list[vel_idx]
## END ROUTINE ##
# Increase velocity if answer is correct (or decrease - I'm not sure of the behaviour you're looking for
if correct:
     consecutive_correct += 1 
     consecutive_incorrect = 0  
     if vel_idx < len(velocity_values) - 1:
          vel_idx += 1 # Move to a more difficult velocity
# Otherwise, decrease velocity (or increase)
else:
     consecutive_incorrect += 1 
     consecutive_correct = 0 
     if consecutive_correct >= 2 and current_index > 0:
          vel_idx -= 1 # Move to an easier velocity

# End loop if too many incorrect responses at one level
    if consecutive_incorrect >= threshold_incorrect:
        currentLoop.finished = True

I’ve not tested the above, but hopefully it’s enough to get you started. Apologies if I’ve misunderstood your goals here!

Kim

1 Like