Hi
I want to subtract all the behaviour that have length scale bigger than data-length/10 from each vector. Here is the function I wrote:
but apparently this does not work probably since the delay part is not calculated right, can anybody help me with this?
Cheers
I want to subtract all the behaviour that have length scale bigger than data-length/10 from each vector. Here is the function I wrote:
Code:
def hpass(vec):
cutoff_hz = len(vec)/10.
sample_rate=len(vec)
nyq_rate = sample_rate / 2.
numtaps = 10
warmup = numtaps - 1
fir_coeff = firwin(numtaps, cutoff_hz/nyq_rate)
delay = (warmup) #/ sample_rate
t=np.arange(len(vec))
t-=delay
ln=len(t)-delay
t=t[:ln]
fl= lfilter(fir_coeff,1.0,vec)
tmp=vec[:ln]-fl[t]
filtered=(tmp)
return filtered
Cheers
Comment