def test_n_dimensional_cctf_encoding_ROMMRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_encoding_ROMMRGB` definition n-dimensional arrays support.
        """

        X = 0.18
        X_ROMM = cctf_encoding_ROMMRGB(X)

        X = np.tile(X, 6)
        X_ROMM = np.tile(X_ROMM, 6)
        np.testing.assert_almost_equal(
            cctf_encoding_ROMMRGB(X), X_ROMM, decimal=7
        )

        X = np.reshape(X, (2, 3))
        X_ROMM = np.reshape(X_ROMM, (2, 3))
        np.testing.assert_almost_equal(
            cctf_encoding_ROMMRGB(X), X_ROMM, decimal=7
        )

        X = np.reshape(X, (2, 3, 1))
        X_ROMM = np.reshape(X_ROMM, (2, 3, 1))
        np.testing.assert_almost_equal(
            cctf_encoding_ROMMRGB(X), X_ROMM, decimal=7
        )
Exemple #2
0
    def test_nan_cctf_encoding_ROMMRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_encoding_ROMMRGB` definition nan support.
        """

        cctf_encoding_ROMMRGB(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
    def test_domain_range_scale_cctf_encoding_ROMMRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_encoding_ROMMRGB` definition domain and range scale support.
        """

        X = 0.18
        X_p = cctf_encoding_ROMMRGB(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_ROMMRGB(X * factor), X_p * factor, decimal=7
                )
Exemple #4
0
    def test_cctf_encoding_ROMMRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_encoding_ROMMRGB` definition.
        """

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

        self.assertAlmostEqual(cctf_encoding_ROMMRGB(0.18),
                               0.385711424751138,
                               places=7)

        self.assertAlmostEqual(cctf_encoding_ROMMRGB(1.0), 1.0, places=7)

        self.assertEqual(cctf_encoding_ROMMRGB(0.18, out_int=True), 98)

        self.assertEqual(
            cctf_encoding_ROMMRGB(0.18, bit_depth=12, out_int=True), 1579)