Skip to content

Commit de7622b

Browse files
committed
Fixed tests to reflect changes in Align and _scale().
1 parent 3d37ebb commit de7622b

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

Diff for: .travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ python:
55
- '3.2'
66
- '3.3'
77
- '3.4'
8-
virtualenv:
9-
system_site_packages: true
108
before_install:
119
- sudo apt-get update -qq
1210
- sudo apt-get install -qq python-numpy python-matplotlib python-pythonmagick
11+
virtualenv:
12+
system_site_packages: true
1313
install:
1414
- pip install .
1515
script: nosetests

Diff for: tests/unittests/test_align.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def setUp(self):
1414
# area to search (whole image)
1515
srch_area = [0, 0, 31, 31]
1616

17-
self.align = Align(img, ref_loc=ref_loc, srch_area=srch_area)
17+
self.align = Align(img)
18+
self.align.set_reference(ref_loc)
19+
self.align.set_search_area(srch_area)
1820

1921
def test_simple_match(self):
2022
# image to be matched

Diff for: tests/unittests/test_image.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22
import os
3-
from halostack.image import Image
3+
from halostack.image import Image, _scale
44
import numpy as np
55

66
class TestImage(unittest.TestCase):
@@ -138,27 +138,27 @@ def test_rgb_subtract(self):
138138
self.assertItemsEqual(correct_result, img.img)
139139

140140
def test_scale_values(self):
141-
self.img_rand8._scale(8)
141+
self.img_rand8.img = _scale(self.img_rand8.img, 8)
142142
self.assertTrue(self.img_rand8.img.dtype == 'uint8')
143143
self.assertTrue(self.img_rand8.min() == 0)
144144
self.assertTrue(self.img_rand8.max() == 255)
145145

146-
self.img_rand16._scale(16)
146+
self.img_rand16.img = _scale(self.img_rand16.img, 16)
147147
self.assertTrue(self.img_rand16.img.dtype == 'uint16')
148148
self.assertTrue(self.img_rand16.min() == 0)
149149
self.assertTrue(self.img_rand16.max() == 2**16-1)
150150

151-
self.img_rand_big1._scale(8)
151+
self.img_rand_big1.img = _scale(self.img_rand_big1.img, 8)
152152
self.assertTrue(self.img_rand_big1.img.dtype == 'uint8')
153153
self.assertTrue(self.img_rand_big1.min() == 0)
154154
self.assertTrue(self.img_rand_big1.max() == 255)
155155

156-
self.img_rand_big2._scale(16)
156+
self.img_rand_big2.img = _scale(self.img_rand_big2.img, 16)
157157
self.assertTrue(self.img_rand_big2.img.dtype == 'uint16')
158158
self.assertTrue(self.img_rand_big2.min() == 0)
159159
self.assertTrue(self.img_rand_big2.max() == 2**16-1)
160160

161-
self.img_rand_neg._scale(8)
161+
self.img_rand_neg.img = _scale(self.img_rand_neg.img, 8)
162162
self.assertTrue(self.img_rand_neg.min() >= 0)
163163

164164
def assertItemsEqual(self, a, b):

Diff for: tests/unittests/test_stack.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22
import os
3-
from halostack.image import Image
3+
from halostack.image import Image, _scale
44
from halostack.stack import Stack
55
import numpy as np
66

@@ -55,7 +55,7 @@ def test_mean_stack(self):
5555
dtype=np.float))
5656
stack.stack.img[1, 1, 1] = 13
5757
stack.stack.img[2, 2, 1] = 23
58-
stack.stack._scale(16)
58+
stack.stack.img = _scale(stack.stack.img, 16)
5959
result = stack.stack.img
6060
self.assertTrue(result.min() == 0)
6161
self.assertTrue(result[1, 1, 1] == 32767)

0 commit comments

Comments
 (0)