def test_n_dimensional_log_encoding_PivotedLog(self): """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition n-dimensional arrays support. """ x = 0.18 y = log_encoding_PivotedLog(x) x = np.tile(x, 6) y = np.tile(y, 6) np.testing.assert_almost_equal( log_encoding_PivotedLog(x), y, decimal=7 ) x = np.reshape(x, (2, 3)) y = np.reshape(y, (2, 3)) np.testing.assert_almost_equal( log_encoding_PivotedLog(x), y, decimal=7 ) x = np.reshape(x, (2, 3, 1)) y = np.reshape(y, (2, 3, 1)) np.testing.assert_almost_equal( log_encoding_PivotedLog(x), y, decimal=7 )
def test_n_dimensional_log_encoding_PivotedLog(self): """ Tests :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition n-dimensional arrays support. """ L = 0.18 V = 0.434995112414467 np.testing.assert_almost_equal(log_encoding_PivotedLog(L), V, decimal=7) L = np.tile(L, 6) V = np.tile(V, 6) np.testing.assert_almost_equal(log_encoding_PivotedLog(L), V, decimal=7) L = np.reshape(L, (2, 3)) V = np.reshape(V, (2, 3)) np.testing.assert_almost_equal(log_encoding_PivotedLog(L), V, decimal=7) L = np.reshape(L, (2, 3, 1)) V = np.reshape(V, (2, 3, 1)) np.testing.assert_almost_equal(log_encoding_PivotedLog(L), V, decimal=7)
def test_n_dimensional_log_encoding_PivotedLog(self): """ Tests :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition n-dimensional arrays support. """ L = 0.18 V = 0.434995112414467 np.testing.assert_almost_equal( log_encoding_PivotedLog(L), V, decimal=7) L = np.tile(L, 6) V = np.tile(V, 6) np.testing.assert_almost_equal( log_encoding_PivotedLog(L), V, decimal=7) L = np.reshape(L, (2, 3)) V = np.reshape(V, (2, 3)) np.testing.assert_almost_equal( log_encoding_PivotedLog(L), V, decimal=7) L = np.reshape(L, (2, 3, 1)) V = np.reshape(V, (2, 3, 1)) np.testing.assert_almost_equal( log_encoding_PivotedLog(L), V, decimal=7)
def test_nan_log_encoding_PivotedLog(self): """ Tests :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition nan support. """ log_encoding_PivotedLog( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
def test_log_encoding_PivotedLog(self): """ Tests :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition. """ self.assertAlmostEqual(log_encoding_PivotedLog(0.0), -np.inf, places=7) self.assertAlmostEqual( log_encoding_PivotedLog(0.18), 0.434995112414467, places=7) self.assertAlmostEqual( log_encoding_PivotedLog(1.0), 0.653390272208219, places=7)
def test_domain_range_scale_log_encoding_PivotedLog(self): """ Tests :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition domain and range scale support. """ x = 0.18 y = log_encoding_PivotedLog(x) 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_encoding_PivotedLog(x * factor), y * factor, decimal=7)
def test_n_dimensional_log_encoding_PivotedLog(self): """ Tests :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition n-dimensional arrays support. """ x = 0.18 y = log_encoding_PivotedLog(x) x = np.tile(x, 6) y = np.tile(y, 6) np.testing.assert_almost_equal( log_encoding_PivotedLog(x), y, decimal=7) x = np.reshape(x, (2, 3)) y = np.reshape(y, (2, 3)) np.testing.assert_almost_equal( log_encoding_PivotedLog(x), y, decimal=7) x = np.reshape(x, (2, 3, 1)) y = np.reshape(y, (2, 3, 1)) np.testing.assert_almost_equal( log_encoding_PivotedLog(x), y, decimal=7)