view python/repostats.py2 @ 201:d5debbfc0200

Added all 27 core instructions of msp430
author Windel Bouwman
date Thu, 13 Jun 2013 00:07:28 +0200
parents aaa4939a7942
children
line wrap: on
line source

#!/usr/bin/python2

import sys
# Use python 2 since mercurial does not support python 3 yet?
assert sys.version_info.major == 2

from mercurial import ui, hg
import numpy
import matplotlib.pyplot as plt
import datetime

u = ui.ui()
repo = hg.repository(u, '..')

stamps = []
nds = repo.changelog.nodesbetween()[0]
for hexid in nds:
   cset = repo.changelog.read(hexid)
   stamps.append(cset[2][0])

dts = [datetime.datetime.fromtimestamp(st) for st in stamps]

x = [dt.weekday() for dt in dts]
y = [dt.hour for dt in dts]

# plot it:
f = plt.figure()
#plt.hexbin(x, y)
plt.scatter(x, y)
ax = plt.gca()
ax.set_ylim([0, 24])
ax.set_ylabel('hour of day')
ax.set_xlim([0, 7])
ax.set_xlabel('day of week')
ax.grid()
plt.show()