Howdy, Stranger!

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

Supported by

[solved] response time timing

edited April 2014 in OpenSesame

Hello,
Love open sesame, super easy to use. Having a little trouble though.
I'm trying to program a response time task to an audio beep. What I want to have is a series of beeps times 1200ms apart (with 300ms jitter), where Ps press the Space bar as quickly as possible when they hear the tone. I need that timing I've chosen to remain consistent. Here's my setup
-Loop
-Sequence
-Advanced Delay
-Synth
-Keyboard Response
-Logger
In my loop I have it set to cycle as many times as the study calls for. My synth is 100ms in duration, my advanced delay is set to 1200ms with 300ms jitter. my keyboard response is set so SPACE is an allowed response. Here's my problem:
-If i have the timeout on the keyboard response left blank or set to infinite, when I run the experiment, the computer will wait until I press SPACE, then start the next advanced delay, which screws up the timing.
- If I have the timeout set to 0, the beeps follow the timing perfectly, but no data is recorded. In my data set under response time, it just reads NA over and over.

I could set the timeout to something like 900ms and then subtract that out of the advanced delay, but then the audio beeps are going to be spaced out different for all my participants. Basically I want the beeps to be performing like the timeout is set to 0 (and all the beeps are set about 1200ms apart) but to be recording the data.
Is there a way to do this? Or a setup I can use that will work better for this?
Look forward to getting a response.

Comments

  • edited 8:55AM

    Here's a screen cap of the setup
    image

  • edited 8:55AM

    Hi,

    I could set the timeout to something like 900ms and then subtract that out of the advanced delay, but then the audio beeps are going to be spaced out different for all my participants.

    You're close. What I would do is define the interval+jitter already in audio_loop. To do this, you can make use of the fact that you can define your variables using Python, by prepending an = sign, like so:

    image

    See also:

    Then you can set the timeout of your keyboard_response to [interval]. Next, directly after the keyboard_response, you use a simple inline_script to pad the time that remains after the participant has responded:

    time_to_pad = self.get('interval') - self.get('response_time')
    self.sleep(time_to_pad)
    

    Does that make sense?

    Cheers,
    Sebastiaan

  • edited 8:55AM

    OK I've tried that, I have created the variable 'interval' and set it to =900+randint(0,600). i set the timeout on my keyboard response to that, but what do I put as the interval in the advanced delay? When I set it to 'interval' my beeps sound much further apart, almost twice as far apart as they should.
    I did a quick run and I've noticed that it still lists response times when I don't respond. Under response it will say none, but it will have a reaction time listed.

  • edited 8:55AM

    OK I got it working, I had forgotten to include spaces in the inline script (I'm such a n00b). You guys are so helpful!
    I'm still have the issue in the data though. I've included a screen shot of my data table. Where the response is listed as "none" should I assume the RT listed is the timeout?
    image

  • edited 8:55AM

    i set the timeout on my keyboard response to that, but what do I put as the interval in the advanced delay?

    Right, just to clarify. You are now using the keyboard_response plus inline_script to do all the sleeping. So you don't need the advanced_delay anymore and you can remove it from your trial sequence. Does that solve the issue?

  • edited 8:55AM

    That seems to have done the trick! thank you!

  • Hello!
    I am trying to achieve something similar as the original query. My participants will pay attention to a word loop, but also click the spacebar whenever they hear a click sound. However, my click sounds are randomly distributed throughout my word loop with no defined interval between them (there just is a specific number of them). I am not entirely sure how to tackle this issue with the solution above. Here is my full code so far: https://pastebin.com/PTyKaQzM

    I would like it so that each word in the word loop is shown for 240ms (as I have set in the sketchpad duration).

    In my inline script for the keyboard, if I set the timeout to 0 it does not record response times at all (NAs throughout). When I set it to 450ms (like it is now) it slows down the duration between words in the word loop, but records the RTs. Ideally, I would like to set the keyboard timeout to 1000ms without affecting the 240ms duration of the words displayed. That is, we will not analyse any response that takes more than 1000ms. Is this possible?

    The current set up:

    Thanks for your time :)

  • Hi,

    For some reason, your pasted code doesn't load into Opensesame. Can you also share the experiment? Anyway, I wrote a little script that should do what you are looking for. You just have to adapt it to your needs.

    import random
    
    cv = Canvas()
    blank_cv = Canvas()
    kb = Keyboard()
    
    # define and shuffle the word list
    nonwords = ['asd','fewsda', 'htergf']*3
    random.shuffle(nonwords)
    
    # define durations of each phase
    non_duration = 240
    blank_duration = 495
    
    # 10 sounds, randomly in 10 seconds
    sounds = random.sample(range(10000),10)
    # load sound 
    src = pool['bark.ogg']
    my_sampler = Sampler(src, volume=.5)
    # keeps track of which sounds have been played
    sound_idx = 0
    # list to collect all the responses
    var.resps = []
    
    # draw the first word 
    idx = 0 
    cv['word'] = Text(nonwords[idx])
    t0 = cv.show()
    
    # start_timer
    t1,t2 = clock.time(),clock.time()
    while True: 
        # get the key presses
        k,t = kb.get_key(timeout = 1)
        if k != None:
            var.resps.append([k,t])
            kb.flush()
    
        # show a blank and draw the next word
        if clock.time()-t1>240:
            t1+=1000
            t2 = blank_cv.show()
            idx += 1
            if idx == len(nonwords):
                break
            cv['word'].text = nonwords[idx]
    
        # show the next word and reset timers
        if clock.time()-t2>500:
            t1 = cv.show()
            t2 += 1000
    
        # play the sounds if it is time
        if not sound_idx == len(sounds):
            if clock.time()-t0>sounds[sound_idx]:
                my_sampler.play()
                sound_idx += 1
    

    Eduard

    Btw. Which version of Opensesame are you using? From your screenshot it appears to me that it isn't the latest one.

    Buy Me A Coffee

  • Hi, I've an issue with a task I don't know if you've already encontered the problem...

    I perform a time-to-contact task. 

    participants hear a sound coming towards them and press "space" when they feel the sound is close.

    then, if the participant has responded in time (if response time = sound time), a green cross appears; if it's too late, a red cross; and if it's too early, a blue cross.


    However, I can't create conditional feedback linking response time to audio file presentation time.

  • Hi,

    However, I can't create conditional feedback linking response time to audio file presentation time.

    What have you tried? Please provide some context, share your experiment, explain your implementation, etc. Otherwise you are essentially asking us to build this experiment for you. If you have a rough sketch of the experiment we can try to help tweak it until the result is satisfactory.

    Eduard

    Buy Me A Coffee

  • sorry I forgot to upload the images ...

    here are the instructions of the task : the participant is watching a white cross and hearing a sound coming towards him.

    then, when the participant "feels" the sound near him he push 'space'.

    after that, there is a feedback :

    1- if the participant respond on time : the feedback is a green cross

    2- if the participant respond too early : the feedback is a blue cross

    3- if the participant respond too late : the feedback is a red cross

    my problem is that I don't know how to create this conditional feedback because there is always example with correct = 0 or 1 but not with 3 possibilities and not relative to the time response

    hope that is better explained...

  • For that you need to do Python coding inside an inline_script .

    You need to define your own "correct" response, or rather response categorization. Importantly, you need to do this after the response in the run phase of the inline_script. For example:

    if response_time < target_time:
         var.resp_category: "too_early"
    elif response_time == target_time: # this one doesn't work, because it is never EXACTLY the same, you should define some sort of tolerance
         var.resp_category: "correct"
    elif response_time > target_time:
         var.resp_category: "too_late"
    

    Then you can put as run_if` statement in the feedback items:

    `[resp_category] == 'too_early'` or one of the other cases, respectively.

    Please note, this example won't work right away. I don't fully understand how you implemented the logic of stimulus presentation and response collection. Assuming that this part works and you have a "proper" response_time, the above code is good enough, I guess. But given your design description, I can imagine the response collection part, also being somewhat intricate.

    Hope this helps,

    Eduard

    Buy Me A Coffee

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