Search code examples
psychopy

Calling to a different stimuli lists


I need to call to a different column with the stimuli depending on a previous given response. I.e. age

  • ask for age
  • if age = X --> choose a certain stimuli column (or a certain xlsx file)

What would be the basic procedure to do this. I am new in Psychopy.

Thanks a lot Elena


Solution

  • You can add a field for age to the experiment info dialog box shown at the beginning of each session. Then you can refer to that value later in code as expInfo['age'].

    Let's say you have two columns in your conditions file, labelled list_A and list_B, and you want to use either of those to put values into a text stimulus. In that text stimulus, put a variable called something like $text_list. Then in a code component, in the "begin routine" tab, put something like this:

    if expInfo['age'] > 30:
        text_list = list_A
    else:
        text_list = list_B
    

    The same principles apply if you want to select between .xlsx files. Put a variable name in the conditions file file field of the loop dialog, and in some routine prior to the loop, set that variable to contain the desired filename.