Skip to content

Commit 676904b

Browse files
authored
Merge pull request #231 from vmarkovtsev/master
Dump devs-parallel progress
2 parents c7c5cb6 + c6e065f commit 676904b

File tree

1 file changed

+37
-15
lines changed

1 file changed

+37
-15
lines changed

labours.py

+37-15
Original file line numberDiff line numberDiff line change
@@ -1640,27 +1640,49 @@ def load_devs_parallel(ownership, couples, devs, max_people):
16401640
clusters = hdbscan_cluster_routed_series(dists, orig_route)
16411641
for k, v in result.items():
16421642
v.commit_coocc_index = route.index(people.index(k))
1643-
v.commit_coocc_index = clusters[v.commit_coocc_index]
1643+
v.commit_coocc_cluster = clusters[v.commit_coocc_index]
16441644

1645-
print(result)
1646-
return result, chosen
1645+
return result
16471646

16481647

1649-
def show_devs_parallel(args, name, start_date, end_date, data):
1648+
def show_devs_parallel(args, name, start_date, end_date, devs):
16501649
matplotlib, pyplot = import_pyplot(args.backend, args.style)
1651-
pyplot.xlim((0, 6))
1652-
pyplot.ylim((0, 1))
1653-
1654-
x = numpy.linspace(0.1, 0.9, 1000)
1655-
y = numpy.linspace(0.1, 0.9, 1000)
1656-
points = numpy.array([x, y]).T.reshape(-1, 1, 2)
1657-
segments = numpy.concatenate([points[:-1], points[1:]], axis=1)
1658-
16591650
from matplotlib.collections import LineCollection
1660-
lc = LineCollection(segments)
1661-
lc.set_array(numpy.linspace(0, 1, segments.shape[0]))
1662-
pyplot.gca().add_collection(lc)
16631651

1652+
def solve_equations(x1, y1, x2, y2):
1653+
xcube = (x1 - x2) ** 3
1654+
a = 2 * (y2 - y1) / xcube
1655+
b = 3 * (y1 - y2) * (x1 + x2) / xcube
1656+
c = 6 * (y2 - y1) * x1 * x2 / xcube
1657+
d = y1 - a * x1 ** 3 - b * x1 ** 2 - c * x1
1658+
return a, b, c, d
1659+
1660+
# biggest = {k: max(getattr(d, k) for d in devs.values())
1661+
# for k in ("commits", "lines", "ownership")}
1662+
for k, dev in devs.items():
1663+
points = numpy.array([
1664+
(1, dev.commits_rank),
1665+
(2, dev.lines_rank),
1666+
(3, dev.ownership_rank),
1667+
(4, dev.couples_index),
1668+
(5, dev.commit_coocc_index)],
1669+
dtype=float)
1670+
points[:, 1] = points[:, 1] / len(devs)
1671+
splines = []
1672+
for i in range(len(points) - 1):
1673+
a, b, c, d = solve_equations(*points[i], *points[i + 1])
1674+
x = numpy.linspace(i + 1, i + 2, 100)
1675+
smooth_points = numpy.array(
1676+
[x, a * x ** 3 + b * x ** 2 + c * x + d]).T.reshape(-1, 1, 2)
1677+
splines.append(smooth_points)
1678+
points = numpy.concatenate(splines)
1679+
segments = numpy.concatenate([points[:-1], points[1:]], axis=1)
1680+
lc = LineCollection(segments)
1681+
lc.set_array(numpy.linspace(0, 0.1, segments.shape[0]))
1682+
pyplot.gca().add_collection(lc)
1683+
1684+
pyplot.xlim(0, 6)
1685+
pyplot.ylim(-0.1, 1.1)
16641686
deploy_plot("Developers", args.output, args.background)
16651687

16661688

0 commit comments

Comments
 (0)