I am trying to build an experiment in which there is one target shape depending on which condition file is picked. The rest of the shapes would be homogenous. For example, if the green_circle.xlsx conditions file is picked then the green circle will always be the target. There will be dots on different sides of each shape, and the participant will have to press ‘q’ if the dot is on the left side of the target shape, and ‘p’ if the dot is on the right side of the target shape.
In order for this to work, I included opacity in the conditions. If the shape is included in the trial, the opacity will be one, if not, the opacity will be 0. I have created 16 shape components for this to work.
I am struggling to have the shapes be recognized from my conditions file and even have them show up on the screen. I will attach pictures of some of my conditions files and builder. Please let me know if you have any advice - this is my first time coding in psychopy! Thank you!!
green_circle.xlsx (15.3 KB)
green_diamond.xlsx (15.2 KB)
Defining Shapes
print(“Condition file selected:”, condition_file)
print(f"Trial data: {trial}“)
print(f"Shape1 value: {trial.get(‘Shape1’, ‘NOT FOUND’)}”)
determine item positions
current_positions = all_positions
shuffle(current_positions)
occupied_positions = current_positions[0:4]
item_pos = {
‘Shape1’:occupied_positions[0],
‘Shape2’:occupied_positions[1],
‘Shape3’:occupied_positions[2],
‘Shape4’:occupied_positions[3]
}
determine target shape
if condition_file == ‘green_circle.xlsx’:
target_shape = ‘Circle’
elif condition_file == ‘red_circle.xlsx’:
target_shape = ‘Circle’
elif condition_file == ‘green_diamond.xlsx’:
target_shape = ‘Diamond’
elif condition_file == ‘red_diamond.xlsx’:
target_shape = ‘Diamond’
elif condition_file == ‘green_square.xlsx’:
target_shape = ‘Square’
elif condition_file == ‘red_square.xlsx’:
target_shape = ‘Square’
elif condition_file == ‘green_hexagon.xlsx’:
target_shape = ‘Hexagon’
elif condition_file == ‘red_hexagon.xlsx’:
target_shape = ‘Hexagon’
instructions
example_trial_txt = [
'\nIn this example, the correct response is ’ + correctAns_txt,
'\nBecause that is the position of the dot inside the ’ + ins_target,
‘\n\nPress the SPACEBAR to continue’]
example_trial_txt = ‘’.join(example_trial_txt)