Howdy, Stranger!

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

Supported by

Visual Looking Preference Paradigm

Has anyone used OpenSesame to develop a Preferential Looking experiment such as the Fagan Test of Infant Intelligence? I couldn't find it in the list of standard tests, but please let me know if I missed it.

Specifically, I'd like to record the latency and duration of all keypresses from two keys while the stimulus is presented. I have some experience creating OpenSesame experiments from the GUI, and I'm ready to add in some inline code as needed.

Any help is greatly appreciated!

Julie

Comments

  • Update: I should have been more specific in my previous post. I can record the keys and timing of keypresses during stimulus presentation. After displaying a sketchpad (duration = 0), I added the following inline code:

    my_keyboard = Keyboard()
    my_keyboard.keylist = [u'left', u'right']

    while True:
    keydown1, timedown1 = my_keyboard.get_key()
    keyup1, timeup1 = my_keyboard.get_key_release()
    if ((timeup1 - timedown1) >= 5000:
    break

    var.look_direction1 = keydown1
    var.look_length1 = timeup1 - timedown1

    This is followed by a sampler item.

    My remaining questions are:
    1) How can I iterate this, such that for each keypress I can record the key and duration of the keypress until the summed time either key is pressed totals exactly X ms, where X = [block loop variable] instead of 5000? As written now, the key must be released before the iteration breaks, but I'd like it to break regardless of whether the key is up or down when the accumulated keypress time occurs.
    2) The sampler cues that this portion of trial is over. Is there any reason to include that here in the inline code instead?

    I'm happy to provide more information if needed.

    Thank you for your patience with my inexperience!

  • edited August 2018

    Hello,

    2) The sampler cues that this portion of trial is over. Is there any reason to include that here in the inline code instead?

    I don't understand what you mean, but generally it is quite easy to include the sampler in an inline_script. Given the setup of your code above, it is probably even necessary to do so. Check out this part of the documentation to learn how to use samplers in inline_scripts.

    1)

    my_keyboard = Keyboard(timeout=0)
    my_keyboard.keylist = [u'left', u'right']
    
    var.totalDur = 0 # initialize a counter for the total down time (across key presses)
    start_time = clock.time() # init stopwatch
    while True: # first while loop takes care of multiple key presses
        if ((clock.time() - start_time) >= var.block_loop_variable: 
                break       
        while True: # second while loop takes care of waiting for the first down key
            keydown1, timedown1 = my_keyboard.get_key()
            # only if a key was pressed, check whether it was released already
            if keydown1 != None:
                while True: # third while loop waits for first key up
                    if ((clock.time() - start_time) >= var.block_loop_variable: 
                        break
                    keyup1, timeup1 = my_keyboard.get_key_release()
                    if keyup1 != None:     
                        var.curDur = timeup1 - timedown1
                        var.totalDur += var.curDur
                        break
                if var.totalDur >= var.block_loop_variable: # however you called it in the loop table
                    break
             if ((clock.time() - start_time) >= var.block_loop_variable: 
                    break       
    
    var.look_direction1 = keydown1
    var.look_length1 = timeup1 - timedown1
    

    Not sure whether this code is exactly what you need, but I think it should you get started on your problem. They key trick is to set the timeout of your keyboard to 0, so that the experiment doesn't sleep during that time and still keeps track of the elapsed time.

    Let us know if you need further help.

    Eduard

    Buy Me A Coffee

  • Thank you very, very much, Eduard. Your response has definitely pushed me in the right direction. I'll be sure to let you know when I reach the solution (or if I need more help!).

    Julie

  • Thank you again for your help, Eduard. I've used the code you sent to move forward, but I was unable to successfully record the duration of each keypress. The following inline script nearly works. I can now correctly measure the total look duration at any point in a trial, and move on to the next part of the experiment once the criterion for look duration is reached (I use 5000 ms here just to make things simpler).

    My Remaining Question:
    Why does the log only display the key name and RT of the first KEYDOWN event, but no subsequent KEYUP or KEYDOWN events? The program itself seems to run correctly--I can make multiple keypresses until the total keypress time = 5000 ms (confirmed with my own stopwatch).

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