def reset(self, stream=None):
""" Reset the progress bar(s) """
logger.debug("Update stream descriptor for progress bars.")
if stream is not None:
self.stream = stream
if self.stream is None:
logger.warning("No stream is associated with the progress bars!")
self.axes = []
else:
self.axes = self.stream.descriptor.axes
self.num = min(self.num, len(self.axes))
self.totals = [self.stream.descriptor.num_points_through_axis(axis) for axis in range(self.num)]
self.chunk_sizes = [max(1,self.stream.descriptor.num_points_through_axis(axis+1)) for axis in range(self.num)]
logger.debug("Reset the progress bars to initial states.")
self.bars = []
for i in range(self.num):
if self.notebook:
self.bars.append(tqdm_notebook(total=self.totals[i]/self.chunk_sizes[i]))
else:
self.bars.append(tqdm(total=self.totals[i]/self.chunk_sizes[i]))
评论列表
文章目录