def dwt1(signal,wname): [lpd,hpd,lpr,hpr]=filter.filtcoef(wname) len_lpfilt=int(len(lpd)) len_hpfilt=int(len(hpd)) len_avg=int(len_lpfilt/2 + len_hpfilt/2) len_sig = int( 2 *(np.ceil(len(signal) * 1.0/2.0))) D=int(2) signal=misc.per_ext(signal,int(len_avg/2)) cA_undec=np.real(convol.convfft(signal,lpd)) cA_undec=cA_undec[len_avg-1:] cA_undec=cA_undec[:len(cA_undec)-len_avg+1] cA_undec=cA_undec[1:len_sig] cA=sample.downsamp(cA_undec,D) cD_undec=np.real(convol.convfft(signal,hpd)) cD_undec=cD_undec[len_avg-1:] cD_undec=cD_undec[:len(cD_undec)-len_avg+1] cD_undec=cD_undec[1:len_sig] cD=sample.downsamp(cD_undec,D) return cA,cD
def dwt1_sym(signal, wname): [lpd, hpd, lpr, hpr] = filter.filtcoef(wname) len_lpfilt = int(len(lpd)) len_hpfilt = int(len(hpd)) lf = len_lpfilt D = int(2) signal = misc.symm_ext(signal, int(lf - 1)) cA_undec = np.real(convol.convfft(signal, lpd)) cA_undec = cA_undec[lf:] cA_undec = cA_undec[: len(cA_undec) - lf + 1] cA = sample.downsamp(cA_undec, D) cD_undec = np.real(convol.convfft(signal, hpd)) cD_undec = cD_undec[lf:] cD_undec = cD_undec[: len(cD_undec) - lf + 1] cD = sample.downsamp(cD_undec, D) return cA, cD
def dwt1_sym(signal,wname): [lpd,hpd,lpr,hpr]=filter.filtcoef(wname) len_lpfilt=int(len(lpd)) len_hpfilt=int(len(hpd)) lf=len_lpfilt D=int(2) signal=misc.symm_ext(signal,int(lf - 1)) cA_undec=np.real(convol.convfft(signal,lpd)) cA_undec=cA_undec[lf:] cA_undec=cA_undec[:len(cA_undec)-lf+1] cA=sample.downsamp(cA_undec,D) cD_undec=np.real(convol.convfft(signal,hpd)) cD_undec=cD_undec[lf:] cD_undec=cD_undec[:len(cD_undec)-lf+1] cD=sample.downsamp(cD_undec,D) return cA,cD
def dwt1(signal, wname): [lpd, hpd, lpr, hpr] = filter.filtcoef(wname) len_lpfilt = int(len(lpd)) len_hpfilt = int(len(hpd)) len_avg = int(len_lpfilt / 2 + len_hpfilt / 2) len_sig = int(2 * (np.ceil(len(signal) * 1.0 / 2.0))) D = int(2) signal = misc.per_ext(signal, int(len_avg / 2)) cA_undec = np.real(convol.convfft(signal, lpd)) cA_undec = cA_undec[len_avg - 1 :] cA_undec = cA_undec[: len(cA_undec) - len_avg + 1] cA_undec = cA_undec[1:len_sig] cA = sample.downsamp(cA_undec, D) cD_undec = np.real(convol.convfft(signal, hpd)) cD_undec = cD_undec[len_avg - 1 :] cD_undec = cD_undec[: len(cD_undec) - len_avg + 1] cD_undec = cD_undec[1:len_sig] cD = sample.downsamp(cD_undec, D) return cA, cD