Remove Picture.scale and Picture._rescale from novice module

The scale and rescale function was never used in the novice module.
These functions are extraneous in a novice code, and have no purpose there.

Also updated tests.
This commit is contained in:
David Koeller
2015-07-12 11:47:07 -05:00
parent d9213bedde
commit d4d3eaa1f1
2 changed files with 2 additions and 11 deletions
+2 -10
View File
@@ -249,7 +249,6 @@ class Picture(object):
def __init__(self, path=None, array=None, xy_array=None):
self._modified = False
self.scale = 1
self._path = None
self._format = None
@@ -325,7 +324,7 @@ class Picture(object):
path : str
Path (with file extension) where the picture is saved.
"""
io.imsave(path, self._rescale(self.array))
io.imsave(path, self.array)
self._modified = False
self._path = os.path.abspath(path)
self._format = imghdr.what(path)
@@ -386,7 +385,7 @@ class Picture(object):
def show(self):
"""Display the image."""
io.imshow(self._rescale(self.array))
io.imshow(self.array)
io.show()
def _makepixel(self, x, y):
@@ -394,13 +393,6 @@ class Picture(object):
rgb = self.xy_array[x, y]
return Pixel(self, self.array, x, y, rgb)
def _rescale(self, array):
"""Rescale image according to scale factor."""
if self.scale == 1:
return array
new_size = (self.height * self.scale, self.width * self.scale)
return img_as_ubyte(resize(array, new_size, order=0))
def _get_channel(self, channel):
"""Return a specific dimension out of the raw image data slice."""
return self._array[:, :, channel]
-1
View File
@@ -32,7 +32,6 @@ def test_pic_info():
assert_equal(pic.width, 451)
assert_equal(pic.height, 300)
assert not pic.modified
assert_equal(pic.scale, 1)
def test_pixel_iteration():