The Python Scipy library provides several functions to downsample signals, but they all have limitations:
- The resample function is based on Fourier method, which means it assumes periodic signals.
- The resample_poly function assumes "values beyond the boundary of the signal to be zero."
- The decimate function can only downsample signals by some integer factors, not to specific number of samples.
- The upfirdn function requires FIR filter coefficients as inputs, which I am not sure how to get.
I have a signal that's NOT periodic and the values beyound the boundary of the signal are NOT zeros, and I want to downsample the singal from 611 samples to 100 samples.
Is there a simple way to do that in Python?
EDIT: The reason why I need to downsample signals to a fixed number of samples is that I have signals with different length, and I want to use those signals to train a 1D CNN for classification/regression tasks, which requires inputs of fixed size; I prefer not to use RNN/LSTM, although those models can accept inputs with various sizes.