Ejemplo n.º 1
0
    def test_primaries_whitepoint(self):
        """
        Tests :func:`colour.models.rgb.derivation.primaries_whitepoint`
        definition.
        """

        P, W = primaries_whitepoint(
            np.array([[0.95255240, 0.00000000, 0.00009368],
                      [0.34396645, 0.72816610, -0.07213255],
                      [0.00000000, 0.00000000, 1.00882518]]))
        np.testing.assert_almost_equal(P,
                                       np.array([[0.73470, 0.26530],
                                                 [0.00000, 1.00000],
                                                 [0.00010, -0.07700]]),
                                       decimal=7)
        np.testing.assert_almost_equal(W,
                                       np.array([0.32168, 0.33767]),
                                       decimal=7)

        P, W = primaries_whitepoint(
            np.array([[0.41240000, 0.35760000, 0.18050000],
                      [0.21260000, 0.71520000, 0.07220000],
                      [0.01930000, 0.11920000, 0.95050000]]))
        np.testing.assert_almost_equal(P,
                                       np.array([[0.64007450, 0.32997051],
                                                 [0.30000000, 0.60000000],
                                                 [0.15001662, 0.06000665]]),
                                       decimal=7)
        np.testing.assert_almost_equal(W,
                                       np.array([0.31271591, 0.32900148]),
                                       decimal=7)
Ejemplo n.º 2
0
    def test_primaries_whitepoint(self):
        """
        Tests :func:`colour.models.rgb.derivation.primaries_whitepoint`
        definition.
        """

        P, W = primaries_whitepoint(np.array(
            [[0.95255240, 0.00000000, 0.00009368],
             [0.34396645, 0.72816610, -0.07213255],
             [0.00000000, 0.00000000, 1.00882518]]))
        np.testing.assert_almost_equal(
            P,
            np.array([[0.73470, 0.26530],
                      [0.00000, 1.00000],
                      [0.00010, -0.07700]]),
            decimal=7)
        np.testing.assert_almost_equal(
            W,
            np.array([0.32168, 0.33767]),
            decimal=7)

        P, W = primaries_whitepoint(
            np.array([[0.41240000, 0.35760000, 0.18050000],
                      [0.21260000, 0.71520000, 0.07220000],
                      [0.01930000, 0.11920000, 0.95050000]]))
        np.testing.assert_almost_equal(
            P,
            np.array([[0.64007450, 0.32997051],
                      [0.30000000, 0.60000000],
                      [0.15001662, 0.06000665]]),
            decimal=7)
        np.testing.assert_almost_equal(
            W,
            np.array([0.31271591, 0.32900148]),
            decimal=7)
Ejemplo n.º 3
0
    def test_primaries_whitepoint(self):
        """
        Tests :func:`colour.models.rgb.derivation.primaries_whitepoint`
        definition.
        """

        P, W = primaries_whitepoint(
            np.array([[9.52552396e-01, 0.00000000e+00, 9.36786317e-05],
                      [3.43966450e-01, 7.28166097e-01, -7.21325464e-02],
                      [0.00000000e+00, 0.00000000e+00, 1.00882518e+00]]))
        np.testing.assert_almost_equal(
            P,
            np.array([[0.73470, 0.26530],
                      [0.00000, 1.00000],
                      [0.00010, -0.07700]]),
            decimal=7)
        np.testing.assert_almost_equal(
            W,
            np.array([0.32168, 0.33767]),
            decimal=7)

        P, W = primaries_whitepoint(
            np.array([[0.41239080, 0.35758434, 0.18048079],
                      [0.21263901, 0.71516868, 0.07219232],
                      [0.01933082, 0.11919478, 0.95053215]]))
        np.testing.assert_almost_equal(
            P,
            np.array([[0.640, 0.330],
                      [0.300, 0.600],
                      [0.150, 0.060]]),
            decimal=7)
        np.testing.assert_almost_equal(
            W,
            np.array([0.3127, 0.3290]),
            decimal=7)
Ejemplo n.º 4
0
    def test_nan_primaries_whitepoint(self):
        """
        Tests :func:`colour.models.rgb.derivation.primaries_whitepoint`
        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:
            M = np.array(np.vstack((case, case, case)))
            primaries_whitepoint(M)
Ejemplo n.º 5
0
    def test_nan_primaries_whitepoint(self):
        """
        Tests :func:`colour.models.rgb.derivation.primaries_whitepoint`
        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:
            M = np.array(np.vstack([case, case, case]))
            primaries_whitepoint(M)