コード例 #1
0
def descriptives(dm):

	"""
	Tabular analysis of the descriptive results.

	Arguments:
	dm		--	A DataMatrix.

	Returns:
	A DataMatrix.
	"""

	dmc = dm.select('correct == 1')
	pm = PivotMatrix(dm, ['soa'], ['subject_nr'], dv='ctoa')
	pm._print('CTOA')
	pm.save('output/ctoa.csv')
	pm = PivotMatrix(dm, ['subject_nr'], ['subject_nr'], dv=lambda x: len(x))
	pm._print('Cell count')
	pm.save('output/cellcount.csv')
	pm = PivotMatrix(dm, ['cueValidity', 'soa', 'cueLum'], ['subject_nr'], \
		dv=lambda x: len(x))
	pm._print('Cell count')
	pm.save('output/cellcount.cueValidity.soa.cueLum.csv')
	pm = PivotMatrix(dmc, ['cueValidity', 'soa'], ['subject_nr'], \
		dv='response_time')
	pm.save('output/rt.csv')
	pm._print('Correct RT')
	pm.linePlot(show=show)
	pm = PivotMatrix(dm, ['cueValidity', 'soa'], ['subject_nr'], \
		dv='correct')
	pm.save('output/acc.csv')
	pm._print('Accuracy')
	pm.linePlot(show=show)
コード例 #2
0
ファイル: fullModel.py プロジェクト: lvanderlinden/004
def plotFullModel(dm, sacc):
	
	"""
	"""


	fig = plt.figure(figsize = (15, 5))
	plt.suptitle("Sacc = %s" % sacc)
	ax1 = plt.subplot(141)
	lCols = ["blue", "red", "orange", "yellow", "green", "pink"]
	
	xVar = "sacc%s_ex" % sacc
	yVar = "sacc%s_ey" % sacc
	
	dm = dm.select("%s != ''" % xVar)
	dm = dm.select("%s != ''" % yVar)

	dm = dm.select("%s != -1000" % xVar)
	dm = dm.select("%s != -1000" % yVar)

	for a in dm.unique("realAngle"):
		_dm = dm.select("realAngle == %s" % a)
		col = lCols.pop()
		plt.scatter(_dm[xVar], _dm[yVar], color = col, marker = ".", label = a)
	plt.axvline(constants.xCen, color = gray[3], linestyle = '--')
	plt.axhline(constants.yCen, color = gray[3], linestyle = '--')

	ax2 = plt.subplot(142)
	pm = PivotMatrix(dm, ["stim_type", "realAngle"], ["file"], "xNorm1", colsWithin =True)
	pm.linePlot(fig = fig)
	pm.save("PM.csv")
	pm._print()
	plt.axhline(0, color = gray[3], linestyle = "--")

	ax3 = plt.subplot(143)
	plt.title("object")
	dmObj= dm.select("stim_type == 'object'")
	#slope, intercept, r_value, p_value, std_err  = scipy.stats.linregress(stimObj["ecc"], stimObj["xNorm1"])
	x = dmObj["ecc"]
	y = dmObj["xNorm%s" % sacc]
	fit = scipy.polyfit(x,y,1)
	fit_fn = scipy.poly1d(fit)
	plt.plot(x,y, 'yo', x, fit_fn(x), '--k')

	ax4 = plt.subplot(144)
	plt.title("non-object")
	dmNo= dm.select("stim_type == 'non-object'")
	#slope, intercept, r_value, p_value, std_err  = scipy.stats.linregress(stimObj["ecc"], stimObj["xNorm1"])
	x = dmNo["ecc"]
	y = dmNo["xNorm%s" % sacc]
	fit = scipy.polyfit(x,y,1)
	fit_fn = scipy.poly1d(fit)
	plt.plot(x,y, 'yo', x, fit_fn(x), '--k')

	plt.savefig("./plots/Full_model_004C_sacc%s.png" % sacc)
	plt.show()
コード例 #3
0
ファイル: analyze01.py プロジェクト: lvanderlinden/004
def simon(dm):
	
	"""
	"""
	

	pm = PivotMatrix(dm, ['response_hand', 'mask_side'], ['file'], dv='RT', colsWithin=False)
	pm._print()
	pm.barPlot(show=True)
	plt.title("simon effect")
コード例 #4
0
ファイル: analyze01.py プロジェクト: lvanderlinden/004
def gapEffect(dm, dv = "saccLat"):
	
	"""
	Regardless of color change...
	"""
	
	pm = PivotMatrix(dm, ['gap'],['file'],dv =dv)
	pm._print()
	pm.barPlot(show=True)
	plt.ylabel(dv)
	plt.title("gap effect")
コード例 #5
0
ファイル: analyses.py プロジェクト: lvanderlinden/004
def perHandle(trim = True, exclY = True):
	
	"""
	"""
	
	fig = plt.figure()
	title = "Per handle side - exclY = %s" % exclY
	
	for sacc in ["1", "2", "3"]:
		
		if sacc == "3":
			continue
		colList = ["#3465a4","#73d216", "#f57900"]
		
		plt.subplot(1,3,int(sacc))
		for exp in ["004A", "004B"]:
			
			dm = getDM.getDM(exp = exp)
			
			# Only include on-object saccades:
			dm = dm.select("endX%sNorm != ''" % sacc)
			dm = dm.select("endX%sNorm > -.5" % sacc)
			dm = dm.select("endX%sNorm < .5" % sacc)
			
			if exclY:
				dm = dm.select("endY%sNorm != ''" % sacc)
				dm = dm.select("endY%sNorm > -.5" % sacc)
				dm = dm.select("endY%sNorm < .5" % sacc)
			
			if exp == "004A":
				dvList = ["endX%sNorm" % sacc, "endX%sCorrNorm" % sacc]
			else:
				dvList = ["endX%sNorm" % sacc]
				
				for dv in dvList:
					
					print dv
					
					if trim:
						dm = dm.selectByStdDev(keys = ["file"], dv = dv)
					
					pm = PivotMatrix(dm, ["handle_side"], ["file"], dv=dv, colsWithin=True)
					pm._print()
					sys.exit()
					col = colList.pop()
					pm.plot(nLvl1 = 1,fig = fig, colors = [col])
		# Modify plot:
		plt.xlabel("handle side")
		plt.ylabel("normalised landing position")
		plt.axhline(0, linestyle = "--", color = "#888a85")
		
	plt.savefig("%s.png" % title)
コード例 #6
0
ファイル: analyze01.py プロジェクト: lvanderlinden/004
def affLumCongr(dm):
	
	dm = dm.select('symm == "asymm"')

	xLabels = ["hande left", "handle right"]
	lLabels = ["control", "more contrast right", "more contrast left"]
	yLabel = "landing position: negative = left, positive = right"
	
	pm = PivotMatrix(dm, ['handle_side', 'mask_side'], ['file'], \
		dv='endX')
	pm._print()
	pm.barPlot(xLabels = xLabels, lLabels = lLabels, yLabel = yLabel, show=True)
	plt.title("overlap between contrast and affordance")
コード例 #7
0
ファイル: analyze01.py プロジェクト: lvanderlinden/004
def lumBinAn(dm, nBin = 8):
	
	"""
	"""
	
	dm = latBins(dm)
	
	pm = PivotMatrix(dm, ['mask_side', 'saccLatBin'], ['file'], dv='endX', colsWithin=False)
	pm._print()
	xLabels = range(1,nBin+1)
	xLabel = "binned latencies"
	lLabel = "contrast manipulation"
	lLabels = ["control", "more contrast right", "more contrast left"]
	#lLabels = None
	yLabel = "landing position - negative = left, positive = right"
	pm.linePlot(show=True,xLabels = xLabels, xLabel = xLabel, yLabel = yLabel, legendTitle = lLabel, lLabels = lLabels)
	plt.axhline(0, color = "grey", linestyle = "--")