コード例 #1
0
ファイル: test_tabular.py プロジェクト: ajun73/Work_Code
    def test_write_spds_to_csv_file(self):
        """
        Tests :func:`colour.io.tabular.write_spds_to_csv_file` definition.
        """

        colour_checker_n_ohta = os.path.join(RESOURCES_DIRECTORY,
                                             'colorchecker_n_ohta.csv')
        spds = read_spds_from_csv_file(colour_checker_n_ohta)
        colour_checker_n_ohta_test = os.path.join(self._temporary_directory,
                                                  'colorchecker_n_ohta.csv')
        write_spds_to_csv_file(spds, colour_checker_n_ohta_test)
        spds_test = read_spds_from_csv_file(colour_checker_n_ohta_test)
        for key, value in spds.items():
            if PY2:
                # Running into precision issues with Python 2.x, applying
                # conservative rounding.
                value.wavelengths = np.around(value.wavelengths, decimals=7)
                value.values = np.around(value.values, decimals=7)
                spds_test[key].wavelengths = np.around(
                    spds_test[key].wavelengths, decimals=7)
                spds_test[key].values = np.around(
                    spds_test[key].values, decimals=7)

            self.assertEqual(value, spds_test[key])

        write_spds_to_csv_file(spds, colour_checker_n_ohta_test, fields=['1'])
        spds_test = read_spds_from_csv_file(colour_checker_n_ohta_test)
        self.assertEqual(len(spds_test), 1)
コード例 #2
0
ファイル: tests_tabular.py プロジェクト: brehm/colour
    def test_write_spds_to_csv_file(self):
        """
        Tests :func:`colour.io.tabular.write_spds_to_csv_file` definition.
        """

        colour_checker_n_ohta = os.path.join(RESOURCES_DIRECTORY,
                                             'colorchecker_n_ohta.csv')
        spds = read_spds_from_csv_file(colour_checker_n_ohta)
        colour_checker_n_ohta_test = os.path.join(self.__temporary_directory,
                                                  'colorchecker_n_ohta.csv')
        write_spds_to_csv_file(spds, colour_checker_n_ohta_test)
        spds_test = read_spds_from_csv_file(colour_checker_n_ohta_test)
        for key, value in spds.items():
            self.assertEqual(value, spds_test[key])
        write_spds_to_csv_file(spds, colour_checker_n_ohta_test, fields=['1'])
        spds_test = read_spds_from_csv_file(colour_checker_n_ohta_test)
        self.assertEqual(len(spds_test), 1)
コード例 #3
0
ファイル: tests_tabular.py プロジェクト: scooperly/colour
    def test_write_spds_to_csv_file(self):
        """
        Tests :func:`colour.io.tabular.write_spds_to_csv_file` definition.
        """

        colour_checker_n_ohta = os.path.join(RESOURCES_DIRECTORY,
                                             'colorchecker_n_ohta.csv')
        spds = read_spds_from_csv_file(colour_checker_n_ohta)
        colour_checker_n_ohta_test = os.path.join(self.__temporary_directory,
                                                  'colorchecker_n_ohta.csv')
        write_spds_to_csv_file(spds, colour_checker_n_ohta_test)
        spds_test = read_spds_from_csv_file(colour_checker_n_ohta_test)
        for key, value in spds.items():
            self.assertEqual(value, spds_test[key])
        write_spds_to_csv_file(spds, colour_checker_n_ohta_test, fields=['1'])
        spds_test = read_spds_from_csv_file(colour_checker_n_ohta_test)
        self.assertEqual(len(spds_test), 1)
コード例 #4
0
ファイル: tests_tabular.py プロジェクト: scooperly/colour
    def test_read_spds_from_csv_file(self):
        """
        Tests :func:`colour.io.tabular.read_spds_from_csv_file` definition.
        """

        colour_checker_n_ohta = os.path.join(RESOURCES_DIRECTORY,
                                             'colorchecker_n_ohta.csv')
        spds = read_spds_from_csv_file(colour_checker_n_ohta)
        for spd in spds.values():
            self.assertIsInstance(spd, SpectralPowerDistribution)

        self.assertEqual(
            spds['1'], SpectralPowerDistribution('1', COLOURCHECKER_N_OHTA_1))
コード例 #5
0
ファイル: tests_tabular.py プロジェクト: brehm/colour
    def test_read_spds_from_csv_file(self):
        """
        Tests :func:`colour.io.tabular.read_spds_from_csv_file` definition.
        """

        colour_checker_n_ohta = os.path.join(RESOURCES_DIRECTORY,
                                             'colorchecker_n_ohta.csv')
        spds = read_spds_from_csv_file(colour_checker_n_ohta)
        for spd in spds.values():
            self.assertIsInstance(spd, SpectralPowerDistribution)

        self.assertEqual(spds['1'],
                         SpectralPowerDistribution('1',
                                                   COLOURCHECKER_N_OHTA_1))