Example #1
0
    def test_polynomial_expansion_Finlayson2015(self):
        """
        Tests :func:`colour.characterisation.correction.\
    polynomial_expansion_Finlayson2015` definition.
        """

        RGB = np.array([0.17224810, 0.09170660, 0.06416938])

        polynomials = [
            [
                np.array([0.17224810, 0.09170660, 0.06416938]),
                np.array([0.17224810, 0.09170660, 0.06416938])
            ],
            [
                np.array([
                    0.17224810, 0.09170660, 0.06416938, 0.02966941, 0.00841010,
                    0.00411771, 0.01579629, 0.00588476, 0.01105305
                ]),
                np.array([
                    0.17224810, 0.09170660, 0.06416938, 0.00789814, 0.00294238,
                    0.00552653
                ])
            ],
            [
                np.array([
                    0.17224810, 0.09170660, 0.06416938, 0.02966941, 0.00841010,
                    0.00411771, 0.01579629, 0.00588476, 0.01105305, 0.00511050,
                    0.00077126, 0.00026423, 0.00144862, 0.00037762, 0.00070927,
                    0.00272088, 0.00053967, 0.00190387, 0.00101364
                ]),
                np.array([
                    0.17224810, 0.09170660, 0.06416938, 0.00789814, 0.00294238,
                    0.00552653, 0.00048287, 0.00012587, 0.00023642, 0.00090696,
                    0.00017989, 0.00063462, 0.00033788
                ])
            ],
            [
                np.array([
                    0.17224810, 0.09170660, 0.06416938, 0.02966941, 0.00841010,
                    0.00411771, 0.01579629, 0.00588476, 0.01105305, 0.00511050,
                    0.00077126, 0.00026423, 0.00144862, 0.00037762, 0.00070927,
                    0.00272088, 0.00053967, 0.00190387, 0.00101364, 0.00088027,
                    0.00007073, 0.00001696, 0.00046867, 0.00032794, 0.00013285,
                    0.00004949, 0.00004551, 0.00002423, 0.00024952, 0.00003463,
                    0.00012217, 0.00017460, 0.00009296, 0.00006504
                ]),
                np.array([
                    0.17224810, 0.09170660, 0.06416938, 0.00789814, 0.00294238,
                    0.00552653, 0.00048287, 0.00012587, 0.00023642, 0.00090696,
                    0.00017989, 0.00063462, 0.00033788, 0.00011717, 0.00008198,
                    0.00003321, 0.00001237, 0.00001138, 0.00000606, 0.00004365,
                    0.00002324, 0.00001626
                ])
            ],
        ]

        for i in range(4):
            np.testing.assert_almost_equal(polynomial_expansion_Finlayson2015(
                RGB, i + 1, False),
                                           polynomials[i][0],
                                           decimal=7)
            np.testing.assert_almost_equal(polynomial_expansion_Finlayson2015(
                RGB, i + 1, True),
                                           polynomials[i][1],
                                           decimal=7)
Example #2
0
    def test_polynomial_expansion_Finlayson2015(self):
        """
        Test :func:`colour.characterisation.correction.\
polynomial_expansion_Finlayson2015` definition.
        """

        RGB = np.array([0.17224810, 0.09170660, 0.06416938])

        polynomials = [
            [
                np.array([0.17224810, 0.09170660, 0.06416938]),
                np.array([0.17224810, 0.09170660, 0.06416938]),
            ],
            [
                np.array(
                    [
                        0.17224810,
                        0.09170660,
                        0.06416938,
                        0.02966941,
                        0.00841010,
                        0.00411771,
                        0.01579629,
                        0.00588476,
                        0.01105305,
                    ]
                ),
                np.array(
                    [
                        0.17224810,
                        0.09170660,
                        0.06416938,
                        0.12568328,
                        0.07671216,
                        0.10513350,
                    ]
                ),
            ],
            [
                np.array(
                    [
                        0.17224810,
                        0.09170660,
                        0.06416938,
                        0.02966941,
                        0.00841010,
                        0.00411771,
                        0.01579629,
                        0.00588476,
                        0.01105305,
                        0.00511050,
                        0.00077126,
                        0.00026423,
                        0.00144862,
                        0.00037762,
                        0.00070927,
                        0.00272088,
                        0.00053967,
                        0.00190387,
                        0.00101364,
                    ]
                ),
                np.array(
                    [
                        0.17224810,
                        0.09170660,
                        0.06416938,
                        0.12568328,
                        0.07671216,
                        0.10513350,
                        0.11314930,
                        0.07228010,
                        0.08918053,
                        0.13960570,
                        0.08141598,
                        0.12394021,
                        0.10045255,
                    ]
                ),
            ],
            [
                np.array(
                    [
                        0.17224810,
                        0.09170660,
                        0.06416938,
                        0.02966941,
                        0.00841010,
                        0.00411771,
                        0.01579629,
                        0.00588476,
                        0.01105305,
                        0.00511050,
                        0.00077126,
                        0.00026423,
                        0.00144862,
                        0.00037762,
                        0.00070927,
                        0.00272088,
                        0.00053967,
                        0.00190387,
                        0.00101364,
                        0.00088027,
                        0.00007073,
                        0.00001696,
                        0.00046867,
                        0.00032794,
                        0.00013285,
                        0.00004949,
                        0.00004551,
                        0.00002423,
                        0.00024952,
                        0.00003463,
                        0.00012217,
                        0.00017460,
                        0.00009296,
                        0.00006504,
                    ]
                ),
                np.array(
                    [
                        0.17224810,
                        0.09170660,
                        0.06416938,
                        0.12568328,
                        0.07671216,
                        0.10513350,
                        0.11314930,
                        0.07228010,
                        0.08918053,
                        0.13960570,
                        0.08141598,
                        0.12394021,
                        0.10045255,
                        0.14713499,
                        0.13456986,
                        0.10735915,
                        0.08387498,
                        0.08213618,
                        0.07016104,
                        0.11495009,
                        0.09819082,
                        0.08980545,
                    ]
                ),
            ],
        ]

        for i in range(4):
            np.testing.assert_almost_equal(
                polynomial_expansion_Finlayson2015(RGB, i + 1, False),
                polynomials[i][0],
                decimal=7,
            )
            np.testing.assert_almost_equal(
                polynomial_expansion_Finlayson2015(RGB, i + 1, True),
                polynomials[i][1],
                decimal=7,
            )