Exemple #1
0
    def test_RGB_to_Prismatic(self):
        """
        Tests :func:`colour.models.rgb.prismatic.RGB_to_Prismatic` definition.
        """

        np.testing.assert_almost_equal(RGB_to_Prismatic(
            np.array([0.0, 0.0, 0.0])),
                                       np.array([0.0, 0.0, 0.0, 0.0]),
                                       decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_Prismatic(np.array([0.25, 0.50, 0.75])),
            np.array([0.7500000, 0.1666667, 0.3333333, 0.5000000]),
            decimal=7)
Exemple #2
0
    def test_domain_range_scale_RGB_to_Prismatic(self):
        """
        Tests :func:`colour.models.rgb.prismatic.RGB_to_Prismatic` definition
        domain and range scale support.
        """

        RGB = np.array([0.25, 0.50, 0.75])
        Lrgb = RGB_to_Prismatic(RGB)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    RGB_to_Prismatic(RGB * factor), Lrgb * factor, decimal=7)
Exemple #3
0
    def test_n_dimensional_RGB_to_Prismatic(self):
        """
        Tests :func:`colour.models.rgb.prismatic.RGB_to_Prismatic` definition
        n-dimensional support.
        """

        RGB = np.array([0.25, 0.50, 0.75])
        Lrgb = RGB_to_Prismatic(RGB)

        RGB = np.tile(RGB, (6, 1))
        Lrgb = np.tile(Lrgb, (6, 1))
        np.testing.assert_almost_equal(RGB_to_Prismatic(RGB), Lrgb, decimal=7)

        RGB = np.reshape(RGB, (2, 3, 3))
        Lrgb = np.reshape(Lrgb, (2, 3, 4))
        np.testing.assert_almost_equal(RGB_to_Prismatic(RGB), Lrgb, decimal=7)
Exemple #4
0
    def test_nan_RGB_to_Prismatic(self):
        """
        Tests :func:`colour.models.rgb.prismatic.RGB_to_Prismatic` 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:
            RGB = np.array(case)
            RGB_to_Prismatic(RGB)