realtime_plot.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:esys-pbi 作者: fsxfreak 项目源码 文件源码
def setup(self):
        #provide all parameters as floats with at least one decimal point
        self.frequency = 250.0
        self.sample_interval = 1/self.frequency
        #converting to milliseconds for timer.start() function
        self.timer_interval = self.sample_interval*1000 
        self.time_window = 10
        self.buffer_size = int(self.time_window/self.sample_interval)
        self.data_buffer = collections.deque([0.0]*self.buffer_size,self.buffer_size)

        self.x = np.linspace(0.0,self.time_window,self.buffer_size)
        self.y = np.zeros(self.buffer_size, dtype=np.float)

        #PyQtGraph settings
        self.app = QtGui.QApplication([])
        self.plt = pg.plot(title='Real Time Open BCI data')
        self.plt.showGrid(x=True, y=True)
        self.plt.setLabel('left','amplitude','uV')
        self.plt.setLabel('bottom','time','s')
        self.curve = self.plt.plot(self.x,self.y,pen=(255,0,0))

        #QTimer
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.update_plot)
        self.timer.start(self.timer_interval)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号