import time
# uniform colors for OS results
-os_colors = ['#B63537', '#4E4DA0', '#008200', 'gray']
+os_colors = ['#AA2029', '#D1942B', '#7FB142', '#69A7CE']
os_order = ['linux', 'mac', 'win', 'otheros']
time_order = ['notime', 'little', 'most', 'always']
-time_colors = ['#AA2029', '#D1942B', '#7FB142', '#69A7CE']
+time_colors = ['#FF0000', '#FF5500', '#FFAC00', '#FFFD08']
time_categories = {
'notime': "don't use it",
'little': "less than 50%",
d = {}
lfile = open(name)
for line in lfile:
+ if line.strip() == "":
+ continue
kv = line.split(':')
+ if kv[0] in d:
+ raise RuntimeError(
+ "Got a line %s with a duplicate key %s whenever value for it "
+ "is known already to be %r" % (line, kv[0], d[kv[0]]))
d[kv[0]] = kv[1].strip().strip('"')
return d
os_dict = load_list2dict('oslist.txt')
datamod_dict = load_list2dict('datamodlist.txt')
sw_dict = load_list2dict('swlist.txt')
+ position_dict = load_list2dict('position-dd-list.txt')
+ employer_dict = load_list2dict('employer-dd-list.txt')
+ ratings_dict = load_list2dict('ratingslist.txt')
def __init__(self, srcdir):
# eats the whole directory
def get_nice_name(self, id):
srcs = [DB.os_dict, os_cat_names, DB.sw_dict, sw_categories,
- resource_categories, time_categories, DB.datamod_dict]
+ resource_categories, time_categories,
+ DB.datamod_dict, DB.position_dict, DB.employer_dict]
for src in srcs:
if id in src:
return src[id]
def mkpic_os_per_env(db, destdir):
- envs = ['pers', 'man', 'virt', 'virt']
+ envs = ['pers_os', 'man_os', 'virt_host_os', 'virt_guest_os']
env_names = ['Personal', 'Managed', 'Virt. Host', 'Virt. Guest']
env_stats = {}
for env in envs:
stats[os_family_rev[os]] += counts[os]
total_count = np.sum(stats.values())
for osf in stats:
- stats[osf] = float(stats[osf]) / total_count
+ if not total_count:
+ stats[osf] = 0
+ else:
+ stats[osf] = float(stats[osf]) / total_count
env_stats[env] = stats
# make stacked barplot
pl.figure(figsize=(6.4, 4.8))
pl.ylim(-0.4, len(envs))
pl.title("Research activity time by environment")
pl.xlabel("Fraction of submissions")
- pl.savefig('%s/ospref_by_env.png' % destdir, format='png', dpi=80)
+ pl.subplots_adjust(right=0.97)
+ pl.savefig('%s/time_by_env.png' % destdir, format='png', dpi=80)
def mkpic_submissions_per_key(db, destdir, key, title, sortby='name',
multiple=False):
counts = db.get_counts(key)
- pl.figure(figsize=(6.4, 4.8))
+ pl.figure(figsize=(6.4, (len(counts)-2) * 0.4 + 2))
+ tmargin = .8/len(counts)
+ if tmargin > 0.3: tmargin = 0.3
+ print key, tmargin
+ pl.subplots_adjust(left=0.03, right=0.97, top=1-tmargin, bottom=tmargin)
pl.title(title)
if not len(counts):
pl.text(.5, .5, "[Insufficient data for this figure]",
else:
raise ValueError("Specify either name or count for sortby")
x = np.arange(len(stats))
- pl.bar(x + (1./8), [s[1] for s in stats], width=0.75, color = '#008200')
- pl.xticks(x + 0.5, ['' for s in stats])
+ pl.barh(x + (1./8), [s[1] for s in stats], height=0.75, color = '#008200')
+ pl.yticks(x + 0.5, ['' for s in stats])
for i, s in enumerate(stats):
- pl.text(i+.5, 0.1, db.get_nice_name(s[0]), rotation=90,
- horizontalalignment='center',
- verticalalignment='bottom',
+ pl.text(0.1, i+.5, db.get_nice_name(s[0]),
+ horizontalalignment='left',
+ verticalalignment='center',
bbox=dict(facecolor='white', alpha=0.8, edgecolor='white'))
- pl.xlim(0, len(stats))
+ pl.ylim(0, len(stats))
yl = "Number of submissions"
if multiple:
yl += "\n(multiple choices per submission possible)"
- pl.ylabel(yl)
+ pl.xlabel(yl)
pl.savefig('%s/submissions_per_%s.png' % (destdir, key), format='png', dpi=80)