Howdy, Stranger!

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

Supported by

Variable won't register negative values (difference between stimuli and response time)

edited July 2016 in OpenSesame

Hi!

I'm doing an experiment where a cue is presented, and then the subject should press a key (space) as soon as possible. A circle will flash before or after the key press, and the subject should determine whether the flash occurred before or after the key press. I use a script to count the mean response time of the key press, to be able to sometimes present the flash before the key press.

I have a variable that registers the response time for the key press, and a variable that registers the time delay before the circle is presented. I also want to know the time difference between these two events (circle_vs_response), but when I subtract the time delay before the circle (flash_delay) from the response time (trial_response_time), the variable circle_vs_response never shows any negative values, whether I press the key before the circle or not. The lowest value it shows is 24. When I look at the specific values in flash_delay and trial_response_time and count the difference the values in circle_vs_response are correct, but obviously there is something wrong with the code, because the difference should sometimes be negative. I guess the problem could be in registering response time or time delay of the circle?

Here is my overall design of the experiment (it continues after the practice block but I will use the same script later in the experiment):

image

Here is my prepare phase of the script:

image

Here is the run phase of the script:

image

Comments

  • edited 5:48AM

    Hi Charlotte, if the specific values for flash_delay and trial_response_time are correct, your desired variable should be flash_delay - trial_response_time. In your script it seems that you have switched these two around, is that right?

    Cheers

    Josh

  • edited 5:48AM

    Hi! Well, first I tried defining the variable just like that (flash_delay - trial_response_time), but then it was the other way around, the variable only gave me negative values, never positive ones. So while I thought the problem was in defining that variable, I start to think that it is the response time and/or the time delay of the circle that are not correct (even though the times look plausible when I print them).

    /Charlotte

  • edited 5:48AM

    Hi Charlotte, it should be easy to check if those individual values make sense or not, as you can calculate some time differences manually.

    Actually, I think the problem is that you're always collecting your keyboard response after the flash canvas in your run-phase. This is bound to always yield positive/negative values depending on which one comes first.

    A better setup may be to start timing with t0 = self.time(). Then you enter a while-loop, where you continuously collect a keyboard response with timeout = 1. You break from the while-loop when a response is given (response != None) or when a general timeout is reached. Before entering the loop, you determine at which point your flash should appear. You can display the flash during the loop by means of:

         current_time = self.time() - t0
         if current_time >= flash_time:
              flash_canvas.show()
    

    Does this make sense?

    Cheers

    Josh

  • edited 5:48AM

    Thank you for your help! It all seems to work fine now, and circle_vs_response registers both positive and negative values.

    /Charlotte

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