Howdy, Stranger!

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

Supported by

[solved] Random interval repetition task

edited March 2014 in OpenSesame

I would like to use a random interval repetition task with two intervals: 900 msec for the short intervals and 1500 msec for the long intervals. These lengths should be sampled randomly each with a probability of 0.50. So the average pace is 1200 msec. I would like to set a restriction of no more than four of the same intervals in a row. Each bleep is a 200-Hz tone presented for 50 msec, and the intervals will be measured from the onset of the bleep to the onset of the next bleep. So in fact the advanced delay time should be 850 of 1500ms. Dependent variables are RT and error rate (failure to respond in time to the stimulus).

So for example: 850 - 850 - 1450 - 850 -1450 - 1450 etc.

Can someone advise me how to program this?

Thanks! Suzanne
s.c.vanveen@uu.nl

Comments

  • edited March 2014

    Hi Suzanne,

    The most effective way to do this, is by using a bit of inline scripting (and since you want to do things pseudo-randomly, there is no alternative). The following script can be used to create a delay, to which you can refer to in other items using [interval]. Add the following to an inline_script at the start of your trial, preferably in the Prepare phase.

    # import the random module, we will need this
    # to make random choices for us
    import random
    
    # next, check if the history list already exists; if
    # it doesn't, we create a new one (the history
    # list is there to keep track of the previous three
    # trials)
    if not hasattr(exp, 'histlist'):
        exp.histlist = []
    
    # randomly choose an interval
    interval = random.choice([850,1450])
    
    # check if the random interval is used in all of
    # the past three trials
    if exp.histlist.count(interval) >= 3:
        # choose the opposite interval
        if interval == 850:
            interval = 1450
        elif interval == 1450:
            interval = 850
    
    # store the new interval in the history list
    exp.histlist.append(interval)
    
    # delete the older entries, as we only keep track
    # of the past three trials
    while len(exp.histlist) > 3:
        exp.histlist.pop(0)
    
    # save the interval variable, so that we can use it
    # in OpenSesame's GUI
    exp.set("interval", interval)
    

    By the way: as the interval is determined in the inline_script, you could get rid of the advanced_delay altogether, and simply use the interval as the duration of the sketchpad preceding your advanced_delay.

    Good luck!

  • edited March 2014

    Hi Edwin,

    Thanks for your quick reply on my question! I added the inline script at the beginnen of my experiment/trial, in the prepare phase.
    I only don't understand what you mean with your last comment: "simply use the interval as the duration of the sketchpad preceding your advanced_delay."

    I used to have a loop with a sequence with:

    * advanced delay
    * sampler
    * synt
    * keyboard
    * logger
    

    In the sampler I added my sound: hoog200Hz.wav
    In the synt controlor, again the Hz: 200
    In the keyboard respons: cr = b, timeout = 2000

    This is the editing script for my loop:

    set repeat "40"
    set description "Repeatedly runs another item"
    set item "recall_mem1_RT"
    set column_order "beep;cr"
    set cycles "1"
    set order "random"
    setcycle 0 beep "hoog200Hz.wav"
    setcycle 0 cr "b"
    run recall_mem1_RT
    

    Where to specify the term [interval] as you mentioned?

    Cheers,
    Suzanne

  • edited March 2014

    I assumed you were using a visual stimulus. Two options:

    1) Replace the advanced_delay with a sketchpad. Set the sketchpad's duration to [interval]. Just leave the sketchpad blank, so it won't change the way the display looks.

    2) Adjust the advanced_delay's script a bit (click on the black button in the top right, it's labelled '>_'). Normally, there would be a line like this:

    set duration "200"
    

    Replace with:

    set duration "[interval]"
    

    Either way, make sure to paste the code from my previous post into the prepare phase of an inline_script at the start of your sequence.

    Good luck!

  • edited 4:39AM

    Hi edwin,
    Again, thank you for your quick reply! I understand the sketchpad adjustments. I've tried to run the experiment, but 1 line in your inline script produces an error. It's about:

    if not hasattr(exp, 'histlist'):
    exp.histlist = []

    The error is:
    Error while executing inline script
    phase: prepare
    item: inline_script
    line: 29
    exception message: name 'histlist' is not defined
    exception type: NameError

    I've tried to fix it myself but it isn't working. Do you know how I could define histlist, so this error doesn't pop up?
    Many thanks for all your help!!

    Suzanne

  • edited 4:39AM

    Hi Suzanne,

    Apologies, my mistake. The error was in line 29 actually, where I wrote hitlist rather than exp.hitlist. I've edited my previous post, which should now work (just tested it: it does on my system).

    Good luck!

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