def buildtree(self, ftype, thresh=None): if ftype in self.T and self.T[ftype] == False: return if thresh is None: thresh = self._thresh if (self.boxsize[...] == 0.0).all(): self.boxsize[...] = self.F[ftype]['locations'].ptp(axis=0) self.origin[...] = self.F[ftype]['locations'].min(axis=0) scale = fillingcurve.scale(origin=self.F[ftype]['locations'].min(axis=0), boxsize=self.F[ftype]['locations'].ptp(axis=0)) else: scale = fillingcurve.scale(origin=self.origin, boxsize=self.boxsize) self.T[ftype] = self.F[ftype].ztree(scale=scale, minthresh=min(thresh), maxthresh=max(thresh), np=self.np)
def buildtree(self, ftype, thresh=None): if ftype in self.T and self.T[ftype] == False: return if thresh is None: thresh = self._thresh if (self.boxsize[...] == 0.0).all(): self.boxsize[...] = self.F[ftype]['locations'].ptp(axis=0) self.origin[...] = self.F[ftype]['locations'].min(axis=0) scale = fillingcurve.scale( origin=self.F[ftype]['locations'].min(axis=0), boxsize=self.F[ftype]['locations'].ptp(axis=0)) else: scale = fillingcurve.scale(origin=self.origin, boxsize=self.boxsize) self.T[ftype] = self.F[ftype].ztree(scale=scale, minthresh=min(thresh), maxthresh=max(thresh), np=self.np)
def work(fid): if '%d' in args.filename: snap = Snapshot(args.filename % fid, args.format) else: snap = Snapshot(args.filename, args.format) N = snap.C['N'].sum() x,y,z = snap[None, 'pos'].T del snap scale = fillingcurve.scale(0, boxsize) zkey = fillingcurve.encode(x, y, z, scale=scale) del x, y, z dig = numpy.uint32(zkey >> (fillingcurve.bits * 3 - bits)) bincount = numpy.bincount(dig) return (fid, bincount.nonzero()[0])