Example #1
0
	def UpdateNodes(self):
		
		# pull data
		sample = self.inlet.pull_sample()
		self.newdata = np.asarray(sample[0][: self.n])
		# print(timestamp)
		
		for i in range(4):
			if i == 1:
				temp, self.data = getCmapForZscores(
					self.data, self.newdata, self.deltaBand
				)
				# set colors
				acolors = self.pgCM.map(temp)
				#print(temp)
				self.deltaGraph.update_nodes(colors=acolors)
				
			if i == 2:
				temp,  self.data = getCmapForZscores(
					self.data, self.newdata, self.thetaBand
				)
				# set colors
				bcolors = self.pgCM.map(temp)
				self.thetaGraph.update_nodes(colors=bcolors)
				

			if i == 3:
				temp,  self.data = getCmapForZscores(
					self.data, self.newdata, self.alphaBand
				)
				# set colors
				ccolors = self.pgCM.map(temp)
				self.alphaGraph.update_nodes(colors=ccolors)
    def UpdateNodes(self, sample):
        output = open('output.txt', 'a')
        # pull data
        # sample = self.inlet.pull_sample()
        self.newdata = np.asarray(sample[0][:self.n])
        # print(timestamp)

        for i in range(4):
            if i == 1:
                temp, self.data = getCmapForZscores(self.data, self.newdata,
                                                    self.deltaBand)
                # set colors
                acolors = self.pgCM.map(temp)
                #print(temp)
                self.deltaGraph.update_nodes(colors=acolors)

            if i == 2:
                temp, self.data = getCmapForZscores(self.data, self.newdata,
                                                    self.thetaBand)
                # set colors
                bcolors = self.pgCM.map(temp)
                self.thetaGraph.update_nodes(colors=bcolors)

            if i == 3:
                temp, self.data = getCmapForZscores(self.data, self.newdata,
                                                    self.alphaBand)
                # set colors
                ccolors = self.pgCM.map(temp)
                self.alphaGraph.update_nodes(colors=ccolors)
                print(ccolors[1], " alpha color", file=output)
                print(temp[1], file=output)
            #print(acolors[30], " " , bcolors[10], " ", ccolors[60], file = output)
        output.close()
Example #3
0
def plotNodes(i):
    global data

    start_time = time.time()
    inlet = StreamInlet(streams[0])

    # get a new sample
    sample = inlet.pull_sample()
    newdata = np.asarray(sample[0][:n])
    # print(newdata)

    zscoreArray, data = getCmapForZscores(data, newdata, -3)

    # define vectors for plot colors and opacity
    # altColors = freqs / 33
    colors = cmap(zscoreArray)
    # colors.astype(float)
    # colors[:, -1] = maxes / maxes.max()
    # print(altColors)
    # print(colors)

    ax1.set_xlim(-6, 6)
    ax1.set_ylim(-6, 6)
    # ax1.scatter(x, y, s = 100, c = altColors, cmap = plt.cm.jet_r)
    ax1.scatter(x, y, s=100, c=colors)

    elapsed_time = time.time() - start_time