|
@@ -125,7 +125,7 @@ def bandpass_filt(x, band=(8,18), fs=500, order=10):
|
|
|
return sosfiltfilt(butter(order,[band[0]/(0.5*fs),band[1]/(0.5*fs)],btype='band',output='sos'),x).reshape(-1)
|
|
|
def get_upper_envelope(y, x, lower_limit = -10000000):
|
|
|
peaks,_ = find_peaks(y, height=lower_limit)
|
|
|
- peaks_x = np.concatenate((np.array([t[0]]),x[peaks],np.array([t[-1]])), axis=0)
|
|
|
+ peaks_x = np.concatenate((np.array([x[0]]),x[peaks],np.array([x[-1]])), axis=0)
|
|
|
peaks_y = np.concatenate((np.array([y[0]]),y[peaks],np.array([y[-1]])), axis=0)
|
|
|
return interp1d(peaks_x, peaks_y, kind = 'cubic')(np.linspace(peaks_x[0], peaks_x[-1], len(y)))
|
|
|
|