testing of compressed maps.

This commit is contained in:
Rowan Cockett
2015-06-01 10:15:20 -07:00
parent 8475eadcce
commit 2c48a69fb2
2 changed files with 49 additions and 4 deletions
+15 -1
View File
@@ -73,8 +73,22 @@ class PropModel(object):
def __init__(self, propMap, vector):
self.propMap = propMap
self.vector = vector
assert len(self.vector) == self.nP
@property
def nP(self):
inds = []
if getattr(self, '_nP', None) is None:
for name in self.propMap._properties:
index = getattr(self.propMap, '%sIndex'%name, None)
if index is not None:
if type(index) is slice:
inds += range(*index.indices(len(self.vector)))
else:
inds += list(index)
self._nP = len(set(inds))
return self._nP
# TODO: nP
_PROPMAPCLASSREGISTRY = {}