pyclustering/cluster/syncnet.py
def show_network(self):
        """!
        @brief Shows connections in the network. It supports only 2-d and 3-d representation.
        
        """
        
        if ( (self._ccore_network_pointer is not None) and (self._osc_conn is None) ):
            self._osc_conn = sync_connectivity_matrix(self._ccore_network_pointer);
        
        dimension = len(self._osc_loc[0]);
        if ( (dimension != 3) and (dimension != 2) ):
            raise NameError('Network that is located in different from 2-d and 3-d dimensions can not be represented');
        
        from matplotlib.font_manager import FontProperties;
        from matplotlib import rcParams;
    
        rcParams['font.sans-serif'] = ['Arial'];
        rcParams['font.size'] = 12;

        fig = plt.figure();
        axes = None;
        if (dimension == 2):
            axes = fig.add_subplot(111);
        elif (dimension == 3):
            axes = fig.gca(projection='3d');
        
        surface_font = FontProperties();
        surface_font.set_name('Arial');
        surface_font.set_size('12');
        
        for i in range(0, self._num_osc, 1):
            if (dimension == 2):
                axes.plot(self._osc_loc[i][0], self._osc_loc[i][1], 'bo');  
                if (self._conn_represent == conn_represent.MATRIX):
                    for j in range(i, self._num_osc, 1):    # draw connection between two points only one time
                        if (self.has_connection(i, j) == True):
                            axes.plot([self._osc_loc[i][0], self._osc_loc[j][0]], [self._osc_loc[i][1], self._osc_loc[j][1]], 'b-', linewidth = 0.5);
                            
                else:
                    for j in self.get_neighbors(i):
                        if ( (self.has_connection(i, j) == True) and (i > j) ):     # draw connection between two points only one time
                            axes.plot([self._osc_loc[i][0], self._osc_loc[j][0]], [self._osc_loc[i][1], self._osc_loc[j][1]], 'b-', linewidth = 0.5);
            
            elif (dimension == 3):
                axes.scatter(self._osc_loc[i][0], self._osc_loc[i][1], self._osc_loc[i][2], c = 'b', marker = 'o');
                
                if (self._conn_represent == conn_represent.MATRIX):
                    for j in range(i, self._num_osc, 1):    # draw connection between two points only one time
                        if (self.has_connection(i, j) == True):
                            axes.plot([self._osc_loc[i][0], self._osc_loc[j][0]], [self._osc_loc[i][1], self._osc_loc[j][1]], [self._osc_loc[i][2], self._osc_loc[j][2]], 'b-', linewidth = 0.5);
                        
                else:
                    for j in self.get_neighbors(i):
                        if ( (self.has_connection(i, j) == True) and (i > j) ):     # draw connection between two points only one time
                            axes.plot([self._osc_loc[i][0], self._osc_loc[j][0]], [self._osc_loc[i][1], self._osc_loc[j][1]], [self._osc_loc[i][2], self._osc_loc[j][2]], 'b-', linewidth = 0.5);
                               
        plt.grid();
        plt.show();
def show_network(self):
        """!
        @brief Shows connections in the network. It supports only 2-d and 3-d representation.
        
        """
        
        if ( (self._ccore_network_pointer is not None) and (self._osc_conn is None) ):
            self._osc_conn = sync_connectivity_matrix(self._ccore_network_pointer);
        
        dimension = len(self._osc_loc[0]);
        if ( (dimension != 3) and (dimension != 2) ):
            raise NameError('Network that is located in different from 2-d and 3-d dimensions can not be represented');
        
        from matplotlib.font_manager import FontProperties;
        from matplotlib import rcParams;
    
        rcParams['font.sans-serif'] = ['Arial'];
        rcParams['font.size'] = 12;

        fig = plt.figure();
        axes = None;
        if (dimension == 2):
            axes = fig.add_subplot(111);
        elif (dimension == 3):
            axes = fig.gca(projection='3d');
        
        surface_font = FontProperties();
        surface_font.set_name('Arial');
        surface_font.set_size('12');
        
        for i in range(0, self._num_osc, 1):
            if (dimension == 2):
                axes.plot(self._osc_loc[i][0], self._osc_loc[i][1], 'bo');  
                if (self._conn_represent == conn_represent.MATRIX):
                    for j in range(i, self._num_osc, 1):    # draw connection between two points only one time
                        if (self.has_connection(i, j) == True):
                            axes.plot([self._osc_loc[i][0], self._osc_loc[j][0]], [self._osc_loc[i][1], self._osc_loc[j][1]], 'b-', linewidth = 0.5);
                            
                else:
                    for j in self.get_neighbors(i):
                        if ( (self.has_connection(i, j) == True) and (i > j) ):     # draw connection between two points only one time
                            axes.plot([self._osc_loc[i][0], self._osc_loc[j][0]], [self._osc_loc[i][1], self._osc_loc[j][1]], 'b-', linewidth = 0.5);
            
            elif (dimension == 3):
                axes.scatter(self._osc_loc[i][0], self._osc_loc[i][1], self._osc_loc[i][2], c = 'b', marker = 'o');
                
                if (self._conn_represent == conn_represent.MATRIX):
                    for j in range(i, self._num_osc, 1):    # draw connection between two points only one time
                        if (self.has_connection(i, j) == True):
                            axes.plot([self._osc_loc[i][0], self._osc_loc[j][0]], [self._osc_loc[i][1], self._osc_loc[j][1]], [self._osc_loc[i][2], self._osc_loc[j][2]], 'b-', linewidth = 0.5);
                        
                else:
                    for j in self.get_neighbors(i):
                        if ( (self.has_connection(i, j) == True) and (i > j) ):     # draw connection between two points only one time
                            axes.plot([self._osc_loc[i][0], self._osc_loc[j][0]], [self._osc_loc[i][1], self._osc_loc[j][1]], [self._osc_loc[i][2], self._osc_loc[j][2]], 'b-', linewidth = 0.5);
                               
        plt.grid();
        plt.show();
def show_network ( self ) : if ( ( self . _ccore_network_pointer is not None ) and ( self . _osc_conn is None ) ) : self . _osc_conn = sync_connectivity_matrix ( self . _ccore_network_pointer ) dimension = len ( self . _osc_loc [ 0 ] ) if ( ( dimension != 3 ) and ( dimension != 2 ) ) : raise NameError ( 'Network that is located in different from 2-d and 3-d dimensions can not be represented' ) from matplotlib . font_manager import FontProperties from matplotlib import rcParams rcParams [ 'font.sans-serif' ] = [ 'Arial' ] rcParams [ 'font.size' ] = 12 fig = plt . figure ( ) axes = None if ( dimension == 2 ) : axes = fig . add_subplot ( 111 ) elif ( dimension == 3 ) : axes = fig . gca ( projection = '3d' ) surface_font = FontProperties ( ) surface_font . set_name ( 'Arial' ) surface_font . set_size ( '12' ) for i in range ( 0 , self . _num_osc , 1 ) : if ( dimension == 2 ) : axes . plot ( self . _osc_loc [ i ] [ 0 ] , self . _osc_loc [ i ] [ 1 ] , 'bo' ) if ( self . _conn_represent == conn_represent . MATRIX ) : for j in range ( i , self . _num_osc , 1 ) : # draw connection between two points only one time
 if ( self . has_connection ( i , j ) == True ) : axes . plot ( [ self . _osc_loc [ i ] [ 0 ] , self . _osc_loc [ j ] [ 0 ] ] , [ self . _osc_loc [ i ] [ 1 ] , self . _osc_loc [ j ] [ 1 ] ] , 'b-' , linewidth = 0.5 ) else : for j in self . get_neighbors ( i ) : if ( ( self . has_connection ( i , j ) == True ) and ( i > j ) ) : # draw connection between two points only one time
 axes . plot ( [ self . _osc_loc [ i ] [ 0 ] , self . _osc_loc [ j ] [ 0 ] ] , [ self . _osc_loc [ i ] [ 1 ] , self . _osc_loc [ j ] [ 1 ] ] , 'b-' , linewidth = 0.5 ) elif ( dimension == 3 ) : axes . scatter ( self . _osc_loc [ i ] [ 0 ] , self . _osc_loc [ i ] [ 1 ] , self . _osc_loc [ i ] [ 2 ] , c = 'b' , marker = 'o' ) if ( self . _conn_represent == conn_represent . MATRIX ) : for j in range ( i , self . _num_osc , 1 ) : # draw connection between two points only one time
 if ( self . has_connection ( i , j ) == True ) : axes . plot ( [ self . _osc_loc [ i ] [ 0 ] , self . _osc_loc [ j ] [ 0 ] ] , [ self . _osc_loc [ i ] [ 1 ] , self . _osc_loc [ j ] [ 1 ] ] , [ self . _osc_loc [ i ] [ 2 ] , self . _osc_loc [ j ] [ 2 ] ] , 'b-' , linewidth = 0.5 ) else : for j in self . get_neighbors ( i ) : if ( ( self . has_connection ( i , j ) == True ) and ( i > j ) ) : # draw connection between two points only one time
 axes . plot ( [ self . _osc_loc [ i ] [ 0 ] , self . _osc_loc [ j ] [ 0 ] ] , [ self . _osc_loc [ i ] [ 1 ] , self . _osc_loc [ j ] [ 1 ] ] , [ self . _osc_loc [ i ] [ 2 ] , self . _osc_loc [ j ] [ 2 ] ] , 'b-' , linewidth = 0.5 ) plt . grid ( ) plt . show ( )
!
        @brief Shows connections in the network. It supports only 2-d and 3-d representation.
!