diff options
author | rcoh <rcoh@mit.edu> | 2011-01-27 16:50:59 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-01-27 16:50:59 -0500 |
commit | 5fb3ea060025241105dc8e9a174513c112f9a133 (patch) | |
tree | e98b1b3eab0b05b0e518b08cbab086d224fd9250 /pixelmappers | |
parent | 5d29906fff79bc6e4ba83be7028e1380a0014d21 (diff) |
A metric $#%$-ton of changes. Added doc-strings to EVERYTHING. Phew. Fixed a massive bug that
increases performance in by up to a factor of 60. A bunch of new behaviors for the class.
Diffstat (limited to 'pixelmappers')
-rw-r--r-- | pixelmappers/GaussianMapper.py | 10 | ||||
-rw-r--r-- | pixelmappers/SimpleMapper.py | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/pixelmappers/GaussianMapper.py b/pixelmappers/GaussianMapper.py index c82f243..883a95d 100644 --- a/pixelmappers/GaussianMapper.py +++ b/pixelmappers/GaussianMapper.py @@ -1,8 +1,16 @@ from operationscore.PixelMapper import * import util.Geo as Geo class GaussianMapper(PixelMapper): + """GaussianMapper is a PixelMapper which weights pixels around an event proportional to a + gaussian surface. Specify: + <Height> -- The height of the gaussian surface + <Width> -- The width of the gaussian surface + <MinWeight> -- the minimum weight event that can be returned + <CutoffDist> -- the maximum radius considered + """ + def mappingFunction(self, eventLocation, screen): - returnPixels = [] #TODO: consider preallocation and trimming + returnPixels = [] [x,y] = eventLocation potentialPixels = screen.pixelsInRange(x-self.CutoffDist, \ x+self.CutoffDist) diff --git a/pixelmappers/SimpleMapper.py b/pixelmappers/SimpleMapper.py index 19d44c4..1568de3 100644 --- a/pixelmappers/SimpleMapper.py +++ b/pixelmappers/SimpleMapper.py @@ -2,6 +2,10 @@ from operationscore.PixelMapper import * import util.Geo as Geo import sys class SimpleMapper(PixelMapper): + """SimpleMapper is a PixelMapper which maps events to the nearest Pixel. It also supports + strings of the form: + {x}>5, {y}<10, {x}*{y}<{x}, etc. (Conditons, separated by commas. and and or may also be + used).""" def mappingFunction(self, eventLocation, screen): if type(eventLocation) == type(tuple()): bestDist = sys.maxint @@ -19,7 +23,6 @@ class SimpleMapper(PixelMapper): return [] else: #{x}>5,{y}<k - #TODO: we should probably encapsulate this somewhere ret = [] eventLocation = eventLocation.replace('{x}', 'pixel.location[0]') eventLocation = eventLocation.replace('{y}', 'pixel.location[1]') |