def setUp(self):
        #np.random.seed(6)
        self.mpts = 100000  #Adding a zero here changes the cython results dramatically
        self.npts = 10000
        self.high = 50
        self.M = np.random.randint(0, self.high,
                                   (self.mpts, 3)).astype(np.int16)
        self.P = np.random.randint(0, self.high,
                                   (self.npts, 3)).astype(np.int16)

        self.testpose = (-2., 42., 80., 0.2, 0.1, 2.6)
        self.testposeinv = poseutil.inverse(self.testpose)
        self.Pxformed = poseutil.check_and_transform_points(
            self.P, self.testpose)[0]

        self.ol = occupiedlist.OccupiedList(1)
        self.ol.addpoints(self.M)

        self.Mkdt = spatial.cKDTree(self.M)

        self.maparray = np.zeros((self.high, self.high, self.high),
                                 dtype=np.bool)
        #self.maparray = ndsparse.ndsparse((self.high, self.high, self.high))
        self.maparray[self.M[:, 0], self.M[:, 1], self.M[:, 2]] = True

        # set up packed arrays map
        ids = occupiedlist._pack(self.M)
        self.mapvoxels_int16 = dict.fromkeys(ids, 1)
        self.mapset = set(ids)
        #self.mapvoxels_int16 = collections.defaultdict(int)
        #for ID in ids:
        #    self.mapvoxels_int16[ID.tostring()] += 1

        # bloom map
        self.bloom = occupiedlist.BloomFilter(self.mpts)
        self.bloom.add_voxel_ids(occupiedlist._pack(self.M))

        # dictionary of dictionaries
        #D = dict.fromkeys(self.mpts[:,0], dict())
        self.Pint = self.P.astype(int)

        D = dict()
        # first initialise
        for a, b, c in self.M:
            D.setdefault(a, dict())
            D[a].setdefault(b, dict())
            D[a][b][c] = 0
        for a, b, c in self.M:
            D[a][b][c] += 1
        self.nestedDict = D
    def setUp(self):
        #np.random.seed(6)
        self.mpts = 100000 #Adding a zero here changes the cython results dramatically
        self.npts = 10000
        self.high = 50
        self.M = np.random.randint(0, self.high, (self.mpts, 3)).astype(np.int16)
        self.P = np.random.randint(0, self.high, (self.npts, 3)).astype(np.int16)
        
        self.testpose = (-2., 42., 80., 0.2, 0.1, 2.6)
        self.testposeinv = poseutil.inverse(self.testpose)
        self.Pxformed = poseutil.check_and_transform_points(self.P, self.testpose)[0]
        
        self.ol = occupiedlist.OccupiedList(1)
        self.ol.addpoints(self.M)

        self.Mkdt = spatial.cKDTree(self.M)

        self.maparray = np.zeros((self.high, self.high, self.high), dtype=np.bool)
        #self.maparray = ndsparse.ndsparse((self.high, self.high, self.high))
        self.maparray[self.M[:, 0], self.M[:, 1], self.M[:, 2]] = True

        # set up packed arrays map
        ids = occupiedlist._pack(self.M)
        self.mapvoxels_int16 = dict.fromkeys(ids, 1)
        self.mapset = set(ids)
        #self.mapvoxels_int16 = collections.defaultdict(int)
        #for ID in ids:
        #    self.mapvoxels_int16[ID.tostring()] += 1

        # bloom map
        self.bloom = occupiedlist.BloomFilter(self.mpts)
        self.bloom.add_voxel_ids(occupiedlist._pack(self.M))

        # dictionary of dictionaries
        #D = dict.fromkeys(self.mpts[:,0], dict())
        self.Pint = self.P.astype(int)

        D = dict()
        # first initialise
        for a, b, c in self.M:
            D.setdefault(a, dict())
            D[a].setdefault(b, dict())
            D[a][b][c] = 0
        for a, b, c in self.M:
            D[a][b][c] += 1
        self.nestedDict = D
    def packed_overlap_with_bloom(self):
        #PV = occupiedlist.pointstovoxels(self.P, 1)
        #ids = occupiedlist._pack(PV)
        ids = occupiedlist._pack(self.P)
        #import pydb; pydb.set_trace()
        overlaps = self.bloom.contains(ids)

        #return len(overlap)
        return np.sum(overlaps)
    def packed_overlap_with_bloom(self):
        #PV = occupiedlist.pointstovoxels(self.P, 1)
        #ids = occupiedlist._pack(PV)
        ids = occupiedlist._pack(self.P)
        #import pydb; pydb.set_trace()
        overlaps = self.bloom.contains(ids)

        #return len(overlap)
        return np.sum(overlaps)
 def packed_set(self):
     Pset = occupiedlist._pack(self.P)
     overlap = self.mapset.intersection(Pset)
     return len(overlap)
 def packed_set(self):
     Pset = occupiedlist._pack(self.P)
     overlap = self.mapset.intersection(Pset)
     return len(overlap)