Howdy, Stranger!

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

Supported by

[open] Count key response

edited November 2014 in OpenSesame

Hi everybody. I'm having one little trouble with my experiment.

I'm collecting duration of specific key press (e.g. how long did participant press key A and key L) and I'm using inline script for that (psychopy backend, pyglet key). Now, I would like to collect sum of all key presses of these two keys (e.g. how many time did participant pressed key A, key L and both keys).

Inline script goes like this: https://gist.github.com/neklektyk/4b48ea0241e77644d855

I know that this is silly question, but I can't find anything in pyglet key doc. Do you guys have any idea?

Cheers!

Comments

  • edited 2:00PM

    Hi,

    So if I understand correctly what you're still missing a counter, i.e. you want to count how many times each key is pressed. Is that correct? I'm not very familiar with the inner workings of pyglet, but it looks like you'll have to implement some logic yourself to keep track of when a key state changes, and increment your counters accordingly. Something like:

    if response[[key.A] and not previous_response[key.A]:
        counter_A += 1
    

    Does that make sense? Looking at the complexity of your script you're not a Python newby, so I imagine this is feasible. (But not terribly convenient.)

    Hope this helps!

    Sebastiaan

  • edited 2:00PM

    Hi Sebastian.

    Yes, that's the little thing I'd like to count. I'll try to incororate these few lines of code into script, which is made by friend of mine, who is coding magician :)

    Beside this, I spotted one big problem: the script is not logging all the events (e.g. not all key press/release). In some number of cases, events are not even logged, like I didn't pressed/released any of keys. Do you have any idea what can be the problem? Maybe pyglet key?

    Cheers!

  • edited 2:00PM

    Yes, I see. You're setting the experimental variables after the loop. In other words, you're only logging the final state of the response variables. If you want to log every key press/ release, you would have to do this during the response collection loop. See what I mean?

    The easiest way to do this would be to write a message to the log file whenever something important happens. Just like you're printing stuff to the debug window now. Like so:

    self.log('pustio a %s' % time_a_only_pressed)
    

    If you do this, you will get an event-based logfile, which is very different from (and incompatible with) the spreadsheet logfile that the logger item will create for you. So that may be tricky, if you're not used to that kind of data. If you want to stick to a spreadsheet format, you'll have to decide first exactly how you want to organize your data. I.e. which columns do you want to have, and what kind of info should they contain?

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