 # Is there a psychopy function to generate coordinates for iso-eccentric locations in visual search displays?

Hello!
I am looking for a function that would automatically compute location coordinates for X items (X being an argument of the function) presented at X iso-eccentric locations equally spaced around the central fixation point (or equally spaced around a point Y that would also be an argument fo the function). Ideally, the function should also take an argument Z to specify the eccentricity, and stimulus type (I am planning to present both words and pictures ).
Many thanks for your help guys!

``````import numpy as np
from numpy import (sin, cos, pi)

"""Draw nPoints around a circle with radius and xLocs/yLocs given"""
degreePoints = 360/nPoints
angles = np.arange(0,360,degreePoints)
angles = [convert*pi/180 for convert in angles] # points of circle in radians
return xyss

xyss = isoEccentric(nPoints=4, radius=100, yLocs=0, xLocs = 0)
``````

This function will provide locations around coordinates defined by xLocs and yLocs, at a distance specified by the radius. You can see the points drawn using ElementArrayStim components - see attached example (if you run, use ‘q’ to quit).

isoEccentric.py (1.4 KB)
.

1 Like

@dvbridges That is awesome, thanks!! This will work for shapes and pictures. Will this function also work for words as well?

It should work, it will just be a case of defining the positions for each text component. If you create 4 locations in `xyss`, then you could have four text components that index the position of those coordinates in a list. E.g.,

``````text1.pos = xyss
text2.pos = xyss
#etc...
``````

Or, you could define the positions in when you initiate the text component object. E.g., see attached

isoEccentricText.py (1.5 KB)

Can this code be reworked so that it does not need to import numpy? and can be used on Pavlovia as an online experiment? It works great in builder but currently not able to initalize online

Hi @Emma1 , yes here is the converted Python function that is compatible with the auto-JS translate. You will need to add `Array.prototype.append = [].push;` to a separate code component used for JS code only (see Wakefields crib sheet).

``````def isoEccentric(nPoints=4, radius=100, yLocs=0, xLocs=0):
degreePoints = 360/nPoints
angles = []
xyss = []

for p in range(0, nPoints):
angles.append(p * degreePoints)
for angle in angles:
return xyss

xyss = isoEccentric(4, 100, 0, 0)
``````

Hello,

I am trying to achieve something similar, but I am having some troubles adjusting the code.
I am working in the builder mode and I have a visual search task with a target letter and many distractors letters. I want them to be randomly located at two eccentricities (4.30 deg and 9.07 deg) around the center of the screen (and sometimes in the centre) in different locations, without being overlapped.

Do I just need to create and then specify as many locations in xyss as my stimuli are?
I am not sure that my approach is correct though (as I am not that expert in pyshcopy or python), so any suggestions would be really appreciated Thank you in advance for your help 