Howdy, Stranger!

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

Supported by

Create 12 unique random pairs from two different lists, and KEEP the pairing constant

2»

Comments

  • Hi @eduard , Hi @lvanderlinden


    Thanks a lot for your message.

    Here I am sharing a We Transfer link where you could download all the png files and my experiment.

    Thanks a lot


    B

  • edited November 2022

    Hi @bbTokyobb ,


    Unless I'm missing something, I think you can do the following:


    • Define the properties of the four to-be-displayed profiles in the `Prepare tab` of an inline_script item (in the trial sequence) like so:
    # Get variable names for each pairing:
    var.face1, var.bio1 = stim_pairs[0]
    var.face2, var.bio2 = stim_pairs[1]
    var.face3, var.bio3 = stim_pairs[2]
    var.face4, var.bio4 = stim_pairs[3]
    
    # Define y coordinates:
    import numpy as np
    var.y1, var.y2, var.y3, var.y4 = np.linspace(-250, 250, 4)
    
    # Define x coordinates:
    var.x1, var.x2 = [-200, 200]
    


    • And use the square-bracket notation to refer to those variables in a subsequent sketchpad item like so:
    set duration keypress
    set description "Displays stimuli"
    draw image center=1 file="[face1].png" scale=0.25 show_if=always x="[x1]" y="[y1]" z_index=0
    draw image center=1 file="[bio1].png" scale=0.25 show_if=always x="[x2]" y="[y1]" z_index=0
    draw image center=1 file="[face2].png" scale=0.25 show_if=always x="[x1]" y="[y2]" z_index=0
    draw image center=1 file="[bio2].png" scale=0.25 show_if=always x="[x2]" y="[y2]" z_index=0
    draw image center=1 file="[face3].png" scale=0.25 show_if=always x="[x1]" y="[y3]" z_index=0
    draw image center=1 file="[bio3].png" scale=0.25 show_if=always x="[x2]" y="[y3]" z_index=0
    draw image center=1 file="[face4].png" scale=0.25 show_if=always x="[x1]" y="[y4]" z_index=0
    draw image center=1 file="[bio4].png" scale=0.25 show_if=always x="[x2]" y="[y4]" z_index=0
    


    For a working example, see here (note that the link will expire):


    Does this help?


    Cheers,


    Lotje

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

  • Dear @lvanderlinden


    Thank you so much for your help!

    Altough I am not sure to totally understand, It works fine!


    Thank you very much again for your help.

    Benoit

  • Hi, I tried to replicate this lists qith the same code but it gives me an error in code

    var.queso = stim_pairs[var.trial_no - 1][0]

    var.nutri = stim_pairs[var.trial_no - 1][1]

    Could someone help me?



  • edited May 2023

    Hi Irene,

    I assume that is the same question as in here. So let's keep the discussion at one place, like that it is easier to not lose the overview.

    For the record, the error message suggests, that your variable var.trial_no is not a number but text. If you fix that, the error should disappear.

    Eduard

    Buy Me A Coffee

  • Thank you so much for your answer, how could I fix that? I`m new programming.

  • I can't tell you how to fix that without knowing what you did. You need to provide a lot more information on your implementation, provide code examples, or even the experiment, and specify what precise problem you have in order for me to properly help you.

    I`m new programming

    If you are new to programming, then I would recommend to take a step back and follow some of our tutorials before you start with your own experiment. Like that you can familiarize yourself with the software and understand the basics. Such that you are more independent to design your own task.

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.