##// END OF EJS Templates
Fixed erros in sfb, idualtree, irls_dn, and irls_dn2
Fixed erros in sfb, idualtree, irls_dn, and irls_dn2

File last commit:

r20:21
r20:21
Show More
sfb.py
60 lines | 1.2 KiB | text/x-python | PythonLexer
'''
Created on Jun 5, 2014
@author: Yolian Amaro
'''
from multirate import *
import numpy as np
from cshift import *
def sfb(lo, hi, sf):
# Synthesis filter bank
#
# USAGE:
# y = sfb(lo, hi, sf)
# INPUT:
# lo - low frqeuency input
# hi - high frequency input
# sf - synthesis filters
# sf(:, 1) - lowpass filter (even length)
# sf(:, 2) - highpass filter (even length)
# OUTPUT:
# y - output signal
# See also afb
#
# WAVELET SOFTWARE AT POLYTECHNIC UNIVERSITY, BROOKLYN, NY
# http://taco.poly.edu/WaveletSoftware/
N = 2*lo.size;
L = sf.size/2;
# Need to change format for upfirdn funct:
lo = lo.T.conj()
lo = lo.reshape(lo.size)
#print 'sfb hi', hi
# Need to change format for upfirdn funct:
hi = hi.T.conj()
hi = hi.reshape(hi.size)
#hi = hi.reshape(1, hi.size)
lo = upfirdn(lo, sf[:,0], 2, 1);
hi = upfirdn(hi, sf[:,1], 2, 1);
y = lo + hi;
y[0:L-1] = y[0:L-1] + y[N+ np.arange(0,L-1)]; #CHECK IF ARANGE IS CORRECT
y = y[0:N];
#print 'y en sbf\n', y.shape
y = y.reshape(1, y.size)
#print 'y en sbf\n', y.shape
y = cshift(y, 1-L/2);
return y;