Index: fact/tools/pyscripts/pyfact/cleaners.py
===================================================================
--- fact/tools/pyscripts/pyfact/cleaners.py	(revision 13174)
+++ fact/tools/pyscripts/pyfact/cleaners.py	(revision 13175)
@@ -112,4 +112,43 @@
                     
         
+        # calculate number of islands
+        surv_id = np.where(surv)[0]
+        # make a copy of survivors:
+        self.surv_copy = list(surv_id.copy())
+        surv_copy = self.surv_copy
+        # the first survivor belongs to the first island, by definition
+        self.islands = []
+        islands = seld.islands
+        if len(surv_copy) > 0:
+            islands.append([surv_copy[0]])
+            del surv_copy[0]
+            nn_found = True
+            while len(surv_copy) > 0:
+                if nn_found:
+                    nn_found = False
+                    for i in islands[-1]:
+                        #print 'i:',i
+                        #print 'nn[i]:', nn[i]
+                        #print 'type(nn[i]):', type(nn[i])
+                        for n in nn[i]:
+                            if n in surv_copy:
+                                del surv_copy[surv_copy.index(n)]
+                                islands[-1].append(n)
+                                nn_found = True
+                                #print 'islands'
+                                #print islands, len(islands)
+                                #print 'surv_copy'
+                                #print surv_copy, len(surv_copy)
+                        #print '*'*80
+                        #print 'END of  for i in islands[-1]:'
+                        #print '*'*80
+                        
+                else:
+                    islands.append( [ surv_copy[0] ])
+                    del surv_copy[0]
+                    nn_found = True
+
+        #print 'cleaner found' ,len(islands), 'islands'
+
         callback( data, core_c, core, surv) 
 
