def test_cctf_decoding_RIMMRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_decoding_RIMMRGB` definition.
        """

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

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

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

        np.testing.assert_allclose(
            cctf_decoding_RIMMRGB(74, in_int=True),
            0.18,
            atol=0.005,
            rtol=0.005,
        )

        np.testing.assert_allclose(
            cctf_decoding_RIMMRGB(1194, bit_depth=12, in_int=True),
            0.18,
            atol=0.005,
            rtol=0.005,
        )
    def test_n_dimensional_cctf_decoding_RIMMRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\
cctf_decoding_RIMMRGB` definition n-dimensional arrays support.
        """

        X_p = 0.291673732475746
        X = cctf_decoding_RIMMRGB(X_p)

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

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

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

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

        X_p = 0.291673732475746
        X = cctf_decoding_RIMMRGB(X_p)

        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_decoding_RIMMRGB(X_p * factor), X * factor, decimal=7
                )