I checked out the source code for dotStim and it looks pretty basic in its generation of the location of dots
def _newDotsXY(self, nDots): """Returns a uniform spread of dots, according to the fieldShape and fieldSize usage:: dots = self._newDots(nDots) """ if self.fieldShape=='circle':#make more dots than we need and only use those that are within circle while True:#repeat until we have enough new=numpy.random.uniform(-1, 1, [nDots*2,2])#fetch twice as many as needed inCircle= (numpy.hypot(new[:,0],new[:,1])<1) if sum(inCircle)>=nDots: return new[inCircle,:][:nDots,:]*0.5 else: return numpy.random.uniform(-0.5, 0.5, [nDots,2])
It doesn’t seem to handle instances where in the event if the spawn location of a dot occurs within the perimeter of another (when two dots overlap), regenerate another random location. I can’t quite figure out how to do this at the moment. Anyone able to lend a helping hand with that? On a side note, I believe it would be a pretty useful added function in future psychopy updates for users who require such a feature for their experiments. In cases where nDot is say set at 10, nobody would really hope for a physical presentation of nDot = 9.5 in cases of a partial overlap or nDot = 9 in a full overlap (or an even smaller value if two or more dots overlap).
This should also apply to ElementArrayStim.