Ejemplo n.º 1
0
    def test_nan_eotf_sRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.sRGB.\
eotf_sRGB` definition nan support.
        """

        eotf_sRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Ejemplo n.º 2
0
    def test_n_dimensional_eotf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
eotf_sRGB` definition n-dimensional arrays support.
        """

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

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

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

        V = np.reshape(V, (2, 3, 1))
        L = np.reshape(L, (2, 3, 1))
        np.testing.assert_almost_equal(
            eotf_sRGB(V),
            L,
            decimal=7)
Ejemplo n.º 3
0
    def test_nan_eotf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
eotf_sRGB` definition nan support.
        """

        eotf_sRGB(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Ejemplo n.º 4
0
    def test_eotf_sRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.sRGB.\
eotf_sRGB` definition.
        """

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

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

        self.assertAlmostEqual(eotf_sRGB(1.0), 1.0, places=7)
Ejemplo n.º 5
0
    def test_domain_range_scale_eotf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
eotf_sRGB` definition domain and range scale support.
        """

        V = 0.461356129500442
        L = eotf_sRGB(V)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    eotf_sRGB(V * factor), L * factor, decimal=7)
Ejemplo n.º 6
0
    def test_n_dimensional_eotf_sRGB(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.sRGB.\
eotf_sRGB` definition n-dimensional arrays support.
        """

        V = 0.461356129500442
        L = eotf_sRGB(V)

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

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

        V = np.reshape(V, (2, 3, 1))
        L = np.reshape(L, (2, 3, 1))
        np.testing.assert_almost_equal(eotf_sRGB(V), L, decimal=7)
Ejemplo n.º 7
0
    def test_eotf_sRGB(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.sRGB.\
eotf_sRGB` definition.
        """

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

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

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