from scipy import signal slow_freq = 1e-4; fast_freq = 1e-2; num_samples = 1e5; t = np.arange(num_samples) s = np.sin(2*np.pi*slow_freq*t) + .1 * np.sin(2*np.pi*fast_freq*t) plot(s) p,f=mlab.psd(s,NFFT=len(s), Fs=1) plot(s[:10000]) loglog(f, p) filter_hz = 1e-3 sampling_frequency = 1 b, a = signal.butter(5, filter_hz / (sampling_frequency/2.), btype='high') print b,a sf = signal.lfilter(b, a, s) plot(sf) plot(sf[:10000]) pf,ff=mlab.psd(sf,NFFT=len(s), Fs=1) loglog(f, p, label="original"); loglog(ff, pf, label="filtered"); legend()