I am hoping to change the stepSizes parameter on the stairHandler based on trial number, not reversal number.
I have found a similar question here: Staircase handler stepSizes parameter - what are the possibilities? - #10 by maxlo although I don’t believe the solutions actually work, as per my reply there. similarly you can find another question like this here, although the reply offers no solution, just an explanation: Dynamically changing step sizes in a staircase method Some code here demonstrates that the given solutions don’t work:
from psychopy import data, event
import random
staircase = data.StairHandler(startVal=50, stepType='lin', stepSizes = 10, nUp=1, nDown=2, nTrials=10)
trial = 0
for thisTrial in staircase:
if trial > 2:
staircase.stepSizes = [1]
print(staircase.stepSizes)
print(thisTrial)
if random.random() > 0.5:
staircase.addData(1)
else:
staircase.addData(0)
trial +=1
I thought about using the multiStairHandler, but that loops through interleaved staircases sequentially or randomly not based on condition. Similarly, loops in the experimentHandler could be a good idea, although I believe this would reset the staircase, which I don’t want to happen. I haven’t found any solutions looking through the source code for stairHandler, although I’m fairly new to coding. There is also a useful psychopy document here I am attempting to use called ‘Coder - interleave staircases’ although I am too new to post another link in this post.
So, I was wondering if anyone had a way to do this, given that there are knock on effects in the staircaser when initialising with a given stepSize and so changing the value later doesn’t do anything?
I’m thinking I may have to do this by hand…
Many thanks for any help!