PsychoPy version (e.g. 1.84.x): 3.2.4
OS: Mac OS Mojave 10.14.6
Standard Standalone?: Yes.
What are you trying to achieve?:
I want to register where mouse clicks are made, to see if they fall within a certain distance from a shape’s perimeter. The shape sizes are to be specified using degrees, and so I want to fetch the mouse’s coordinates in deg units as well, to simplify comparison of perimeter/mouse positions.
What did you try to make it work?:
I made a simple project to test coordinate registering out, and later simplified it even more to create a minimally reproducible example, available here: https://github.com/AnonZebra/psychopy_mouse_deg_coords
(note that if you try this out locally yourself, you need to change ‘Experiment Settings->Screen->Monitor’ from ‘myMacMonitor’ to a monitor specification that works with your setup)
In the experiment, there is a Polygon/Rectangle Component with width 5 and height 6 (size set to ‘(5, 6)’ ), and a Mouse Component that is set to save mouse state on every click. The Experiment Settings->Screen ‘Units’ option is set to ‘deg’.
As I understand the documentation for ShapeStim, the width specified should correspond to the distance from the left end to the right end of the object, as the documentation describes this example:
# This stimulus is 20% wide and 50% tall with respect to window
stim = visual.PatchStim(win, units='norm', size=(0.2, 0.5)
# This stimulus is 0.2 degrees wide and 0.5 degrees tall.
stim.units = 'deg'
That means that if I click the vertical center of the right end of the polygon, I expect the mouse coordinate to be roughly [2.5, 0].
So I tried to run the experiment and click the vertical center right end, horizontal center bottom, vertical center left end and horizontal center top of the polygon.
What specifically went wrong when you tried that?:
The coordinates in the data file are
mouse.x: [5.086002249832904, -5.043262735128426, 0.6838322352716509, 0.34191611763582547]
mouse.y: [1.1112273823164327, 0.8547902940895638, 5.983532058626945, -6.154490117444858]
So I am getting coordinate values that are twice as high as what I expect. I’ve tried to manually measure the polygon’s width on the screen and that seems OK when comparing the measurement to what the formula 5/360 * 2 * pi * [distance from screen]
gives. So the polygon seems to be rendered as it should. It’s just that the mouse coordinates are odd.
I’ve also tried other kinds of shapes and clicking the edges of the screen - in all cases, the mouse coordinates seem to be about twice as large as they should.
In sum
Does anyone know what I might be doing wrong that leads to mouse coordinates in deg units being twice as large as what should be expected? If someone could download the .psyexp file on github and try to reproduce the error that would be very helpful.
Edit: I just tried to change the experiment settings and the polygon setting to ‘px’ units. Everything then works as expected - e. g. clicking the right end of the polygon when it’s set to width of 500px generates an x coordinate of 250. So the issue seems to be specific for when using ‘deg’ units.