Change Number of Dots every repeat

Hi all,

in my experiment I want to manipulate, among other things, the number of dots of a RDK across trials.

How can I do this in the builder? It seems that if I set up a condition file, this can’t be read to change the number of dots…If I follow what is written here

https://groups.google.com/forum/#!topic/psychopy-users/73MLZ7_jqqU

so that for example I have a code component that in the ‘begin routine’ has

dots = visual.DotStim(win=win, name='dots',
    nDots=target_num, dotSize=2,
    speed=0.1, dir=0.0, coherence=1.0,
    fieldPos=[-0.5, 0.0], fieldSize=1.0,fieldShape=u'circle',
    signalDots=u'same', noiseDots=u'direction',dotLife=3,
    color=[1.0,1.0,1.0], colorSpace=u'rgb', opacity=1,    depth=0.0)

how can I then draw this for only 300 ms?

Thanks!

What don’t you just try using a graphical dots component in Builder rather than defining it in code? Just put your target_num variable in the “Number of dots” field, set it to update every repeat, and give it a duration of 0.3 s.

Hi Michael thanks, the fact is that the Random Dot Component does not update the number dots from trial to trial…I would like to find a way to solve this.

Thanks

[insert holiday delay]

OK, put something like this in the Every frame tab:

if t <= 0.300: # for the first 300 ms of a trial
    dots.draw()

Hello, to solve this problem I used the code view and I just move the block of code that you are quoting. After the trial definition and that’s all. You can use targe_num if the trial is already defined (the second for loop after the line in which your xlxs is defined.