示例#1
0
def fhn_timeseries(simfile):

    # load simfile as numpy matrix
    # extract first column of simout as time vector
    # read u_i time series from simout

    simout = sb.load_matrix(simfile)

    # extract time vector and dt
    tvec = simout[:, 0]
    dt = tvec[1] - tvec[0]
    T = int(math.ceil((tvec[-1]) / dt * params.dt))

    # extract u-columns
    u_indices = np.arange(1, simout.shape[1], 1)
    timeseries = simout[:, u_indices]

    print "extracted u-timeseries: shape =", timeseries.shape, ", dt = ", dt
    #np.savetxt('u_timeseries_python.dat',timeseries,fmt='%.6f',delimiter='\t')

    return timeseries, T
示例#2
0
def fhn_timeseries(simfile):

	# load simfile as numpy matrix
	# extract first column of simout as time vector
	# read u_i time series from simout
	
	simout = sb.load_matrix(simfile)
	
	# extract time vector and dt
	tvec = simout[:,0]
	dt   = tvec[1] - tvec[0]
	T    = int(math.ceil( (tvec[-1])  / dt * params.dt ))

	# extract u-columns
	u_indices = np.arange(1, simout.shape[1] ,1)
	timeseries = simout[:, u_indices]
	
	print "extracted u-timeseries: shape =", timeseries.shape, ", dt = ", dt
	#np.savetxt('u_timeseries_python.dat',timeseries,fmt='%.6f',delimiter='\t')
	
	return timeseries, T
示例#3
0
	Y_fft = np.fft.fft(Y , m_pow) /float(m)
	Y_fft = 2*abs(Y_fft[0:m_pow /2 +1])  
	# frequency domain [Hz]
	freq  = float(f_s)/2 * np.linspace(0,1, m_pow/2 + 1);
	
	return Y_fft, freq


# user defined input name
if __name__ == '__main__':
	try:
		input_name = sys.argv[1]
	except:
		sys.exit(1)

data_matrix = sb.load_matrix(input_name)
out_basename = sb.get_dat_basename(input_name)

corr_matrix = correl_matrix(data_matrix , out_basename)

## if data is already a correlation matrix :
#corr_matrix = data_matrix
image = plot_corr_diag(corr_matrix, out_basename)
# real node index : add 1!
[i, j, k , l ]  = 	    node_index(corr_matrix)
# BOLD activity of the nodes correlating the best
pl.figure(2)
plot_bold_signal(data_matrix, i,j)
# BOLD activity of the nodes correlating the worst
pl.figure(3)
plot_bold_signal(data_matrix, k,l)