Exemplo n.º 1
0
    def test_n_dimensional_xy_to_z(self):
        """
        Tests :func:`colour.models.rgb.derivation.xy_to_z` definition
        n-dimensional arrays support.
        """

        xy = np.array([0.25, 0.25])
        z = 0.5
        np.testing.assert_almost_equal(
            xy_to_z(xy),
            z,
            decimal=7)

        xy = np.tile(xy, (6, 1))
        z = np.tile(z, 6, )
        np.testing.assert_almost_equal(
            xy_to_z(xy),
            z,
            decimal=7)

        xy = np.reshape(xy, (2, 3, 2))
        z = np.reshape(z, (2, 3))
        np.testing.assert_almost_equal(
            xy_to_z(xy),
            z,
            decimal=7)
Exemplo n.º 2
0
    def test_nan_xy_to_z(self):
        """
        Tests :func:`colour.models.rgb.derivation.xy_to_z` definition nan
        support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=2))
        for case in cases:
            xy_to_z(case)
Exemplo n.º 3
0
    def test_xy_to_z(self):
        """
        Tests :func:`colour.models.rgb.derivation.xy_to_z` definition.
        """

        np.testing.assert_almost_equal(
            xy_to_z((0.25, 0.25)),
            0.5,
            decimal=7)

        np.testing.assert_almost_equal(
            xy_to_z((0.00010, -0.07700)),
            1.07690,
            decimal=7)

        np.testing.assert_almost_equal(
            xy_to_z((0.00000, 1.00000)),
            0.00000,
            decimal=7)
Exemplo n.º 4
0
    def test_xy_to_z(self):
        """
        Tests :func:`colour.models.rgb.derivation.xy_to_z` definition.
        """

        np.testing.assert_almost_equal(
            xy_to_z(np.array([0.2500, 0.2500])),
            0.5,
            decimal=7)

        np.testing.assert_almost_equal(
            xy_to_z(np.array([0.0001, -0.0770])),
            1.0769,
            decimal=7)

        np.testing.assert_almost_equal(
            xy_to_z(np.array([0.0000, 1.0000])),
            0.0,
            decimal=7)