Example #1
0
 def test_normalize_result_is_int(self):
     a = (100 * np.random.random((5, ))).astype(np.int16)
     self.assertEqual(normalize(a).dtype, np.int16)
Example #2
0
 def test_normalize_already_normal():
     a = np.array([NORMAL_MAXIMUM, NORMAL_MAXIMUM // 10, 0])
     np.testing.assert_array_equal(normalize(a), a)
Example #3
0
 def test_normalize_twos():
     a = 2 * np.ones((5, ))
     b = np.ones((5, )) * NORMAL_MAXIMUM
     np.testing.assert_array_equal(normalize(a), b)
Example #4
0
 def test_normalize():
     a = np.array([10, 1, 0])
     b = np.array([NORMAL_MAXIMUM, NORMAL_MAXIMUM // 10, 0])
     np.testing.assert_array_equal(normalize(a), b)
Example #5
0
 def test_normalize_ones():
     a = np.ones((5, ))
     b = NORMAL_MAXIMUM * a
     np.testing.assert_array_equal(normalize(a), b)