Changing the amount of points in the circles in each frame

Hey!
I want to create an experiment in which exercises are shown when the operators are ‘clouds of points’ - meaning that two circles will be displayed on the sides of the screen, and within each circle a number of dots.
I understood that this should be written in code so that the dots can change randomly. I would like to know what should be written in ‘nDots’ (just insert the name of the variable (in the Excel file)?):
(in begin routine)
polygonL = visual.ShapeStim(
win=win, name=‘polygonL’,
size=(0.5, 0.5), vertices=‘circle’,
ori=0.0, pos=(-0.60, 0), anchor=‘center’,
lineWidth=1.0, colorSpace=‘rgb’, lineColor=[-1.0000, -1.0000, -1.0000], fillColor=[0.0039, 0.0039, 0.0039],
opacity=None, depth=0.0, interpolate=True)

dots2 = visual.DotStim(
win=win, name=‘dots’,
nDots=100, dotSize=10.0,
speed=0.0, dir=0.0, coherence=0.0,
fieldPos=(-0.6, 0.0), fieldSize=-0.43, fieldAnchor=‘center’, fieldShape=‘circle’,
signalDots=‘same’, noiseDots=‘direction’,dotLife=0.0,
color=[-1.0000, -1.0000, -1.0000], colorSpace=‘rgb’, opacity=None,
depth=-1.0)

polygonR = visual.ShapeStim(
win=win, name=‘polygonR’,
size=(0.5, 0.5), vertices=‘circle’,
ori=0.0, pos=(0.60, 0), anchor=‘center’,
lineWidth=1.0, colorSpace=‘rgb’, lineColor=[-1.0000, -1.0000, -1.0000], fillColor=[0.0039, 0.0039, 0.0039],
opacity=None, depth=0.0, interpolate=True)

dots1 = visual.DotStim(
win=win, name=‘dots1’,
nDots=100, dotSize=10.0,
speed=0.0, dir=0.0, coherence=0.0,
fieldPos=(0.6, 0.0), fieldSize=-0.43, fieldAnchor=‘center’, fieldShape=‘circle’,
signalDots=‘same’, noiseDots=‘direction’,dotLife=0.0,
color=[-1.0000, -1.0000, -1.0000], colorSpace=‘rgb’, opacity=None,
depth=-1.0)

In addition, how can times be inserted in the code? I want each variable to appear for 1.5ms. What I tried (in each frame):
if t <= 1.500:
polygonR.draw()
dots1.draw()

polygonL.draw()
dots2.draw()

Thanks!

If you’re running from Builder then yes, nDots would be a column name from the conditions file, preceeded by a $ to indicate that it’s code. If you’re coding from scratch then it would just be whatever variable you’ve previously assigned the value to - which depends on how you’ve written the experiment.

Hello

switching every 1.5 ms requires very sophisticated hardware. Extremely expensive monitors are capable of 1 ms switching, gaming monitors often claim to be capable of high refresh rates, but they achieve this by “overshooting”, making parts much brighter than they are indented, and they are not in the 1.5 ms range. An average monitor does not switch faster than 16.667 ms.

Best wishes Jens

I tried to run through Builder with a $ sign but it didn’t work…
Can you explain to me where I went wrong?

There seems to be a problem with this line:

dots = visual.DotStim(
win=win, name=‘dots’,
nDots=$nDots, dotSize=10.0,
speed=0.0, dir=0.0, coherence=0.0,
fieldPos=(-0.6, 0.0), fieldSize=-0.43, fieldAnchor=‘center’, fieldShape=‘circle’,
signalDots=‘same’, noiseDots=‘direction’,dotLife=0.0,
color=[-1.0000, -1.0000, -1.0000], colorSpace=‘rgb’, opacity=None,
depth=-1.0)

And in general, how can you add variable display times within code?

Hello shirel

the code-line

fixDur = random() *(1.5 - 0.5) + 0.5

creates a variable called fixDur that has a minimum of 0.5 sec. and a maximum of 1.5 sec. Use $fixDur in the duration-property of your stimulus.

Best wishes Jens