def test_nan_eotf_DCDM(self): """ Test :func:`colour.models.rgb.transfer_functions.dcdm.eotf_DCDM` definition nan support. """ eotf_DCDM(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
def test_eotf_DCDM(self): """ Tests :func:`colour.models.rgb.transfer_functions.dcdm.eotf_DCDM` definition. """ self.assertAlmostEqual(eotf_DCDM(0.0), 0.0, places=7) self.assertAlmostEqual(eotf_DCDM(0.11281861), 0.18, places=7) self.assertAlmostEqual(eotf_DCDM(0.21817973), 1.0, places=7) np.testing.assert_allclose( eotf_DCDM(462, in_int=True), 0.18, atol=0.00001, rtol=0.00001)
def test_domain_range_scale_eotf_DCDM(self): """ Tests :func:`colour.models.rgb.transfer_functions.dcdm.eotf_DCDM` definition domain and range scale support. """ XYZ_p = 0.11281861 XYZ = eotf_DCDM(XYZ_p) 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_DCDM(XYZ_p * factor), XYZ * factor, decimal=7)
def test_n_dimensional_eotf_DCDM(self): """ Test :func:`colour.models.rgb.transfer_functions.dcdm.eotf_DCDM` definition n-dimensional arrays support. """ XYZ_p = 0.11281861 XYZ = eotf_DCDM(XYZ_p) XYZ_p = np.tile(XYZ_p, 6) XYZ = np.tile(XYZ, 6) np.testing.assert_almost_equal(eotf_DCDM(XYZ_p), XYZ, decimal=7) XYZ_p = np.reshape(XYZ_p, (2, 3)) XYZ = np.reshape(XYZ, (2, 3)) np.testing.assert_almost_equal(eotf_DCDM(XYZ_p), XYZ, decimal=7) XYZ_p = np.reshape(XYZ_p, (2, 3, 1)) XYZ = np.reshape(XYZ, (2, 3, 1)) np.testing.assert_almost_equal(eotf_DCDM(XYZ_p), XYZ, decimal=7)