Howdy, Stranger!

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

Supported by

[open] Visual Analogue Scale

edited April 2016 in OpenSesame

Dear all,

I'm programming my recognition experiment with OpenSesame and I've just started to learn python.
I want to collect continuos confidence ratings for 3 different categories (labels) using visual analogue scales (probably->confident). How can I do that?

image

Comments

  • edited 9:44AM

    Hi,

    Step one is to draw a canvas (similar to sketchpad, see http://osdoc.cogsci.nl/python/canvas/)

    Step two is to collect a mouse response, see http://osdoc.cogsci.nl/python/mouse/

    The mouse response contains a button as well as coordinates, and these coordinates can be used to retrieve your visual analogue scale score. You would just have to determine the coordinates of the scales beforehand, and then calculate to which % the X-coordinate corresponds.

    At some point you'll also want to do some subtle things, such as making sure that a mouse response only counts when it was actually on a scale. Your response collecting command will therefore probably have to be in a while loop, from which you only break when the response was valid.

    Good luck!

    Josh

  • edited April 2016

    Thanks a lot Josh!

    I'm stacked at the first point. Do I have to create (in Prepare) a canvas for each object (in this case: 3 rectangles, 3 words, 3 lines and 6 words) and ask OpenSesame to show them in the run section, right?
    It shows me the canvas sequentially, not all in the same time. Why?

  • edited 9:44AM

    Hi,

    For all items that are static (that is don't change depending on what you're doing on the screen), you have to use a single canvas. For all other items that do change, you need to add another layer and update it regularly. So, the first canvas, you can indeed prepare in the prepare phase. However, the dynamic layer has to go into the run phase, because the things you're showing (e.g. current selection), will change depending on your behaviour.

    Does this make sense?

    Eduard

    Buy Me A Coffee

  • edited April 2016

    Yes Eduard, it make sense.

    but how can I do that? I've done it, but the rectangles are displayed sequentially not all in the same time. I mean first the first rectangle appear and immediatly disappear, then the second rectangle appears. The same happens to the last one.

    How can I display something like this immage?
    image

  • edited April 2016

    If you want to show three of those sliders at the same time, have a look at this topic: http://www.cogsci.nl/forum/index.php?p=/discussion/827/solved-rating-slider-data-logging/p1

    The solution there is copied below (this should be in the Run phase of an inline_script item):

    # import everything we need
    from openexp.canvas import canvas
    from openexp.mouse import mouse
    
    # create the instances we need
    my_canvas = canvas(self.experiment)
    my_mouse = mouse(self.experiment, timeout=20)
    
    # slider dimensions
    slider_w = 500
    slider_h = 10
    slider_x = self.get("width")/2 - slider_w/2
    # three different y-coordinates, one for each slider
    slider_y = [self.get("height")/4, 2*self.get("height")/4, 3*self.get("height")/4]
    
    # variable names to store the slider fillings in
    names = ["slider_1", "slider_2", "slider_3"]
    
    # questions to put above the sliders
    questions = ["question 1", "question 2", "question 3"]
    
    # loop through all three slider positions, to draw the empty slider canvas
    for i in range(len(slider_y)):
        # draw some text (this can be anything)
        my_canvas.text(questions[i], y=slider_y[i]-100)
        # draw the slider frame
        my_canvas.rect(slider_x, slider_y[i], slider_w, slider_h)
    
    # add a text below the bottom slider, telling participants to click to accept
    my_canvas.text("Click to accept ...", y=slider_y[-1]+100) 
    
    # loop through all three sliders, waiting for input
    for i in range(len(slider_y)):
    
        # keep showing the interactive slider until a click has been made
        clicked = False
        while not clicked:
    
            # determine the slider fill based on the mouse position
            pos, time = my_mouse.get_pos()
            x, y = pos
            slider_fill = min(slider_w, max(0, x-slider_x))
    
            # draw an empty rect within the slider frame, effectively resetting it
            my_canvas.rect(slider_x+1, slider_y[i]+1, slider_w-2, slider_h-2, fill=True, color=self.get("background"))
            # draw the slider fill
            my_canvas.rect(slider_x+1, slider_y[i]+1, slider_fill-2, slider_h-2, fill=True)
            # show the updated canvas
            my_canvas.show()
    
            # Poll the mouse for buttonclicks
            button, position, timestamp = my_mouse.get_click(timeout = 20)
            if button != None:
                clicked = True
    
        # save the slider's filling
        slider_percent = 100.0*slider_fill/slider_w     
        self.experiment.set(names[i], slider_percent)
    
  • edited April 2016

    Thanks Edwin!
    This is amazing and really useful and it works well! But what if I would to let participant chose to answer just to one of these three sliders, and not to each one sequencially? Should I add a mousetrap to let the mouse visible?

  • edited 9:44AM

    Hi Edwin,
    In my output I cannot find any variable with slider_percent. I ust say that I inserted a logger not immediatly after the inline script, but in the end of the trial.

    Anyone can tell me why?
    # save the slider's filling
    slider_percent = 100.0*slider_fill/slider_w
    self.experiment.set(names[i], slider_percent)

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