예제 #1
0
    def test_nan_oetf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
oetf_sRGB` definition nan support.
        """

        oetf_sRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
예제 #2
0
    def test_n_dimensional_oetf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
oetf_sRGB` definition n-dimensional arrays support.
        """

        L = 0.18
        V = 0.461356129500442
        np.testing.assert_almost_equal(
            oetf_sRGB(L),
            V,
            decimal=7)

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

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

        L = np.reshape(L, (2, 3, 1))
        V = np.reshape(V, (2, 3, 1))
        np.testing.assert_almost_equal(
            oetf_sRGB(L),
            V,
            decimal=7)
예제 #3
0
    def test_nan_oetf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
oetf_sRGB` definition nan support.
        """

        oetf_sRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
예제 #4
0
    def test_oetf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
oetf_sRGB` definition.
        """

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

        self.assertAlmostEqual(oetf_sRGB(0.18), 0.461356129500442, places=7)

        self.assertAlmostEqual(oetf_sRGB(1.0), 1.0, places=7)
예제 #5
0
    def test_oetf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
oetf_sRGB` definition.
        """

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

        self.assertAlmostEqual(oetf_sRGB(0.18), 0.461356129500442, places=7)

        self.assertAlmostEqual(oetf_sRGB(1.0), 1.0, places=7)
예제 #6
0
    def test_domain_range_scale_oetf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
oetf_sRGB` definition domain and range scale support.
        """

        L = 0.18
        V = oetf_sRGB(L)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    oetf_sRGB(L * factor), V * factor, decimal=7)
예제 #7
0
    def test_domain_range_scale_oetf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
oetf_sRGB` definition domain and range scale support.
        """

        L = 0.18
        V = oetf_sRGB(L)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(oetf_sRGB(L * factor),
                                               V * factor,
                                               decimal=7)
예제 #8
0
    def test_n_dimensional_oetf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
oetf_sRGB` definition n-dimensional arrays support.
        """

        L = 0.18
        V = oetf_sRGB(L)

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

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

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