Howdy, Stranger!

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

Supported by

[solved] Staircase

edited February 2013 in OpenSesame

Hi all,

My latest adventure (I'm probably becoming a bit of a pest at this point!) in OpenSesame is an attempt to create a staircase loop. I've found the following discussion:

http://www.cogsci.nl/forum/index.php?p=/discussion/149/open-breaking-from-a-staircase-loop/p1

and planned to contact the original poster to ascertain if they were successful in implementing the loop but I cannot locate any contact details.

I hope to create a loop where I'll have up to 8 different display timings for a sketchpad (same stimuli each time) and be able to drop out of the loop once a participant reaches approx. 75% accuracy on one of those timings and then run a sequence for the actual experiment using said timing.

Has anyone here successfully achieved anything similar?

Advice would be most welcome as I've managed to build an experiment just fine for an undergrad but this addition would make it more elegant and the student is keen to get started.

Boo.

Comments

  • edited November 2012

    Hi boo,

    Sebastiaan contacted me about this.

    as for the original post, I was able to figure it out:
    http://www.filedropper.com/ioraccletters1opensesametar

    Bare with me; it was the first thing I ever did in python (and thereby also in opensesame). The whole thing is a bit bloated, and it's full of eyelink-stuff that you probably won't need; but I hope you can still use it as an inspiration

    The task was a slight variation of the posner cueing paradigm, where participants were to indicate whether an M or N was presented. The presentation time of the letter is what I varied using PEST, as outlined here:
    http://www.hitl.washington.edu/publications/r-98-11/node54.html
    (I'm not sure what you meant by "up to 8 different display timings", but maybe using PEST provides an alternative?)

    My expt looks as follows;

    • An introduction with some familiarizing to the displays

    • A practice loop where the pres. time is not varied yet.

    • A staircase loop sc_loop where PEST is first run; either until it has converged or until It has lasted 'long enough'

    • An experiment during which PEST runs in the background

    The staircase loop is what you're probably most interested in. What I did was:

    1. Have a staircase sequence, and within this sequence, place a loop that runs over N (for me N was 9) trials of randomly chosen conditions. (setting N close to all possible combinations makes your staircase fully balanced, but would in my case imply a tediously long staircase phase)
    2. Within this loop, the script DoPEST checks the accuracy every N trials and changes the critical variable(s) (here 'prestime') accordingly. As PEST requires, it also keeps track of these changes
    3. in DoPEST it is also determined whether 'continue_staircase' should be set to False
    4. at the end of the sc_sequence, a script 'check_rerun_sc_loop' eventually does the magic: it will rerun the sc_block_loop (i.e. N trials, and the PEST algorithm) in the way discussed in the previous thread:

      while self.get('continue_staircase') == True:
      self.experiment.items['sc_block_loop'].prepare()
      self.experiment.items['sc_block_loop'].run()

    ... thus breaking from it when 'continue_staircase' becomes false.

    That's practically all! For you, looking at the sc_loop structure seems most useful. I hope you can work it out this way!

    It is a quite powerfool way to manipulate experiment flow, if you want more than simple randomization, and I use it a lot currently. One word of warning though: using while loops is always tricky: make sure you will at least ever break from your staircase procedure ;)

    good luck!

    Wouter

  • edited 8:08PM

    Hi there Wouter,

    Thanks very much for getting back to me!

    I've downloaded your OpenSesame file but unfortunately get the following error:

      Error: Failed to open 'C:/Documents and Settings/psundere/Desktop/Staircase        /IOR_acc_letters1.opensesame.tar.gz'
      Description: not a gzip file
    

    I was wondering what version of OpenSesame you used as I'm still operating on 0.26?

    If you use 0.27 this may be why I cannot open your file.

    Boo.

  • edited 8:08PM

    huh...remarkable...I'm under 0.26 as well, so that can't be it.
    here's the script by itself; i.e. not as a tar.gz but simply a .opensesame; does that work?

    http://www.filedropper.com/ioraccletters1

  • edited 8:08PM

    Hi,

    That opens up just fine now :D

    I'll go ahead and have a play around with it for the rest of the day and report back how I get on.

    Thanks Wouter, you're a star ;)

    Boo.

  • edited 8:08PM

    Hi Wouter,

    I ended up doing something very different from your code and it also worked. I'll post it up here with detailed descriptions on what is happening soon for any other user that wants to do something similar.

    If mods could leave the thread open for this purpose I'd appreciate it.

    Thanks all,

    Boo.

  • edited February 2013

    Hi all,

    Sorry for taking so long to add this. Xmas break and crazy work since has distracted me somewhat.

    The following is the staircase code I used for my experimental design in OS.

    It is by no means the most efficient code (it certainly could be cleaned up).

    It is a 6 block sequence where at the end of each block if accuracy falls on, above or below 75% the duration of display is adjust. For example, if below 75% the display duration is increased by 20ms.

    After 3 blocks instead of 20 the changes are one frame of 10ms.

    Here are shots of the OS stream of events:

    file:///F:/open_forum/pic.bmp

    The following is the code used in the inline script called 'acc_script':

    print "START OF INLINE SCRIPT"

    dur1 = self.experiment.get("dur")
    acc = self.experiment.get("accuracy")
    loop_count = self.experiment.get("count_inline_loop")

    correct_count1 = self.experiment.get("correct_count")

    if ((loop_count+1) <= 3):
    print "FIRST IF < 3 LOOP COUNT"
    print loop_count
    if (correct_count1 > 10 ):
    print "correct_count1 > 10", correct_count1
    self.experiment.items['TOJ_Seq'].prepare()
    self.experiment.unset("dur")
    self.experiment.set("dur", dur1 - 20)
    self.experiment.unset("accuracy")
    self.experiment.set("accuracy", 0)
    self.experiment.unset("correct_count")
    self.experiment.set("correct_count", 0)
    self.experiment.items['TOJ_Seq'].run()

    elif (correct_count1 < 8):
        print "correct_count1 < 8", correct_count1
        self.experiment.items['TOJ_Seq'].prepare()
        self.experiment.unset("dur")
        self.experiment.set("dur", dur1 + 20)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.items['TOJ_Seq'].run()
    
    elif (correct_count1 == 8):
        print "correct_count1 = 8", correct_count1
        self.experiment.items['TOJ_Seq'].prepare()
        self.experiment.unset("dur")
        self.experiment.set("dur", dur1 + 10)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.items['TOJ_Seq'].run()
    
    elif (correct_count1 == 10):
        print "correct_count1 = 10", correct_count1
        self.experiment.items['TOJ_Seq'].prepare()
        self.experiment.unset("dur")
        self.experiment.set("dur", dur1 - 10)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.items['TOJ_Seq'].run()
    
    else:
        print "Keep timing as is", dur1
        self.experiment.items['TOJ_Seq'].prepare()
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.items['TOJ_Seq'].run()
    

    elif ((loop_count+1) >= 4) and ((loop_count+1) <= 6):
    print "ELIF > 3 LOOP COUNT"

    if ((loop_count+1) < 6) and (correct_count1 > 10):
        print "correct_count1 > 10", correct_count1
        self.experiment.items['TOJ_Seq'].prepare()
        self.experiment.unset("dur")
        self.experiment.set("dur", dur1 - 10)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.items['TOJ_Seq'].run()
    
    elif ((loop_count+1) < 6) and (correct_count1 <= 7):
        print "corerct_count1 = 7", correct_count1
        self.experiment.items['TOJ_Seq'].prepare()
        self.experiment.unset("dur")
        self.experiment.set("dur", dur1 + 10)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.items['TOJ_Seq'].run()
    
    elif ((loop_count+1) < 6) and (correct_count1 >=8) and (correct_count1 <= 10):
        print "correct_count1 is 8-10", correct_count1
        self.experiment.items['TOJ_Seq'].prepare()
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.items['TOJ_Seq'].run()
    
    elif ((loop_count+1) == 6) and (correct_count1 > 10):
        print loop_count
        print "END OF LAST BLOCK GO TO EXPERIMENT"
        print "correct_count1 > 10", correct_count1
        self.experiment.items['Experimental_Loop'].prepare()
        self.experiment.unset("dur")
        self.experiment.set("dur", dur1 - 10)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.items['Experimental_Loop'].run()
    
    
    elif ((loop_count+1) == 6) and (correct_count1 <= 7):
        print "corerct_count1 = 7", correct_count1
        self.experiment.items['Experimental_Loop'].prepare()
        self.experiment.unset("dur")
        self.experiment.set("dur", dur1 + 10)
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.items['Experimental_Loop'].run()
    
    elif ((loop_count+1) == 6) and (correct_count1 >=8) and (correct_count1 <= 10):
        print "correct_count1 is 8-10", correct_count1
        self.experiment.items['Experimental_Loop'].prepare()
        self.experiment.unset("accuracy")
        self.experiment.set("accuracy", 0)
        self.experiment.unset("correct_count")
        self.experiment.set("correct_count", 0)
        self.experiment.items['Experimental_Loop'].run()
    
    
    else:
        print "SOMETHING WRONG in > 3 loop count"
    

    else:
    print "SOMETHING WENT WRONG!!!!"

    The variable 'dur' was defined in the 'set_variables' loop.

    I hope someone can find a use for this basic code or at least it may point you in the right direction.

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