src-d / hercules

Gaining advanced insights from Git repository history.
Other
2.63k stars 334 forks source link

Fix bugs in old_vs_new visualization #297

Closed umarniz closed 5 years ago

umarniz commented 5 years ago

This PR increases the time window of new_lines by a day to avoid an edge case of commits in the last day.

I did not explore the logic too deeply but I can confirm I have noticed a crash with error: IndexError: index 4 is out of bounds for axis 0 with size 4

Where the days array has more values then initialised in the new_lines array.

The second fix in the PR is in in the window object which can sometimes lead to a 0 being passed to the slepian function and causing the window array to be empty and hence the next convolve functions crashes with a domain error caused by a 0 passed to the log within the function.

Both these bugs have been fixed and tested on ~50 internal repos of varying sizes.

vmarkovtsev commented 5 years ago

Thank you @umarniz, you've been brave enough to dig labours.py which desperately needs refactoring... I'll find some time today or tomorrow to review, could you please sign-off your commit meanwhile (the DCO check in this PR).

umarniz commented 5 years ago

Thanks a lot @vmarkovtsev!

I was working on an internal experiment this morning and found this super cool project, had to share what fixed my troubles :)

And thanks for this amazing project! Very useful and such cool output 👏