[visionegg] Re: stimulus code outputs

Darren Weber wrote:

Can we implement this with numarray, so we can output summary stats,
including: mean, stdev, min, max?




30 seconds and 3 lines changed, and yes you can, added and/or changed lines have been commented. I haven't run this or bug checked, I just added code to the e-mail, so if someone finds any errors please forgive.

import pygame
from Numeric import * ## import the Numeric package

pygame.init()
t = pygame.time

numiter = 10000 # number of iterations of the loop
c = zeros((numiter)) # initialize a storage vector

max = -1
a = t.get_ticks()

for i in range(0,numiter):
   b = t.get_ticks()
   c[i] = b - a # proper indexing
   if c[i]>max: # proper indexing
       max = c[i] # proper indexing
   a = b
   t.delay(10)

print max
print c # print the vector

Now a vector c will store the result of b-a for each iteration, and you can do whatever you want with it. If you are now going to e-mail the list and ask for the addition of mean and standard deviation calculations, I suggest you try to add that code yourself.




====================================== The Vision Egg mailing list Archives: http://www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html

Other related posts: