Howdy, Stranger!

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

Supported by

[open] Displaying Error Feedback with 'Swipe Stimuli' on Android

edited December 2015 in OpenSesame

Hello,

I have an experiment that involves 'swiping' stimuli up and down the screen (an image is presented, and the individual then either swipes it towards or away from them), however I want to make this blocked instead of free-response - thus there will be incorrect/error feedback. However, I'm not entirely sure how to do this seeing as the image is being swiped, so it is the end location that needs to provide the feedback of whether it was an error or not (as well as whether it was too slow).

from openexp.mouse import mouse
from openexp.canvas import canvas
my_mouse = mouse(exp)
my_canvas = canvas(exp)
path = exp.get_file(u'NEM4.png')
upper = exp.get("height") - 200
lower = 200
my_canvas.image(path)
trialstart = my_canvas.show()
button, position, movstart = my_mouse.get_click(timeout=None)
exp.set ("position_NEM4", position)
while True:
    pos, time = my_mouse.get_pos()
    my_canvas.clear()
    my_canvas.image(path, x=pos[0], y=pos[1])
    timestamp = my_canvas.show()
    if pos[1] < lower:
        response = "top"
        break
    if pos[1] > upper:
        response = "bottom"
        break
    # calculate the movement time
    movtime = timestamp - movstart
    # calculate the RT
    resptime = movstart - trialstart
exp.set("response_NEM4", response)  
exp.set("movetime_NEM4", movtime)
exp.set("reponse_time_NEM4", resptime)

Thanks!

Comments

  • edited 8:21AM

    Hey,

    I don't really understand the problem. When exactly do you want to present the feedback? During the movement, or after it is done? From what I get so far, your situation is not much different than in a regular experiment.

    Would you mind helping me out here?

    Eduard

    Buy Me A Coffee

  • edited 8:21AM

    Hi Eduard,

    I would like the feedback to be presented if the image is swiped in the wrong direction (there is a sketchpad item before each image telling the participant which way to swipe), which I thought could be done by importing another sketchpad item to the script when it's the wrong way?

    Also, there needs to be feedback if the response time is too short or too long, however I'm not entirely sure how to do this.

    So basically, for the former, the feedback would be after the movement is done (i.e. if the response is incorrect) and the latter would be before the movement if it is too slow and after if it was too quick, if that makes any more sense?

    Thanks!

  • edited December 2015

    Hi,

    Assuming that you have a variable that codes the correct response, this code here (adapted from the one you posted) should do what you want.

    from openexp.mouse import mouse
    from openexp.canvas import canvas
    
    my_mouse = mouse(exp)
    my_canvas = canvas(exp)
    feedback_cv = canvas(exp) # new
    
    correct_response = exp.get('correct_response') # new
    path = exp.get_file(u'NEM4.png')
    upper = exp.get("height") - 200
    lower = 200
    min_rt = 100 # new
    max_rt = 2000 # new
    my_canvas.image(path)
    trialstart = my_canvas.show()
    while True: # new
        button, position, movstart = my_mouse.get_click(timeout=None)
        exp.set ("position_NEM4", position)
        if movstart - trialstart < min_rt: # new
            feedback = "Too quick!" # new
            break # new
        elif movstart - trialstart > max_rt: # new
            feedback = "Too slow!" # new
            break # new
        while True:
            pos, time = my_mouse.get_pos()
            my_canvas.clear()
            my_canvas.image(path, x=pos[0], y=pos[1])
            timestamp = my_canvas.show()
            if pos[1] < lower:
                response = "top"
                responded = True # new
                break
            if pos[1] > upper:
                response = "bottom"
                responded = True # new
                break
        break
    
    if responded: # new
        if correct_response == response: # new
             feedback = "Correct!" # new
        else: # new
             feedback = "Wrong!" # new
    feedback_cv.text(feedback) # new
    feedback_cv.show() # new 
    self.sleep(1000) # new
    # calculate the movement time
    movtime = timestamp - movstart
    # calculate the RT
    resptime = movstart - trialstart
    exp.set("response_NEM4", response)  
    exp.set("movetime_NEM4", movtime)
    exp.set("reponse_time_NEM4", resptime)
    
    # note: I did not define a correct response here. 
    # This should have happened earlier
    

    As you can see I added another while loop to make it work. Can you try the code and let me know whether it does what it supposed to do?

    Thanks,

    Eduard

    Buy Me A Coffee

  • edited 8:21AM

    Whereabouts should I be defining the correct response? Is it in this bit:

    correct_response = exp.get('correct_response') # new 
    

    or

    if responded: # new
        if correct_response == response: # new
             feedback = "Correct!" # new
    

    The correct response for example would be 'bottom'.

    Thanks for your help.

  • edited 8:21AM

    Rather the first than the second, in best case even earlier. Like you said, a sketchpad informs the subjects which direction is the correct one. I suppose this direction is not constant but can change over trials. Therefore, you would have to have a variable, whose value is updated on every trial and defines the direction. This variable (if it has the values bottom and top) you can use as correct response variable.

    The typical approach is to define for every unique trial the respective correct response in the loop table. If you did so, you can retrieve those values with the command exp.get(variable).

    Does this make sense?

    Eduard

    Buy Me A Coffee

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