Package SmootLight :: Package pixelmappers :: Module GaussianMapper
[hide private]
[frames] | no frames]

Source Code for Module SmootLight.pixelmappers.GaussianMapper

 1  from operationscore.PixelMapper import * 
 2  import util.Geo as Geo 
3 -class GaussianMapper(PixelMapper):
4 """GaussianMapper is a PixelMapper which weights pixels around an event proportional to a 5 gaussian surface. Specify: 6 <Height> -- The height of the gaussian surface 7 <Width> -- The width of the gaussian surface 8 <MinWeight> -- the minimum weight event that can be returned 9 <CutoffDist> -- the maximum radius considered 10 """ 11
12 - def mappingFunction(self, eventLocation, screen):
13 returnPixels = [] 14 [x,y] = eventLocation 15 potentialPixels = screen.pixelsInRange(x-self.CutoffDist, \ 16 x+self.CutoffDist) 17 for (x,pixel) in screen.pixelsInRange(x-self.CutoffDist, \ 18 x+self.CutoffDist): 19 pixelDist = Geo.dist(pixel.location, eventLocation) 20 if pixelDist < self.CutoffDist: 21 w = Geo.gaussian(pixelDist, self.Height, 0, self.Width) 22 if w > self.MinWeight: 23 returnPixels.append((pixel, w)) 24 return returnPixels
25