Howdy, Stranger!

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

Supported by

[solved] Displaying/Recording Responses at the same time as pictures

edited August 2014 in OpenSesame

Hiya

I've been looking through the forum and discussions and haven't managed to find a thread that relates to my difficulty yet (may have just missed it).

The experiment that I would like to run displays a picture then the participant has to choose which emotion they are feeling. Ideally I would like the participant to see the picture and options (emotions) at the same time. Then either through touch response or via mouse click for them to choose the appropriate emotion. How do I do this? I've managed to upload all the pictures (and then run fine) and then tried to put in multiple choice response but don't know how to put them together.

I'm new to opensesame so if there is a tutorial that would be amazing.

Hope I've made sense

Best wishes

Ollie

Comments

  • edited 2:01PM

    Hi Ollie,

    It sounds like you would be best off using a custom form:

    For example, the script below, which should be placed in a form_base plug-in item, presents a picture and three clickable checkboxes. The picture is taken from a file in the file pool, defined by the variable picture. The response is stored in the variable emotion.

    This is one way to collect responses, but you could also use buttons, buttons with images (a smiley face for happy, etc.), or a rating scale. All of this is explained on the page linked to above.

    Hope this helps!

    Sebastiaan

    set rows "1;1"
    set cols "1;1;1"
    widget 0 0 2 1 image path="[picture]"
    widget 0 1 1 1 checkbox group="emotion" click_accepts="yes" text="Happy" var="emotion_response"
    widget 1 1 1 1 checkbox group="emotion" click_accepts="yes" text="Neutral" var="emotion_response"
    widget 2 1 1 1 checkbox group="emotion" click_accepts="yes" text="Sad" var="emotion_response"
    
  • edited 2:01PM

    Hi Sebastiaan,

    Thanks very much that looks really helpful.

    Will let you know how i get on.

    Best wishes

    Ollie

  • edited 2:01PM

    Hi again,

    How do you change the size of the picture at the moment its really small (i'm using the python code version).

    I tried form.set_widget(image, (0,2),colspan=4) thinking that it would span the 4 columns but this was not the case,

    then tried image.set_rect(rect) but that also did not work.

    I'm sure its relatively simple.

    Also I was wondering whether you have to create a new script for each new photo or whether you can code it so that it randomises it from the file pool somehow?

    Best wishes

    Ollie

  • edited 2:01PM

    Hi Ollie,

    How do you change the size of the picture at the moment its really small. I tried form.set_widget(image, (0,2),colspan=4) thinking that it would span the 4 columns but this was not the case.

    The size of the picture is adapted to fit the cell it's placed in. Because you only changed the column span but not the row span, the size of the picture didn't change. Does changing the row span as well solve your problem?

    # Change the colspan as well as the rowspan to make the picture larger:
    form.set_widget(image, (0,2),colspan=4, rowspan=4)
    

    Also I was wondering whether you have to create a new script for each new photo or whether you can code it so that it randomises it from the file pool somehow?

    Sure! You can retrieve all trial information from your block loop in an inline_script item by using the built-in experiment function self.get(). For example:

    # Retrieve the picture of the current trial from the block loop by using 
    # the self.get() function.
    
    # (In the example below it is assumed that the header of the column
    # containing the names of the  pictures in the filepool is called 'picture')
    pict = self.get("picture")
    
    # Next, we use the new variable 'pict' for the widgets.image() function:
    image = widgets.image(form, path=self.experiment.get_file(pict))
    

    For more information, see:

    Eventually, your inline code should probably look something like this:

    # Import the widgets library
    from libopensesame import widgets
    
    # Create a form
    form = widgets.form(self.experiment, cols=[1,1,1,1,1,1,1], rows=[1,1,1,1,1,1], margins=(50,100,50,100), spacing=25)
    
    # Retrieve the picture of the current trial from the block loop by using 
    # the self.get() function.
    
    # (In the example below it is assumed that the header of the column
    # containing the names of the  pictures in the filepool is called 'picture')
    pict = self.get("picture")
    
    # Next, we use the new variable 'pict' for the widgets.image() function:
    image = widgets.image(form, path=self.experiment.get_file(pict))
    
    # Change the colspan as well as the rowspan to make the picture larger:
    form.set_widget(image, (0,2),colspan=4, rowspan=4)
    form._exec()
    

    Does this help?

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 2:01PM

    Hi Lotje,

    That's really helpful thank you very much.

    Best wishes

    Ollie

  • edited 2:01PM

    Hello,

    I am having trouble recording responses.

    I have created a inline script experiment that asks what emotion the person is showing and how much they empathise with that person however:

    I need the experiment to record response and target response, which if I choose just those variables it doesn't record, however if I choose record all it records all the responses but not the target response (and creates a very messy table) any suggestions?

    Best wishes

    Ollie

  • edited 2:01PM

    Hi Ollie,

    Could you be a bit more specific? How exactly are you collecting responses, which variables do you want to log and which variables are missing?

    Cheers,
    Sebastiaan

  • edited October 2013

    Hi Sebastiaan,

    Thanks for the reply,

    I've created a multiple choice form (with yours guys help) where the participant clicks on the emotion that they think matches the picture.

    what I would ideally like is the experiment to record the response (emotion chosen) and what emotion they should have chosen (target emotion).

    Is there a way to send you the expt so you guys could look over it?

    This is what the inline script looks like at the moment:

    from libopensesame import widgets
    
    print "Image Num : " + str(number)
    
    # Create a form
    form = widgets.form(self.experiment, cols=[1,1,1,1], rows=[1,2,1,1],
        margins=(50,100,50,100), spacing=25)
    # Create four widgets
    labelTitle = widgets.label(form, text='Question')
    labelQuestion = widgets.label(form,
        text='What Emotion is this Person Feeling?',
        center=True)
    
    pict = stimulus[number][0]
    image = widgets.image(form, path=self.experiment.get_file(pict))
    
    variable1 = stimulus[number][1]
    variable2 = stimulus[number][2]
    variable3 = stimulus[number][3]
    variable4 = stimulus[number][4]
    
    button1 = widgets.button(form, text=variable1)
    button2 = widgets.button(form, text=variable2)
    button3 = widgets.button(form, text=variable3)
    button4 = widgets.button(form, text=variable4)
    
    # Add the widgets to the form. The position in the form is indicated as a
    # (column, row) tuple.
    form.set_widget(labelTitle, (0,0), colspan=4)
    form.set_widget(labelQuestion, (0,0), colspan=4)
    form.set_widget(image, (0,1), colspan=4, rowspan=2)
    form.set_widget(button1, (0,3))
    form.set_widget(button2, (1,3))
    form.set_widget(button3, (2,3))
    form.set_widget(button4, (3,3))
    # Execute the form! In this case, the form will return the text of the button that
    # was clicked. This is one way to get a return value out of the form. Another way
    # is to use the 'var' keyword, supported some of the widgets.
    
    Response = form._exec()
    

    There is also a rating of emotion:

    # Import the widgets library
    from libopensesame import widgets
    print "Image Num : " + str(number)
    # Create a form
    form = widgets.form(self.experiment, cols=[1,1,1,1,1,1,1,1,1], rows=[1,2,1,1],
        margins=(50,100,50,100), spacing=25)
    # Create four widgets
    labelTitle = widgets.label(form, text='Question')
    labelQuestion = widgets.label(form,
        text='How Much do you empathize with this person? How Much do you feel for this person? 1 = not at all; 9 = very much',
        center=True)
    
    
    pict = emp_stimulus[number][0]
    image = widgets.image(form, path=self.experiment.get_file(pict))
    
    variable1 = 1
    variable2 = 2
    variable3 = 3
    variable4 = 4
    variable5 = 5
    variable6 = 6
    variable7 = 7
    variable8 = 8
    variable9 = 9
    
    button1 = widgets.button(form, text=variable1)
    button2 = widgets.button(form, text=variable2)
    button3 = widgets.button(form, text=variable3)
    button4 = widgets.button(form, text=variable4)
    button5 = widgets.button(form, text=variable5)
    button6 = widgets.button(form, text=variable6)
    button7 = widgets.button(form, text=variable7)
    button8 = widgets.button(form, text=variable8)
    button9 = widgets.button(form, text=variable9)
    
    # Add the widgets to the form. The position in the form is indicated as a
    # (column, row) tuple.
    form.set_widget(labelTitle, (0,0), colspan=4)
    form.set_widget(labelQuestion, (0,0), colspan=9)
    form.set_widget(image, (0,1), colspan=9, rowspan=2)
    form.set_widget(button1, (0,3))
    form.set_widget(button2, (1,3))
    form.set_widget(button3, (2,3))
    form.set_widget(button4, (3,3))
    form.set_widget(button5, (4,3))
    form.set_widget(button6, (5,3))
    form.set_widget(button7, (6,3))
    form.set_widget(button8, (7,3))
    form.set_widget(button9, (8,3))
    # Execute the form! In this case, the form will return the text of the button that
    # was clicked. This is one way to get a return value out of the form. Another way
    # is to use the 'var' keyword, supported some of the widgets.
    count = count +1
    
    Response = form._exec()
    

    Hope that helps

    Ollie

  • edited 2:01PM

    Looking at your scripts, I think the problem is simply that you have not used exp.set() to make the variable Response available elsewhere in the experiment, such as in the logger item.

    Basically, you can set the form response as the experimental variable my_form_response like this:

    Response = form._exec()
    exp.set('my_form_ response', Response)
    

    Practically speaking, this will give you a column in your logfile that is called my_form_response and contains the text on the clicked button. Of course, you will need to use different variable names for the two forms, otherwise they will overwrite each other.

    Does that clear things up?

    Is there a way to send you the expt so you guys could look over it?

    You can upload your experiment through one of the services listed above the reply box.

    Cheers!

  • edited 2:01PM

    still wont work for me

  • edited 2:01PM

    Have you tried turning it off and on again?

    But seriously, you will need to be a bit more specific about 1) what you want, 2) what you did, and 3) what went wrong specifically (preferably accompanied by an error message). By simply telling us it doesn't work for you, we don't have a clue about where to start troubleshooting!

  • edited 2:01PM

    nvm edwin i figured it out .. xoxo thanks

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