src-d / hercules

Gaining advanced insights from Git repository history.
Other
2.06k stars 146 forks source link

[BUG] Problem with time series for repository with a short lifetime ( <64 day) #362

Open Detrous opened 4 years ago

Detrous commented 4 years ago

Hi! I found that time_series cannot be created for repositories with lifetime lower than 64 days. It is caused by this constant https://github.com/src-d/hercules/blob/master/python/labours/modes/devs.py#L51 window = slepian(size // resolution, 0.5) windows can be blank(if size < resolution) that will cause this error:

Traceback (most recent call last):
  File "/usr/local/bin/labours", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/labours/cli.py", line 449, in main
    modes[mode]()
  File "/usr/local/lib/python3.7/site-packages/labours/cli.py", line 349, in devs
    max_people=args.max_people,
  File "/usr/local/lib/python3.7/site-packages/labours/modes/devs.py", line 66, in show_devs
    final[route_map[i]] = convolve(full_history, window, "same")
  File "/usr/local/lib/python3.7/site-packages/scipy/signal/signaltools.py", line 811, in convolve
    method = choose_conv_method(volume, kernel, mode=mode)
  File "/usr/local/lib/python3.7/site-packages/scipy/signal/signaltools.py", line 698, in choose_conv_method
    if _fftconv_faster(volume, kernel, mode):
  File "/usr/local/lib/python3.7/site-packages/scipy/signal/signaltools.py", line 512, in _fftconv_faster
    tuple(out_shape)))
  File "/usr/local/lib/python3.7/site-packages/scipy/signal/signaltools.py", line 511, in <genexpr>
    fft_time = sum(n * math.log(n) for n in (x.shape + h.shape +
ValueError: math domain error

Why resolution is set to 64 ? Maybe this value must be calculated based on size and should always be lower then size ? #

nepp95 commented 2 years ago

Can reproduce this. Also not working for me.

apachetonville commented 8 months ago

I can reproduce this error as well. Debug log below:

Plotting
Traceback (most recent call last):
  File "/usr/local/bin/labours", line 33, in <module>
    sys.exit(load_entry_point('labours==10.7.2', 'console_scripts', 'labours')())
  File "/usr/local/lib/python3.6/dist-packages/labours/cli.py", line 449, in main
    modes[mode]()
  File "/usr/local/lib/python3.6/dist-packages/labours/cli.py", line 349, in devs
    max_people=args.max_people,
  File "/usr/local/lib/python3.6/dist-packages/labours/modes/devs.py", line 59, in show_devs
    final[route_map[i]] = convolve(full_history, window, "same")
  File "/usr/local/lib/python3.6/dist-packages/scipy/signal/signaltools.py", line 799, in convolve
    method = choose_conv_method(volume, kernel, mode=mode)
  File "/usr/local/lib/python3.6/dist-packages/scipy/signal/signaltools.py", line 692, in choose_conv_method
    if _fftconv_faster(volume, kernel, mode):
  File "/usr/local/lib/python3.6/dist-packages/scipy/signal/signaltools.py", line 508, in _fftconv_faster
    tuple(out_shape)))
  File "/usr/local/lib/python3.6/dist-packages/scipy/signal/signaltools.py", line 507, in <genexpr>
    fft_time = sum(n * math.log(n) for n in (x.shape + h.shape +
ValueError: math domain error
##[debug]Docker Action run completed with exit code 1
##[debug]Finishing: Hercules