示例#1
0
文件: pRF.py 项目: karlzipser/kzpy3.0
def convolve_s_with_hrf(S,S_times,hrf,TR_times):
	X = np.shape(S)[0]
	Y = np.shape(S)[1]
	s_conv_hrf = np.zeros((X,Y,len(TR_times)))
	pb = ProgressBar(X)
	for x in range(X):
		pb.animate(x+1)
		for y in range(Y):
			s = S[x,y,:]
			hp = np.convolve(s, hrf)[:(np.shape(s)[0])]
			hp_interp = np.interp(TR_times,S_times,hp)
			s_conv_hrf[x,y,:] = hp_interp
	return s_conv_hrf
示例#2
0
def convolve_s_with_hrf(S, S_times, hrf, TR_times):
    X = np.shape(S)[0]
    Y = np.shape(S)[1]
    s_conv_hrf = np.zeros((X, Y, len(TR_times)))
    pb = ProgressBar(X)
    for x in range(X):
        pb.animate(x + 1)
        for y in range(Y):
            s = S[x, y, :]
            hp = np.convolve(s, hrf)[:(np.shape(s)[0])]
            hp_interp = np.interp(TR_times, S_times, hp)
            s_conv_hrf[x, y, :] = hp_interp
    return s_conv_hrf
示例#3
0
文件: pRF.py 项目: karlzipser/kzpy3.0
def rf_peak_xy(s_conv_hrf,a,TR_times,fig,graphics=True):
	X = np.shape(s_conv_hrf)[0]
	Y = np.shape(s_conv_hrf)[1]
	rf = np.zeros((X,Y))
	#pb = ProgressBar(X)
	for x in range(X):
		#pb.animate(x+1)
		for y in range(Y):
			rf[x,y] = np.corrcoef(s_conv_hrf[x,y],a)[0,1]
	peak = np.unravel_index(rf.argmax(), rf.shape)
	if graphics:
		PP[FF]=4,4
		plt.figure(fig+': rf')
		plt.clf()
		mi(rf,fig+': rf',[1,1,1],img_title=(peak,np.max(rf)))   
		PP[FF]=13,2
		x,y = peak
		hp_interp = s_conv_hrf[x,y,:]
		plt.figure(fig+': time course')
		plt.clf()
		plt.plot(TR_times,z21r(hp_interp),'gx')
		plt.plot(TR_times,8*z21r(a),'r')
	return rf,peak
示例#4
0
def rf_peak_xy(s_conv_hrf, a, TR_times, fig, graphics=True):
    X = np.shape(s_conv_hrf)[0]
    Y = np.shape(s_conv_hrf)[1]
    rf = np.zeros((X, Y))
    #pb = ProgressBar(X)
    for x in range(X):
        #pb.animate(x+1)
        for y in range(Y):
            rf[x, y] = np.corrcoef(s_conv_hrf[x, y], a)[0, 1]
    peak = np.unravel_index(rf.argmax(), rf.shape)
    if graphics:
        PP[FF] = 4, 4
        plt.figure(fig + ': rf')
        plt.clf()
        mi(rf, fig + ': rf', [1, 1, 1], img_title=(peak, np.max(rf)))
        PP[FF] = 13, 2
        x, y = peak
        hp_interp = s_conv_hrf[x, y, :]
        plt.figure(fig + ': time course')
        plt.clf()
        plt.plot(TR_times, z21r(hp_interp), 'gx')
        plt.plot(TR_times, 8 * z21r(a), 'r')
    return rf, peak