Skip to content

Instantly share code, notes, and snippets.

@hharnisc
Last active February 13, 2018 14:59
Show Gist options
  • Save hharnisc/4643e6ec19f47a6920d4d4d490a7f34b to your computer and use it in GitHub Desktop.
Save hharnisc/4643e6ec19f47a6920d4d4d490a7f34b to your computer and use it in GitHub Desktop.
Atomic Migration Strategy For Web Teams - Chapter 1 Graphs
import math
from datetime import datetime
import matplotlib.pyplot as plt
import numpy
num_authors = [36, 36, 31, 32, 30, 32, 44, 49, 39, 42, 39, 30, 29, 36, 31, 25, 22, 21, 20, 18, 19, 23, 16, 13, 11, 12, 12, 13, 16, 15, 11, 13, 12, 12, 11, 9]
commits = [1104, 1249, 838, 895, 912, 1070, 1667, 1102, 1358, 1563, 1251, 746, 958, 1235, 1123, 780, 636, 932, 664, 1031, 710, 829, 860, 666, 885, 1030, 485, 815, 1138, 811,1042, 1024, 1141, 1001, 1071, 835]
dates = [
"12/1/2016","11/1/2016","10/1/2016","9/1/2016","8/1/2016","7/1/2016","6/1/2016","5/1/2016","4/1/2016","3/1/2016","2/1/2016","1/1/2016","12/1/2015","11/1/2015","9/1/2015","8/1/2015","7/1/2015","6/1/2015","5/1/2015","4/1/2015","3/1/2015","2/1/2015","1/1/2015","12/1/2014","11/1/2014","10/1/2014","9/1/2014","8/1/2014","7/1/2014","6/1/2014","5/1/2014","4/1/2014","3/1/2014","2/1/2014","1/1/2014","12/1/2013"]
dates = map(lambda date: datetime.strptime(date, '%m/%d/%Y'), dates)
commits_per_author = []
for i in range(0, len(num_authors)):
commits_per_author.append(commits[i] / num_authors[i])
# fit with a polynomial factor of 2
z = numpy.polyfit(range(0, len(commits_per_author)), commits_per_author, 2)
p = numpy.poly1d(z)
plt.style.use('fivethirtyeight')
plt.gcf().autofmt_xdate()
plt.figure(figsize=(14,8))
plt.title('Commits Per Author Over Time')
plt.ylabel('Commits/Author')
plt.plot(dates, commits_per_author, '-', dates, p(range(0, len(commits_per_author))), '--')
# plt.show()
plt.savefig('CommitsPerAuthor.png')
import matplotlib.pyplot as plt
import math
def logistic(a, b, c, x):
return c / (1 + math.pow(a * math.e, -1 * b * x))
values = []
for x in range(-100, 100):
floatX = x * 0.1
values.append(logistic(2, -0.3, 10, floatX))
plt.style.use('fivethirtyeight')
plt.plot(values)
plt.ylabel('Developer Pace')
plt.xlabel('Time')
plt.xticks([])
plt.yticks([])
# plt.show()
plt.savefig('DeveloperPaceOverTime.png')
import math
from datetime import datetime
import matplotlib.pyplot as plt
import numpy
num_authors = [36, 36, 31, 32, 30, 32, 44, 49, 39, 42, 39, 30, 29, 36, 31, 25, 22, 21, 20, 18, 19, 23, 16, 13, 11, 12, 12, 13, 16, 15, 11, 13, 12, 12, 11, 9]
commits = [1104, 1249, 838, 895, 912, 1070, 1667, 1102, 1358, 1563, 1251, 746, 958, 1235, 1123, 780, 636, 932, 664, 1031, 710, 829, 860, 666, 885, 1030, 485, 815, 1138, 811,1042, 1024, 1141, 1001, 1071, 835]
commits_per_author = []
for i in range(0, len(num_authors)):
commits_per_author.append(commits[i] / num_authors[i])
plt.style.use('fivethirtyeight')
plt.gcf().autofmt_xdate()
plt.figure(figsize=(14,8))
plt.title('Marginal Productivity As Team Grows')
plt.ylabel('Commits/Author')
plt.xlabel('Num Authors')
plt.plot(num_authors, commits_per_author, 'o')
# plt.show()
plt.savefig('MarginalProductivity.png')
backports.functools-lru-cache==1.5
cycler==0.10.0
matplotlib==2.1.2
numpy==1.14.0
pyparsing==2.2.0
python-dateutil==2.6.1
pytz==2018.3
six==1.11.0
subprocess32==3.2.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment