I'm downsampling a signal through decimate (scipy implementation), but the result has a different amplitude than the original signal, which if I understood correctly, shouldn't happen. The original signal is sampled at 128Hz, and I want to downsample it to 1Hz. Decimation code is:
sig_d = signal.decimate(sig, 8) sig_d = signal.decimate(sig_d, 8) sig_d = signal.decimate(sig_d, 2)
I then checked in the first 1 minute window of the original and decimated signals:
df = pd.DataFrame(sig[0:7680]) print(df.describe()) df = pd.DataFrame(sig_d[0:60]) print(df.describe())
and this is the output statistics:
Original count 7680.000000 mean 94.191307 std 0.551882 min 92.580971 25% 94.028488 50% 94.086906 75% 94.794744 max 94.969666 Decimated count 60.000000 mean 91.011716 std 0.516294 min 89.658212 25% 90.847055 50% 90.886592 75% 91.589404 max 91.689528
As you can see, there is a huge decrease in amplitude for the same time window in the decimated signal. Per the statistics, it doesn't seem to be related to peak removal, since this window in the original signal has very small variability, and not really any pronounced peaks. I did plot the two signals to check if I wasn't messing up the alignment, and they were aligned perfectly, their shape in this time window is the same (besides sampling rate), but the decimated signal seemed to be "pushed down" in amplitude. Unfortunately, I cannot post the plots (for proxy reasons).
This seems to happen only with IIR filter(though FIR has other issues). Is this normal behavior of decimation? Or am I doing something wrong?