Exemplo n.º 1
0
def nulCDF(peaks,exc=None,method="RFT"):
	"""Returns cumulative  density (p-values) using the exponential function that defines the distribution of local maxima in a GRF under the null hypothesis of no activation as introduced in Cheng & Schwartzman, 2005"""
	peaks = (peaks,) if not isinstance(peaks, (tuple, list)) else peaks
	if method == "RFT":
		F0 = [1-np.exp(-exc*(x-exc)) for x in peaks]
	elif method == "CS":
		F0 = [1-peakdistribution.peakp(y)[0] for y in peaks]
	return F0
Exemplo n.º 2
0
def altCDF(peaks,mu,sigma=None,exc=None,method="RFT"):
	if method == "RFT":
		ksi = (peaks-mu)/sigma
		alpha = (exc-mu)/sigma
		Fa = (scipy.stats.norm(mu,sigma).cdf(peaks) - scipy.stats.norm(mu,sigma).cdf(exc))/(1-scipy.stats.norm(mu,sigma).cdf(exc))
	elif method == "CS":
		Fa = [1-peakdistribution.peakp(y-mu)[0] for y in peaks]
	return Fa
Exemplo n.º 3
0
ps = spm.flatten()
ps = [x for x in ps if x == x]


xn = np.arange(-10,10,0.01)
twocol = Paired_12.mpl_colors
plt.figure(figsize=(7,5))
plt.hist(ps,lw=0,facecolor=twocol[0],normed=True,bins=np.arange(-2,10,0.3),label="observed distribution")
plt.xlim([-2,10])
plt.ylim([0,0.5])
plt.plot(xn,stats.norm.pdf(xn),color=twocol[1],lw=3,label="null distribution")
plt.show()

peaks = cluster.cluster(spm)
peaks['pval'] = peakdistribution.peakp(peaks.peak.tolist())
bum = BUM.bumOptim(peaks["pval"].tolist(),starts=10)
modelfit = neuropower.TFpeakfit(peaks['peak'].tolist(),bum['pi1'])


xn = np.arange(-10,10,0.01)

twocol = Paired_12.mpl_colors
plt.figure(figsize=(7,5))
plt.hist(peaks['peak'].tolist(),lw=0,facecolor=twocol[0],normed=True,bins=np.arange(-2,10,0.3),label="observed distribution")
plt.xlim([-2,10])
plt.ylim([0,0.5])
plt.plot(xn,[(1-bum["pi1"])*peakdistribution.peakdens3D(p,1) for p in xn],color=twocol[3],lw=3,label="null distribution")
plt.plot(xn,[bum["pi1"]*peakdistribution.peakdens3D(p-modelfit['delta'],1) for p in xn],color=twocol[5],lw=3,label="alternative distribution")
plt.plot(xn,neuropower.mixprobdens(modelfit["delta"],bum["pi1"],xn),color=twocol[1],lw=3,label="fitted distribution")
plt.title("histogram")