Changeset 13175
- Timestamp:
- 03/22/12 20:41:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/cleaners.py
r13143 r13175 112 112 113 113 114 # calculate number of islands 115 surv_id = np.where(surv)[0] 116 # make a copy of survivors: 117 self.surv_copy = list(surv_id.copy()) 118 surv_copy = self.surv_copy 119 # the first survivor belongs to the first island, by definition 120 self.islands = [] 121 islands = seld.islands 122 if len(surv_copy) > 0: 123 islands.append([surv_copy[0]]) 124 del surv_copy[0] 125 nn_found = True 126 while len(surv_copy) > 0: 127 if nn_found: 128 nn_found = False 129 for i in islands[-1]: 130 #print 'i:',i 131 #print 'nn[i]:', nn[i] 132 #print 'type(nn[i]):', type(nn[i]) 133 for n in nn[i]: 134 if n in surv_copy: 135 del surv_copy[surv_copy.index(n)] 136 islands[-1].append(n) 137 nn_found = True 138 #print 'islands' 139 #print islands, len(islands) 140 #print 'surv_copy' 141 #print surv_copy, len(surv_copy) 142 #print '*'*80 143 #print 'END of for i in islands[-1]:' 144 #print '*'*80 145 146 else: 147 islands.append( [ surv_copy[0] ]) 148 del surv_copy[0] 149 nn_found = True 150 151 #print 'cleaner found' ,len(islands), 'islands' 152 114 153 callback( data, core_c, core, surv) 115 154
Note:
See TracChangeset
for help on using the changeset viewer.