def update(self):
""" Update the status of the progress bar(s) """
if self.stream is None:
logger.warning("No stream is associated with the progress bars!")
num_data = 0
else:
num_data = self.stream.points_taken
logger.debug("Update the progress bars.")
for i in range(self.num):
if num_data == 0:
# Reset the progress bar with a new one
if self.notebook:
self.bars[i].sp(close=True)
self.bars[i] = tqdm_notebook(total=self.totals[i]/self.chunk_sizes[i])
else:
self.bars[i].close()
self.bars[i] = tqdm(total=self.totals[i]/self.chunk_sizes[i])
pos = int(10*num_data / self.chunk_sizes[i])/10.0 # One decimal is good enough
if pos > self.bars[i].n:
self.bars[i].update(pos - self.bars[i].n)
num_data = num_data % self.chunk_sizes[i]
评论列表
文章目录