Beispiel #1
0
def Loves(x,y):
	if not ran:
		if x == X or x == Y or y == X or y == Y:
			print "Error: variables not allowed in declarative phase."
			return False
		global bradb
		# inject stimulus object
		injectBrain(bradb, agent, rates[x], 0.0, parameters['LEARNING'])
		injectBrain(bradb, object, rates[y], 0.0, parameters['LEARNING'])
		print "Stored"
	else:
		lX=loadBrain(parameters['BRAINNAME']+'-'+x+'Report.txt')
		lA=loadBrain(parameters['BRAINNAME']+'-'+agent+'Report.txt')
		lY=loadBrain(parameters['BRAINNAME']+'-'+y+'Report.txt')
		lO=loadBrain(parameters['BRAINNAME']+'-'+object+'Report.txt')

		_,spikesX=brainalyze.countSpikes(lX,10000*parameters['LEARNING'])
		_,spikesA=brainalyze.countSpikes(lA,10000*parameters['LEARNING'])

		_,spikesY=brainalyze.countSpikes(lY,10000*parameters['LEARNING'])
		_,spikesO=brainalyze.countSpikes(lO,10000*parameters['LEARNING'])

		xAg = brainalyze.corr(spikesX,spikesA)
		yAg = brainalyze.corr(spikesY,spikesA)
		xObj = brainalyze.corr(spikesX,spikesO)
		yObj = brainalyze.corr(spikesY,spikesO)

                if x == mary:
                        xAgc=xAg/ma_nl
                        yAgc=yAg/ja_nl
                if x == john:
                        xAgc=xAg/ja_nl
                        yAgc=yAg/ma_nl
                if y == mary:
                        yObjc=yObj/mo_nl
                        xObjc=xObj/jo_nl
                if y == john:
                        yObjc=yObj/jo_nl
                        xObjc=xObj/mo_nl

		print "X Agent, Y Agent ", xAg,yAg
		print "X Object, Y Object ", xObj,yObj
#		print "Coeff xAg/yAg ", xAg/yAg
#		print "Coeff yObj/xObj", yObj/xObj
		print "(Corrected) X Agent, Y Agent ", xAgc,yAgc
		print "(Corrected) X Object, Y Object ", xObjc,yObjc

		if xAgc > yAgc and yObjc > xObjc:
			return True
		else:
			return False
Beispiel #2
0
def qLoves(x,y):
	global parameters

	lB=bsim.loadBrain('vb-exp-BReport.txt')
	lG=bsim.loadBrain('vb-exp-GReport.txt')
	lT=bsim.loadBrain('vb-exp-TReport.txt')
	lS=bsim.loadBrain('vb-exp-SReport.txt')
	_,spikesB=brainalyze.countSpikes(lB,10000*(parameters['ENDSIM']/2))
	_,spikesG=brainalyze.countSpikes(lG,10000*(parameters['ENDSIM']/2))
	_,spikesT=brainalyze.countSpikes(lT,10000*(parameters['ENDSIM']/2))
	_,spikesS=brainalyze.countSpikes(lS,10000*(parameters['ENDSIM']/2))

	if x[1]=='B':
		spikesA=spikesB
	elif x[1]=='G':
		spikesA=spikesG
	if y[1]=='B':
		spikesO=spikesB
	elif y[1]=='G':
		spikesO=spikesG

	cBT=brainalyze.corr(spikesB,spikesT)#/(brainalyze.corr(spikesT,spikesS)/1)
	cGT=brainalyze.corr(spikesG,spikesT)#/(brainalyze.corr(spikesT,spikesS)/1)
	cBS=brainalyze.corr(spikesB,spikesS)#/(brainalyze.corr(spikesS,spikesT)/1)
	cGS=brainalyze.corr(spikesG,spikesS)#/(brainalyze.corr(spikesS,spikesT)/1)

	cAT=brainalyze.corr(spikesA,spikesT)#/(brainalyze.corr(spikesS,spikesT)/1)
	cOT=brainalyze.corr(spikesO,spikesT)#/(brainalyze.corr(spikesS,spikesT)/1)
	cAS=brainalyze.corr(spikesA,spikesS)#/(brainalyze.corr(spikesS,spikesT)/1)
	cOS=brainalyze.corr(spikesO,spikesS)#/(brainalyze.corr(spikesS,spikesT)/1)

	print "john = Lover (cBT)", cBT*100
	print "mary = Lover (cGT)", cGT*100
	print "john = Lovee (cBS)", cBS*100
	print "mary = Lovee (cGS)", cGS*100
	print "x = Lover (cAT)", cAT*100
	print "y = Lover (cOT)", cOT*100
	print "x = Lovee (cAS)", cAS*100
	print "y = Lovee (cOS)", cOS*100

	if x != y and cAT > cOT and cOS > cAS:
		return True
	elif x == y:
		# this is a bit of a hack, but can be made not to depend on x or y
		if x==john and cBT > cBS and cGT > cGS and cBT >= cGT and cBS >= cGS:
			return True
		elif x==mary and cBS > cBT and cGS > cGT and cGT >= cBT and cGS >= cBS:
			return True
		else:
			return False
	else:
		return False
Beispiel #3
0
def run_analysis():
	x=0
	y=0
	corrBT=np.zeros((max_x,max_y)) # Blue Triangle
	corrGT=np.zeros((max_x,max_y)) # Green Triangle
	corrBS=np.zeros((max_x,max_y)) # Blue Square
	corrGS=np.zeros((max_x,max_y)) # Green Square
	frateB=np.zeros((max_x,max_y)) # Blue firing rate
	frateG=np.zeros((max_x,max_y)) # Green firing rate
	frateT=np.zeros((max_x,max_y)) # Triangle firing rate
	frateS=np.zeros((max_x,max_y)) # Square firing rate
	while x < max_x:
		while y < max_y:
			print x,y
			spikesB, spikesG, spikesT, spikesS = brainalyze.loadExperimentBind4('vb-exp', x, y)
			corrBT[x][y]=brainalyze.corr(spikesB,spikesT)
			corrGT[x][y]=brainalyze.corr(spikesG,spikesT)
			corrBS[x][y]=brainalyze.corr(spikesB,spikesS)
			corrGS[x][y]=brainalyze.corr(spikesG,spikesS)
			frateB[x][y]=brainalyze.frate(spikesB)
			frateG[x][y]=brainalyze.frate(spikesG)
			frateT[x][y]=brainalyze.frate(spikesT)
			frateS[x][y]=brainalyze.frate(spikesS)
			y=y+1
		y=0 #reset
		x=x+1

	# Save all numeric data
	np.save('corrBT.npy',corrBT)
	np.save('corrGT.npy',corrGT)
	np.save('corrBS.npy',corrBS)
	np.save('corrGS.npy',corrGS)
	np.save('frateB.npy',frateB)
	np.save('frateG.npy',frateG)
	np.save('frateT.npy',frateT)
	np.save('frateS.npy',frateS)
	return (corrBT,corrGT,corrBS,corrGS,frateB,frateG,frateT,frateS)
Beispiel #4
0
		lX=brainsim8.loadBrain('vb-exp'+str(x)+'-'+str(y)+'-XReport.txt')
		lY=brainsim8.loadBrain('vb-exp'+str(x)+'-'+str(y)+'-YReport.txt')
		lAP=brainsim8.loadBrain('vb-exp'+str(x)+'-'+str(y)+'-APReport.txt')
		lOP=brainsim8.loadBrain('vb-exp'+str(x)+'-'+str(y)+'-OPReport.txt')
		lAQ=brainsim8.loadBrain('vb-exp'+str(x)+'-'+str(y)+'-AQReport.txt')
		lOQ=brainsim8.loadBrain('vb-exp'+str(x)+'-'+str(y)+'-OQReport.txt')
		lI=brainsim8.loadBrain('vb-exp'+str(x)+'-'+str(y)+'-IReport.txt')
		_,spikesJ=brainalyze.countSpikes(lJ,10000*(parameters['ENDSIM']/2))
		_,spikesM=brainalyze.countSpikes(lM,10000*(parameters['ENDSIM']/2))
		_,spikesX=brainalyze.countSpikes(lX,10000*(parameters['ENDSIM']/2))
		_,spikesY=brainalyze.countSpikes(lY,10000*(parameters['ENDSIM']/2))
		_,spikesAP=brainalyze.countSpikes(lAP,10000*(parameters['ENDSIM']/2))
		_,spikesOP=brainalyze.countSpikes(lOP,10000*(parameters['ENDSIM']/2))
		_,spikesAQ=brainalyze.countSpikes(lAQ,10000*(parameters['ENDSIM']/2))
		_,spikesOQ=brainalyze.countSpikes(lOQ,10000*(parameters['ENDSIM']/2))
		cJX=brainalyze.corr(spikesJ,spikesX)
		cMX=brainalyze.corr(spikesM,spikesX)
		cJY=brainalyze.corr(spikesJ,spikesY)
		cMY=brainalyze.corr(spikesM,spikesY)

		cXAP=brainalyze.corr(spikesX,spikesAP)
		cXOP=brainalyze.corr(spikesX,spikesOP)
		cXAQ=brainalyze.corr(spikesX,spikesAQ)
		cXOQ=brainalyze.corr(spikesX,spikesOQ)

		cYAP=brainalyze.corr(spikesY,spikesAP)
		cYOP=brainalyze.corr(spikesY,spikesOP)
		cYAQ=brainalyze.corr(spikesY,spikesAQ)
		cYOQ=brainalyze.corr(spikesY,spikesOQ)

		avg = (abs(cJX - cJY) + abs(cMY - cMX) + abs(cXAP - cXAQ) + abs(cXOQ - cXOP) + abs(cXAQ - cXAP) + abs(cXOP - cXOQ))/6
Beispiel #5
0
	plt.subplot(514)
	plt.plot(sp,lS,'b')
	plt.subplot(515)
	plt.plot(sp,lI,'b')
	plt.show()

brainsim.simBrain(parameters)
lB=brainsim.loadBrain('vb-exp-BReport.txt')
lG=brainsim.loadBrain('vb-exp-GReport.txt')
lT=brainsim.loadBrain('vb-exp-TReport.txt')
lS=brainsim.loadBrain('vb-exp-SReport.txt')
_,spikesB=brainalyze.countSpikes(lB,10000*(parameters['ENDSIM']/2))
_,spikesG=brainalyze.countSpikes(lG,10000*(parameters['ENDSIM']/2))
_,spikesT=brainalyze.countSpikes(lT,10000*(parameters['ENDSIM']/2))
_,spikesS=brainalyze.countSpikes(lS,10000*(parameters['ENDSIM']/2))
cBT=brainalyze.corr(spikesB,spikesT)/(brainalyze.corr(spikesT,spikesS)/1)
cGT=brainalyze.corr(spikesG,spikesT)/(brainalyze.corr(spikesT,spikesS)/1)
cBS=brainalyze.corr(spikesB,spikesS)/(brainalyze.corr(spikesS,spikesT)/1)
cGS=brainalyze.corr(spikesG,spikesS)/(brainalyze.corr(spikesS,spikesT)/1)

#cBS=cBS+10
#cGS=cGS+10
#cBS=(cBS/cGS)*cBT
#cGS=cBT

print "Blue Triangle", cBT*100
print "Green Triangle", cGT*100
print "Blue Square", cBS*100
print "Green Square", cGS*100

#plotUse()