Howdy, Stranger!

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

Supported by

Response time logging with mouse

Dear Forum,

In my experiment, I am recording responses with the class mouse: button, position, time = my_mouse.get_click()

After every response, I am logging the answer and response time:

var.buttonpress = button

var.time_buttonpress = time

I now looked at the data file from a pilot data collection and have a couple of general questions regarding how response times are logged:

  • Is the format of the log file in milliseconds? Because the first recorded time is quite large - is it possible that the time until the experiment has been started is measured here?
  • Am I correct in the assumption that the time recording starts when the function is called and stops when the participant answers (= clicks with the mouse)?
  • Since I am calling the functions more than 200 times during the experiment, I was wondering whether the response times are summed up? Because the data indicates that the response time is getting larger with every answer, which points to some kind of accumulation. If this is the case, would I have to use the mouse.flush() function every time an answer has been recorded?

I am looking forward to hearing back from you - thank you very much in advance :)




  • Hi @sarah_alexandra,

    I think the confusion comes from the fact that your sample the time variable instead of the response time associated with the mouse click object. As far as I know, the time variable simply refers to the internal clock time. It'll always go increasing as the task runs and does not reflect the interval between the onset of the mouse object and the time a click is registered.

    If you'd like to calculate that interval manually through code, you'd have to use a variable to store the time when you want to start measuring, and then right after a click is detected, calculate the difference between the current time and the stored time.

    Otherwise, simply use the response_time variable (var.response_time or [response_time] depending on the context), or the response time variable for the specific mouse object (let's imagine my mouse event is called 'mymouse', var.response_time_mymouse or [response_time_mymouse] depending on the context).

    See this example:

    Hope this helps,


    Buy Me A Coffee

  • edited February 2023

    Hi Fabrice,

    Thanks a lot for your fast answer!

    That means when calling the mouse function such as "button, position, time = my_mouse.get_click()", I am not recording the response time, but simply the current timestamp since the experiment has started?

    Since I have programmed my experiment mainly with inline code and am using a while loop as part of a staircase mechanism, I have to calculate the time interval manually through code. Do you have an example how that could look like? Would the variable used to store the time when I want to start measuring be right after or before calling the mouse function?

    Thanks a lot in advance!



  • FabFab
    edited February 2023

    Hi @sarah_alexandra,

    Ok, now it's clearer to me where you get your time variable from. You get it from the definition of a get_click() event. You might want to call the time element timestamp or something, just to avoid potential problems as "time" is also a python reserved word. Might generate problems, but just to be on the safe side, I'd call it something else.

    I'm not accustomed to program this type of event directly from python code, but I looked it up for you and it looks as if, as I thought, your time variable (from "button, position, time = my_mouse.get_click()) is a measure of the current time with reference to the computer's internal clock (probably starting when the task begins). So, to calculate the the interval between a certain event and the mouse click, what you want to do is to define a timestamp for the first event:

    start_time = self.time()

    And then calculate the difference between time and start_time.

    I had a quick go at it in this example.

    Hopefully that'll help


    Buy Me A Coffee

  • Hi Fabrice,

    That indeed helps a lot, thank you very much for your fast answer! I'll give that a try :)



  • Ok, @sarah_alexandra ๐Ÿ‘๏ธ

    Incidentally, when replying in this forum, you can direct a message to a specific person by using their handle. For example, if you type @Fab, you'll see a pulldown menu appear where you can select my handle. If you use it, then I get a notification when I open the forum (otherwise, when there are many requests at once, I don't always see that a message is addressed to me.

    Buy Me A Coffee

  • Perfect, thanks for the recommendation @Fab ! I just tried it out and it works perfectly ๐Ÿ‘๏ธ Thank you!!

  • Hi @sarah_alexandra,

    Glad I could help!

    Good luck with your experiment!


    Buy Me A Coffee

  • Thank you! ๐Ÿ˜Š

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 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