Howdy, Stranger!

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

Supported by

Presenting sets with random number of stimuli in random order

edited April 2016 in OpenSesame

Hello to all,

I need some help. I am trying to build an experiment in which 5 sets of pictures will be presented in a very fast pace (0.3 second each picture). Thing is, I want the order of the pictures to be random and the order of the sets to be random as well. In addition, the sets are to be created from 2 different categories, each set with a random number of stimuli from each category (for instance, 8 from A 10 from B, 6 from A 5 from B, etc.), although the number cannot be too small (say min 4). Does anyone have an idea how to do this?

Thanks in advanced
Amihai

Comments

  • edited 1:45AM

    Any help?

    I have done some progress and have another question: Is there a way to run less cycles than the variable levels in a loop? meaning the loop will choose randomly from the levels.
    I tried putting [a variable] in the cycles number but got an error.

  • edited April 2016

    Hi Amihai,

    Have you already solved the randomization problem?

    Is there a way to run less cycles than the variable levels in a loop?

    Yes! In the loop item there is an advanced options checkbox. If you enable it, you can set a value for a break if field. In this field, you can add variable names.

    Does this make sense?

    Eduard

    Buy Me A Coffee

  • edited 1:45AM

    Dear Eduard,

    I solved part of the randomization problem using loop functions.
    I was thinking to use the "less cycles than the variable levels in a loop" solution to randomize the number of stimuli from each category (although not an elegant solution..).
    Do you know how could I use the Break if check box to do this?

    And thanks for your help.

    Amihai

  • edited 1:45AM

    Hi Amihai,

    you could use a counter variable and break the loop (with the break_if field), once the variable has a certain value. So, if you have a loop that supposed to have 15 trials, you add an inline_script to your trial_sequence, in which you increment the variable by one (counter += 1).

    Does something like that work for you?

    Good luck,

    Eduard

    btw. sorry for the late reply!

    Buy Me A Coffee

  • edited 1:45AM

    Dear Eduard (or anyone else who can help),

    Thank you very much for your replay. I used your tip and eventually managed to find a plausible solution. Yet, now I have another problem: I need to log the pictures that were eventually presented in the loop from the total number of possible pictures. The output file does not give me this information. Is there a way to do this?

    Thanks you
    Amihai

  • edited 1:45AM

    Hi Amihai,

    All exp.variables are automatically logged by the log item, so all you have to do is to store the picture names in a few variables.

    Say you have a picture list as follows: pictures = ['1.jpg','2.jpg','3.jpg'], shuffled with random.shuffle(pictures). Now you can log them as follows:

     exp.pic1 = pictures[0]
     exp.pic2 = pictures[1]
     exp.pic3 = pictures[2]
    

    Hope this hepls.

    Cheers,

    Josh

  • edited 1:45AM

    Hi Josh,

    First of all, thank you.
    Secondly, I did not understand your answer. I am using a loop function to randomly show the pictures from a variable list with the pictures names. I have two categories of pictures so to randomly show a different proportion from each category I used the "less cycles than the variable levels in a loop" option (see above). How can I know which pictures were eventually shown?

    Amihai

  • edited 1:45AM

    Still no luck.
    doed any one have an idea how to solve this?

  • edited 1:45AM

    Hi Amihai,

    What I suggested requires the use of an inline_script item. You can place that thing somewhere in your trial sequence. I also assume that your pictures have names, right? (e.g. '1.jpg'). As soon as the picture for your trial is specified, you can log it.

    Cheers,

    Josh

  • edited 1:45AM

    Hi Josh,

    I am using the sketchpad to display the images from the loop function.
    This is the text from the sketchpad script:

    set duration "[duration]"
    set description "Displays stimuli"
    draw image center=1 file="[words]" scale=1 show_if=always x=0 y=0 z_index=0

    How can i log the image from this?

    And thank you very much for your help

    Amihai

Sign In or Register to comment.