Ejemplo n.º 1
0
    def test_domain_range_scale_IPT_to_XYZ(self):
        """
        Tests :func:`colour.models.ipt.IPT_to_XYZ` definition domain and
        range scale support.
        """

        IPT = np.array([0.38426191, 0.38487306, 0.18886838])
        XYZ = IPT_to_XYZ(IPT)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    IPT_to_XYZ(IPT * factor), XYZ * factor, decimal=7)
Ejemplo n.º 2
0
    def test_n_dimensional_IPT_to_XYZ(self):
        """
        Tests :func:`colour.models.ipt.IPT_to_XYZ` definition n-dimensional
        support.
        """

        IPT = np.array([0.38426191, 0.38487306, 0.18886838])
        XYZ = IPT_to_XYZ(IPT)

        IPT = np.tile(IPT, (6, 1))
        XYZ = np.tile(XYZ, (6, 1))
        np.testing.assert_almost_equal(IPT_to_XYZ(IPT), XYZ, decimal=7)

        IPT = np.reshape(IPT, (2, 3, 3))
        XYZ = np.reshape(XYZ, (2, 3, 3))
        np.testing.assert_almost_equal(IPT_to_XYZ(IPT), XYZ, decimal=7)
Ejemplo n.º 3
0
    def test_n_dimensional_IPT_to_XYZ(self):
        """
        Tests :func:`colour.models.ipt.IPT_to_XYZ` definition n-dimensions
        support.
        """

        IPT = np.array([0.36571124, -0.11114798, 0.01594746])
        XYZ = np.array([0.07049534, 0.10080000, 0.09558313])
        np.testing.assert_almost_equal(IPT_to_XYZ(IPT), XYZ, decimal=7)

        IPT = np.tile(IPT, (6, 1))
        XYZ = np.tile(XYZ, (6, 1))
        np.testing.assert_almost_equal(IPT_to_XYZ(IPT), XYZ, decimal=7)

        IPT = np.reshape(IPT, (2, 3, 3))
        XYZ = np.reshape(XYZ, (2, 3, 3))
        np.testing.assert_almost_equal(IPT_to_XYZ(IPT), XYZ, decimal=7)
Ejemplo n.º 4
0
    def test_nan_IPT_to_XYZ(self):
        """Test :func:`colour.models.ipt.IPT_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:
            IPT = np.array(case)
            IPT_to_XYZ(IPT)
Ejemplo n.º 5
0
    def test_IPT_to_XYZ(self):
        """
        Tests :func:`colour.models.ipt.IPT_to_XYZ` definition.
        """

        np.testing.assert_almost_equal(
            IPT_to_XYZ(np.array([0.38426191, 0.38487306, 0.18886838])),
            np.array([0.20654008, 0.12197225, 0.05136952]),
            decimal=7)

        np.testing.assert_almost_equal(
            IPT_to_XYZ(np.array([0.49437481, -0.19251742, 0.18080304])),
            np.array([0.14222010, 0.23042768, 0.10495772]),
            decimal=7)

        np.testing.assert_almost_equal(
            IPT_to_XYZ(np.array([0.35167774, -0.07525627, -0.30921279])),
            np.array([0.07818780, 0.06157201, 0.28099326]),
            decimal=7)
Ejemplo n.º 6
0
    def test_IPT_to_XYZ(self):
        """
        Tests :func:`colour.models.ipt.IPT_to_XYZ` definition.
        """

        np.testing.assert_almost_equal(
            IPT_to_XYZ(np.array([1.00300825, 0.01906918, -0.01369292])),
            np.array([0.96907232, 1.00000000, 1.12179215]),
            decimal=7)

        np.testing.assert_almost_equal(
            IPT_to_XYZ(np.array([0.73974548, 0.95333412, 1.71951212])),
            np.array([1.92001986, 1.00000000, -0.12413470]),
            decimal=7)

        np.testing.assert_almost_equal(
            IPT_to_XYZ(np.array([1.06406598, -0.08075812, -0.39625384])),
            np.array([1.01316770, 1.00000000, 2.11217686]),
            decimal=7)