ruptures icon indicating copy to clipboard operation
ruptures copied to clipboard

Errors management for .predict() method of ruptures.detection.Window class

Open LGabilly opened this issue 6 years ago • 1 comments

As I understand, the predict of the ruptures.detection.Window class will fail if the number of samples in the signal is lower than 1.5 x the width parameters of the __init__ method.

Python will raise the following error

~/Documents/env/lib/python3.6/site-packages/ruptures/detection/window.py in _seg(self, n_bkps, pen, epsilon)
    177         peak_inds_arr = np.take(self.inds, peak_inds_shifted)
    178         # sort according to score value
--> 179         _, peak_inds = unzip(sorted(zip(gains, peak_inds_arr)))
    180         peak_inds = list(peak_inds)
    181 

ValueError: not enough values to unpack (expected 2, got 0)

which is a bit ambiguous.

Did I miss something in the documentation ? Or a slight improvement in error management is feasible ?

LGabilly avatar Aug 28 '19 15:08 LGabilly

This is definitely a bug. I get the same error.

idnavid avatar Feb 04 '20 22:02 idnavid