Author: sleon
Date: 2006-01-07 16:05:11 +0000 (Sat, 07 Jan 2006)
New Revision: 7800

Modified:
   trunk/apps/freeviz/gen.py
   trunk/apps/freeviz/handler.py
   trunk/apps/freeviz/histogram.py
Log:
look and feel and other nice weirdo

Modified: trunk/apps/freeviz/gen.py
===================================================================
--- trunk/apps/freeviz/gen.py   2006-01-07 15:28:51 UTC (rev 7799)
+++ trunk/apps/freeviz/gen.py   2006-01-07 16:05:11 UTC (rev 7800)
@@ -49,13 +49,14 @@
                 #a number between 0 and 0.5
                 delta = min(abs(a-b), 1-abs(a-b))

-                index=0
-                chunk=0.5 / float(histogram.precision)
-                for i in range(histogram.precision):
-                        if chunk * float(i) <= delta and chunk * float(i+1) > 
delta:
-                                index = i
-                                break
-               return index
+               return delta
+                #index=0
+                #chunk=0.5 / float(histogram.precision)
+                #for i in range(histogram.precision):
+                #        if chunk * float(i) <= delta and chunk * float(i+1) > 
delta:
+                #                index = i
+                #                break
+               #return index * chunk

        def find_and_addswapedge(self, g, nodes, identity, nstate):

@@ -81,8 +82,12 @@
        def gentopology(self):
                #NodePair.createTable( ifNotExists=True )
                node_pairs = list(db.NodePair.select())
-               nodes = handler.get_activenodes()
+               assert node_pairs
+               nodes = list( handler.get_activenodes())
+               assert nodes
                nstate = self.getnstate(nodes)
+               assert nstate
+
                g=pydot.Dot(type='digraph')
                lastver = self.regver.match( db.getLastVer()).group(1)

@@ -133,7 +138,7 @@
                        if node_pair.backoffcur_node1 != '0' or 
node_pair.backoffcur_node2 != '0':
                                edgecolor= self.edgeBLOCKED
                        gedge = pydot.Edge(node_pair.node1.name , 
node_pair.node2.name, color=edgecolor , fontcolor=edgecolor,
-                                                       label='d: %d' % 
distance, fontsize='9.5',arrowhead='none')
+                                                       label='d: %f' % 
distance, fontsize='9.5',arrowhead='none')
                        #node1 is tail, node2 is head
                        if edgecolor == self.edgeBLOCKED:
                                if node_pair.backoffcur_node1 != '0':

Modified: trunk/apps/freeviz/handler.py
===================================================================
--- trunk/apps/freeviz/handler.py       2006-01-07 15:28:51 UTC (rev 7799)
+++ trunk/apps/freeviz/handler.py       2006-01-07 16:05:11 UTC (rev 7800)
@@ -44,7 +44,8 @@


 def get_activenodes():
-       nodes = db.Node.select()
+       nodes = list(db.Node.select())
+       assert nodes
        active_nodes=[]

        for node in nodes:

Modified: trunk/apps/freeviz/histogram.py
===================================================================
--- trunk/apps/freeviz/histogram.py     2006-01-07 15:28:51 UTC (rev 7799)
+++ trunk/apps/freeviz/histogram.py     2006-01-07 16:05:11 UTC (rev 7800)
@@ -13,6 +13,7 @@

 def gen():
        links = histdata.get()
+       chunk=0.5 / float(precision)

        histogram=[]
        for x in range(0,precision):
@@ -28,7 +29,6 @@
                delta = min(abs(a-b), 1-abs(a-b))

                index=0
-               chunk=0.5 / float(precision)
                for i in range(precision):
                        if chunk * float(i) <= delta and chunk * float(i+1) > 
delta:
                                index = i
@@ -44,11 +44,12 @@
        x.xtitle = "Distance"
        x.ytitle = "%"
        x.title = "Histogram of link location distances"
-       x.ext_color = [ 0x055202 , 0x169310 , 0x298760 , 0x297987 , 0xc1d72b , 
0xd4f113 , 0xf18113 , 0xf13713 , 0xcf0000 , 0x000000 ]
+       x.ext_color = [ 0x055202 , 0x169310 , 0x298760 , 0x297987 , 0xc1d72b , 
0xd4f113 , 0xf18113 , 0xf13713 , 0xcf0000 , 0x700606 ]
        x.setData(histogram_percents)
        label=[]
-       for column_name in range(0,precision):
-                label.append(str(column_name))
+       for i in range(0,precision):
+               column_name = str(chunk * i)
+               label.append(column_name)
        x.setLabels(label)
        x.draw("/tmp/histogram.png")
        #print histogram


Reply via email to