psychopy.org | Reference | Downloads | Github

RDK noiseDots question

Hello,

I’m attempting to code an experiment using the RDK stimuli. I have varying degrees of coherence, which I set over the course of the experiment (the 0.5 is a placeholder), but what I am really currently interested in is the direction of the noise dots. It seems noise dots can only be set to walk, direction, or position. Currently I am using direction, which set all noise dots to a “random, but constant direction.”

However, I do not want the direction of my noise dots to be random - I would like to instead set my noise dots to move in the direction directly opposite my signal dots. Thus, if my signal dots are moving at 45 degrees (the direction tied to my RDK), I’d like to be able to set noise dots to move at 225 degrees.

Is there a way to directly set the noise dot direction so all noise dots move together and opposite the signal dots? I know setDir sets the direction of the signal dots, but I’d like to control the noise dot direction as well.

I’ve coded my RDKs as such:

tar = visual.DotStim(win, units=‘deg’, nDots=24, coherence=0.5, fieldPos=fovea, fieldSize=[.4,.4], fieldShape=‘circle’, dotSize=1.5, dotLife=-1, dir=0, speed=0.05, color=[1,1,1], colorSpace=‘rgb’, opacity=1, contrast=1, signalDots=‘same’, noiseDots=‘direction’)

Thank you!

Andrew

Alternatively, is there some sort of dots.setNDots() function that will allow me to code two separate RDKs, overlay them, and then manipulate the number of dots moving in either desired direction to artificially simulate the desired coherences? When I try to do this (with a csv input for trialList) using dots.set(‘nDots’, (thisTrial[‘dotN’])), I receive a broadcasting error, presumably because the new dot number does not match the old dot number.

Thanks again,

Andrew

It’s a bit of a hack, but you could perhaps do the following after stimulus creation and after a change in coherence:

tar._dotsDir[np.logical_not(tar._signalDots)] = np.radians(tar.dir + 180.0)
1 Like

Thanks - that appears to have done the trick in response to my original question. Much appreciated. I actually needed changes of 90 degrees (not 180 as I originally stated), and the final code looked like this:

– Draw Trials Setup –

tar.setDir(thisTrial['TarDir'])
tar.setFieldCoherence(thisTrial['TarCoh'])
if thisTrial['TarDir'] == 45:
    tar._dotsDir[np.logical_not(tar._signalDots)] = np.radians(tar.dir + 90.0)
elif thisTrial['TarDir'] == 135:
    tar._dotsDir[np.logical_not(tar._signalDots)] = np.radians(tar.dir - 90.0)