Exemple #1
0
    def test_n_dimensional_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition n-dimensional arrays support.
        """

        V = 0.312012855550395
        L = 0.18
        np.testing.assert_almost_equal(
            log_decoding_CanonLog(V),
            L,
            decimal=7)

        V = np.tile(V, 6)
        L = np.tile(L, 6)
        np.testing.assert_almost_equal(
            log_decoding_CanonLog(V),
            L,
            decimal=7)

        V = np.reshape(V, (2, 3))
        L = np.reshape(L, (2, 3))
        np.testing.assert_almost_equal(
            log_decoding_CanonLog(V),
            L,
            decimal=7)

        V = np.reshape(V, (2, 3, 1))
        L = np.reshape(L, (2, 3, 1))
        np.testing.assert_almost_equal(
            log_decoding_CanonLog(V),
            L,
            decimal=7)
Exemple #2
0
    def test_nan_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition nan support.
        """

        log_decoding_CanonLog(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Exemple #3
0
    def test_nan_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition nan support.
        """

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

        clog = 0.343389651726069
        x = log_decoding_CanonLog(clog)

        d_r = (("reference", 1), ("1", 1), ("100", 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(log_decoding_CanonLog(clog *
                                                                     factor),
                                               x * factor,
                                               decimal=7)
    def test_domain_range_scale_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition domain and range scale support.
        """

        clog = 0.343389651726069
        x = log_decoding_CanonLog(clog)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    log_decoding_CanonLog(clog * factor),
                    x * factor,
                    decimal=7)
Exemple #6
0
    def test_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition.
        """

        self.assertAlmostEqual(log_decoding_CanonLog(0.073059700000000),
                               0.0,
                               places=7)

        self.assertAlmostEqual(log_decoding_CanonLog(0.312012855550395),
                               0.18,
                               places=7)

        self.assertAlmostEqual(log_decoding_CanonLog(0.627408304537653),
                               1.0,
                               places=7)
Exemple #7
0
    def test_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition.
        """

        self.assertAlmostEqual(log_decoding_CanonLog(-0.023560122781997),
                               -0.1,
                               places=7)

        self.assertAlmostEqual(log_decoding_CanonLog(0.125122480156403),
                               0.0,
                               places=7)

        self.assertAlmostEqual(log_decoding_CanonLog(0.343389651726069),
                               0.18,
                               places=7)

        self.assertAlmostEqual(log_decoding_CanonLog(0.343138084215647, 12),
                               0.18,
                               places=7)

        self.assertAlmostEqual(log_decoding_CanonLog(0.327953896935809, 10,
                                                     False),
                               0.18,
                               places=7)

        self.assertAlmostEqual(log_decoding_CanonLog(0.312012855550395, 10,
                                                     False, False),
                               0.18,
                               places=7)

        self.assertAlmostEqual(log_decoding_CanonLog(0.618775485598649),
                               1.0,
                               places=7)
    def test_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition.
        """

        self.assertAlmostEqual(
            log_decoding_CanonLog(-0.023560122781997), -0.1, places=7)

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.125122480156403), 0.0, places=7)

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.343389651726069), 0.18, places=7)

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.343138084215647, 12), 0.18, places=7)

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.327953896935809, 10, False),
            0.18,
            places=7)

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.312012855550395, 10, False, False),
            0.18,
            places=7)

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.618775485598649), 1.0, places=7)
Exemple #9
0
    def test_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition.
        """

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.073059700000000),
            0.0,
            places=7)

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.312012855550395),
            0.18,
            places=7)

        self.assertAlmostEqual(
            log_decoding_CanonLog(0.627408304537653),
            1.0,
            places=7)
Exemple #10
0
    def test_n_dimensional_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition n-dimensional arrays support.
        """

        V = 0.312012855550395
        L = 0.18
        np.testing.assert_almost_equal(log_decoding_CanonLog(V), L, decimal=7)

        V = np.tile(V, 6)
        L = np.tile(L, 6)
        np.testing.assert_almost_equal(log_decoding_CanonLog(V), L, decimal=7)

        V = np.reshape(V, (2, 3))
        L = np.reshape(L, (2, 3))
        np.testing.assert_almost_equal(log_decoding_CanonLog(V), L, decimal=7)

        V = np.reshape(V, (2, 3, 1))
        L = np.reshape(L, (2, 3, 1))
        np.testing.assert_almost_equal(log_decoding_CanonLog(V), L, decimal=7)
    def test_n_dimensional_log_decoding_CanonLog(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.canon_log.\
log_decoding_CanonLog` definition n-dimensional arrays support.
        """

        clog = 0.343389651726069
        x = log_decoding_CanonLog(clog)

        clog = np.tile(clog, 6)
        x = np.tile(x, 6)
        np.testing.assert_almost_equal(
            log_decoding_CanonLog(clog), x, decimal=7)

        clog = np.reshape(clog, (2, 3))
        x = np.reshape(x, (2, 3))
        np.testing.assert_almost_equal(
            log_decoding_CanonLog(clog), x, decimal=7)

        clog = np.reshape(clog, (2, 3, 1))
        x = np.reshape(x, (2, 3, 1))
        np.testing.assert_almost_equal(
            log_decoding_CanonLog(clog), x, decimal=7)