OpenCores
URL https://opencores.org/ocsvn/nocmodel/nocmodel/trunk

Subversion Repositories nocmodel

[/] [nocmodel/] [trunk/] [nocmodel/] [noc_guilib.py] - Diff between revs 3 and 4

Show entire file | Details | Blame | View Log

Rev 3 Rev 4
Line 46... Line 46...
except:
except:
    print("Matplotlib package not found. Drawing functions will not work.")
    print("Matplotlib package not found. Drawing functions will not work.")
    has_matplotlib = False
    has_matplotlib = False
 
 
import networkx as nx
import networkx as nx
 
import warnings
 
 
from noc_base import *
from noc_base import *
 
 
def draw_noc(noc, rectangular=True, nodepos=None):
def draw_noc(noc, rectangular=True, nodepos=None):
    """
    """
Line 62... Line 63...
      positions in nodepos argument
      positions in nodepos argument
    * nodepos: Optional dictionary where keys are router's indexes and values
    * nodepos: Optional dictionary where keys are router's indexes and values
      are tuples with x and y positions.
      are tuples with x and y positions.
    """
    """
    if not has_matplotlib:
    if not has_matplotlib:
        print("Function not available")
        warnings.warn("Function not available")
        return None
        return None
 
 
    # node positions
    # node positions
    if rectangular:
    if rectangular:
        if nodepos == None:
        if nodepos == None:
Line 113... Line 114...
        # ip channel label
        # ip channel label
        ax.text(thepos[0]+(ip_relpos[0]/2), thepos[1]+(ip_relpos[1]/2), i.channel_ref.name, horizontalalignment="center", bbox=dict(facecolor='red', alpha=0.2))
        ax.text(thepos[0]+(ip_relpos[0]/2), thepos[1]+(ip_relpos[1]/2), i.channel_ref.name, horizontalalignment="center", bbox=dict(facecolor='red', alpha=0.2))
        # box with ipcore labels
        # box with ipcore labels
        ax.text(thepos[0]+ip_relpos[0], thepos[1]+ip_relpos[1], i.name, horizontalalignment="center", bbox=dict(facecolor='green', alpha=0.2))
        ax.text(thepos[0]+ip_relpos[0], thepos[1]+ip_relpos[1], i.name, horizontalalignment="center", bbox=dict(facecolor='green', alpha=0.2))
 
 
 
    # adjust axis TODO!
    plt.show()
    plt.show()
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.