Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Psychopy Questhandler and OpenSesame

edited May 2013 in OpenSesame

Hi,

for my current experiment I want to use a staircase procedure to determine the contrast of a grating flexibly and in dependence of the trial by trial performance of the subject. For that reason I switched to the PsychoPy backend and implemented the Questhandler function (http://www.psychopy.org/api/data.html#questhandler) of PsychoPy. The function allows you to create a QUEST staircase with NTrials as the determining factor for how long the staircase has time to fine the point of subjective equality (PSE).

However, since I have 4 different conditions in which each needs its own staircase, I am experiencing some troubles. Even though everything seems to work flawless (correct values are proposed by the staircase procedure and the correct values are stored by OpenSesame), the function crashes too early. That is, although I set e.g. the Ntrials for each staircase to 10, so each staircase would accept 10 responses as input, it crashes as soon as I reach 10 trials for the whole experiment. That means that each staircase has less than 10 responses but rather around 2-3 maybe (trials and conditions are randomly picked). So for some reason it seems as if Ntrials is not accepted as input for each staircase individually and thus only used by each of them individually, but rather that Ntrials is either updated every single trial for all staircases or only exists a single time and is used by each staircase.

I asked around in the PsychoPy developers group and they could not give me a reason and argued that cant find an indication in the code why that should be a problem. Which is why they suspect that this might be an OpenSesame related problem (see this link: https://groups.google.com/forum/?fromgroups=#!topic/psychopy-users/V2IxyJEPqNo)

All staircases are defined outside the trial and block sequence (seperate sequence) in the run phase and are only executed once. I store the values after the OpenSesame response acquisition according to the PsychoPy code (seedocumentation).
Here is the code I used to create the staircases:

nTrials_high_peripheral = 750 #amount of trials in the staircase
nTrials_low_peripheral = 750 
nTrials_high_distributed = 750
nTrials_low_distributed = 750 

high_startVal = 0.20 #prior threshold estimate or initial guess threshold
high_startValSd = 0.5 #SD of starting guess threshold (be generous, more than one SD deviation causes problems)
low_startVal = 0.20
low_startValSd = 0.5
pThreshold = 0.82 #desired accuracy
# Note: QUEST tries to keep this value in mind and therefore to deliver the best guess at the end of this value. Less trials result thus is conservative guessing and more weight for the first trials.
# Either increase the amount of trials or use SD as limitation.

# Create four staircase classes, one high peripheral, low peripheral, high distributed and low distributed
exp.staircase_high_peripheral = copy.deepcopy(data.QuestHandler(high_startVal, low_startValSd, pThreshold, stepType='log',gamma = 0.01, nTrials=nTrials_high_peripheral, minVal=0.0, maxVal=0.8))
exp.staircase_low_peripheral = copy.deepcopy(data.QuestHandler(low_startVal, low_startValSd, pThreshold, stepType='log',gamma = 0.01, nTrials=nTrials_low_peripheral, minVal=0.0, maxVal=0.8))
exp.staircase_high_distributed = copy.deepcopy(data.QuestHandler(high_startVal, low_startValSd, pThreshold, stepType='log',gamma = 0.01, nTrials=nTrials_high_distributed, minVal=0.0, maxVal=0.8))
exp.staircase_low_distributed = copy.deepcopy(data.QuestHandler(low_startVal, low_startValSd, pThreshold, stepType='log',gamma = 0.01, nTrials=nTrials_low_distributed, minVal=0.0, maxVal=0.8))

As you can see I also tried to deepcopy the objects because I was suspecting that they would use the very same memory. However, they are all stored at different addresses (even without deepcopy). So I figured that cannot be the issue.
The error message is always a stopIteration error which corresponds according to the questhandler documentation to an error that the maximum amount of trials for a staircase has been reached.

My initial idea was then just to trick the staircase by increasing Ntrials to number of staircases * trials per staircase. So in my example above this would be Ntrial for each staircase is 40 (120 in total if it would work correctly). Then in fact it does not crash earlier and each staircase has the amount of trials I want it to have (that is 10).

However, to me it appears than that the staircase adjusts its behavior because 'it thinks' it has now more time to estimate the correct PSE. That results in slower corrections in the proposed next() value and therefore subjects never really end at a propose Pthreshold of e.g. 82% since the values were PPs start to make more errors would be tested in e.g. the last 10 trials. So in fact it appears as if the Ntrials is interpreted correctly since the staircase adjusts testing behavior but it will be stopped nevertheless at the wrong value.

Does someone have a clue why this is not working? Could it be that for some reason OpenSesame interferes with the proper working of this function? Maybe by directly influencing Ntrials?

Thank you!!

PS: For those who want to try it, I had to implement the wx module in OpenSesame in order to get the staircase working!

PPS: If you need more code, please do not hesitate to ask!

Comments

  • edited 10:31PM

    Hi Michel,

    Does someone have a clue why this is not working? Could it be that for some reason OpenSesame interferes with the proper working of this function? Maybe by directly influencing Ntrials?

    I'm not sure how the QuestHandler is implemented, but I'd say that's unlikely.

    Could you perhaps upload a simple working experiment that illustrates the problem?

    Cheers,
    Sebastiaan

  • edited 10:31PM

    Ok, I'll upload one next week!

  • edited 10:31PM

    Although unlikely, is there a solution to this now? I have trouble implementing multiple staircases with the Quest Plugin. I suspect the second _init overrides the first _init during preparation in OpenSesame.

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games