python - How to filter a non periodic function -
python - How to filter a non periodic function -
i'm new python programming , wanted know if there way create high-pass filter periodic function so:
import numpy np scipy.signal import lfilter, firwin, butter pylab import figure, plot, show sample_rate = .0167 nsamples = 480 f_1hz = 1.38e-4 a_1hz = 1.0 f_15hz = .0011 a_15hz = .5 t = np.arange(nsamples) / sample_rate signal = a_1hz * np.sin(2*np.pi*f_1hz*t) + a_15hz*np.sin(2*np.pi*f_15hz*t) signal[::120] = 2 figure(1) plot(t,signal,'b') show()
i want maintain higher frequency ( .0011 hz) spikes of 2 @ spots, amplitudes of .0011 hz needs remain @ .5 , spikes need remain @ amplitude of 2, normalizing isn't option. moreover, if made function have spikes of 2 @ non-periodic intervals(say spike @ signal[prime numbers]) still filter correctly, right amplitudes?
the reply quite no.
the reason behind blunt reply spikes (which have value of 2) stand on top of signal. if filter away, signal amplitude may alter @ spikes.
if alter this:
signal[::120] = 2
into
signal[::120] += 2
then such filter can constructed. want filter away? below .0011 hz?
python numpy filtering
Comments
Post a Comment