def local_CC(sig1, sig2, t_lag, fs):
"""
Calculation of Local-CC after Hale 2006.
Output = H3 - non-smoothed LCC
C - smoothed LCC (after Gussian smoothing)
t_lag - array of t_lag times
"""
l_max = int(t_lag*fs)
h3 = np.zeros((2*l_max, len(sig1)), sig1.dtype)
c = np.zeros((2*l_max, len(sig1)), sig1.dtype)
##
t_lag = sp.linspace(-l_max/fs, l_max/fs, 2*l_max, endpoint=False)
##
##
for l in xrange(-l_max, l_max):
l_f = int(floor(l/2.))
l_g = int(ceil(l/2.))
h3[l+l_max] = (__shift2(sig1, l_f) * __shift2(sig2, -l_g) +
__shift2(sig1, l_g) * __shift2(sig2, -l_f))/2
c[l+l_max] = Gaussian1D(h3[l+l_max], 10, padding=0)
#------------------not sure which formula for h3 is correct--------------------
# h3[l+l_max]=(shift2(sig1,-l_f)*shift2(sig2,l_g) +\
# shift2(sig1,-l_g)*shift2(sig2,l_f))/2
#
return c, h3, t_lag
评论列表
文章目录