I recently tried to replicate the random dots setup of Shadlen & Newsome (2001). It turned out that PsychoPy’s DotStim does have a simplified version of their algorithm implemented (as ‘different’ signal dots + ‘position’ noise), so I decided to give it a try. Based on the parameter values reported by Shadlen & Newsome, I figured the parameters to supply to DotStim. However, when I run a pilot study, it didn’t really work. The reason for this is that DotStim is rounding up the coherence based on nDots, which effectively makes this parameter discrete. Now, for the setups having many dots per frame this isn’t an issue, but for nDots = 6 (like in Shadlen & Newsome’s experiment and alike), all coherence levels less than 1/6 are rounded to zero, which is a serious issue.
This is probably caused by different interpretations of the coherence parameter persisting in the literature. In some papers, coherence defines proportion of the dots moving coherently (this definition is implemented in DotStim). Others (including Shadlen & Newsome) define coherence as probability of each dot moving in the stimulus direction. In the limit of many dots per frame and many frames, the two definitions are basically equivalent. However, if you have small number of dots per frame in your setup, only the probabilistic definition makes sense. It is then possible that more or fewer than coherence*nDots are moving coherently at any given frame, but the overall proportion of coherently moving dots over many frames (or many trials) will be exactly equal to the coherence value.
Now, I suggest that at least the current DotStim documentation should be updated to specify the minimum recommended number of dots per frame, or to explicitly warn that using small nDots is not recommended. Although the comments in the source code mention that coherence is rounded, some users might not look that deep, so much time and effort could be saved for those who try DotStim with small nDots (the setup which is quite popular in the literature).
More generally, I think that the paper behind DotStim’s algorithms, Scase et al (1996), is a bit outdated. More modern algorithms are now used in the literature, and I know a number of Matlab implementations of these algorithms distributed over personal/lab websites of the developers, but nothing in Python so far. Pilly & Seitz (2009) provide a nice overview of four of the currently popular random dots algorithms, including Shadlen & Newsome’s, which they recognize as ‘dominant’. In my opinion, it would be great to develop a new version of DotStim based on Pilly & Seitz’s paper. If there’s any interest in this in the PsychoPy community, I’ll probably be able to code some of the algorithms.
Pilly, P. K., & Seitz, A. R. (2009). What a difference a parameter makes: A
psychophysical comparison of random dot motion algorithms. Vision research,
Shadlen, M. N., & Newsome, W. T. (2001). Neural basis of a perceptual decision in
the parietal cortex (area LIP) of the rhesus monkey. Journal of
neurophysiology, 86(4), 1916-1936.