-- Dr. Jonathan Peirce Associate Professor Nottingham Visual Neuroscience School of Psychology Nottingham University +44 (0)115 8467176 (tel) http://www.peirce.org.uk/
This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
To deal with the stretching, read tutorial 1, and note the info on
window/stimulus units:
http://www.psychopy.org/home.php/Docs/Tutorial1
> -The dots don't move as fluently as in the small window version
> (600*600). About once per revolution there is a slight delay. Maybe
> the ElementArrayStim class would work better (I have an openGL2.0
> graphics card)? Would it work by just returning the cartesian
> coordinates as an array and replacing the _dotsXY statements by
> myStim.setXYs(xyNumpyArray)?
I'm surprised you're dropping frames on the stimulus. Here are some
things to try:
- Use the following version of the script, which subclasses the
DotStim (and overrides a function that might be wasting cpu time)
- Try setting fullscr=1 (this should be marginally more efficient
than simply having a window that fills the screen as you've got)
- Don't run from something that attempts to 'debug' during running
(e.g. wingide, or IDLE). These have a substantial overhead.
Switching to ElementArray probably won't help any further, and may slow
things down. DotStim should be very fast if given element=None as an
argument (if you want to use more complex thigns than dots then switch).
hope that helps
Jon
#----------------------
from psychopy import visual, misc
import numpy
nDots = 1000
angVelocity = 1 #deg rotation per frame
win = visual.Window((600,600))
class SphereDotStim(visual.DotStim):
def _update_dotsXY(self):
#override this so that the dots dont get updated
#(which they normally do during draw() for RDKs)
pass
myStim = SphereDotStim(win, nDots=nDots)#most parameters aren't going to
be used here
#starting spherical coordinates for our dots
azims = numpy.random.random(nDots)*360
elevs = numpy.random.random(nDots)*180-90
radii = 0.5
win.setRecordFrameIntervals()
for frameN in range(1000):
azims += angVelocity #add angVel to the azimuth of the dots
x,y,z = misc.sph2cart(elevs, azims, radii)
myStim._dotsXY[:,0] = x
myStim._dotsXY[:,1] = z #?!
myStim._calcDotsXYRendered()
myStim.draw()
win.flip()
print win.fps()