aboutsummaryrefslogtreecommitdiff
path: root/operationscore/PixelMapper.py
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-01-27 16:50:59 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-01-27 16:50:59 -0500
commit5fb3ea060025241105dc8e9a174513c112f9a133 (patch)
treee98b1b3eab0b05b0e518b08cbab086d224fd9250 /operationscore/PixelMapper.py
parent5d29906fff79bc6e4ba83be7028e1380a0014d21 (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 'operationscore/PixelMapper.py')
-rw-r--r--operationscore/PixelMapper.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/operationscore/PixelMapper.py b/operationscore/PixelMapper.py
index 7e2b0af..3937973 100644
--- a/operationscore/PixelMapper.py
+++ b/operationscore/PixelMapper.py
@@ -2,6 +2,9 @@ from operationscore.SmootCoreObject import *
from logger import main_log
import pdb
class PixelMapper(SmootCoreObject):
+ """PixelMapper is the parent class for PixelMappers. Inheriting classes should define
+ mappingFunction which takes an eventLocation and a screen and returns a list of (weight, pixels). PixelMapper
+ handles caching automatically."""
def init(self):
self.mem = {} #Dictionary of all seen events
self.totalCalls = 0
@@ -19,6 +22,7 @@ class PixelMapper(SmootCoreObject):
return self.mem[eventLocation]
#Takes a Screen and returns a list of tuples
#(pixel, weight), with the sum of weights = 1
- #TODO: consider abstracting away from pixels
def mappingFunction(self,eventLocation, screen):
- pass
+ """Takes a Screen and event location and returns a list of tuples (pixel,weight) with
+ sum(weights)=1"""
+ raise Exception('Mapping function not defined!')