Пример #1
0
    def test_n_dimensional_cctf_encoding_RIMMRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_encoding_RIMMRGB` definition n-dimensional arrays support.
        """

        X = 0.18
        X_p = cctf_encoding_RIMMRGB(X)

        X = np.tile(X, 6)
        X_p = np.tile(X_p, 6)
        np.testing.assert_almost_equal(
            cctf_encoding_RIMMRGB(X), X_p, decimal=7
        )

        X = np.reshape(X, (2, 3))
        X_p = np.reshape(X_p, (2, 3))
        np.testing.assert_almost_equal(
            cctf_encoding_RIMMRGB(X), X_p, decimal=7
        )

        X = np.reshape(X, (2, 3, 1))
        X_p = np.reshape(X_p, (2, 3, 1))
        np.testing.assert_almost_equal(
            cctf_encoding_RIMMRGB(X), X_p, decimal=7
        )
Пример #2
0
    def test_nan_cctf_encoding_RIMMRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_encoding_RIMMRGB` definition nan support.
        """

        cctf_encoding_RIMMRGB(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Пример #3
0
    def test_domain_range_scale_cctf_encoding_RIMMRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_encoding_RIMMRGB` definition domain and range scale support.
        """

        X = 0.18
        X_p = cctf_encoding_RIMMRGB(X)

        d_r = (("reference", 1), ("1", 1), ("100", 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    cctf_encoding_RIMMRGB(X * factor), X_p * factor, decimal=7
                )
Пример #4
0
    def test_cctf_encoding_RIMMRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_encoding_RIMMRGB` definition.
        """

        self.assertAlmostEqual(cctf_encoding_RIMMRGB(0.0), 0.0, places=7)

        self.assertAlmostEqual(cctf_encoding_RIMMRGB(0.18),
                               0.291673732475746,
                               places=7)

        self.assertAlmostEqual(cctf_encoding_RIMMRGB(1.0),
                               0.713125234297525,
                               places=7)

        self.assertEqual(cctf_encoding_RIMMRGB(0.18, out_int=True), 74)

        self.assertEqual(
            cctf_encoding_RIMMRGB(0.18, bit_depth=12, out_int=True), 1194)