Ejemplo n.º 1
0
    def test_nan_linear_function(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.linear.\
linear_function` definition nan support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]

        for case in cases:
            linear_function(case)
Ejemplo n.º 2
0
    def test_linear_function(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.linear.\
linear_function` definition.
        """

        self.assertEqual(linear_function(0.0), 0.0)

        self.assertEqual(linear_function(0.18), 0.18)

        self.assertEqual(linear_function(1.0), 1.0)
Ejemplo n.º 3
0
    def test_linear_function(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.linear.\
linear_function` definition.
        """

        self.assertEqual(linear_function(0.0), 0.0)

        self.assertEqual(linear_function(0.18), 0.18)

        self.assertEqual(linear_function(1.0), 1.0)
Ejemplo n.º 4
0
    def test_n_dimensional_linear_function(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.linear.\
linear_function` definition n-dimensional arrays support.
        """

        a = 0.18
        a_p = linear_function(a)

        a = np.tile(a, 6)
        a_p = np.tile(a_p, 6)
        np.testing.assert_almost_equal(linear_function(a), a_p, decimal=7)

        a = np.reshape(a, (2, 3))
        a_p = np.reshape(a_p, (2, 3))
        np.testing.assert_almost_equal(linear_function(a), a_p, decimal=7)

        a = np.reshape(a, (2, 3, 1))
        a_p = np.reshape(a_p, (2, 3, 1))
        np.testing.assert_almost_equal(linear_function(a), a_p, decimal=7)
Ejemplo n.º 5
0
    def test_n_dimensional_linear_function(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.linear.\
linear_function` definition n-dimensional arrays support.
        """

        a = 0.18
        a_p = linear_function(a)

        a = np.tile(a, 6)
        a_p = np.tile(a_p, 6)
        np.testing.assert_almost_equal(linear_function(a), a_p, decimal=7)

        a = np.reshape(a, (2, 3))
        a_p = np.reshape(a_p, (2, 3))
        np.testing.assert_almost_equal(linear_function(a), a_p, decimal=7)

        a = np.reshape(a, (2, 3, 1))
        a_p = np.reshape(a_p, (2, 3, 1))
        np.testing.assert_almost_equal(linear_function(a), a_p, decimal=7)