Пример #1
0
 def test_offset(self):
     lut = linear_lut(10, 265, fill=True)
     expected_lut = np.zeros(266, dtype='uint8')
     expected_lut[:10] = 0
     expected_lut[10:] = np.linspace(0, 255, 256)
     self.assertEqual(len(lut), len(expected_lut))
     self.assertTrue(np.all(lut == expected_lut))
Пример #2
0
 def test_offset(self):
     lut = linear_lut(10, 265, fill=True)
     expected_lut = np.zeros(266, dtype='uint8')
     expected_lut[:10] = 0
     expected_lut[10:] = np.linspace(0, 255, 256)
     self.assertEqual(len(lut), len(expected_lut))
     self.assertTrue(np.all(lut == expected_lut))
Пример #3
0
 def test_fill_false1(self):
     lut = linear_lut(100, 199)
     self.assertEqual(len(lut), 200)
Пример #4
0
 def test_dtype_uint16(self):
     lut = linear_lut(dtype='uint16')
     self.assertEqual(lut.dtype, np.uint16)
     self.assertTrue(np.all(lut == np.arange(2 ** 16, dtype='uint16')))
Пример #5
0
 def test_all_defaults(self):
     lut = linear_lut()
     self.assertEqual(lut.dtype, np.uint8)
     self.assertTrue(np.all(lut == np.arange(2 ** 8, dtype='uint8')))
Пример #6
0
 def test_vmin_omin(self):
     lut = linear_lut(10, 209, omin=10, omax=209)
     expected_lut = np.arange(210)
     expected_lut[:10] = 10
     self.assertEqual(len(lut), len(expected_lut))
     self.assertTrue(np.all(lut == expected_lut))
Пример #7
0
 def test_vmin_omin(self):
     lut = linear_lut(10, 209, omin=10, omax=209)
     expected_lut = np.arange(210)
     expected_lut[:10] = 10
     self.assertEqual(len(lut), len(expected_lut))
     self.assertTrue(np.all(lut == expected_lut))
Пример #8
0
 def test_fill1(self):
     lut = linear_lut(100, 199, fill=500)
     self.assertEqual(len(lut), 500)
Пример #9
0
 def test_fill2(self):
     lut = linear_lut(100, 3000, fill=500)
     self.assertEqual(len(lut), 3001)
Пример #10
0
 def test_fill1(self):
     lut = linear_lut(100, 199, fill=500)
     self.assertEqual(len(lut), 500)
Пример #11
0
 def test_fill_true2(self):
     lut = linear_lut(100, 3000, fill=True)
     self.assertEqual(len(lut), 3001)
Пример #12
0
 def test_fill_true1(self):
     lut = linear_lut(100, 199, fill=True)
     self.assertEqual(len(lut), 256)
Пример #13
0
 def test_fill_false1(self):
     lut = linear_lut(100, 199)
     self.assertEqual(len(lut), 200)
Пример #14
0
 def test_dtype_uint16(self):
     lut = linear_lut(dtype='uint16')
     self.assertEqual(lut.dtype, np.uint16)
     self.assertTrue(np.all(lut == np.arange(2**16, dtype='uint16')))
Пример #15
0
 def test_all_defaults(self):
     lut = linear_lut()
     self.assertEqual(lut.dtype, np.uint8)
     self.assertTrue(np.all(lut == np.arange(2**8, dtype='uint8')))
Пример #16
0
 def test_fill_true1(self):
     lut = linear_lut(100, 199, fill=True)
     self.assertEqual(len(lut), 256)
Пример #17
0
 def test_fill_true2(self):
     lut = linear_lut(100, 3000, fill=True)
     self.assertEqual(len(lut), 3001)
Пример #18
0
 def test_scale(self):
     lut = linear_lut(0, 511)
     expected_lut = np.arange(256)
     expected_lut = np.repeat(expected_lut, 2)
     self.assertEqual(len(lut), len(expected_lut))
     self.assertTrue(np.all(lut == expected_lut))
Пример #19
0
 def test_fill2(self):
     lut = linear_lut(100, 3000, fill=500)
     self.assertEqual(len(lut), 3001)
Пример #20
0
 def test_omin(self):
     lut = linear_lut(0, 399, omin=10, omax=209)
     expected_lut = np.arange(200)
     expected_lut = np.repeat(expected_lut, 2) + 10
     self.assertEqual(len(lut), len(expected_lut))
     self.assertTrue(np.all(lut == expected_lut))
Пример #21
0
 def test_scale(self):
     lut = linear_lut(0, 511)
     expected_lut = np.arange(256)
     expected_lut = np.repeat(expected_lut, 2)
     self.assertEqual(len(lut), len(expected_lut))
     self.assertTrue(np.all(lut == expected_lut))
Пример #22
0
 def test_omin(self):
     lut = linear_lut(0, 399, omin=10, omax=209)
     expected_lut = np.arange(200)
     expected_lut = np.repeat(expected_lut, 2) + 10
     self.assertEqual(len(lut), len(expected_lut))
     self.assertTrue(np.all(lut == expected_lut))