# Path: disentanglement_lib/visualize/visualize_util.py
# def save_image(image, image_path):
# def grid_save_images(images, image_path):
# def padded_grid(images, num_rows=None, padding_px=10, value=None):
# def padded_stack(images, padding_px=10, axis=0, value=None):
# def padding_array(image, padding_px, axis, value=None):
# def best_num_rows(num_elements, max_ratio=4):
# def pad_around(image, padding_px=10, axis=None, value=None):
# def add_below(image, padding_px=10, value=None):
# def save_animation(list_of_animated_images, image_path, fps):
# def cycle_factor(starting_index, num_indices, num_frames):
# def cycle_gaussian(starting_value, num_frames, loc=0., scale=1.):
# def cycle_interval(starting_value, num_frames, min_val, max_val):


import os
import numpy as np
from absl.testing import absltest
from disentanglement_lib.visualize import visualize_util
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for visualize_util.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


class VisualizeUtilTest(absltest.TestCase):

  def test_save_image(self):
    image = np.zeros((128, 256, 3), dtype=np.float32)
    path = os.path.join(self.create_tempdir().full_path, "save_image.png")
    visualize_util.save_image(image, path)

  def test_save_image_grayscale(self):
    image = np.ones((128, 256, 1), dtype=np.float32)
    path = os.path.join(self.create_tempdir().full_path,
                        "save_image_grayscale.png")
    visualize_util.save_image(image, path)

  def test_grid_save_images(self):
    images = np.zeros((18, 128, 256, 3), dtype=np.float32)
    path = os.path.join(self.create_tempdir().full_path, "grid_save_images.png")
    visualize_util.grid_save_images(images, path)

  def test_save_animation(self):
    path = os.path.join(self.create_tempdir().full_path, "animation.gif")
    images = np.ones((18, 128, 256, 3), dtype=np.float32)

# Path: disentanglement_lib/visualize/visualize_util.py
# def save_image(image, image_path):
# def grid_save_images(images, image_path):
# def padded_grid(images, num_rows=None, padding_px=10, value=None):
# def padded_stack(images, padding_px=10, axis=0, value=None):
# def padding_array(image, padding_px, axis, value=None):
# def best_num_rows(num_elements, max_ratio=4):
# def pad_around(image, padding_px=10, axis=None, value=None):
# def add_below(image, padding_px=10, value=None):
# def save_animation(list_of_animated_images, image_path, fps):
# def cycle_factor(starting_index, num_indices, num_frames):
# def cycle_gaussian(starting_value, num_frames, loc=0., scale=1.):
# def cycle_interval(starting_value, num_frames, min_val, max_val):


# Path: disentanglement_lib/visualize/visualize_util_test.py
import os
import numpy as np
from absl.testing import absltest
from disentanglement_lib.visualize import visualize_util

# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for visualize_util.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


class VisualizeUtilTest(absltest.TestCase):

  def test_save_image(self):
    image = np.zeros((128, 256, 3), dtype=np.float32)
    path = os.path.join(self.create_tempdir().full_path, "save_image.png")
    visualize_util.save_image(image, path)

  def test_save_image_grayscale(self):
    image = np.ones((128, 256, 1), dtype=np.float32)
    path = os.path.join(self.create_tempdir().full_path,
                        "save_image_grayscale.png")
    visualize_util.save_image(image, path)

  def test_grid_save_images(self):
    images = np.zeros((18, 128, 256, 3), dtype=np.float32)
    path = os.path.join(self.create_tempdir().full_path, "grid_save_images.png")
    visualize_util.grid_save_images(images, path)

  def test_save_animation(self):
    path = os.path.join(self.create_tempdir().full_path, "animation.gif")
    images = np.ones((18, 128, 256, 3), dtype=np.float32)

    visualize_util.save_animation([images, images], path, fps=18)