Esempio n. 1
0
 def display(self, figure, width=None):
     filename = 'figure-{}.png'.format(self._num_figures)
     block = blocks.Image(filename, width)
     self._blocks[self._get_current_line()].append(block)
     filename = os.path.join(self._directory, filename)
     figure.savefig(filename)
     self._logger.info('Saved figure: {}'.format(filename))
     self._num_figures += 1
Esempio n. 2
0
 def add_figure(self, figure, width=None):
     filename = 'figure-{}.png'.format(self._num_figures)
     block = blocks.Image(filename, width)
     self._pending.append(block)
     filename = self._directory / filename
     figure.savefig(filename)
     self._logger.info('Saved figure: {}'.format(filename))
     self._num_figures += 1
Esempio n. 3
0
 def add_figure(self, figure, width=None, show=False):
     filename = 'figure-{}.png'.format(self._num_figures)
     block = blocks.Image(filename, width)
     self._pending.append(block)
     filename = os.path.join(self._directory, filename)
     figure.savefig(filename)
     self._logger.info('Saved figure: {}'.format(filename))
     self._num_figures += 1
     if show:
         self.show()
Esempio n. 4
0
 def add_image(self, image, format='png', width=None):
     if isinstance(image, str):
         filename = image
     else:
         import imageio
         filename = 'image-{}.{}'.format(self._num_images, format)
         imageio.imsave(self._directory / filename, image)
         self._logger.info('Saved image: {}'.format(filename))
     block = blocks.Image(filename, width)
     self._pending.append(block)
     self._num_images += 1
Esempio n. 5
0
 def add_image(self, image, img_format='png', width=None, show=False):
     if isinstance(image, str):
         filename = image
     else:
         import imageio
         filename = 'image-{}.{}'.format(self._num_images, img_format)
         imageio.imsave(os.path.join(self._directory, filename), image)
         self._logger.info('Saved image: {}'.format(filename))
     block = blocks.Image(filename, width)
     self._pending.append(block)
     self._num_images += 1
     if show:
         self.show()
Esempio n. 6
0
 def add_video(self, video, format='gif', fps=30, width=None):
     if isinstance(video, str):
         filename = video
     else:
         import imageio
         filename = 'video-{}.{}'.format(self._num_videos, format)
         imageio.mimsave(self._directory / filename, video, fps=fps)
         self._logger.info('Saved video: {}'.format(filename))
     if filename.endswith('.gif'):
         block = blocks.Image(filename, width)
     else:
         block = blocks.Video(filename, width)
     self._pending.append(block)
     self._num_videos += 1