psychopy visual TypeError: 'str' object is not callable
I am writing to ask for your help because I get an error in my OpenSesame script that I can't really solve.
In my program there is an algorithm running which changes state (i.e. seizure/non-seizure) detecting in real time a stream of EEG data. The algorithm runs with a clock that is independent from the clock of the main experiment (i.e. the visual stimuli presentation). Using the psycho back-end, stimuli and a background animated background are shown. The subject has to press a Joystick button (implemented via PyGame) in order to give the right response. Therefore, while the subject sees the stimuli appear on the screen and responds to them by pressing the Joystick button, the algorithm processes the EEG data and makes the stimuli change according to the state the algorithm enters.
What happens is that anytime the algorithm enters the "seizure" state and the subject does not press the button in time, the function I repeatedly use both for the practice and the experimental session during a "non-seizure" state, does not work. I get this error: TypeError: 'str' object is not callable
The function I am talking about is the following:
def no_resp(): draw_after() TextStim3.draw() win.flip() clock.sleep(1000)
In particular the error in no_resp() is related to the line of win.flip(), which sounds very weird to me because all the other functions defined (which use win.flip() as well) when the subject gives both a correct or a wrong button press work fine in both states of the algorithm. Here it is how these functions are called in the inline script I use for stimuli presentation:
#If correct answer is given within time if var.responseKey == var.correct_response: [var.resRate_seizure, var.accu_seizure] = good_resp(var.resRate_seizure, var.accu_seizure) #If false answer is given within time elif var.responseKey != var.correct_response and var.responseTime != 0: var.resRate_seizure = false_resp(var.resRate_seizure) #No response elif var.responseTime == 0: no_resp()
Also, the same function (i.e. no_resp()) works perfectly during the practice trial and in the "non-absence" state of the algorithm.
I tried to check if any possible string I defined would show a similar name to win.flip. I tried to readdress all the win I have in the program (e.g.
Distractor_r = visual.Circle(win =win, units="pix", radius=50, fillColor=random.choice(["green", "Blue", "Red", "Magenta", "Orange"]), pos = (-800,85)).
I also tried to remove the function from that condition (i.e. elif var.responseTime == 0:) and just print something. In that case the error still persists on win.flip(), but this time it appears in the pre-stimuli animated background that is shown before stimuli are presented.
I have a hard time understanding what is happening. Can you maybe help me figuring it out? Is something somebody is familiar with as well?
Thanks a lot in advance for your time!