[Blends-commit] r3636 - /blends/trunk/team_analysis_tools/count-dependencies.py

tille at users.alioth.debian.org tille at users.alioth.debian.org
Tue Nov 6 10:16:37 UTC 2012


Author: tille
Date: Tue Nov  6 10:16:36 2012
New Revision: 3636

URL: http://svn.debian.org/wsvn/blends/?sc=1&rev=3636
Log:
Enable selecting certain tasks which are worth ploting inside the diagram without spoiling it with low number tasks

Modified:
    blends/trunk/team_analysis_tools/count-dependencies.py

Modified: blends/trunk/team_analysis_tools/count-dependencies.py
URL: http://svn.debian.org/wsvn/blends/blends/trunk/team_analysis_tools/count-dependencies.py?rev=3636&op=diff
==============================================================================
--- blends/trunk/team_analysis_tools/count-dependencies.py (original)
+++ blends/trunk/team_analysis_tools/count-dependencies.py Tue Nov  6 10:16:36 2012
@@ -24,6 +24,28 @@
 # FIXME: Blend name should be parameter - currently only used for Debian Med
 BLEND='med'
 # BLEND='science'
+
+# Some tasks contain only a few dependencies which are just spoiling the 3D view
+# Make sure we are drawing a certain selection and all those tasks that might
+# have more dependencies than these
+DRAWTASKS = { 'med': ['bio', 'bio-dev', 'epi', 'practice', 'psychology'],
+            }
+
+def TasksGetDrawList(tasks):
+    task_last = tasks[sorted(tasks.keys())[-1]]
+    # evaluate minimum number of dependencies to draw
+    min2draw = 100
+    drawlist = []
+    for t in DRAWTASKS[BLEND]:
+	if task_last.nrecommended[t] < min2draw:
+	    min2draw = task_last.nrecommended[t]
+    for r in task_last.recommends.keys():
+	if task_last.nrecommended[r] >= min2draw:
+	    drawlist.append(r)
+
+    drawlist.sort()
+    return drawlist
+
 
 class taskscontent:
     def __init__(self, version=None, date=None, htask=None, hrecommended=None):
@@ -94,16 +116,11 @@
 		mtask = tasks[task.datekey]
 		if mtask.version != task.version:
 		    mtask.version = mtask.version + '+' + task.version
-		    #print >>stderr, "Different versions at same date."
-		    #print >>stderr, "mtask = ", mtask
-		    #print >>stderr, "task = ", task
-		    #continue
 		if mtask.recommends.has_key(mver['task']):
 		    print >>stderr, "Duplicated task at same date."
 		    continue
 		mtask.recommends[mver['task']] = []
 		mtask.nrecommended[mver['task']] = int(mver['recommends'])
-		# print mtask
 	    else:
 		tasks[task.datekey] = task
 
@@ -168,11 +185,13 @@
 
     tasks_found.sort()
 
-    cNorm  = colors.Normalize(vmin=0, vmax=len(tasks_found))
+    drawlist = TasksGetDrawList(tasks)
+
+    cNorm  = colors.Normalize(vmin=0, vmax=len(drawlist))
     jet = plt.get_cmap('jet')
     scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=jet)
     cs = []
-    for i in range(len(tasks_found)):
+    for i in range(len(drawlist)):
 	colorVal = scalarMap.to_rgba(i)
 	cs.append(colorVal)
 
@@ -181,7 +200,7 @@
 	task = tasks[t]
     	xtime.append(datetime.date(task.year, task.month, task.day))
     values = []
-    for ti in tasks_found:
+    for ti in drawlist:
     	v = []
 	for t in sorted(tasks.keys()):
 	    task = tasks[t]
@@ -190,15 +209,14 @@
     	    else:
     		# v.append(None)
     		v.append(0)
-	print ti, v, len(v)
+	# print ti, v, len(v)
     	values.append(v)
 
     fig = plt.figure()
     ax = fig.add_subplot(111, projection='3d')
-#    for c, z in zip(['r', 'g', 'b', 'y'], range(20)):
-    for z in range(len(tasks_found)):
-	xs = xtime#[0:len(tasks_found)]
-	ys = values[z]#[0:len(tasks_found)]
+    for z in range(len(drawlist)):
+	xs = xtime
+	ys = values[z]
 
 	# You can provide either a single color or an array. To demonstrate this,
 	# the first bar of each set will be colored cyan.
@@ -214,33 +232,13 @@
 	#   http://stackoverflow.com/questions/886716/controling-bars-width-in-matplotlib-with-per-month-data
 	ax.bar(xtime, values[z], zs=z, zdir='y', color=color, alpha=0.8, width=90)
 
-    ax.set_yticklabels(tasks_found)
+    ax.set_yticklabels(drawlist)
     ax.set_xlabel('')
     ax.set_ylabel('')
     ax.set_zlabel('')
 
     plt.show()
 
-#    print "-------------------------------"
-#    for v in values:
-#	print xtime
-#	print len(v)
-#	print tasks_found
-#	print cs
-#	print "xtime is", type(xtime), len(xtime), "; v is", type(v), len(v), "; tasks_found is", type(tasks_found), len(tasks_found), "; cs is", type(cs), len(cs)
-#   This does not work for whatever strange reason 
-#	ax.bar(left=xtime, height=v, zs=tasks_found, zdir='y', color=cs, alpha=0.8, width=90)
-#	ax.bar(left=range(44), height=range(44), zs=range(len(tasks_found)), zdir='y')# , color=cs, alpha=0.8, width=90)
-    # print values
-
-    # ax.set_yticks(tasks_found)
-#    ax.set_yticklabels(tasks_found)
-#    ax.set_xlabel('')
-#    ax.set_ylabel('')
-#    ax.set_zlabel('')
-#
-#    plt.show()
-
 
 if __name__ == '__main__':
   main()




More information about the Blends-commit mailing list