示例#1
0
 def test_segment_lookup(self):
     """
     This test is pretty much already covered by the
     idl-functions package.
     """
     data = numpy.arange(400*400).reshape((400, 400))
     seg = segmentation.Segments(data)
     idx = seg.locations(6666)
     self.assertTrue((data[idx] == data[data == 6666]).all())
示例#2
0
 def test_multiple_segments(self):
     data = numpy.arange(400*400).reshape((400, 400))
     seg = segmentation.Segments(data)
     self.assertEqual(159999, seg.n_segments)
示例#3
0
 def test_zero_segments(self):
     data = numpy.zeros((400, 400), dtype='int8')
     seg = segmentation.Segments(data)
     self.assertEqual(0, seg.n_segments)
示例#4
0
 def test_include_zero(self):
     data = numpy.zeros((400, 400), dtype='int8')
     data[0:100, 0:100] = 1
     seg = segmentation.Segments(data, include_zero=True)
     self.assertEqual(2, seg.n_segments)
示例#5
0
 def test_single_segment(self):
     data = numpy.ones((400, 400), dtype='int8')
     seg = segmentation.Segments(data)
     self.assertEqual(1, seg.n_segments)