graph.py 文件源码

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

项目:Wall-EEG 作者: neurotechuoft 项目源码 文件源码
def __call__(self, sample):
        '''
        For given instance, obtain data from OpenBCI and a) save to .CSV, and 
        b) update the graph.
        '''
        t = timeit.default_timer() - self.start_time

        # print timeSinceStart|Sample Id
        if self.verbose:
            print("CSV: %f | %d" % (t, sample.id))

        row = ''
        row += str(t)
        row += self.delim
        row += str(sample.id)
        row += self.delim
        for i in sample.channel_data:
            row += str(i)
            row += self.delim
        for i in sample.aux_data:
            row += str(i)
            row += self.delim
        # remove last comma
        row += '\n'
        with open(self.file_name, 'a') as f:
            f.write(row)

        ani = animation.FuncAnimation(self.fig, animate, interval=1000)
        plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号