Howdy, Stranger!

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

Supported by

[solved] SOA - stimulus onset asynchronies

edited March 2014 in OpenSesame

In my experiment, I would like to vary parametrically the onset asynchronies of two stimuli (auditory and visual stimuli). For example, the range of stimulus onset asynchronies would be: -100 ms; -50 ms; 0; 50 ms; +100 ms.

How could I manage this problem in OpenSesame?

Thanks in advance!

Comments

  • edited 10:29AM

    Have a look at this thread, it contains the code that should (in principle) be able to do it, as well as a link to a setup that would allow you to do audiovisual experiments with high timing accuracy.

    Good luck!

  • edited March 2014

    Thank you Edwin and, of course, Raquel for your help. However, I still have some problems, maybe since I’m noob about programming!
    In my experiment, as I told you, I have a circle and a auditory stimulus that are presented for different SOA.
    Here my few script lines:

    # Here draw the circle.
    set duration "10"
    set description "Displays stimuli"
    draw circle 0 -64 256 fill=0 penwidth=1 color=#ffffff show_if="always"
    

    ...

    #Here the beep
    set volume "1"
    set description "Plays a sound file in .wav or .ogg format"
    set sample "SoundOut2.WAV"
    set pitch "1"
    set duration "sound"
    set stop_after "0"
    set pan "0"
    set fade_in "0"
    

    ...

    #Here the inline_script for different SOA, as Raquel did. 
    if SOA == -10 or SOA == -30 or SOA == -50 or SOA == -80 or SOA == -100 or SOA == -150 or SOA == -200 or SOA == -250 or SOA == -300:
        beep.play()
        self.sleep(abs(SOA))
        circle.win()
    
            elif SOA == 10 or SOA== 30 or SOA == 50 or SOA == 80 or SOA == 100 or SOA == 150 or SOA == 200        or SOA == 250 or SOA == 300:
        circle.win()
        self.sleep(abs(SOA))
        beep.play()
    
    else:
        beep.play()
        circle.win()
    

    … I’m not sure if circle.win() is a correct command. In fact, the debug output is:

    Traceback:
    File "dist\libopensesame\inline_script.py", line 121, in prepare
    File "", line 5
    circle.win()
    ^
    IndentationError: unindent does not match any outer indentation level
    

    I am not able to write the right command to view the stimulus on the screen, according to the SOA. Any suggestion?

  • edited March 2014

    It seems like the indentation isn't right, which means that you either have too little or too many spaces/tabs in front of the code. Directly after an if statement, Python expects there to be a tab. And if you continue the statement, it expects there to be a elif or else command on the same level of indentation. An example:

    This is code that works:

    if something:
        this = ok
    else:
        this = also_ok
    

    This is code that does not work:

    if something:
    this = not_indented_enough
    

    And this doesn't either:

    if something:
        this = ok
        else:
            this = not_ok_else_is_indented_to_far
    

    So to fix the code you posted, you should decrease the indentation of your "elif" in line 6:

    #Here the inline_script for different SOA, as Raquel did. 
    if SOA == -10 or SOA == -30 or SOA == -50 or SOA == -80 or SOA == -100 or SOA == -150 or SOA == -200 or SOA == -250 or SOA == -300:
        beep.play()
        self.sleep(abs(SOA))
        circle.win()
    elif SOA == 10 or SOA== 30 or SOA == 50 or SOA == 80 or SOA == 100 or SOA == 150 or SOA == 200 or SOA == 250 or SOA == 300:
        circle.win()
        self.sleep(abs(SOA))
        beep.play()
    else:
        beep.play()
        circle.win()
    

    If that does not work, remove all of the spaces in front of all the lines of code. Then insert tabs in all lines, apart from the lines that begin with if, elif or else.

    Good luck!

  • edited March 2014

    Also, it just occurred to me that you will most likely not have the beep and the circle set up in a similar way as Raquel has. We should fix that too!

    Add the following to an inline_script item somewhere at the start of your experiment:

    # import the libraries that we will need
    from openexp.sampler import sampler
    from openexp.canvas import canvas
    
    # create the sound, using your file
    exp.beep = sampler(exp, exp.get_file('SoundOut2.WAV'))
    
    # create the display with a central circle
    exp.circle = canvas(exp)
    exp.circle.fixdot()
    

    Now use a slightly adjusted script to present the stimuli:

    # first, check the SOA
    SOA = exp.get("soa_var") # change 'soa_var' to the variable you use for the SOA!
    
    # then check what to do
    if SOA == -10 or SOA == -30 or SOA == -50 or SOA == -80 or SOA == -100 or SOA == -150 or SOA == -200 or SOA == -250 or SOA == -300:
        exp.beep.play()
        self.sleep(abs(SOA))
        exp.circle.show()
    elif SOA == 10 or SOA== 30 or SOA == 50 or SOA == 80 or SOA == 100 or SOA == 150 or SOA == 200 or SOA == 250 or SOA == 300:
        exp.circle.show()
        self.sleep(abs(SOA))
        exp.beep.play()
    else:
        exp.beep.play()
        exp.circle.show()
    

    Please do note the potential pitfalls mentioned in the thread I linked to! Sound timing is different to get precisely right (not just for OpenSesame, by the way).

  • edited 10:29AM

    Edwin, thank you for your precious help: the experiment works perfectly!

    Greetings!

    @};- @};- @};-

  • edited 10:29AM

    Very good to hear, I'll mark this as solved. Good luck with your study! :)

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