Howdy, Stranger!

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

Supported by

[solved] Use the images with highest mean score in likert scales in a experiment

edited January 2014 in OpenSesame

I open a second topic because this question is quite different:

I have another question about my project. I will do the Visual pro task, for this I want to use 10 images of food (5 healthy and 5 unhealthy).

The first thing I want to do is to ask to the child 2 questions about 50 images:

  1. "To what extent you think this food looks attractive?" "not at all (likert scale) very much"
    2 . "To me, this food is a temptation, difficult to resist eating it?" strongly disagree (likert scale) strongly agree

The second thing is, I would like that the software use the 10 images with highest mean score in the visual probe, automatically.

Is it possible?
I did not find any software yet possible to do it, and my supervisor advised to try OpenSesame.

Many thanks in advance,


  • edited March 2012

    I don't know of any software you could use within OpenSesame, but there's always the option to use an inline_script (where you can use Python code to do whatever the heck you want).

    Firstly, I think it'd work best if you were to name your pictures with a number (e.g. 0.bmp, 1.bmp, 2.bmp, ..., 49.bmp). After naming 'em correctly, you add your images to the file pool.

    Next up, you can set up a loop-item, running a sequence. In this loop-item, you create a variable called 'picname' (or something similar). You set 50 cycles. In each of the rows you type in one number, starting from 0 and moving all the way up to 49.

    Third, you add a sketchpad and a rating_scale to the loop's sequence. In the sketchpad, you click on the Image Tool, click on the place where you want to present your images (probably the middle of the sketchpad) and select the first image. You'll notice this image is now being presented on your sketchpad and if you were to run your experiment now, this very same image would be presented 50 consecutive trials.
    Luckily, we have already set up a variable named 'picname' and we're going to use it to present a new picture. In the sketchpad, press the 'edit script' button. You'll notice a line saying this:

    draw image 0.0 0.0 "0.bmp" scale=1.0 center=1 show_if="always"

    To present a different image each trial, change it to this:

    draw image 0.0 0.0 "[picname].bmp" scale=1.0 center=1 show_if="always"

    So far so good, it's quite likely you already knew it could be done like this. But here's the thing: in Python, you can use numbers to address values stored in variables. Example: we have a variable named 'banana', which 'stores' the values 1, 2 and 3 (in Pyhon, this would be written as 'banana = [1,2,3]'). Now, if we would like to know what value is stored on the second place in 'banana', we can call 'banana[1]'. This would produce the answer 2. Notice how you call banana[1] for the 2 position. This is because Python starts counting at 0. That's exactly why we have begun counting at zero too, by the way! Were going to use inline scripting to store scores for the pictures, using a single variable 'score', with 50 positions containing the individual scores per picture.

    After this, I'm going to ask you to add some code into inline_scripts. In this case, always do so within the 'run phase'!

    To do so, insert an inline_script all the way to the beginning of the experiment. In this inline_script, type:

    global scores # this is so our variable is callable throughout the entire experiment
    scores = {} # sets up an empty dictionary
    for picturenr in range(50): # runs for fifty times
        scores[picturenr] = 0 # adds a zero to our scores on every run

    This creates a dictionary (a kind of list, to be short) containing fifty 0's.

    Now, add an inline_script to your loop's sequence, right behind the rating_scale. In this one, you type:

    global scores # this is so our variable is callable throughout the entire experiment
    scores[self.get("picname")] += int(self.get(“response”)) # this adds the response score to the total score for this particular picture

    In the main sequence (NOT in the loop's sequence!), behind the loop-item, add yet another inline_script. In this one, the actual sorting will take place:

    global scores
    sortedscores = sorted(scores,key=scores.__getitem__, reverse=True) # sort our pictures, based upon the scores
    pictures = sortedscores[0:10] # select the first ten pictures

    Lastly, insert another loop on the main sequence, right behind the last inline_script. In this loop, create a variable called 'picture' and set the number of cycles to 10. In the first row, type [picture0]; in the second row, type [picture1]; in the third row, type[picture2]; etc.
    Then, in add a sketchpad to the sequence of your newest loop, press the 'edit script'-button and type the following:

    draw image 0.0 0.0 "[picture].bmp" scale=1.0 center=1 show_if="always"

    Now, you should be set to go! Of course, you probably want to add some loggers, an introduction and maybe some instructions in between, but that's up to you! :)

    Good luck!


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