Example #1
0
    def test_domain_range_scale_CMY_to_CMYK(self):
        """
        Tests :func:`colour.models.rgb.deprecated.CMY_to_CMYK` definition
        domain and range scale support.
        """

        CMY = np.array([0.54379481, 0.96918929, 0.95908048])
        CMYK = CMY_to_CMYK(CMY)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    CMY_to_CMYK(CMY * factor), CMYK * factor, decimal=7)
Example #2
0
    def test_n_dimensional_CMY_to_CMYK(self):
        """
        Tests :func:`colour.models.rgb.deprecated.CMY_to_CMYK` definition
        n-dimensional arrays support.
        """

        CMY = np.array([0.54379481, 0.96918929, 0.95908048])
        CMYK = CMY_to_CMYK(CMY)

        CMY = np.tile(CMY, (6, 1))
        CMYK = np.tile(CMYK, (6, 1))
        np.testing.assert_almost_equal(CMY_to_CMYK(CMY), CMYK, decimal=7)

        CMY = np.reshape(CMY, (2, 3, 3))
        CMYK = np.reshape(CMYK, (2, 3, 4))
        np.testing.assert_almost_equal(CMY_to_CMYK(CMY), CMYK, decimal=7)
Example #3
0
    def test_n_dimensional_CMY_to_CMYK(self):
        """
        Tests :func:`colour.models.rgb.deprecated.CMY_to_CMYK` definition
        n-dimensional arrays support.
        """

        CMY = np.array([0.75000000, 0.40000000, 0.95000000])
        CMYK = np.array([0.58333333, 0.00000000, 0.91666667, 0.40000000])
        np.testing.assert_almost_equal(CMY_to_CMYK(CMY), CMYK, decimal=7)

        CMY = np.tile(CMY, (6, 1))
        CMYK = np.tile(CMYK, (6, 1))
        np.testing.assert_almost_equal(CMY_to_CMYK(CMY), CMYK, decimal=7)

        CMY = np.reshape(CMY, (2, 3, 3))
        CMYK = np.reshape(CMYK, (2, 3, 4))
        np.testing.assert_almost_equal(CMY_to_CMYK(CMY), CMYK, decimal=7)
Example #4
0
    def test_CMY_to_CMYK(self):
        """
        Tests :func:`colour.models.rgb.deprecated.CMY_to_CMYK` definition.
        """

        np.testing.assert_almost_equal(
            CMY_to_CMYK(np.array([0.75000000, 0.40000000, 0.95000000])),
            np.array([0.58333333, 0.00000000, 0.91666667, 0.40000000]),
            decimal=7)

        np.testing.assert_almost_equal(
            CMY_to_CMYK(np.array([0.15000000, 1.00000000, 1.00000000])),
            np.array([0.00000000, 1.00000000, 1.00000000, 0.15000000]),
            decimal=7)

        np.testing.assert_almost_equal(
            CMY_to_CMYK(np.array([0.15000000, 0.00000000, 0.00000000])),
            np.array([0.15000000, 0.00000000, 0.00000000, 0.00000000]),
            decimal=7)
Example #5
0
    def test_CMY_to_CMYK(self):
        """
        Tests :func:`colour.models.rgb.deprecated.CMY_to_CMYK` definition.
        """

        np.testing.assert_almost_equal(
            CMY_to_CMYK(np.array([0.54379481, 0.96918929, 0.95908048])),
            np.array([0.00000000, 0.93246304, 0.91030457, 0.54379481]),
            decimal=7)

        np.testing.assert_almost_equal(
            CMY_to_CMYK(np.array([0.15000000, 1.00000000, 1.00000000])),
            np.array([0.00000000, 1.00000000, 1.00000000, 0.15000000]),
            decimal=7)

        np.testing.assert_almost_equal(
            CMY_to_CMYK(np.array([0.15000000, 0.00000000, 0.00000000])),
            np.array([0.15000000, 0.00000000, 0.00000000, 0.00000000]),
            decimal=7)
Example #6
0
    def test_nan_CMY_to_CMYK(self):
        """
        Tests :func:`colour.models.rgb.deprecated.CMY_to_CMYK` definition nan
        support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=3))
        for case in cases:
            CMY = np.array(case)
            CMY_to_CMYK(CMY)