示例#1
0
def calcWiener2(ds, dpathInput="/", dpathEnsemble='/evtcond', newpath='/kernel'):
	'''Calculates the 0, 1, and 2 order wiener kernels between the Input and Event channelis.'''
	dat=ds.getSubData(dpathEnsemble).getData()
	sd = ds.getSubData(dpathInput)
	inp = sd.getData()
	h0=float(dat.shape[1])/inp.shape[0]
	sigma2=(inp**2).sum()/inp.shape[0]
	sigma4=(inp**4).sum()/inp.shape[0]
	h1=dat.mean(1)/sigma2
	h1=h1-h1.mean()
	h2=dot(dat, transpose(dat))/(dat.shape[1]-1)
	h2=h2/(sigma4)
	h2=h2-identity(h2.shape[0])*h0/sigma2
	ds.createSubData(newpath, data=None, head={"SampleType":"group", "h0":h0}, delete=True)
	ds.createSubData(newpath+"/h1", data=h1, head={"SampleType":"timeseries", "SamplesPerSecond":sd.fs()}, delete=True)
	ds.createSubData(newpath+"/h2", data=h2, head={"SampleType":"timeseries", "SamplesPerSecond":sd.fs()}, delete=True)
示例#2
0
def combineWiener(ds, dpathPred="/dp", ratio=.02):
	sd = ds.getSubData(dpathPred)
	dat = sd.getData()
	dat = dat[:,0] + ratio*dat[:,1]
	sd.datinit(dat)