def jitMCQ(self,x,y,jsig, mcp): from PYME.Analysis.points.QuadTree import pointQT Imc = numpy.rand(len(x)) < mcp qt = pointQT.qtRoot(-250,250, 0, 500) if type(jsig) == numpy.ndarray: jsig = jsig[Imc] for xi, yi in zip(x[Imc] + jsig*numpy.random.normal(size=Imc.sum()), y[Imc] + jsig*numpy.random.normal(size=Imc.sum())): qt.insert(pointQT.qtRec(xi, yi, None)) self.setQuads(qt, 100, True)
def GenQuads(self): from PYME.Analysis.points.QuadTree import pointQT di = max(self.imageBounds.x1 - self.imageBounds.x0, self.imageBounds.y1 - self.imageBounds.y0) numPixels = di/self.QTGoalPixelSize di = self.QTGoalPixelSize*2**np.ceil(np.log2(numPixels)) self.Quads = pointQT.qtRoot(self.imageBounds.x0, self.imageBounds.x0+di, self.imageBounds.y0, self.imageBounds.y0 + di) for xi, yi in zip(self['x'],self['y']): self.Quads.insert(pointQT.qtRec(xi,yi, None))