#NEWLINE# def get_close_clusters( self , cluster_id ) : #NEWLINE# #INDENT# assert isinstance ( cluster_id , int ) #NEWLINE# pos0 = self . get_best_channel_position ( cluster_id ) #NEWLINE# n = len ( pos0 ) #NEWLINE# assert ( n in ( 2 , 3 ) ) #NEWLINE# clusters = self . cluster_ids #NEWLINE# pos = np . vstack ( [ self . get_best_channel_position ( int ( clu ) ) for clu in cluster_id ] ) #NEWLINE# assert ( pos . shape == ( len ( clusters ) , n ) ) #NEWLINE# dist = ( ( pos - pos0 ) ** 2 ) #NEWLINE# assert ( dist . shape == ( len ( clusters ) , n ) ) #NEWLINE# dist = ( np . sum ( dist , axis = 1 ) ** 0.5 ) #NEWLINE# assert ( dist . shape == ( len ( clusters ) , ) ) #NEWLINE# ind = np . argsort ( dist ) #NEWLINE# ind = ind [ : self . n_spikes_close_clusters ] #NEWLINE# return [ ( int ( clusters [ i ] ) , float ( dist [ i ] ) ) for i in ind ]