Commit efc799b5 authored by peastman's avatar peastman
Browse files

Fixed more test failures

parent c551be55
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -340,7 +340,7 @@ class TestLayers(test_util.TensorFlowTestCase):
    value = np.random.uniform(size=(2, 3)).astype(np.float32)
    with self.session() as sess:
      result = Exp()(value).eval()
      assert np.array_equal(np.exp(value), result)
      assert np.allclose(np.exp(value), result)

  def test_interatomic_distances(self):
    """Test that the interatomic distance calculation works."""
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import numpy as np
import pandas as pd
import deepchem as dc
import scipy.ndimage
from PIL import Image


class TestTransformers(unittest.TestCase):
@@ -621,7 +622,7 @@ class TestTransformers(unittest.TestCase):
    dt = DataTransforms(self.d)
    h = 150
    w = 150
    scale = scipy.misc.imresize(self.d, (h, w))
    scale = Image.fromarray(self.d).resize((h, w))
    check_scale = dt.scale(h, w)
    np.allclose(scale, check_scale)

+3 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ import time
import deepchem as dc
import tensorflow as tf
from deepchem.data import NumpyDataset
from PIL import Image


def undo_transforms(y, transformers):
@@ -1058,7 +1059,7 @@ class ImageTransformer(Transformer):
  def transform_array(self, X, y, w):
    """Transform the data in a set of (X, y, w) arrays."""
    images = [scipy.ndimage.imread(x, mode='RGB') for x in X]
    images = [scipy.misc.imresize(x, size=self.size) for x in images]
    images = [Image.fromarray(x).resize(self.size) for x in images]
    return np.array(images), y, w


@@ -1301,7 +1302,7 @@ class DataTransforms(Transformer):
                h - height of the images
                w - width of the images
    """
    return scipy.misc.imresize(self.Image, (h, w))
    return Image.fromarray(self.Image).resize((h, w))

  def flip(self, direction="lr"):
    """ Flips the image