Esempio n. 1
0
	def reset(self):
		averageEnergy=0.0
		for e in self.energy:
			averageEnergy+=e
		averageEnergy/=self.survivalDuration

		f=open('data/brain0/brain0Data.txt','a')
		f.write('%f, %f, %d\n'%(self.time,averageEnergy,self.survivalDuration))
		f.close()
		#plotting goes here
		name='data/brain0/%d-EvT.png'%int(self.time)
		p.plotEnergyVsTime(self.energy,name)	

		#reset stats
		self.survivalDuration=0
		self.energy=[]
		self.time=time.time()
Esempio n. 2
0
	def reset(self):
		#calculations
		averageEnergy=0.0
		for e in self.energy: averageEnergy+=e
		averageEnergy/=self.survivalDuration

		#record data
		f=open('data/brain2/brain2Data.txt','a')
		f.write('%f, %f, %d, %f\n'%(self.time, averageEnergy, self.survivalDuration, self.constantFB))
		f.close()
		
		#plots
		name='data/brain2/%d-%f-EvT.png'%(int(self.time),self.constantFB)
		p.plotEnergyVsTime(self.energy,name)

		#reset class vars
		self.time=time.time()
		self.energy=[]
		self.survivalDuration=0