Example #1
0
    def record(self, forever=True):
        epocrec = Epoc()
        epocrec.connect()

        while True:
            if self.threadsDieNow:
                break

            # if self.O1: 
            #     self.chan=9
            # if self.O2: 
            #     self.chan=14

            #two individual arrays to allow for the recording of the data
            datarray = numpy.zeros((1, 4))
            datarray2 = numpy.zeros((1, 4))         

            #data = numpy.random.randint(4000, 5000, size=(1, 4))
            # gets raw data from channel that is stated in the epoc

            #datarray & datarray2 get the data which is being recorded from channels 9 and 14
            data = epocrec.aquire([9])
            datarray = numpy.concatenate((datarray, data), axis=1)
            
            data2= epocrec.aquire([14])
            datarray2= numpy.concatenate((datarray2, data2), axis=1)


            self.newRecord = True

            temp = [] * 4
            for i in xrange(0, len(datarray[0])):
                if datarray[0][i] > 0:
                    temp.append(datarray[0][i])
            

            
            temp2 = [] * 4
            for i in xrange(0, len(datarray2[0])):
                if datarray2[0][i] > 0:
                    temp2.append(datarray2[0][i])

            self.ys = numpy.roll(self.ys, -4)
            for i in xrange(0, 4):
                self.ys[508 + i] = temp[i]

            self.ys2 = numpy.roll(self.ys2, -4)
            for i in xrange(0, 4):
                self.ys2[508 + i] = temp2[i]


            # import time
            # time.sleep(0.015)

            # print self.ys

            if not forever:
                break
Example #2
0
	def initUI(self): 
		
		# Emotiv Initialization and data acquisition
		
		epoc= Epoc()

		# collecting data from the headset and placing into two different arrays

		data= epoc.aquire([9]) 
		#data2= epoc.aquire([14]) 
		datarray = np.concatenate((datarray, data), axis = 1)
		#datarray2= np.concatenate((datarray2, data2), axis=1)



		#self.clab = ['F3', 'F4', 'P7', 'FC6', 'F7', 'F8', 'T7', 'P8', 'FC5', 'AF4','T8', 'O2', 'O1', 'AF3']
		self.timek = 512 
		self.x = np.arange(0,self.timek,1)
		self.y = [[0] for i in xrange(len(self.datarray[0]))]
		self.offset = [2500.0*i for i in xrange(len(self.datarray[0]))]
		
		self.cancel = False		
Example #3
0
power_avg=[]
power_store=[]
time= 0
#sth=[]



while time<4:
	print time
	datarray=np.zeros((1,4)) #resets datarray every time we run the loop
	
	for t in range(0,100):
		
		#data= epoc.get_raw() #gets raw data from all the channels.. unnecessary once connect is made
		data= epoc.aquire([9]) #gets raw data from channel O1
		#data2= epoc.aquire([14]) #connection on hardware is to AF4:not an issue at all on S/w
		#print data.shape
		datarray = np.concatenate((datarray, data), axis = 1)
		#print datarray[0]
		#datarray2= np.concatenate((datarray2, data2), axis=1)
		
		
		#print "Data: %r \n" %datarray[0]
		t=t+1
	sth =[]*len(datarray[0]) 
	
	for i in range(0, len(datarray[0])): 
		if datarray[0][i]>0: 
			sth.append(datarray[0][i])