Beispiel #1
0
    def test_n_dimensional_OSA_UCS_to_XYZ(self):
        """
        Tests :func:`colour.models.osa_ucs.OSA_UCS_to_XYZ` definition
        n-dimensions support.
        """

        Ljg = np.array([-3.00499790, 2.99713697, -9.66784231])
        XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) * 100
        np.testing.assert_allclose(OSA_UCS_to_XYZ(Ljg),
                                   XYZ,
                                   rtol=0.00001,
                                   atol=0.00001)

        Ljg = np.tile(Ljg, (6, 1))
        XYZ = np.tile(XYZ, (6, 1))
        np.testing.assert_allclose(OSA_UCS_to_XYZ(Ljg),
                                   XYZ,
                                   rtol=0.00001,
                                   atol=0.00001)

        Ljg = np.reshape(Ljg, (2, 3, 3))
        XYZ = np.reshape(XYZ, (2, 3, 3))
        np.testing.assert_allclose(OSA_UCS_to_XYZ(Ljg),
                                   XYZ,
                                   rtol=0.00001,
                                   atol=0.00001)
Beispiel #2
0
    def test_OSA_UCS_to_XYZ(self):
        """
        Tests :func:`colour.models.osa_ucs.OSA_UCS_to_XYZ` definition.
        """

        np.testing.assert_allclose(
            OSA_UCS_to_XYZ(np.array([-3.00499790, 2.99713697, -9.66784231]),
                           {'disp': False}),
            np.array([0.20654008, 0.12197225, 0.05136952]) * 100,
            rtol=0.00001,
            atol=0.00001)

        np.testing.assert_allclose(
            OSA_UCS_to_XYZ(np.array([-1.64657491, 4.59201565, 5.31738757]),
                           {'disp': False}),
            np.array([0.14222010, 0.23042768, 0.10495772]) * 100,
            rtol=0.00001,
            atol=0.00001)

        np.testing.assert_allclose(
            OSA_UCS_to_XYZ(np.array([-5.08589672, -7.91062749, 0.98107575]),
                           {'disp': False}),
            np.array([0.07818780, 0.06157201, 0.28099326]) * 100,
            rtol=0.00001,
            atol=0.00001)
Beispiel #3
0
    def test_domain_range_scale_OSA_UCS_to_XYZ(self):
        """
        Tests :func:`colour.models.osa_ucs.OSA_UCS_to_XYZ` definition domain
        and range scale support.
        """

        Ljg = np.array([-3.00499790, 2.99713697, -9.66784231])
        XYZ = OSA_UCS_to_XYZ(Ljg)

        d_r = (('reference', 1), (1, 0.01), (100, 1))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    OSA_UCS_to_XYZ(Ljg * factor), XYZ * factor, decimal=7)