Example #1
0
    def test_read_LUT_SonySPI1D(self):
        """
        Tests :func:`colour.io.luts.sony_spi1d.read_LUT_SonySPI1D` definition.
        """

        LUT_1 = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_1D.spi1d'))

        np.testing.assert_almost_equal(
            LUT_1.table,
            np.array([
                -7.73990000e-03, 5.16000000e-04, 1.22181000e-02,
                3.96819000e-02, 8.71438000e-02, 1.57439400e-01, 2.52950100e-01,
                3.75757900e-01, 5.27729400e-01, 7.10566500e-01, 9.25840600e-01,
                1.17501630e+00, 1.45946870e+00, 1.78049680e+00, 2.13933380e+00,
                2.53715520e+00
            ]))
        self.assertEqual(LUT_1.name, 'oetf reverse sRGB 1D')
        self.assertEqual(LUT_1.dimensions, 1)
        np.testing.assert_array_equal(LUT_1.domain, np.array([-0.1, 1.5]))
        self.assertEqual(LUT_1.size, 16)
        self.assertListEqual(LUT_1.comments, [
            'Generated by "Colour 0.3.11".',
            '"colour.models.oetf_reverse_sRGB".'
        ])

        LUT_2 = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_2D.spi1d'))
        self.assertListEqual(LUT_2.comments, [
            'Generated by "Colour 0.3.11".',
            '"colour.models.oetf_reverse_sRGB".'
        ])
        np.testing.assert_array_equal(
            LUT_2.domain, np.array([[-0.1, -0.1, -0.1], [1.5, 1.5, 1.5]]))
Example #2
0
    def test_read_LUT_SonySPI1D(self):
        """
        Tests :func:`colour.io.luts.sony_spi1d.read_LUT_SonySPI1D` definition.
        """

        LUT_1 = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_1D.spi1d'))

        np.testing.assert_almost_equal(
            LUT_1.table,
            np.array([
                -7.73990000e-03, 5.16000000e-04, 1.22181000e-02,
                3.96819000e-02, 8.71438000e-02, 1.57439400e-01, 2.52950100e-01,
                3.75757900e-01, 5.27729400e-01, 7.10566500e-01, 9.25840600e-01,
                1.17501630e+00, 1.45946870e+00, 1.78049680e+00, 2.13933380e+00,
                2.53715520e+00
            ]))
        self.assertEqual(LUT_1.name, 'oetf reverse sRGB 1D')
        self.assertEqual(LUT_1.dimensions, 1)
        np.testing.assert_array_equal(LUT_1.domain, np.array([-0.1, 1.5]))
        self.assertEqual(LUT_1.size, 16)
        self.assertListEqual(LUT_1.comments, [
            'Generated by "Colour 0.3.11".',
            '"colour.models.oetf_reverse_sRGB".'
        ])

        LUT_2 = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_3x1D.spi1d'))
        self.assertListEqual(LUT_2.comments, [
            'Generated by "Colour 0.3.11".',
            '"colour.models.oetf_reverse_sRGB".'
        ])
        np.testing.assert_array_equal(
            LUT_2.domain, np.array([[-0.1, -0.1, -0.1], [1.5, 1.5, 1.5]]))
Example #3
0
    def test_write_LUT_SonySPI1D(self):
        """
        Tests :func:`colour.io.luts.sony_spi1d.write_LUT_SonySPI1D` definition.
        """

        LUT_1_r = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_1D.spi1d'))

        write_LUT_SonySPI1D(
            LUT_1_r,
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_1D.spi1d'))

        LUT_1_t = read_LUT_SonySPI1D(
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_1D.spi1d'))

        self.assertEqual(LUT_1_r, LUT_1_t)

        write_LUT_SonySPI1D(
            LUTSequence(LUT_1_r),
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_1D.spi1d'))

        self.assertEqual(LUT_1_r, LUT_1_t)

        LUT_2_r = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_2D.spi1d'))

        write_LUT_SonySPI1D(
            LUT_2_r,
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_2D.spi1d'))

        LUT_2_t = read_LUT_SonySPI1D(
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_2D.spi1d'))

        self.assertEqual(LUT_2_r, LUT_2_t)
        self.assertListEqual(LUT_2_r.comments, LUT_2_t.comments)
Example #4
0
    def test_write_LUT_SonySPI1D(self):
        """
        Tests :func:`colour.io.luts.sony_spi1d.write_LUT_SonySPI1D` definition.
        """

        LUT_1_r = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_1D.spi1d'))

        write_LUT_SonySPI1D(
            LUT_1_r,
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_1D.spi1d'))

        LUT_1_t = read_LUT_SonySPI1D(
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_1D.spi1d'))

        self.assertEqual(LUT_1_r, LUT_1_t)

        write_LUT_SonySPI1D(
            LUTSequence(LUT_1_r),
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_1D.spi1d'))

        self.assertEqual(LUT_1_r, LUT_1_t)

        LUT_2_r = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_3x1D.spi1d'))

        write_LUT_SonySPI1D(
            LUT_2_r,
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_3x1D.spi1d'))

        LUT_2_t = read_LUT_SonySPI1D(
            os.path.join(self._temporary_directory,
                         'oetf_reverse_sRGB_3x1D.spi1d'))

        self.assertEqual(LUT_2_r, LUT_2_t)
        self.assertListEqual(LUT_2_r.comments, LUT_2_t.comments)
Example #5
0
    def test_write_LUT_SonySPI1D(self):
        """Test :func:`colour.io.luts.sony_spi1d.write_LUT_SonySPI1D` definition."""

        LUT_1_r = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, "eotf_sRGB_1D.spi1d"))
        write_LUT_SonySPI1D(
            LUT_1_r,
            os.path.join(self._temporary_directory, "eotf_sRGB_1D.spi1d"),
        )
        LUT_1_t = read_LUT_SonySPI1D(
            os.path.join(self._temporary_directory, "eotf_sRGB_1D.spi1d"))
        self.assertEqual(LUT_1_r, LUT_1_t)

        LUT_2_r = read_LUT_SonySPI1D(
            os.path.join(LUTS_DIRECTORY, "eotf_sRGB_3x1D.spi1d"))
        write_LUT_SonySPI1D(
            LUT_2_r,
            os.path.join(self._temporary_directory, "eotf_sRGB_3x1D.spi1d"),
        )
        LUT_2_t = read_LUT_SonySPI1D(
            os.path.join(self._temporary_directory, "eotf_sRGB_3x1D.spi1d"))
        self.assertEqual(LUT_2_r, LUT_2_t)
        self.assertListEqual(LUT_2_r.comments, LUT_2_t.comments)