Ejemplo n.º 1
0
    def testImageConversions(self):
        # test that f([x, y, ...]) = [f(x), f(y), ...] for rectangular image arrays.

        for name, convert in colors.conversions.items():
            if name.find("CMYK") < 0:
                self._checkImageConversion(
                    4,
                    lambda p: vectorize(p, 1, lambda q: stacked(convert, q)))
Ejemplo n.º 2
0
 def testConditionalComplex(self):
     a = array([[[1, 2], [4, 5]], [[7, 8], [10, 11]]])
     a = vectorize(a, 0, _test_complex_conditional)
     self.assertEqualArrays(a,
                            [[[-1, -1], [40, 50]], [[70, 80], [100, 111]]])
Ejemplo n.º 3
0
 def testSimpleConditional(self):
     a = array([[[0.1, 0.6], [1.8, 0.4]], [[-0.1, -0.8], [1.1, 0.5]]])
     a = vectorize(a, 0, _test_simple_conditional)
     self.assertEqualArrays(
         a, [[[-0.1, 1.6], [2.8, -0.4]], [[0.1, 0.8], [2.1, -0.5]]])
Ejemplo n.º 4
0
 def testConditionalComplex(self):
     a = array([[[1, 2], [4, 5]], [[7, 8], [10, 11]]])
     a = vectorize(a, 0, _test_complex_conditional)
     self.assertEqualArrays(a, [[[-1, -1], [40, 50]], [[70, 80], [100, 111]]])
Ejemplo n.º 5
0
 def testSimpleConditional(self):
     a = array([[[0.1, 0.6], [1.8, 0.4]], [[-0.1, -0.8], [1.1, 0.5]]])
     a = vectorize(a, 0, _test_simple_conditional)
     self.assertEqualArrays(a, [[[-0.1, 1.6], [2.8, -0.4]], [[0.1, 0.8], [2.1, -0.5]]])
Ejemplo n.º 6
0
    def testImageConversions(self):
        # test that f([x, y, ...]) = [f(x), f(y), ...] for rectangular image arrays.

        for name, convert in colors.conversions.items():
            if name.find('CMYK') < 0:
                self._checkImageConversion(4, lambda p: vectorize(p, 1, lambda q: stacked(convert, q)))