Howdy, Stranger!

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

Supported by

[solved] Reaction times all the same number, bug?

wazwaz
edited January 2014 in OpenSesame

Hello!!

First of all, I'd like to thank you because I'm very happy with open sesame.

I made a task for my experiment where subjects saw a coloured square and they had to press a key out of 5 indicating the colour they saw. The stimulus (a jpg file) was there for 400ms followed by a blank screen for 1750ms, 65 stimuli repeted 10 times each. I only added the response and the reaction times as variables to log. I tried it before (in linux, my laptop) and it worked fine, responses and reaction times were normal. But after I run my experiment with all the subjects (windows pc), I looked at the data and I saw that reaction times are almost the same for across subjects and stimuli. The numbers I got ranged from -217 to -214, the 90% of the times it was -215 and I got some timeouts of 599 and 600. So I lost all the data :( . I tried it again (not the whole thing, just around 50 trials) and I got normal reaction times (numbers ranging from 200 to 450) + some -215.

Any clue of what could be happening? I would love to recover my data, but it looks quite difficult since the numbers I got look very strange.

Thanks a lot!

Comments

  • edited 5:24AM

    Hi Waz,

    That is very strange! So you got negative (strange) RTs when running subjects, but if you now run the same experiment again you get different (normal) results? It's difficult for me to say how this happened and whether you will be able to recover the data. First of all, are you absolutely sure that you didn't accidentally run an old/ different version of the experiment? (Speaking from experience here.)

    Otherwise, perhaps you could send me the experiment file and the data or (better, but only if you don't mind posting it publicly) upload it somewhere? In that case I could take a look at it.

    Cheers,
    Sebastiaan

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    Hi Sebastiaan,

    Actually I was running 8 different experiments ".opensesame" and got the same with all. I ran it again, but with less trials, and I got normal RTs but also some "-215"s. I will send it to you because you also need the pictures to run it, and then we can post something about it if we get any ideas!

    Thank you! :)

    Waz

  • edited 5:24AM

    Hi Waz,

    I just looked at your experiment, and I noticed that you are using the Psycho back-end. With OpenSesame 0.25 there were occasional problems with the clock in the Psycho back-end (see this discussion). These issues were very hard to reproduce, but occasionally occurred, and apparently only on specific systems. Are you by any chance still using 0.25? If so, that might be it, and I would recommend upgrading to 0.26.

    If the problem also occurs with 0.26, perhaps you could run this test script: https://gist.github.com/1675762 (click on raw to download). This script should return very consistent timestamps, matching the refresh rate of the monitor. If this script gives erratic results on OpenSesame 0.26, or if you need further help, please let me know.

    Cheers,
    Sebastiaan

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    Thank you Sebastiaan! I'm using 0.26. I will try it and post the results!

    Thanks again :)

    Waz

  • wazwaz
    edited 5:24AM

    Hi Sebastiaan,

    I run the script and it gave a coherent M and SD, but it didn't print any .txt. Is there anything else I should check?

    I also tried just pressing a key when the blank screen is there and it seems that that's when the problem comes. So it could be that the program is logging the time before the new stimulus is coming, and not the time after the stimulus. It also makes sense since, to get the actual responses to coincide with the stimulus showed, I had to delete the first response (first row in the output file) for all the subjects. Still, there doesn't seem to be any logic in the numbers: they are all roughly the same across subjects.

    Any ideas?

    Waz

  • edited 5:24AM
    I run the script and it gave a coherent M and SD, but it didn't print any .txt. Is there anything else I should check?

    Nope, that's all. Basically it checks the interval between two display presentations. This should be larger than 50ms, match the refresh rate of the monitor (M=67ms on a 60Hz monitor) and be very constant (SD<1ms). If this is ok, which it usually is, than you're fine timing wise.

    Still, there doesn't seem to be any logic in the numbers: they are all roughly the same across subjects.

    I looked again at your experiment. I don't know what caused your problems, but I do have some suggestions. Basically, the structure is as follows, right?

    • Sketchpad (duration = 400ms)
    • Keyboard response (timeout = 200ms)

    This basically means that the subject is unable to press a key for the 400ms while the sketchpad is shown, and then has only a 200ms period during which he/she can respond. Otherwise a timeout occurs. Because the option 'Flush pending keypresses' is deactivated in the keyboard_response, keypresses that occurred prior to the keyboard_response will be captured as well. But, and here is the tricky part, these 'old' pending keypresses may not have a proper timestamp. This could cause your problems, although I'm not sure how exactly. I know I'm being vague, but that's because I'm not sure exactly how old pending key presses are dealt with, and it might vary across systems and back-ends. Does that make sense?

    You probably want to present a stimulus for a fixed amount of time (400ms), and capture keypresses while the stimulus is being shown and for some time (200ms) after that as well, am I correct? There's a more complicated, but better (!) way to do this described here: http://forum.cogsci.nl/index.php?p=/discussion/143/open-how-do-i-collect-the-keyboard_response-after-a-stimulus-disappears

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    Thank you! It seems that's exactly what I need! I have no experience with Python but I downloaded the book suggested.

    Do I have to add an inline_script under experiment and paste it there? Do I have to start the experiment from scratch using Python? I've been trying to make it work but it don't find out how. Perhaps you have some other reading to suggest?

    :)

  • edited 5:24AM

    You can insert the code from this discussion as an inline_script where you would normally insert a keyboard_response, and it will behaved as described there. So you can just pick and choose, and use inline_scripts only where necessary. You certainly don't need to start your experiment from scratch.

    Regarding other reading, I think a Byte of Python is the best way to get acquainted with Python, even though it's not specific to experiment building or OpenSesame. Some more advanced material is offered here:

    Cheers!

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    Hello!

    I tried the script. It works but I still get some negative numbers (which is actually always -214). My sketchpad lasts 400 ms and blank screen 1750ms. Timeout1 is 400 and timeout2 is 1750. Is that right? So I tried changing timeout2 several times: 1350, 1750, 2150, 2500, 3000. I get more -214's the smaller timeout2 is, but the next coloured square comes 2150 ms after the previous, so timeout2 can't be more than that. Am I missing something here? A mistake in the logic? Maybe someone has some ideas :)

    Thanks again!

  • edited 5:24AM

    I tested it again, and for me it works perfectly. The only thing is that timeout2 is the total timeout, so for you that would be 400+1750 = 2150. But that shouldn't be the reason why you get negative RTs.

    Could you maybe describe the structure of your trial_sequence in more detail?

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    When I try pressing a button right after the colour it works, but when I press it just before the next colour (i.e. I take a long time to answer), I start getting the negative numbers. Could you try that as well and let me know what happens?

    This is the script for the trial sequence

    set flush_keyboard "yes"
    set description "Runs a number of items in sequence"
    run my_blank_canvas "always"
    run my_sketchpad "always"
    run _inline_script "always"
    run logger "always"

  • edited 5:24AM

    You are right! I din't notice at first, because I did not have an empty screen before the sketchpad. The problem is that the keyboard is not flushed, so it responds also to pending keypresses (without proper timestamps). The following modification to the script should fix it. Simply add the my_keyboard.flush() bit to the script.

    my_keyboard = keyboard(exp, keylist=allowed_keys)
    my_keyboard.flush()
    my_blank_canvas = canvas(exp)

    Let me know if this doesn't solve your problem.

    Buy Me A Coffee

  • wazwaz
    edited July 2012

    Now I don't get negative numbers but when I press a key close to next stimulus, I don't get the response logged and I get always 2150 as a number (which is strange since it does not seem plausible to be exactly as fast for 5 trials). Timeout should only appear when I don't press any key at all.

    colour count_colourchips   response    response_time
    D4                  NA                      c   1101.704836
    G5                  NA                          x   648.199081
    C11             NA                          v   427.948952
    D12                 NA                          z   741.173983
    F3                  NA              timeout 2150.079012
    F10             NA              timeout 2150.063037
    C9                  NA                  timeout 2150.087118
    F8                  NA              timeout 2150.074959
    G3              NA              timeout 2150.072097

    What do you think?

  • edited 5:24AM

    That's because each trial starts with an empty screen during which participants are not allowed to respond, right? So yes, all responses that are given during this period are lost. If you remove the empty screen at the start of the trial (and possibly increase timeout2 in the script to compensate) you should be able to press a key at all times.

    Does that make sense?

    Buy Me A Coffee

  • wazwaz
    edited July 2012

    I changed the order, the stimulus comes first. Now this is the sequence:

    set flush_keyboard "yes"
    set description "Runs a number of items in sequence"
    run my_sketchpad "always"
    run my_blank_canvas "always"
    run _inline_script "always"
    run logger "always" 

    Shouldn't it be this way: timeout1= 400 (stimulus) and timeout2=2150 (stimulus + blank screen)?
    The output in this way are all timeouts (response_time=2180 response=timeout). What I need is, as you said, for the subject to be able to be able to press a key at all times and for the program to assign a response to every stimulus (one every 2150 miliseconds).

    Sorry if I'm not understanding very well!

  • edited July 2012

    Right, no, sorry. You do not need to add a blank screen at all if you use this script. If you look at the code you will see that the blank canvas is already in there. So you just need the following sequence:

    • my_sketchpad (duration = 0ms)
    • inline_script (waits for 400ms, blanks screen, waits for another 1750ms)
    • logger

    If you add your own blank sketchpad somewhere, it will be shown, but participants will not be able to respond while it's being presented.

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    I made the changes but now the problem is that every time I press a key, I get a new colour and instead I want my responses not to change anything.

    :S

  • edited 5:24AM

    That's correct, yes. Perhaps it would be easiest if you specify exactly what you want the trial progression to look like.

    So you want the interval between two colours to be the same, regardless of when the response is given, right? But you also mention that you want participants to be able to respond at all times. So how would you, for example, want to deal with two responses in a row (e.g. the subject accidentally presses twice after seeing a colour)?

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    Yes, what are the possibilities in that case? Can it log several responses and I choose the first one? Can I write it so that it just logs the first key?

  • edited January 2014

    Hi Waz,

    I see. I think, given that you basically need a kind of continuous stream, it's better to just use an inline_script for the entire block. That will be much simpler in the end. I didn't fully understanded what you wanted to do at first, otherwise I would have suggested that before!

    Below you see a script that alternately presents stimuli and blanks, and records all responses that are given during that time. The (custom) log-file will look a bit different from what you are used to, but it's still human-readable text. You may want to tweak it a bit, based on the functions as described on http://osdoc.cogsci.nl/python-inline-code.

    I hope that this script will (finally) make things work for you!

    Cheers,
    Sebastiaan

    from random import shuffle
    from openexp.keyboard import keyboard
    from openexp.canvas import canvas
    
    timeout1 = 400
    timeout2 = 1750
    
    # Create a keyboard object
    my_keyboard = keyboard(exp)
    
    # Create a canvas object
    my_canvas = canvas(exp)
    
    # Create a randomly ordered list of all pictures, like 'D13.jpg' etc.
    pic_list = []
    for letter in 'C', 'D', 'E', 'F', 'G':
        for  number in range(3, 16):
            pic = '%s%d.jpg' % (letter, number)
            pic_list.append(pic)
    shuffle(pic_list)
    
    # Log the start of the trial
    self.log('%s start_trial' % self.time())
    
    # While there are pictures to be shown, keep looping
    while len(pic_list) > 0:
    
        # Take the last picture out of the list, show it, and
        # log its presentation timestamp
        pic = pic_list.pop()
        my_canvas.image(exp.get_file(pic))
        timestamp = my_canvas.show()
        self.log('%s %s' % (timestamp, pic))
    
        # Collect responses continuously    
        while self.time() - timestamp < timeout1:
            resp, time = my_keyboard.get_key(timeout=1)
            if resp not in (None, 'timeout'):
                self.log('%s response %s ' % (self.time(), my_keyboard.to_chr(resp)))
    
        # Show a blank screen
        my_canvas.clear()
        timestamp = my_canvas.show()
        self.log('%s blank' % timestamp)
    
        # Collect responses continuously
        while self.time() - timestamp < timeout2:
            resp, time = my_keyboard.get_key(timeout=1)
            if resp not in (None, 'timeout'):
                self.log('%s response %s ' % (self.time(), my_keyboard.to_chr(resp)))
    
    # Log the end of the trial
    self.log('%s end_trial' % self.time())
    

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    GREAT! It seems to be working perfectly! I just have to calculate the reaction time based on the difference between the time of the response and the time of the onset, right? One problem to play with the data is that I don't get "timeout" as response, but instead I don't get the "response" row. I will see how to deal with that.

    Thank you so much Sebastiaan, you saved my experiment :) . I hope this is useful for other people too!

  • wazwaz
    edited 5:24AM

    Just one small thing: the sequence runs forever (it is supposed to be 10 times each stimulus). Is there anything I can add for it to stop afterthat and show the "thank you" page?

    :)

  • edited 5:24AM

    Hi Waz,

    The script runs through the pic_list (65 pictures) and then quits. So if your experiments goes on indefinitely you probably have a loop with a lot of cycles or something along those lines.

    If you want to change pic_list, it is simply a standard Python list with names that refer to pictures in the file pool. So can easily create your own if you want to present more or less pictures. You may want to take a look at the section on lists in a Byte of Python.

    Cheers!
    Sebastiaan

    Buy Me A Coffee

  • wazwaz
    edited 5:24AM

    Thankss!!

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