Howdy, Stranger!

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

Supported by

abort the trial after responding and jump to the next trial without continuing the current trial

edited May 2016 in OpenSesame

Hello,

I'm trying to use the inline script to create a customized Stop-Signal task with visual stop signal modality adapted for tablet. (participant needs to hold his/her response if a stop signal is present after the target showed, and the period during the target stimulus and stop signal is called "stop signal delay (SSD)")

So far, the script is going on the track that I want it to.

However, in the STOP condition, if a response was made BEFORE the stop signal, which means the reaction time is shorter than SSD, the script would be interrupt shortly somehow...
Although the task will continue, the subsequent 2-3 trials would be not presented normally (the stimulus presentations in the subsequent trials would bounce).

Here is the general (simplified) structure of the script:
1. fixation

  1. target and stop-signal (STOP condition) present

if var.stop_presence == 1:

t0 = GO_canvas.show()

 self.sleep(SSD)

STOP_canvas.show()

self.sleep(345)

GO_canvas.show()

elif var.stop_presence == 0:

t0 = GO_canvas.show()

  1. get the response

click, pos, t1 = my_mouse.get_click()

  1. define correct response

if var.stop_presence == 1:

if click != None:

      var.response_time = t1 - t0

      var.correct = 0

       .
       . (I skipped the detailed script for demonstration purpose)
       .

elif click == None:

      var.response_time = 0

      var.correct = 1

elif var.stop_presence == 0:

 if click != None:

     var.response_time = t1 - t0

       .
       . (define correct (1)/incorrect (0) response)
       .

else:

   var.response_time = 0 

   var.correct = 2 (missing response in GO condition)
  1. output to log file

I tried to use "if var.response_time <= SSD:" (Here's another question, how do I express "equal or less" in opensesame inline script. Cause the "<=" in python seems not work here...), but I'm not sure where to put this condition...

Is there function (like "break" or "continue") in opensesame inline that I can use to break the current trial under the condition when responding before the stop-signal in STOP trial and continue the task? (In that case, after a response is made, the stop-signal will not be presented, and this will be categorized as the incorrect STOP. But the given response time still needs to be recorded)

I appreciate any suggestion and help.

Thank you so much!

Best,
Samantha

Comments

  • edited 10:37PM

    Hi Samantha,

    It is difficult to say what causes the problem in your script due to the formatting but one of the options could be to place (parts of) the script within a while-loop. These loops run until a certain condition has been met, then you can choose to abort (break) the trial if a response has been given.

    For example:

    if var.stop_presence == 1:
    
       while True:
    
          # Set the timestamp for GO canvas
          t0 = GO_canvas.show()
          # Sleep the specified SSD duration
          self.sleep(SSD)
          # Check if a response has been given before the STOP-signal
          click, pos, timestamp = my_mouse.get_click(20)
          # Break the loop if response has been found
          if click != None:
             var.correct = 0
             break
          # If no response has been given display the STOP-signal and continue trial
          STOP_canvas.show()
    
          self.sleep(345)
    
          GO_canvas.show()
    

    This would be the general idea, but i have not tested it in any way nor am i very experienced with python, so proceed accordingly :)

    The 'equal or less' operator <= should work, are you sure the values are correct? Alternatively you can just use the 'less' operator (<) since the chance of the response time being exactly equal to the SSD in ms is very small.

    Best,
    Laurent

  • edited May 2016

    Hello Laurent,

    Thank you so much for the quick reply!
    Yes, the idea is very like to be working.
    But I have some questions regarding the "mouse.get_click" function in the while-loop.

    As you suggested, I have to check if a click response is made before the STOP-signal.
    To do this, you use

    click, pos, timestamp = my_mouse.get_click(20)

    In this line, what does the "20" mean? Should the value here be the duration of SSD?

    I actually used

    click, pos, t1 = my_mouse.get_click(self.get('SSD'))

    The SSD will change according to participant's response in the previous performance

    but an error message was showed: get_click() takes exactly 1 argument (2 given)

    Would I be able to collect the response time for this response? (Cause even this will be an incorrect STOP response, but I still have to record how this response is made, including the response as well as the response time)

    I'm basically a new hand in programming, any suggestion would be very helpfully.

    Thank you so much!!

    Best wishes,
    Samantha

  • edited May 2016

    Hi Samantha,

    In this line, what does the "20" mean? Should the value here be the duration of SSD?

    The 20 (which is in ms) sets the timeout duration to collect a mouseclick. I used this arbitrary number because the documentation uses it.

    click, pos, t1 = my_mouse.get_click(self.get('SSD'))

    That's a good idea but make sure to check how it behaves with the self.sleep(SSD) line, i don't think that you can simultaneously sleep and collect responses. But someone else please correct me if i'm wrong.

    but an error message was showed: get_click() takes exactly 1 argument (2 given)

    Maybe if you assign the SSD duration to the timeout argument beforehand it takes the correct time.

    Would I be able to collect the response time for this response?

    Yes, the t1 collects the timestamp of the mouseclick, you can derive the response time like you did in the original post:

    if var.stop_presence == 1:
    
       # Assign the timeout duration to SSD
       timeout = var.SSD
    
       while True:
    
          # Set the timestamp for GO canvas
          t0 = GO_canvas.show()
          # Sleep the specified SSD duration
          self.sleep(SSD)
          # Check if a response has been given for the duration of SSD
          click, pos, t1= my_mouse.get_click(timeout=timeout)
          # Break the loop if response has been found
          if click != None:
             var.response_time = t1 - t0
             var.correct = 0
             break
          # If no response has been given display the STOP-signal and continue trial
          STOP_canvas.show()
    
          self.sleep(345)
    
          GO_canvas.show()
    

    I'm not sure how this loop behaves when no response has been made during the SSD. In other words: if the while-loop doesn't end automatically after GO_canvas.show() you might want to inlcude another break after it. But like i said, i'm no expert either and haven't tested it.

    Good luck!

    Laurent

  • edited 10:37PM

    Hi Laurent,

    Thank you so much for the information.

    For this customized task, I put the "while-loop" at the beginning of the entire trial_script, and separated the "STOP" and "GO" conditions in the loop to make it easier to write the script. So far so good^^

    Thanks again.

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