Example #1
0
    def test_nan_eotf_inverse_DCDM(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.dcdm.\
eotf_inverse_DCDM` definition nan support.
        """

        eotf_inverse_DCDM(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Example #2
0
    def test_n_dimensional_eotf_inverse_DCDM(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.dcdm.\
eotf_inverse_DCDM` definition n-dimensional arrays support.
        """

        XYZ = 0.18
        XYZ_p = eotf_inverse_DCDM(XYZ)

        XYZ = np.tile(XYZ, 6)
        XYZ_p = np.tile(XYZ_p, 6)
        np.testing.assert_almost_equal(eotf_inverse_DCDM(XYZ),
                                       XYZ_p,
                                       decimal=7)

        XYZ = np.reshape(XYZ, (2, 3))
        XYZ_p = np.reshape(XYZ_p, (2, 3))
        np.testing.assert_almost_equal(eotf_inverse_DCDM(XYZ),
                                       XYZ_p,
                                       decimal=7)

        XYZ = np.reshape(XYZ, (2, 3, 1))
        XYZ_p = np.reshape(XYZ_p, (2, 3, 1))
        np.testing.assert_almost_equal(eotf_inverse_DCDM(XYZ),
                                       XYZ_p,
                                       decimal=7)
Example #3
0
    def test_eotf_inverse_DCDM(self):
        """
        Test :func:`colour.models.rgb.transfer_functions.\
dcdm.eotf_inverse_DCDM` definition.
        """

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

        self.assertAlmostEqual(eotf_inverse_DCDM(0.18), 0.11281861, places=7)

        self.assertAlmostEqual(eotf_inverse_DCDM(1.0), 0.21817973, places=7)

        self.assertEqual(eotf_inverse_DCDM(0.18, out_int=True), 462)
Example #4
0
    def test_domain_range_scale_eotf_inverse_DCDM(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.\
dcdm.eotf_inverse_DCDM` definition domain and range scale support.
        """

        XYZ = 0.18
        XYZ_p = eotf_inverse_DCDM(XYZ)

        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_inverse_DCDM(XYZ * factor), XYZ_p * factor, decimal=7)