Example #1
0
    def test_nan_eotf_inverse_DICOMGSDF(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\
eotf_inverse_DICOMGSDF` definition nan support.
        """

        eotf_inverse_DICOMGSDF(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Example #2
0
    def test_domain_range_scale_eotf_inverse_DICOMGSDF(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\
eotf_inverse_DICOMGSDF` definition domain and range scale support.
        """

        L = 130.0662
        J = eotf_inverse_DICOMGSDF(L)

        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_DICOMGSDF(L * factor), J * factor, decimal=7)
Example #3
0
    def test_eotf_inverse_DICOMGSDF(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\
eotf_inverse_DICOMGSDF` definition.
        """

        self.assertAlmostEqual(
            eotf_inverse_DICOMGSDF(0.05), 0.001007281350787, places=7)

        self.assertAlmostEqual(
            eotf_inverse_DICOMGSDF(130.0662), 0.500486263438448, places=7)

        self.assertAlmostEqual(
            eotf_inverse_DICOMGSDF(4000), 1.000160314715578, places=7)

        self.assertAlmostEqual(
            eotf_inverse_DICOMGSDF(130.0662, out_int=True), 512, places=7)
Example #4
0
    def test_n_dimensional_eotf_inverse_DICOMGSDF(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\
eotf_inverse_DICOMGSDF` definition n-dimensional arrays support.
        """

        L = 130.0662
        J = eotf_inverse_DICOMGSDF(L)

        L = np.tile(L, 6)
        J = np.tile(J, 6)
        np.testing.assert_almost_equal(eotf_inverse_DICOMGSDF(L), J, decimal=7)

        L = np.reshape(L, (2, 3))
        J = np.reshape(J, (2, 3))
        np.testing.assert_almost_equal(eotf_inverse_DICOMGSDF(L), J, decimal=7)

        L = np.reshape(L, (2, 3, 1))
        J = np.reshape(J, (2, 3, 1))
        np.testing.assert_almost_equal(eotf_inverse_DICOMGSDF(L), J, decimal=7)