diff --git a/ipi_extract.py b/ipi_extract.py index 49b5a064229c788c00b8ce000f1cb38799fac7c2..33366cd2f43e765c7d07c83d096d43ed80150bf2 100644 --- a/ipi_extract.py +++ b/ipi_extract.py @@ -39,6 +39,8 @@ def load_file(in_path, channel, low, high): song = song[:, channel] sos = sg.butter(3, [low, high], 'bandpass', fs=sr, output='sos') song = sg.sosfiltfilt(sos, song) + if len(song) < 20*sr: + song = np.pad(song, (1, 20*sr), mode='constant') frac = Fraction(FSSR, sr) song_resample = sg.resample_poly(song, frac.numerator, frac.denominator) print('Done processing')