Howdy, Stranger!

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

Supported by

calculate accurate response time in while-loop

edited June 2016 in OpenSesame

Hi,

I had created a Stop-Signal task recently using opensesame inline script. Everything goes well as expected for now.

But while looking at the result output, sometimes (not all always) some values in "response_time" would be illogically big values (e.g., 4455, 8757), or small values (like 1, or 0 (even a response was made)). The unusual results didn't appear every time, and the irrational values were not always at the same trials. (This situation occurred more often in Stop-trial, when subject could not hold the response as it supposed to do in stop-trial)

I'm wondering if there's any problem in the script... Or is there any reason could explain this

In stop-trial, the target would appear a period of time (stop-signal delay, SSD), and a stop-signal would appear. Three different scenarios might happen:

  1. if the response was made during SSD (before the stop-signal showed), the target would disappear once the response was made, and the given will be ceased and to the next trial;
  2. if the response is made after the stop-signal appeared, the trial would be ceased once it got a response;
  3. if the subject successfully held the response, the trial would be ended for "SSD + signal_duration (this would be the timeout period in stop trial)" period of time

I used while-loop to determine whether the stop-signal would be shown, and calculate the response time if a response is detected.

Here's the script for determining the response time during stop-trial:

    start_time = self.time()

    #clear pending input
    if my_mouse.flush() == False:
        click = None

    elapsed_time = 0

    while elapsed_time < self.get('stop_timeout'):
        t0 = GO_canvas.show()

        if elapsed_time < self.get('SSD'):
            click, pos, t1 = my_mouse.get_click(timeout=self.get('SSD'))
            if click != None:
                var.response_time = t1 - t0
                break

        if elapsed_time > self.get('SSD'):
            self.sleep(self.get('SSD'))
            STOP_canvas.show()

            if click == None:
                click, pos, stop_time = my_mouse.get_click(timeout=self.get('stop_duration'))
                break
            if click != None:
                click, pos, t1 = my_mouse.get_click(timeout=self.get('stop_duration'))
                var.response_time = t1 - t0
                break
        elapsed_time = self.time() - start_time 

Any suggestion or opinion will be very helpful

Thank you so much!!!

Best,

Samantha

Comments

  • edited 6:27AM

    Hi Samantha,

    I have a hard time following the logic of your script. I'm not sure it's incorrect, but it's definitely not the most straightforward implementation of a stop-signal task that I've seen! So I cannot really say what causes the weird behavior.

    My suggestion is to simply use the new coroutines plug-in. This was created especially for these situations, and the stop-signal task is actually given as an example experiment. If you're using OpenSesame 3.0, you have to install the coroutines plug-in separately:

    But you can also use the 3.1 prerelease, which is already quite stable and comes with coroutines by default:

    And then you can find the stop-signal task here:

    Cheers!
    Sebastiaan

  • edited 6:27AM

    Hi Sebastiaan,

    Thank you for the suggestion!

    I appreciate your time on this, and I'm sorry that my script is not that straightforward... (because the entire script is quiet complicated, so I just posted the part when the program started to collect the subject's response in stop trial)

    I actually considered using the coroutines plug-in at the beginning, but in this customized Stop-Signal task, we want the SSD (stop signal delay) to be dynamic. We want to use the tracking SSD, which the current period of SSD will depend on whether previous stop trial is accurate. If the subject successfully holds the response in the stop trial, the SSD will be increased by, that's say, 50 ms (this is the variable "stop_duration" in my first post) for the next stop trial, but if the subject fails to hold the response in stop trial, the subsequent SSD will be decreased by 50 ms.

    Does coroutines be able to do this?

    Many thanks,
    Samantha

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