[Blends-commit] r3629 - in /blends/trunk/team_analysis_tools: count-dependencies.py med_historical_data.json

tille at users.alioth.debian.org tille at users.alioth.debian.org
Tue Oct 30 22:29:41 UTC 2012


Author: tille
Date: Tue Oct 30 22:29:40 2012
New Revision: 3629

URL: http://svn.debian.org/wsvn/blends/?sc=1&rev=3629
Log:
Get some very rough 3D barplot about evolution of metapackage dependencies - needs definitely polishing but works somehow

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

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=3629&op=diff
==============================================================================
--- blends/trunk/team_analysis_tools/count-dependencies.py (original)
+++ blends/trunk/team_analysis_tools/count-dependencies.py Tue Oct 30 22:29:40 2012
@@ -12,6 +12,12 @@
 from subprocess import Popen, PIPE
 from debian import deb822
 from mx.DateTime import *
+import datetime
+
+from mpl_toolkits.mplot3d import Axes3D
+import matplotlib.pyplot as plt
+import matplotlib.colors as colors
+import matplotlib.cm as cmx
 
 debug=0
 
@@ -31,7 +37,7 @@
 	self.recommends	= {}
 	self.nrecommended = {}
 	if htask != None and hrecommended != None:
-	    self.nrecommended[htask] = hrecommended
+	    self.nrecommended[htask] = int(hrecommended)
 	    self.recommends[htask] = []
 	self.ctrlfile	= None
 
@@ -47,6 +53,7 @@
 	    if r.startswith(BLEND+'-common') or r.startswith(BLEND+'-config') or r.startswith(BLEND+'-tasks'):
 		continue
 	    self.recommends[p].append(r)
+	self.nrecommended[p] = len(self.recommends[p])
 
     def __str__(self):
 	s="Version: %s; Date: %s-%02i-%02i:" % (self.version, self.year, int(self.month), int(self.day))
@@ -55,6 +62,7 @@
 		self.nrecommended[r] = len(self.recommends[r])
 	    s += '\n  ' + r + ': ' + str(self.nrecommended[r])
 	return s
+
 
 def main():
     root = '../../../projects/'+BLEND+'/tags' 
@@ -76,6 +84,8 @@
 	    if mver['task'] == 'bio-contrib':
 		# we are not interested in non-free dependencies
 		continue
+	    if mver['task'] == 'dent':
+		mver['task'] = 'dental'
 	    if not mver['task'] in tasks_found:
 		tasks_found.append(mver['task'])
 	    task = taskscontent(mver['version'], mver['date'], mver['task'], mver['recommends'])
@@ -92,7 +102,7 @@
 		    print >>stderr, "Duplicated task at same date."
 		    continue
 		mtask.recommends[mver['task']] = []
-		mtask.nrecommended[mver['task']] = mver['recommends']
+		mtask.nrecommended[mver['task']] = int(mver['recommends'])
 		# print mtask
 	    else:
 		tasks[task.datekey] = task
@@ -140,6 +150,8 @@
             if pkg.has_key('package'):
                 package = pkg['package']
                 if package != BLEND+'-common' and package != BLEND+'-tasks' and package != BLEND+'-config':
+		    if package == 'med-dent':
+			package = 'med-dental'
 		    if not package.replace(BLEND+'-', '') in tasks_found:
 			tasks_found.append(package.replace(BLEND+'-', ''))
                     if pkg.has_key('recommends'):
@@ -154,12 +166,81 @@
     	        except:
     		    pkg = None
 
+    tasks_found.sort()
+
+    cNorm  = colors.Normalize(vmin=0, vmax=len(tasks_found))
+    jet = plt.get_cmap('jet')
+    scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=jet)
+    cs = []
+    for i in range(len(tasks_found)):
+	colorVal = scalarMap.to_rgba(i)
+	cs.append(colorVal)
+
+    xtime = []
     for t in sorted(tasks.keys()):
 	task = tasks[t]
-        print task
-
-    tasks_found.sort()
-    print tasks_found
+    	xtime.append(datetime.date(task.year, task.month, task.day))
+    values = []
+    for ti in tasks_found:
+    	v = []
+	for t in sorted(tasks.keys()):
+	    task = tasks[t]
+    	    if task.nrecommended.has_key(ti):
+    		v.append(task.nrecommended[ti])
+    	    else:
+    		# v.append(None)
+    		v.append(0)
+	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)]
+
+	# You can provide either a single color or an array. To demonstrate this,
+	# the first bar of each set will be colored cyan.
+	color = []
+	csz = cs[z]
+	for i in range(len(xtime)):
+	    if ys[i] > 0:
+		color.append(csz)
+	    else:
+		color.append((1.0, 1.0, 1.0, 0.0)) # how to make zero dependencies invisible ????
+	# col = [cs[z]] * len(xtime)
+        # setting width of bars:
+	#   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_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()

Modified: blends/trunk/team_analysis_tools/med_historical_data.json
URL: http://svn.debian.org/wsvn/blends/blends/trunk/team_analysis_tools/med_historical_data.json?rev=3629&op=diff
==============================================================================
--- blends/trunk/team_analysis_tools/med_historical_data.json (original)
+++ blends/trunk/team_analysis_tools/med_historical_data.json Tue Oct 30 22:29:40 2012
@@ -1,37 +1,53 @@
 [
+ {"README": "This file simplifies the evaluation of historical data of single Debian Med metapackages.  Formerly the metapackages were created from single source files and this fake data input file tries to trigger them at the same dates to have a sensible chance for plotting some graphs.  The real release dates are added as comments."},
  {"task": "bio", "version": "0.1-1", "date": "2002-02-06", "recommends": "4"},
+ {"task": "bio-contrib", "version": "0.1-1", "date": "2002-02-06", "recommends": "6"},
+ {"task": "dent", "version": "0.1-1", "date": "2002-02-06", "recommends": "1"},
+ {"comment": "the world has seen the following versions of dent: 0.1-2, 0.2-1, 0.3-1, 0.4-1, 0.5-1 and 0.5-2 - but none of these added additional dependencies"},
+ {"task": "imaging", "version": "0.1-1", "date": "2002-02-06", "recommends": "4"},
+ {"comment": "version 0.1-1 of imaging was actually at date: 2002-04-11 but for simplicity we are faking same date as bio 0.1-1 release"},
+ {"task": "imaging-dev", "version": "0.1-1", "date": "2002-02-06", "recommends": "2"},
+ {"comment": "version 0.1-1 of imaging-dev was actually at date: 2002-04-11 but for simplicity we are faking same date as bio 0.1-1 release"},
+ {"task": "tools", "version": "0.1-1", "date": "2002-02-06", "recommends": "1"},
  {"task": "bio", "version": "0.1-2", "date": "2002-02-08", "recommends": "6"},
  {"task": "bio", "version": "0.2-1", "date": "2002-04-14", "recommends": "7"},
+ {"task": "imaging", "version": "0.2-1", "date": "2002-04-14", "recommends": "4"},
+ {"comment": "version 0.2-1 of imaging was actually at date: 2002-05-19 but for simplicity we are faking same date as bio 0.2-1 release"},
+ {"task": "imaging-dev", "version": "0.2-1", "date": "2002-04-14", "recommends": "2"},
+ {"comment": "version 0.2-1 of imaging-dev was actually at date: 2002-05-19 but for simplicity we are faking same date as bio 0.2-1 release"},
+ {"task": "tools", "version": "0.2-1", "date": "2002-04-14", "recommends": "1"},
+ {"comment": "version 0.2-1 of tools was actually at date: 2002-05-19 but for simplicity we are faking same date as bio 0.2-1 release"},
  {"task": "bio", "version": "0.3-1", "date": "2002-04-19", "recommends": "8"},
+ {"task": "imaging", "version": "0.3-1", "date": "2002-04-19", "recommends": "5"},
+ {"comment": "version 0.3-1 of imaging was actually at date: 2002-05-28 but for simplicity we are faking same date as bio 0.3-1 release"},
+ {"task": "imaging-dev", "version": "0.3-1", "date": "2002-04-19", "recommends": "3"},
+ {"comment": "version 0.3-1 of imaging-dev was actually at date: 2002-06-26 but for simplicity we are faking same date as bio 0.3-1 release"},
+ {"task": "tools", "version": "0.3-1", "date": "2002-04-19", "recommends": "1"},
+ {"comment": "version 0.3-1 of tools was actually at date: 2002-06-25 but for simplicity we are faking same date as bio 0.3-1 release"},
  {"task": "bio", "version": "0.4-1", "date": "2002-05-18", "recommends": "8"},
+ {"task": "imaging", "version": "0.4-1", "date": "2002-05-18", "recommends": "5"},
+ {"comment": "version 0.4-1 of imaging was actually at date: 2002-06-26 but for simplicity we are faking same date as bio 0.4-1 release"},
  {"task": "bio", "version": "0.4-2", "date": "2002-05-28", "recommends": "9"},
+ {"task": "imaging", "version": "0.4-2", "date": "2002-05-28", "recommends": "5"},
+ {"comment": "version 0.4-2 of imaging was actually at date: 2002-07-24 but for simplicity we are faking same date as bio 0.4-2 release"},
  {"comment": "leave out bio 0.4-3 which has no change in number and was released at same day as 0.4-2"},
  {"task": "bio", "version": "0.5-1", "date": "2002-06-24", "recommends": "9"},
  {"task": "bio", "version": "0.5-2", "date": "2003-01-05", "recommends": "12"},
  {"comment": "seems bio 0.5-3 was never released - at least there is no changelog entry"},
  {"task": "bio", "version": "0.5-4", "date": "2003-04-04", "recommends": "15"},
- {"task": "bio", "version": "0.5-5", "date": "2004-01-14", "recommends": "17"},
+ {"task": "imaging", "version": "0.4-3", "date": "2003-04-04", "recommends": "8"},
+ {"comment": "version 0.4-3 of imaging was actually at date: 2003-04-14 but for simplicity we are faking same date as bio 0.5-4 release"},
+ {"task": "imaging-dev", "version": "0.3-2", "date": "2003-04-04", "recommends": "5"},
+ {"comment": "version 0.3-2 of imaging-dev was actually at date: 2003-04-14 but for simplicity we are faking same date as bio 0.5-4 release"},
+ {"task": "tools", "version": "0.3-2", "date": "2003-04-04", "recommends": "2"},
+ {"comment": "version 0.3-2 of tools was actually at date: 2003-04-14 but for simplicity we are faking same date as bio 0.5-4 release"},
+ {"comment": "Drop imaging-dev even if it adds another dependency - plot would become unnecessarily crowded for no extra information", "notask": "imaging-dev", "version": "0.3-3", "date": "2003-04-23", "recommends": "5"},
+ {"task": "bio", "version": "0.5-5", "date": "2003-10-05", "recommends": "17"},
+ {"comment": "version 0.5-5 of bio was actually at date: 2004-01-14 but for simplicity we are faking same date as imaging 0.4-4 release"},
+ {"task": "imaging", "version": "0.4-4", "date": "2003-10-05", "recommends": "7"},
+ {"task": "imaging-dev", "version": "0.3-4", "date": "2003-10-05", "recommends": "4"},
+ {"task": "tools", "version": "0.3-3", "date": "2003-10-05", "recommends": "1"},
+ {"comment": "version 0.3-3 of tools was actually at date: 2003-06-29 but for simplicity we are faking same date as imaging 0.4-4 release"},
  {"task": "bio", "version": "0.5-6", "date": "2004-02-13", "recommends": "19"},
- {"task": "bio-contrib", "version": "0.1-1", "date": "2002-02-06", "recommends": "6"},
- {"task": "dent", "version": "0.1-1", "date": "2002-02-06", "recommends": "1"},
- {"comment": "the world has seen the following versions of dent: 0.1-2, 0.2-1, 0.3-1, 0.4-1, 0.5-1 and 0.5-2 - but none of these added additional dependencies"},
- {"task": "imaging", "version": "0.4-4", "date": "2003-10-05", "recommends": "7"},
- {"task": "imaging", "version": "0.4-3", "date": "2003-04-14", "recommends": "8"},
- {"task": "imaging", "version": "0.4-2", "date": "2002-07-24", "recommends": "5"},
- {"task": "imaging", "version": "0.4-1", "date": "2002-06-26", "recommends": "5"},
- {"task": "imaging", "version": "0.3-1", "date": "2002-05-28", "recommends": "5"},
- {"task": "imaging", "version": "0.2-1", "date": "2002-05-19", "recommends": "4"},
- {"task": "imaging", "version": "0.1-1", "date": "2002-04-11", "recommends": "4"},
- {"task": "imaging-dev", "version": "0.3-4", "date": "2003-10-05", "recommends": "4"},
- {"task": "imaging-dev", "version": "0.3-3", "date": "2003-04-23", "recommends": "5"},
- {"task": "imaging-dev", "version": "0.3-2", "date": "2003-04-14", "recommends": "5"},
- {"task": "imaging-dev", "version": "0.3-1", "date": "2002-06-26", "recommends": "3"},
- {"task": "imaging-dev", "version": "0.2-1", "date": "2002-05-19", "recommends": "2"},
- {"task": "imaging-dev", "version": "0.1-1", "date": "2002-04-11", "recommends": "2"},
- {"task": "tools", "version": "0.3-3", "date": "2003-06-29", "recommends": "1"},
- {"task": "tools", "version": "0.3-2", "date": "2003-04-14", "recommends": "2"},
- {"task": "tools", "version": "0.3-1", "date": "2002-06-25", "recommends": "1"},
- {"task": "tools", "version": "0.2-1", "date": "2002-05-19", "recommends": "1"},
- {"task": "tools", "version": "0.1-1", "date": "2002-02-06", "recommends": "1"},
  {"task": "cms", "version": "0.1-1", "date": "2004-01-06", "recommends": "1"}
 ]




More information about the Blends-commit mailing list