Neither I am an expert about signal processing, but out of curiosity I tried it and np.convolve convoluted happily.
When kernel was "padded" with zeros, it "zeroed" part of input signal. Perhaps try shorter filtering window or sparkz's advice to use full mode to avoid cutting?
import numpy as np from scipy.signal import gaussian import matplotlib.pyplot as plt def convoluplot(signal, kernel): fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True) ax1.plot(signal) ax1.set_title('Signal') ax2.plot(kernel) ax2.set_title('Filter') filtered = np.convolve(signal, kernel, "same") / sum(kernel) ax3.plot(filtered) ax3.set_title("Convolution") fig.show() signal = np.zeros(500) signal[100:150] = 1 signal[250:400] = np.linspace(0,1,150) kernel = gaussian(100, 10) convoluplot(signal, kernel)Spoiled image of output:
When kernel was "padded" with zeros, it "zeroed" part of input signal. Perhaps try shorter filtering window or sparkz's advice to use full mode to avoid cutting?