Ejemplo n.º 1
0
    def test_nan_eotf_reverse_DCDM(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.dcdm.\
eotf_reverse_DCDM` definition nan support.
        """

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

        XYZ = 0.18
        XYZ_p = 0.11281861
        np.testing.assert_almost_equal(eotf_reverse_DCDM(XYZ),
                                       XYZ_p,
                                       decimal=7)

        XYZ = np.tile(XYZ, 6)
        XYZ_p = np.tile(XYZ_p, 6)
        np.testing.assert_almost_equal(eotf_reverse_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_reverse_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_reverse_DCDM(XYZ),
                                       XYZ_p,
                                       decimal=7)
Ejemplo n.º 3
0
    def test_eotf_reverse_DCDM(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.\
dcdm.eotf_reverse_DCDM` definition.
        """

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

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

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

        self.assertEqual(eotf_reverse_DCDM(0.18, out_int=True), 462)
Ejemplo n.º 4
0
    def test_domain_range_scale_eotf_reverse_DCDM(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.\
dcdm.eotf_reverse_DCDM` definition domain and range scale support.
        """

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