Skip to content

Instantly share code, notes, and snippets.

@cdleary
Last active August 5, 2017 06:13
Show Gist options
  • Save cdleary/d0279e3f5b2aaf546e29d402b8fa3217 to your computer and use it in GitHub Desktop.
Save cdleary/d0279e3f5b2aaf546e29d402b8fa3217 to your computer and use it in GitHub Desktop.
Hacked up script for matplotting change in TF compiler dir.
# git log --format='%ad %H %s' --no-merges --date=short tensorflow/compiler/ | python2.7 ~/changeplot.py
import fileinput
import matplotlib.pyplot as plt
from datetime import date, timedelta
START_DATE = date(2017, 1, 1)
dates = [(START_DATE, START_DATE + timedelta(days=7))]
while True:
dates.append((dates[-1][1], dates[-1][1] + timedelta(days=7)))
if dates[-1][1] > date.today():
break
counts = [0 for m in xrange(len(dates))]
for line in fileinput.input():
date_str, text = line.split(' ', 1)
y, m, d = [int(p) for p in date_str.split('-')]
change_date = date(y, m, d)
for i, (lo, hi) in enumerate(dates):
if lo <= change_date < hi:
counts[i] += 1
break
plt.style.use('ggplot')
plt.stem([d[0] for d in dates], counts)
plt.xticks(rotation = 90)
plt.title('TF/compiler Commit Activity vs Time')
plt.ylabel('Commit Count')
plt.xlabel('Week')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment