def test_CIE_standard_illuminant_A_function(self): """ Tests :func:`colour.colorimetry.illuminants.\ CIE_standard_illuminant_A_function` definition. """ np.testing.assert_almost_equal(CIE_standard_illuminant_A_function( np.arange(360, 830, 5)), A_DATA, decimal=7)
def setUp(self): """ Initialises common tests attributes. """ self._spd = SAMPLE_SPD.copy() self._cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] wl = self._cmfs.shape.range() self._A = SpectralPowerDistribution(dict( zip(wl, CIE_standard_illuminant_A_function(wl))), name='A (360, 830, 1)')
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 [1]_. References ---------- .. [1] ASTM International. (2015). ASTM E308–15 - Standard Practice for Computing the Colors of Objects by Using the CIE System, 1–47. doi:10.1520/E0308-15 """ cmfs = CMFS.get('CIE 1964 10 Degree Standard Observer') wl = cmfs.shape.range() A = SpectralPowerDistribution( 'A (360, 830, 1)', dict(zip(wl, CIE_standard_illuminant_A_function(wl)))) 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.get('CIE 1931 2 Degree Standard Observer') D65 = ILLUMINANTS_RELATIVE_SPDS['D65'].clone().align( cmfs.shape, interpolation_method='Linear') 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)
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'] wl = cmfs.shape.range() A = SpectralPowerDistribution(dict( zip(wl, CIE_standard_illuminant_A_function(wl))), name='A (360, 830, 1)') 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_RELATIVE_SPDS['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)