Exemplo n.º 1
0
    def test_nan_ootf_BT2100_HLG(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\
ootf_BT2100_HLG` definition nan support.
        """

        ootf_BT2100_HLG(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Exemplo n.º 2
0
    def test_ootf_BT2100_HLG(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\
ootf_BT2100_HLG` definition.
        """

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

        self.assertAlmostEqual(ootf_BT2100_HLG(0.1),
                               63.095734448019336,
                               places=7)

        self.assertAlmostEqual(ootf_BT2100_HLG(1.0), 1000.0, places=7)

        self.assertAlmostEqual(ootf_BT2100_HLG(0.1, 0.001, 10000, 1.4),
                               398.108130742780300,
                               places=7)

        a = np.array(
            [[45.884942278760597, 0.000000000000000, -45.884942278760597],
             [-63.095734448019336, -63.095734448019336, -63.095734448019336],
             [63.095734448019336, 63.095734448019336, 63.095734448019336],
             [51.320396090100672, -51.320396090100672, 51.320396090100672]]
        )  # yapf: disable
        np.testing.assert_almost_equal(ootf_BT2100_HLG(
            np.array([[0.1, 0.0, -0.1], [-0.1, -0.1, -0.1], [0.1, 0.1, 0.1],
                      [0.1, -0.1, 0.1]])),
                                       a,
                                       decimal=7)
Exemplo n.º 3
0
    def test_nan_ootf_BT2100_HLG(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\
ootf_BT2100_HLG` definition nan support.
        """

        ootf_BT2100_HLG(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Exemplo n.º 4
0
    def test_ootf_BT2100_HLG(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\
ootf_BT2100_HLG` definition.
        """

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

        self.assertAlmostEqual(
            ootf_BT2100_HLG(0.1), 63.095734448019336, places=7)

        self.assertAlmostEqual(ootf_BT2100_HLG(1.0), 1000.0, places=7)

        self.assertAlmostEqual(
            ootf_BT2100_HLG(0.1, 0.001, 10000, 1.4),
            398.108130742780300,
            places=7)

        a = np.array(
            [[45.884942278760597, 0.000000000000000, -45.884942278760597],
             [-63.095734448019336, -63.095734448019336, -63.095734448019336],
             [63.095734448019336, 63.095734448019336, 63.095734448019336],
             [51.320396090100672, -51.320396090100672, 51.320396090100672]],
        )  # yapf: disable
        np.testing.assert_almost_equal(
            ootf_BT2100_HLG(
                np.array([[0.1, 0.0, -0.1], [-0.1, -0.1, -0.1],
                          [0.1, 0.1, 0.1], [0.1, -0.1, 0.1]])),
            a,
            decimal=7)
Exemplo n.º 5
0
    def test_domain_range_scale_ootf_BT2100_HLG(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\
ootf_BT2100_HLG` definition domain and range scale support.
        """

        E = 0.1
        F_D = ootf_BT2100_HLG(E)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    ootf_BT2100_HLG(E * factor), F_D * factor, decimal=7)
Exemplo n.º 6
0
    def test_domain_range_scale_ootf_BT2100_HLG(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\
ootf_BT2100_HLG` definition domain and range scale support.
        """

        E = 0.1
        F_D = ootf_BT2100_HLG(E)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(ootf_BT2100_HLG(E * factor),
                                               F_D * factor,
                                               decimal=7)
Exemplo n.º 7
0
    def test_n_dimensional_ootf_BT2100_HLG(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\
ootf_BT2100_HLG` definition n-dimensional arrays support.
        """

        E = 0.1
        F_D = 63.095734448019336
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.tile(E, 6)
        F_D = np.tile(F_D, 6)
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.reshape(E, (2, 3))
        F_D = np.reshape(F_D, (2, 3))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.reshape(E, (2, 3, 1))
        F_D = np.reshape(F_D, (2, 3, 1))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.reshape(E, (6, 1))
        F_D = np.reshape(F_D, (6, 1))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.array([0.25, 0.50, 0.75])
        F_D = np.array([213.01897444, 426.03794887, 639.05692331])
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.tile(E, (6, 1))
        F_D = np.tile(F_D, (6, 1))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.reshape(E, (2, 3, 3))
        F_D = np.reshape(F_D, (2, 3, 3))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)
Exemplo n.º 8
0
    def test_n_dimensional_ootf_BT2100_HLG(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\
ootf_BT2100_HLG` definition n-dimensional arrays support.
        """

        E = 0.1
        F_D = ootf_BT2100_HLG(E)

        E = np.tile(E, 6)
        F_D = np.tile(F_D, 6)
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.reshape(E, (2, 3))
        F_D = np.reshape(F_D, (2, 3))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.reshape(E, (2, 3, 1))
        F_D = np.reshape(F_D, (2, 3, 1))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.reshape(E, (6, 1))
        F_D = np.reshape(F_D, (6, 1))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.array([0.25, 0.50, 0.75])
        F_D = np.array([213.01897444, 426.03794887, 639.05692331])
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.tile(E, (6, 1))
        F_D = np.tile(F_D, (6, 1))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)

        E = np.reshape(E, (2, 3, 3))
        F_D = np.reshape(F_D, (2, 3, 3))
        np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7)