def test_raise_exception_tristimulus_weighting_factors_ASTME2022(self): """ Test :func:`colour.colorimetry.tristimulus_values.\ tristimulus_weighting_factors_ASTME2022` definition raised exception. """ shape = SpectralShape(360, 830, 10) cmfs_1 = MSDS_CMFS["CIE 1964 10 Degree Standard Observer"] # pylint: disable=E1102 cmfs_2 = reshape_msds(cmfs_1, shape) A_1 = sd_CIE_standard_illuminant_A(cmfs_1.shape) A_2 = sd_CIE_standard_illuminant_A(cmfs_2.shape) self.assertRaises( ValueError, tristimulus_weighting_factors_ASTME2022, cmfs_1, A_2, shape, ) self.assertRaises( ValueError, tristimulus_weighting_factors_ASTME2022, cmfs_2, A_1, shape, )
def test_raise_exception_tristimulus_weighting_factors_ASTME2022(self): """ Tests :func:`colour.colorimetry.tristimulus.\ tristimulus_weighting_factors_ASTME2022` definition raised exception. """ shape = SpectralShape(360, 830, 10) cmfs_1 = CMFS['CIE 1964 10 Degree Standard Observer'] cmfs_2 = cmfs_1.copy().align(shape) A_1 = sd_CIE_standard_illuminant_A(cmfs_1.shape) A_2 = sd_CIE_standard_illuminant_A(cmfs_2.shape) self.assertRaises(ValueError, tristimulus_weighting_factors_ASTME2022, cmfs_1, A_2, shape) self.assertRaises(ValueError, tristimulus_weighting_factors_ASTME2022, cmfs_2, A_1, shape)
def setUp(self): """ Initialises common tests attributes. """ self._sd = SAMPLE_SD.copy() self._cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] self._A = sd_CIE_standard_illuminant_A(self._cmfs.shape)
def test_sd_CIE_standard_illuminant_A(self): """ Tests :func:`colour.colorimetry.illuminants.\ sd_CIE_standard_illuminant_A` definition. """ np.testing.assert_almost_equal(sd_CIE_standard_illuminant_A( SpectralShape(360, 830, 5)).values, A_DATA, decimal=7)
def test_sd_CIE_standard_illuminant_A(self): """ Tests :func:`colour.colorimetry.illuminants.\ sd_CIE_standard_illuminant_A` definition. """ np.testing.assert_almost_equal( sd_CIE_standard_illuminant_A(SpectralShape(360, 830, 5)).values, A_DATA, decimal=7)
def test_tristimulus_weighting_factors_ASTME2022(self): """ Tests :func:`colour.colorimetry.tristimulus.\ tristimulus_weighting_factors_ASTME2022` definition. Notes ----- - :attr:`TWF_A_CIE_1964_10_10`, :attr:`TWF_A_CIE_1964_10_20` and :attr:`TWF_D65_CIE_1931_2_20` attributes data is matching :cite:`ASTMInternational2015b`. References ---------- :cite:`ASTMInternational2015b` """ cmfs = MSDS_CMFS['CIE 1964 10 Degree Standard Observer'] A = sd_CIE_standard_illuminant_A(cmfs.shape) twf = tristimulus_weighting_factors_ASTME2022( cmfs, A, SpectralShape(360, 830, 10)) np.testing.assert_almost_equal(np.round(twf, 3), TWF_A_CIE_1964_10_10, decimal=3) twf = tristimulus_weighting_factors_ASTME2022( cmfs, A, SpectralShape(360, 830, 20)) np.testing.assert_almost_equal(np.round(twf, 3), TWF_A_CIE_1964_10_20, decimal=3) cmfs = MSDS_CMFS['CIE 1931 2 Degree Standard Observer'] D65 = SDS_ILLUMINANTS['D65'].copy().align( cmfs.shape, interpolator=LinearInterpolator) twf = tristimulus_weighting_factors_ASTME2022( cmfs, D65, SpectralShape(360, 830, 20)) np.testing.assert_almost_equal(np.round(twf, 3), TWF_D65_CIE_1931_2_20, decimal=3) twf = tristimulus_weighting_factors_ASTME2022(cmfs, D65, SpectralShape( 360, 830, 20), k=1) np.testing.assert_almost_equal(twf, TWF_D65_CIE_1931_2_20_K1, decimal=7)
def test_tristimulus_weighting_factors_ASTME202211(self): """ Tests :func:`colour.colorimetry.tristimulus.\ tristimulus_weighting_factors_ASTME202211` definition. Notes ----- - :attr:`A_CIE_1964_10_10_TWF`, :attr:`A_CIE_1964_10_20_TWF` and :attr:`D65_CIE_1931_2_20_TWF` attributes data is matching :cite:`ASTMInternational2015b`. References ---------- :cite:`ASTMInternational2015b` """ cmfs = CMFS['CIE 1964 10 Degree Standard Observer'] A = sd_CIE_standard_illuminant_A(cmfs.shape) twf = tristimulus_weighting_factors_ASTME202211( cmfs, A, SpectralShape(360, 830, 10)) np.testing.assert_almost_equal( np.round(twf, 3), A_CIE_1964_10_10_TWF, decimal=3) twf = tristimulus_weighting_factors_ASTME202211( cmfs, A, SpectralShape(360, 830, 20)) np.testing.assert_almost_equal( np.round(twf, 3), A_CIE_1964_10_20_TWF, decimal=3) cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] D65 = ILLUMINANTS_SDS['D65'].copy().align( cmfs.shape, interpolator=LinearInterpolator) twf = tristimulus_weighting_factors_ASTME202211( cmfs, D65, SpectralShape(360, 830, 20)) np.testing.assert_almost_equal( np.round(twf, 3), D65_CIE_1931_2_20_TWF, decimal=3) twf = tristimulus_weighting_factors_ASTME202211( cmfs, D65, SpectralShape(360, 830, 20), k=1) np.testing.assert_almost_equal( twf, D65_CIE_1931_2_20_TWF_K1, decimal=7)
def setUp(self): """Initialise the common tests attributes.""" self._sd = SD_SAMPLE.copy() self._cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"] self._A = sd_CIE_standard_illuminant_A(self._cmfs.shape)