# HG changeset patch # User Stephen Skory # Date 1247000605 25200 # Branch hopwrap # Node ID 9b51d2a3582605f24d11399df7882f5ccc2c172b # Parent 19aa8984a3d3590f0bfc44a7d599c1e0b75d9cbb A few more bugs in chainHOP. diff -r 19aa8984a3d3590f0bfc44a7d599c1e0b75d9cbb -r 9b51d2a3582605f24d11399df7882f5ccc2c172b yt/extensions/kdtree/fKD_source.f90 --- a/yt/extensions/kdtree/fKD_source.f90 Mon Jul 06 17:18:49 2009 -0700 +++ b/yt/extensions/kdtree/fKD_source.f90 Tue Jul 07 14:03:25 2009 -0700 @@ -1115,7 +1115,7 @@ end subroutine kdtree2_n_nearest_around_point subroutine kdtree2_r_nearest(tp,qv,r2,nfound,nalloc,results) - ! find the nearest neighbors to point 'idxin', within SQUARED + ! find the nearest neighbors to point 'qv', within SQUARED ! Euclidean distance 'r2'. Upon ENTRY, nalloc must be the ! size of memory allocated for results(1:nalloc). Upon ! EXIT, nfound is the number actually found within the ball. diff -r 19aa8984a3d3590f0bfc44a7d599c1e0b75d9cbb -r 9b51d2a3582605f24d11399df7882f5ccc2c172b yt/lagos/HaloFinding.py --- a/yt/lagos/HaloFinding.py Mon Jul 06 17:18:49 2009 -0700 +++ b/yt/lagos/HaloFinding.py Tue Jul 07 14:03:25 2009 -0700 @@ -605,10 +605,10 @@ halo.write_particle_list(f) class chainHF(GenericHaloFinder, chainHOPHaloList): - def __init__(self, pf, threshold=160, dm_only=True, num_neighbors=64): + def __init__(self, pf, threshold=160, dm_only=True): GenericHaloFinder.__init__(self, pf, dm_only, padding=0.0) self.padding = 0.0 - self.num_neighbors = num_neighbors + self.num_neighbors = 65 # get the total number of particles across all procs, with no padding padded, LE, RE, self._data_source = self._partition_hierarchy_3d(padding=self.padding) # also get the total mass of particles diff -r 19aa8984a3d3590f0bfc44a7d599c1e0b75d9cbb -r 9b51d2a3582605f24d11399df7882f5ccc2c172b yt/lagos/chainHOP/chainHOP.py --- a/yt/lagos/chainHOP/chainHOP.py Mon Jul 06 17:18:49 2009 -0700 +++ b/yt/lagos/chainHOP/chainHOP.py Tue Jul 07 14:03:25 2009 -0700 @@ -43,7 +43,7 @@ fKD.qv = empty(3,dtype='d') fKD.nn = self.num_neighbors fKD.nparts = size - fKD.sort = False # faster, but unordered neighbors (OK for chainHOP) + fKD.sort = True # slower, but needed in _connect_chains fKD.rearrange = True # faster, more memory # this actually copies the data into the fortran space fKD.pos[0,:] = self.xpos @@ -146,7 +146,8 @@ # if this particle is in the padding, don't make a connection if part.is_inside is False: continue # loop over nearest neighbors - for i in range(self.num_neighbors): + #for i in range(self.num_neighbors): + for i in range(self.nMerge+2): thisNN = part.NNtags[i] # if our neighbor is in the same chain, move on if part.chainID == self.NN[thisNN].chainID: continue @@ -197,7 +198,7 @@ #print 'neither already assigned' groupID += 1 # chains that haven't been linked to another chain increase the count - # by themselves and change label + # by themselves and change label. Also add to chain_connections for i in range(chain_count): if self.reverse_map[i] == -1: self.reverse_map[i] = groupID @@ -281,6 +282,7 @@ def _chainHOP(self): size = len(self.xpos) + self.nMerge = 4 mylog.info('Building kd tree for %d particles...' % \ size) self.__init_kd_tree(size)