From 5fb3ea060025241105dc8e9a174513c112f9a133 Mon Sep 17 00:00:00 2001 From: rcoh Date: Thu, 27 Jan 2011 16:50:59 -0500 Subject: 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. --- operationscore/PixelMapper.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'operationscore/PixelMapper.py') 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!') -- cgit v1.2.3