URL of experiment: https://gitlab.pavlovia.org/nicbadcock/phonological-attentional-blink
Description of the problem:
I’m new to PsychoPy and attempting to create an experiment (including bits of code) within the builder to generate a PsychoJS script to use with pavlovia. I’d like to be able to import a stimulus file (different to a condition file that I use TrialHandler for) in order to create random lists of items for presentation (i.e., a rapid serial visual presentation) using matrix selection (i.e., give me all of the item in the ‘target’ column when the ‘target_number’ column is equal to ‘T2’).
I’ve got this working with the pandas library and it functions nicely in the builder (see PAB2020.py / PAB2020.psyexp). For example, creating a list of T2 (second target) items from a ‘target’ column contingent upon a ‘target_number’ column being equal to ‘T2’:
T2list = list(stim['target'][(stim['target_number'] == 'T2')])
But the conversion from PsychoPy to PsychoJS fails with pandas included (consistent with some threads in the forum).
I’ve imported the stimulus file with TrialHandler but I can’t figure out how to handle the data to do matrix selection of stimuli. I am able to access rows nicely but the column functionality has me stumped.
targets = data.TrialHandler(nReps=0, method='sequential', originPath=-1, trialList=data.importConditions("C:\DATA\gitlab\PAB\PAB_stimuli_targets.xlsx"), seed=None, name='targets') first_row = targets.trialList
I have attempted converting the sheet to a ‘wide’ format but I’m not able to select multiple columns using logical tests (i.e., just end up with a single FALSE) value.
Any help for matrix selection of items within native PsychoPy functions would be ideal but maybe there are some libraries that operate with PsychoJS. Very open to suggestions.
PS I haven’t attempted to only code this in PsychoJS yet as I wanted to build it up piece by piece within the builder so I could learn PsychoJS but doing it a little more blindly is my fallback