Howdy, Stranger!

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

Supported by

Set an incompressible duration of sketchpad while recording response time

Hi,

First of all, Opensesame is really useful and easy so thank you for that !

But I don’t succeed to do something that I thought would be easy to.
I would like to show a picture for at least 3000ms and allow the participant to answer (with keyboard) during that duration or after (the picture should stay at least that 3000ms and until the participant answers which can be for example 10s later).
If I set the duration of the sketchpad to 3000 and deselect the “clear key pressed before” on the keyboard_response it does work, but then I don’t have the response_time if the participant answer before the 3000ms.
If I set the sketchpad to 0ms then I can have the response_time directly after my picture appears but the picture disappears when the participant answers so it might not have been shown long enough (3s).

Does someone know how to handle that ?

Thanks

Comments

  • Hi,

    How about some python scripting? Set the duration of the sketchpad to 0 and replace the keyboard with an inline_script in which you will collect the response:


    kb = keyboard(timeout = 0) blank = canvas() start_time = clock.time() var.correct = NA var.resp_time = NA while True: k,t = kb.get_key() if k != None: var.resp_time = t-start_time var.correct = k==var.correct_response break if clock.time()-start_time > 3000: blank.show() elif clock.time() - start_time > timeout: break

    Edaurd

    Buy Me A Coffee

  • Thanks Eduard, the thing is that I don't know anything about Python...
    I did a copy/paste and it didn't work (It tells me variable "correct" doesn't exist). I guess that I should add some informations in this code but I really don't know what and how...

  • I see.


    kb = keyboard(timeout = 0) # initializes a keyboard response item with a timeout of 0 blank = canvas() # makes an empty canvas var.correct_response = 'd' # define what you consider a correct response. start_time = clock.time() # start time of reaction time measure var.correct = NA # initialize correct response variable var.resp_time = NA # initialize response time variable # loop for as long as you want, e.g. 10 seconds timeout = 10000 while True: k,t = kb.get_key() # sample key response if k != None: # if a key was pressed ... var.resp_time = t-start_time # ... measure response time var.correct = k==var.correct_response # and define whether response was correct if clock.time()-start_time > 3000: # if response was given after 3 seconds, .... break # break the loop if clock.time()-start_time > 3000: # after 3000 seconds blank.show() # show an empty canvas elif clock.time() - start_time > timeout: # after a certain time (defined earlier) ... break # break the loop

    YOu can also check out the documentation. It's not all that difficult:

    http://osdoc.cogsci.nl/3.1/manual/python/about/
    http://osdoc.cogsci.nl/3.1/manual/python/keyboard/

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    So I did the necessary to understand a bit python code but I still don't succeed.

    What I would like to have is :
    If a key is pressed but the response time is inferior at 3000ms : collect response time and correct response + my picture stays on the screen until it reaches this 3000ms of presentation (and unfortunately this until function doesn't exist...) and then move on to the next picture.
    If this is not the case : wait with my picture on the screen until the participant answers and then collect all informations and continue on next picture.

    Do you have any idea of what I should do ?

  • Did you try my code? It should work I think...

    kb = keyboard(timeout = 0) # initializes a keyboard response item with a timeout of 0 
    my_canvas = copy_sketchpad('my_sketchpad') # makes an empty canvas
    var.correct_response = ['q','m'] # define what you consider a correct response.
    start_time = clock.time() # start time of reaction time measure
    var.correct = NA # initialize correct response variable
    var.resp_time = NA # initialize response time variable
    # loop for as long as you want, e.g. 10 seconds
    timeout = 10000
    while True:
        k,t = kb.get_key() # sample key response
        if k != None: # if a key was pressed ...
             var.resp_time = t-start_time  # ... measure response time
             var.correct = k==var.correct_response # and define whether response was correct
             if clock.time()-start_time > 3000: # if response was given after 3 seconds, ....
                   break # break the loop
             else:
                   clock.sleep(timeout-(clock.time()-start_time) )
        if clock.time()-start_time > 3000: # after 3000 seconds
            blank.show() # show an empty canvas
        elif clock.time() - start_time > timeout: # after a certain time (defined earlier) ...
             break # break the loop
    

    Btw. Please post code as text, not as image, this makes working with it a lot easier.

    Eduard

    Buy Me A Coffee

  • I found something much easier which works as I want.

    self.sleep(3000-self.get('response_time'))

    Thank you a lot for your help !

    Ysia

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