Пример #1
0
    def test_n_dimensional_JzAzBz_to_XYZ(self):
        """
        Tests :func:`colour.models.jzazbz.JzAzBz_to_XYZ` definition
        n-dimensions support.
        """

        JzAzBz = np.array([0.00535048, 0.00924302, 0.00526007])
        XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
        np.testing.assert_allclose(JzAzBz_to_XYZ(JzAzBz),
                                   XYZ,
                                   rtol=0.000001,
                                   atol=0.000001)

        JzAzBz = np.tile(JzAzBz, (6, 1))
        XYZ = np.tile(XYZ, (6, 1))
        np.testing.assert_allclose(JzAzBz_to_XYZ(JzAzBz),
                                   XYZ,
                                   rtol=0.000001,
                                   atol=0.000001)

        JzAzBz = np.reshape(JzAzBz, (2, 3, 3))
        XYZ = np.reshape(XYZ, (2, 3, 3))
        np.testing.assert_allclose(JzAzBz_to_XYZ(JzAzBz),
                                   XYZ,
                                   rtol=0.000001,
                                   atol=0.000001)
Пример #2
0
    def test_domain_range_scale_JzAzBz_to_XYZ(self):
        """
        Tests :func:`colour.models.jzazbz.JzAzBz_to_XYZ` definition domain and
        range scale support.
        """

        JzAzBz = np.array([0.00535048, 0.00924302, 0.00526007])
        XYZ = JzAzBz_to_XYZ(JzAzBz)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_allclose(JzAzBz_to_XYZ(JzAzBz * factor),
                                           XYZ * factor,
                                           rtol=0.000001,
                                           atol=0.000001)
Пример #3
0
    def test_nan_JzAzBz_to_XYZ(self):
        """
        Tests :func:`colour.models.jzazbz.JzAzBz_to_XYZ` 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:
            JzAzBz = np.array(case)
            JzAzBz_to_XYZ(JzAzBz)
Пример #4
0
    def test_JzAzBz_to_XYZ(self):
        """
        Tests :func:`colour.models.jzazbz.JzAzBz_to_XYZ` definition.
        """

        np.testing.assert_allclose(
            JzAzBz_to_XYZ(np.array([0.00535048, 0.00924302, 0.00526007])),
            np.array([0.20654008, 0.12197225, 0.05136952]),
            rtol=0.000001,
            atol=0.000001)

        np.testing.assert_allclose(
            JzAzBz_to_XYZ(np.array([0.00619681, -0.00608426, 0.00534077])),
            np.array([0.14222010, 0.23042768, 0.10495772]),
            rtol=0.000001,
            atol=0.000001)

        np.testing.assert_allclose(
            JzAzBz_to_XYZ(np.array([0.01766826, 0.00064174, -0.00052906])),
            np.array([0.96907232, 1.00000000, 1.12179215]),
            rtol=0.000001,
            atol=0.000001)