Beispiel #1
0
def syncAnalysis(X,t,w=[]):
	"""Perform the synchronization analysis
	as in Allefeld2004
	Some issues were identifed here, the code is 
	right (I think) but the algoritham does
	not do what would be expected.
	"""
	import variables
	n,m = X.shape
	# get all the FSM
	print 'estimating DFS for all '+str(m)+' oscillators'
	xFSM = []
	for i in range(m):
		if len(w)>0:
			xFSM.append(variables.getFSM(X[:,i],t,w))
		else:
			# estimate w if here (should only happen first time
			xFSM.append(variables.getFSM(X[:,i],t))
			# use estimated w
			w = xFSM[i][:,0]
	
	# now calculate the the synchronization at each w
	k = len(w)
	R = np.zeros((k,m))
	tHat = np.arange(np.min(t),np.max(t),(np.max(t)-np.min(t))/float(len(t)))
	nTime = len(tHat)

	for i in range(k):
		print 'calculating sync at freq '+str(w[i])
		th = np.zeros((nTime,m))
		for j in range(m):
			x,phase,f,amp = variables.getVars(tHat,xFSM=xFSM[j][i,:])
			th[:,j] = phase 


		R[i,:] = clusterSyncStr(th)
		
	R = np.c_[w,R]
	return(R)
Beispiel #2
0
def freqTimeOrder(X,t,w=[],q=1,nTime=0):
	"""Perform the synchronization analysis
	similar to Allefeld2004, still not quite 
	what I want.
	"""
	import variables
	n,m = X.shape
	# get all the FSM
	print 'estimating DFS for all '+str(m)+' oscillators'
	xFSM = []
	for i in range(m):
		if len(w)>0:
			xFSM.append(variables.getFSM(X[:,i],t,w))
		else:
			# estimate w if here (should only happen first time
			xFSM.append(variables.getFSM(X[:,i],t))
			# use estimated w
			w = xFSM[i][:,0]
	
	# now calculate the the synchronization at each w
	k = len(w)
	if nTime==0: nTime = len(t)
	tHat = np.arange(np.min(t),np.max(t),(np.max(t)-np.min(t))/float(nTime))
	nTime = len(tHat)
	R = np.zeros((k,nTime))

	for i in range(k):
		print 'calculating sync at freq '+str(w[i])
		th = np.zeros((nTime,m))
		for j in range(m):
			x,phase,f,amp = variables.getVars(tHat,xFSM=xFSM[j][i,:])
			th[:,j] = phase 


		R[i,:] = np.abs(orderParam(th,q))
		
	return(R,tHat,w)