Howdy, Stranger!

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

Supported by

[open] Collecting accumulative RT across two sketchpad frames

edited August 2013 in OpenSesame

Can you help? I want to present two frames consecutively for different lengths of time, and allow participants to respond at any time during the two presentations. I guess I need an inline script, but don't know how to write it appropriately... Many thanks, Tilly

Comments

  • edited February 2014

    Hi Tilly,

    The script below shows how you can collect responses while two sketchpads are being presented. In general, the trick is to alternate between showing a display and polling the keyboard. The responses are stored as response1, response_time1, etc. For more details and instructions on how to use this script in your experiment, see the code comments.

    Similar questions have been asked a few times before, and these discussions may be useful as well:

    The script may seem a bit complicated. To get some feel about how this works, I would recommend walking through one of the Python tutorials. You won't need any extreme coding skills, just a basic understanding of the syntax:

    Cheers!
    Sebastiaan

    Update: Fixed typo

    from openexp.keyboard import keyboard
    
    # Durations for the two displays
    duration1 = 1000
    duration2 = 1000
    
    # Displays are copied from sketchpads. To avoid these
    # sketchpads from being shown twice (i.e. once in the 
    # normal way, and once in this inline_script), you can set
    # their 'Run-if' statement to 'never'.
    canvas1 = self.copy_sketchpad('sketchpad1')
    canvas2 = self.copy_sketchpad('sketchpad2')
    
    # Create a keyboard object with a zero timeout to allow
    # for continuous polling.
    my_keyboard = keyboard(exp, timeout=0)
    
    # Keep track of which response we are collecting, in case
    # the participant responds multiple times.
    response_nr = 1
    
    # We collect at most 10 responses, and reset these 10 responses
    # to 'NA' before we start collecting new responses.
    max_response_nr = 10
    for i in range(1, max_response_nr+1):
        exp.set('response%d' % i, 'NA')
        exp.set('response_time%d' % i, 'NA')
    
    # Show the first canvas, and poll the keyboard for the
    # specified duration.
    show_time1 = canvas1.show()
    while self.time() - show_time1 < duration1:
        key, time = my_keyboard.get_key()
        # If a key is pressed, store the key and the response time.
        # The response time is the time after the presentation of the
        # first display.
        if key != None and response_nr <= max_response_nr:      
            exp.set('response%d' % response_nr, key)
            exp.set('response_time%d' % response_nr, time-show_time1)
            response_nr += 1
    
    # Show the second canvas, and poll the keyboard for the
    # specified duration.       
    show_time2 = canvas2.show()
    while self.time() - show_time2 < duration2:
        key, time = my_keyboard.get_key()
        # If a key is pressed, store the key and the response time.
        # The response time is the time after the presentation of the
        # first display.
        if key != None and response_nr <= max_response_nr:      
            exp.set('response%d' % response_nr, key)
            exp.set('response_time%d' % response_nr, time-show_time1)
            response_nr += 1        
    
  • edited 11:21PM

    Hi Sebastiaan,
    Thank you so much for all your help with this - will give it a go!
    BW, Tilly

  • edited 11:21PM

    I think there is a typo in this script. second while loop should compare with "duration2" not "duration1".

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