Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Introduce an "Everything but X" in block loop

Hi,

I am building a RT Comprehension task where participants see a video prime, and have to decide whether it relates to a subsequent target object (yes / no).

What I am trying to do is that on compatible trials ("yes" trials) the correct object is called. That is no problem. However, I would like that in the incompatible trials, I would like the program to display any object at random that is not the correct object. How could I do that? I created an extra column "Shown_Target" (The video prime is later called as follows: set video_src "[Shown_Target][Prime][Producer].mp4"). I introduced the numbers of the correct objects for this block, and I would like to fill the empty cells with something like a code that tells the program "any object but X".

Is this possible? I am super grateful for any help I can get :)

Thanks!
Ingrid

P.s. Attached (I hope) you can see the block loop for the main task.

Comments

  • sebastiaansebastiaan Posts: 2,737

    Hi Ingrid,

    I don't fully understand your paradigm, but this sounds like something you could do with horizontal shuffling, which is an advanced loop operation. The idea would be that you put all incompatible objects in different columns, then shuffle these columns, and then take the first one, so that you end up with a randomly selected incompatible object.

    You can see how this works in this video (in a different context):

    Does that help at all?

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Ingrid MCIngrid MC Posts: 4

    Hi Sebastiaan,

    thanks for your help! It might work, but I am not sure about how to implement it. I will try to explain things from the beginning again, as if may not have been clear previously. Attached is also the OpenSesame file.

    As I mentioned, the experiment consists of relating video primes to image targets that are either compatible or incompatible with the video primes. The problem is that we have 30 different objects these primes and targets relate to.

    **The video primes are called in the sketchpad as follows:
    **set video_src "[Object][Prime][Producer].mp4"

    "Object" has 30 levels (we have 30 different objects) and "Prime" has two levels (we have two primes that relate to each object). You can ignore the "Producer" variable for the time being.

    Now, what I am trying to do is that in compatible=yes trials, the image target shows the correct object. That is why I created a variable called "Target" that indicates which target is to be displayed. What I would like is that in compatible=no trials, any object but the correct one is displayed.

    **The image targets are called in the sketchpad as follows:
    **draw image center=1 file="w_[Target].png" scale=1 show_if=always x=0 y=0 z_index=0

    If I create the horizontal shuffles, how do I write the command in the sketchpad?

    The only solution I can come up with now is to create, say, three blocks with differently assigned incompatible targets for each object, and just have the program run one of the three blocks at random every time a new experiment starts. Do you see what I mean? That, of course, is a suboptimal solution, and I would end up with an experiment that has dozens of blocks at every step of the way (given that the above is an example of one block, but I have more blocks with other materials to be added later on).

    I hope I made things a bit clearer. The dream solution I initially envisioned was that in the block loop, I could assign fixed and random values within a column. So, to have taken the **empty **cells you can see under "Target" and to have introduced in all of them a formula that would go along the lines of "everything but "correct"".

    Once more, thanks so much for your help.
    Ingrid

  • eduardeduard Posts: 875

    Hi Ingrid,

    That is much clearer. Unfortunately, I don't have much experience using the advanced options of the loop item (horizontal shuffle, etc). I prefer to do slightly advanced things directly in an inline_script. So something along these lines:

    import random
    target_list = [1,2,3,4]
    if compatible == 'yes':
         target = target_list[0]
    else:
         target = random.choice(target_list[1:])
    
    # do more stuff
    

    If you are interested, I can make a small example script for you?

    Eduard

  • Dear Eduard,

    thank you so much for your help.

    This would mean that Target list 0 would draw from a column that includes the right information for compatible objects, whereas any other target list (assigned to the compatible = no trials) would draw a random item from a second list, right? I think this sounds about right! Where exactly should I implement such a script?

    Indeed, I would be very happy if you could send an example. I hope it does not take too much time.
    Cheers,

    Ingrid

  • eduardeduard Posts: 875

    Hi,

    Put the inline_script in the beginning of your block, and either do everything in it (incl. stimulus presentation, response collection and logging), or just set the relevant files names that will be used henceforth.

    Attached a file that implements it. See the logic?

    Ps . It probably won't work, something weird is going one with your experiment. I suppose you played around with the loop settings? maybe it is better to start over.

    Eduard

    ads.osexp 411.8K
  • Once more, thanks!

    I ended up building the task a bit differently, by simply introducing two blocks with different non-compatible targets, and alternating their administration.

    What I am curious about is what you say about something weird going on with my experiment. On my laptop it all works fine, so I am not sure about what you mean.

    Ingrid

  • eduardeduard Posts: 875

    Hi,

    If it works don't worry too much. Not sure what exactly the issue is (could be also on my end), but when I opened your script (by clicking show general script, in the first item in the overview area), there were more than 1000 lines of code, which is far more than usual, even for rather complex experiments. I had the impression that for some reason OS remembered all the entries you have had in your loop table at some point while writing the experiment, but that's just guessing.

    Anyway, if it works reliably and you are happy, there is nothing to worry about :smile:

    Eduard

Sign In or Register to comment.