psychopy.org | Reference | Downloads | Github

Simple posner cueing task - error with cue orientation specification

Hello all,
I am trying to program the simple Posner cueing task (based on online tutorial) in which an arrow cue points to the left or right and is followed by a target/probe circle also presented to the left and right to which the participant needs to responds. The positions of the cue and of the probe are specified in the excel sheet but it seems my code for orientation of the cue is turning error message:

Traceback (most recent call last):
File “C:\Users\USER\OneDrive\Área de Trabalho\psychopy\new_coding\posnertask.py”, line 27, in
cue.ori = (orient, 0)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\tools\attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\basevisual.py”, line 1414, in ori
self.dict[‘ori’] = float(value)
TypeError: float() argument must be a string or a number, not ‘tuple’

Experiment ended.

below see code for the experiment

from psychopy import core, visual, event, data

import csv
win = visual.Window([1000,568], fullscr=False, units=‘pix’)

cue = visual.ShapeStim(win, vertices = [[-30,-20], [-30,20], [30,0]],
lineColor = ‘red’, fillColor = ‘salmon’)

probe = visual.GratingStim(win, size = 80, # ‘size’ is 3xSD for gauss,
#we’ll change this later
tex = None, mask = ‘gauss’,
color = ‘green’)

#initialise some stimuli
fixation = visual.Circle(win, size = 5,
lineColor = ‘white’, fillColor = ‘lightGrey’)

datafile = open(“posnertask.csv”, newline=’’, encoding=‘utf-8-sig’)
reader = csv.reader(datafile, delimiter=";")

for row in reader:

orient = row[0]
posi = row[1]

cue.ori = (orient, 0)
cue.draw()
win.flip()
core.wait(0.5)

probe.pos = (posi, 0)
probe.draw()
win.flip()
event.waitKeys()

win.close

posnertask.csv (88 Bytes)

Can anyone help in this matter? Many thanks Best wishes
Jose

Why isn’t this cue.ori = orient ?

Thank you wakecarter changing to cue.ori = orient worked

Can I just make one more question…is there any way I can adjust this code to increase number of trials and randomize its order?

Thank you