Example #1
0
 def getNeighbourDists(self, forceRetriang = False):
     from PYME.LMVis import visHelpers
     
     if forceRetriang or not 'neighbourDistances' in self.GeneratedMeasures.keys():
         statNeigh = statusLog.StatusLogger("Calculating mean neighbour distances ...")
         self.GeneratedMeasures['neighbourDistances'] = np.array(visHelpers.calcNeighbourDists(self.getTriangles(forceRetriang)))
         
     return self.GeneratedMeasures['neighbourDistances']
Example #2
0
    def _get_neighbour_dists(self):
        from matplotlib import tri
        triangles = tri.Triangulation(
            self.colourFilter['x'] +
            .1 * np.random.normal(size=len(self.colourFilter['x'])),
            self.colourFilter['y'] +
            .1 * np.random.normal(size=len(self.colourFilter['x'])))

        return np.array(visHelpers.calcNeighbourDists(triangles))
 def execute(self, namespace):
     from matplotlib import delaunay
     from PYME.LMVis import visHelpers
     pos = namespace[self.inputPositions]
     
     x, y = pos['x'], pos['y']
     #triangulate the data
     T = delaunay.Triangulation(x + .1*np.random.normal(size=len(x)), y + .1*np.random.normal(size=len(x)))
     #find the average edge lengths leading away from a given point
     res = np.array(visHelpers.calcNeighbourDists(T))
     
     res = tabular.DictSource({self.key:res})
     if 'mdh' in dir(pos):
         res.mdh = pos.mdh
     
     namespace[self.outputName] = res