OS Win10
PsychoPy version 2020.1.3
Standard Standalone? yes
What are you trying to achieve?:
Hi there, so I’m trying to build a visuomotor rotation experiment in Psychopy. I’m completely new to Psychopy and Python (have been using Matlab though). So far I have a starting circle, a mouse cursor (which is updated each frame) and a target circle. I want the target circle to appear after the mouse cursor has been in the starting circle for a random period between 500 and 800ms. Once the movement is initiated, the cursor should disappear and reappear when it crosses the distance to the target circle (this means it should reappear at the same radius as the target but it may be at a different location).
What did you try to make it work?:
In order to to have the target circle appear after a certain time, I added a code component and I’m checking “each Frame” whether the mouse is in the starting circle. Then I can add a a random delay after which the target appears and movement is initiated. This is how I’m doing it:
if baseline_mouse.getPos() in baseline_fixation.pos():
sleep(randint(0.5,0.8))
baseline_target_circle.opacity = 1
baseline_fixation.opacity = 0
baseline_fixation.pos = baseline_mouse.getPos() - mouse_center
baseline_fixation is my starting circle.
What specifically went wrong when you tried that?:
So first of all, I’m not sure if this is the right way to approach it. Is it better to use the ‘condition’ option in the components? Second, the code gets stuck at the first line when checking if the mouse is in the target. I know this is a coding problem but I don’t seem to be able to find the right way to phrase this…
This is the error I get:
if baseline_mouse.getPos() in baseline_fixation.pos():
TypeError: ‘numpy.ndarray’ object is not callable
Include pasted full error message if possible. “That didn’t work” is not enough information.