def test__ne__(self): """ Tests :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__ne__` method. """ mapping1 = CaseInsensitiveMapping(John='Doe', Jane='Doe') mapping2 = CaseInsensitiveMapping(Gi='Doe', Jane='Doe') self.assertNotEqual(mapping1, mapping2)
def test__len__(self): """ Tests :meth:`colour.utilities.data_structures.CaseInsensitiveMapping.__len__` method. """ self.assertEqual(len(CaseInsensitiveMapping()), 0) self.assertEqual(len(CaseInsensitiveMapping(John='Doe', Jane='Doe')), 2)
def test__eq__(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__eq__` method. """ mapping1 = CaseInsensitiveMapping(John="Doe", Jane="Doe") mapping2 = CaseInsensitiveMapping(John="Doe", Jane="Doe") mapping3 = CaseInsensitiveMapping(john="Doe", jane="Doe") self.assertEqual(mapping1, mapping2) self.assertEqual(mapping2, mapping3)
def test__iter__(self): """ Tests :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__iter__` method. """ mapping = CaseInsensitiveMapping(John='Doe', Jane='Doe') self.assertListEqual(sorted([item for item in mapping]), ['Jane', 'John'])
def test__iter__(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__iter__` method. """ mapping = CaseInsensitiveMapping(John="Doe", Jane="Doe") self.assertListEqual(sorted(item for item in mapping), ["Jane", "John"])
def test_raise_exception__ne__(self): """ Tests :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__ne__` method raised exception. """ self.assertRaises(ValueError, operator.ne, CaseInsensitiveMapping(John='Doe', Jane='Doe'), ['John', 'Doe', 'Jane', 'Doe'])
def test_lower_items(self): """ Tests :meth:`colour.utilities.data_structures.CaseInsensitiveMapping.lower_items` # noqa method. """ mapping = CaseInsensitiveMapping(John='Doe', Jane='Doe') self.assertListEqual(sorted([item for item in mapping.lower_items()]), [('jane', 'Doe'), ('john', 'Doe')])
def test__getitem__(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__getitem__` method. """ mapping = CaseInsensitiveMapping(John="Doe", Jane="Doe") self.assertEqual(mapping["John"], "Doe") self.assertEqual(mapping["john"], "Doe") self.assertEqual(mapping["Jane"], "Doe") self.assertEqual(mapping["jane"], "Doe") mapping = CaseInsensitiveMapping({1: "Foo", 2: "Bar"}) self.assertEqual(mapping[1], "Foo")
def test__setitem__(self): """ Tests :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__setitem__` method. """ mapping = CaseInsensitiveMapping() mapping['John'] = 'Doe' self.assertEqual(mapping['John'], 'Doe') self.assertEqual(mapping['john'], 'Doe')
def test__repr__(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__repr__` method. """ mapping = CaseInsensitiveMapping() mapping["John"] = "Doe" self.assertEqual(repr(mapping), "CaseInsensitiveMapping({'John': 'Doe'})")
def test__setitem__(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__setitem__` method. """ mapping = CaseInsensitiveMapping() mapping["John"] = "Doe" self.assertEqual(mapping["John"], "Doe") self.assertEqual(mapping["john"], "Doe")
def test_copy(self): """ Tests :meth:`colour.utilities.data_structures.CaseInsensitiveMapping.copy` method. """ mapping1 = CaseInsensitiveMapping(John='Doe', Jane='Doe') mapping2 = mapping1.copy() self.assertEqual(mapping1, mapping2) self.assertNotEqual(id(mapping1), id(mapping2))
def test_lower_items(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.lower_items` method. """ mapping = CaseInsensitiveMapping(John="Doe", Jane="Doe") self.assertListEqual( sorted(item for item in mapping.lower_items()), [("jane", "Doe"), ("john", "Doe")], )
def test_raise_exception__ne__(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__ne__` method raised exception. """ self.assertRaises( ValueError, operator.ne, CaseInsensitiveMapping(John="Doe", Jane="Doe"), ["John", "Doe", "Jane", "Doe"], )
def test__getitem__(self): """ Tests :meth:`colour.utilities.data_structures.CaseInsensitiveMapping.__getitem__` # noqa method. """ mapping = CaseInsensitiveMapping(John='Doe', Jane='Doe') self.assertEqual(mapping['John'], 'Doe') self.assertEqual(mapping['john'], 'Doe') self.assertEqual(mapping['Jane'], 'Doe') self.assertEqual(mapping['jane'], 'Doe')
def test__contains__(self): """ Tests :meth:`colour.utilities.data_structures.CaseInsensitiveMapping.__contains__` # noqa method. """ mapping = CaseInsensitiveMapping(John='Doe', Jane='Doe') self.assertIn('John', mapping) self.assertIn('john', mapping) self.assertIn('Jane', mapping) self.assertIn('jane', mapping)
def test_data(self): """ Tests :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.data` property. """ self.assertDictEqual( CaseInsensitiveMapping({ 'John': 'Doe', 'Jane': 'Doe' }).data, { 'jane': ('Jane', 'Doe'), 'john': ('John', 'Doe') })
def test__delitem__(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__delitem__` method. """ mapping = CaseInsensitiveMapping(John="Doe", Jane="Doe") del mapping["john"] self.assertNotIn("John", mapping) del mapping["Jane"] self.assertNotIn("jane", mapping) self.assertEqual(len(mapping), 0)
def test__delitem__(self): """ Tests :meth:`colour.utilities.data_structures.CaseInsensitiveMapping.__delitem__` # noqa method. """ mapping = CaseInsensitiveMapping(John='Doe', Jane='Doe') del (mapping['john']) self.assertNotIn('John', mapping) del (mapping['Jane']) self.assertNotIn('jane', mapping) self.assertEqual(len(mapping), 0)
def test__contains__(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.__contains__` method. """ mapping = CaseInsensitiveMapping(John="Doe", Jane="Doe") self.assertIn("John", mapping) self.assertIn("john", mapping) self.assertIn("Jane", mapping) self.assertIn("jane", mapping)
def test_data(self): """ Test :meth:`colour.utilities.data_structures.\ CaseInsensitiveMapping.data` property. """ self.assertDictEqual( CaseInsensitiveMapping({ "John": "Doe", "Jane": "Doe" }).data, { "jane": ("Jane", "Doe"), "john": ("John", "Doe") }, )
__all__ += ['DatasetLoader_Brendel2020', 'build_Brendel2020'] __all__ += ['DatasetLoader_Dyer2017', 'build_Dyer2017'] __all__ += ['DatasetLoader_Ebner1998', 'build_Ebner1998'] __all__ += ['DatasetLoader_Hung1995', 'build_Hung1995'] __all__ += ['DatasetLoader_Jakob2019', 'build_Jakob2019'] __all__ += ['DatasetLoader_Jiang2013', 'build_Jiang2013'] __all__ += ['DatasetLoader_Labsphere2019', 'build_Labsphere2019'] __all__ += ['DatasetLoader_Luo1999', 'build_Luo1999'] __all__ += ['DatasetLoader_XRite2016', 'build_XRite2016'] DATASET_LOADERS = CaseInsensitiveMapping({ DatasetLoader_Asano2015.ID: build_Asano2015, DatasetLoader_Brendel2020.ID: build_Brendel2020, DatasetLoader_Dyer2017.ID: build_Dyer2017, DatasetLoader_Ebner1998.ID: build_Ebner1998, DatasetLoader_Hung1995.ID: build_Hung1995, DatasetLoader_Jakob2019.ID: build_Jakob2019, DatasetLoader_Jiang2013.ID: build_Jiang2013, DatasetLoader_Labsphere2019.ID: build_Labsphere2019, DatasetLoader_Luo1999.ID: build_Luo1999, DatasetLoader_XRite2016.ID: build_XRite2016, }) DATASET_LOADERS.__doc__ = """ Dataset loaders ids and callables. DATASET_LOADERS : CaseInsensitiveMapping """ from .kuopio import DATASET_LOADERS_KUOPIO_UNIVERSITY # noqa DATASET_LOADERS.update(DATASET_LOADERS_KUOPIO_UNIVERSITY)
SMITS_1999_SDS = CaseInsensitiveMapping({ 'white': SpectralDistribution( SMITS_1999_SDS_DATA['white'], name='white'), 'cyan': SpectralDistribution( SMITS_1999_SDS_DATA['cyan'], name='cyan'), 'magenta': SpectralDistribution( SMITS_1999_SDS_DATA['magenta'], name='magenta'), 'yellow': SpectralDistribution( SMITS_1999_SDS_DATA['yellow'], name='yellow'), 'red': SpectralDistribution( SMITS_1999_SDS_DATA['red'], name='red'), 'green': SpectralDistribution( SMITS_1999_SDS_DATA['green'], name='green'), 'blue': SpectralDistribution( SMITS_1999_SDS_DATA['blue'], name='blue') }) # yapf: disable SMITS_1999_SDS.__doc__ = """
__all__ += [ "ColourRendering_Specification_CRI", "colour_rendering_index", ] __all__ += [ "ColourRendering_Specification_CQS", "COLOUR_QUALITY_SCALE_METHODS", "colour_quality_scale", ] __all__ += [ "spectral_similarity_index", ] COLOUR_FIDELITY_INDEX_METHODS = CaseInsensitiveMapping({ "CIE 2017": colour_fidelity_index_CIE2017, "ANSI/IES TM-30-18": colour_fidelity_index_ANSIIESTM3018, }) COLOUR_FIDELITY_INDEX_METHODS.__doc__ = """ Supported *Colour Fidelity Index* (CFI) computation methods. References ---------- :cite:`CIETC1-902017`, :cite:`ANSI2018` """ def colour_fidelity_index( sd_test: SpectralDistribution, additional_data=False, method: Union[Literal["CIE 2017", "ANSI/IES TM-30-18"], str] = "CIE 2017",
COLORCHECKER_1976 = [ ColourChecker_Specification(*x) for x in COLORCHECKER_1976_DATA ] """ *ColourChecker* developed by McCamy et al. at Macbeth, a Division of Kollmorgen. COLORCHECKER_1976 : list """ COLOURCHECKERS = CaseInsensitiveMapping({ 'BabelColor Average': ColourChecker('BabelColor Average', BABELCOLOR_AVERAGE, BABELCOLOR_AVERAGE_ILLUMINANT), 'ColorChecker 2005': ColourChecker('ColorChecker 2005', COLORCHECKER_2005, COLORCHECKER_2005_ILLUMINANT), 'ColorChecker 1976': ColourChecker('ColorChecker 1976', COLORCHECKER_1976, COLORCHECKER_1976_ILLUMINANT) }) """ Aggregated *ColourCheckers* chromaticity coordinates. COLOURCHECKERS : CaseInsensitiveMapping **{'BabelColor Average', 'ColorChecker 2005', 'ColorChecker 1976'}** Aliases: - 'babel_average': 'BabelColor Average' - 'cc2005': 'ColorChecker 2005'
'chromatic_adaptation_matrix_VonKries', 'chromatic_adaptation_VonKries' ] __all__ += ['chromatic_adaptation_Fairchild1990'] __all__ += [ 'CMCCAT2000_InductionFactors', 'CMCCAT2000_VIEWING_CONDITIONS', 'chromatic_adaptation_forward_CMCCAT2000', 'chromatic_adaptation_reverse_CMCCAT2000', 'chromatic_adaptation_CMCCAT2000' ] __all__ += ['chromatic_adaptation_CIE1994'] CHROMATIC_ADAPTATION_METHODS = CaseInsensitiveMapping({ 'CIE 1994': chromatic_adaptation_CIE1994, 'CMCCAT2000': chromatic_adaptation_CMCCAT2000, 'Fairchild 1990': chromatic_adaptation_Fairchild1990, 'Von Kries': chromatic_adaptation_VonKries, }) CHROMATIC_ADAPTATION_METHODS.__doc__ = """ Supported chromatic adaptation methods. References ---------- - :cite:`CIETC1-321994b` - :cite:`Fairchild1991a` - :cite:`Fairchild2013s` - :cite:`Fairchild2013t` - :cite:`Li2002a` - :cite:`Westland2012k`
# yapf: disable HUNTERLAB_ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER_DATA = ( ('A', np.array([109.83, 100.00, 35.55]), np.array([185.20, 38.40])), ('C', np.array([98.04, 100.00, 118.11]), np.array([175.00, 70.00])), ('D65', np.array([95.02, 100.00, 108.82]), np.array([172.30, 67.20])), ('D50', np.array([96.38, 100.00, 82.45]), np.array([173.51, 58.48])), ('D60', np.array([95.23, 100.00, 100.86]), np.array([172.47, 64.72])), ('D75', np.array([94.96, 100.00, 122.53]), np.array([172.22, 71.30])), ('F2', np.array([98.09, 100.00, 67.53]), np.array([175.00, 52.90])), ('TL 4', np.array([101.40, 100.00, 65.90]), np.array([178.00, 52.30])), ('UL 3000', np.array([107.99, 100.00, 33.91]), np.array([183.70, 37.50]))) # yapf: enable HUNTERLAB_ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER = ( CaseInsensitiveMapping({ x[0]: HunterLab_Illuminant_Specification(*x) for x in HUNTERLAB_ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER_DATA })) """ *Hunter L,a,b* illuminant dataset for *CIE 1931 2 Degree Standard Observer*. HUNTERLAB_ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER : CaseInsensitiveMapping """ # yapf: disable HUNTERLAB_ILLUMINANTS_CIE_1964_10_DEGREE_STANDARD_OBSERVER_DATA = ( ('A', np.array([111.16, 100.00, 35.19]), np.array([186.30, 38.20])), ('C', np.array([97.30, 100.00, 116.14]), np.array([174.30, 69.40])), ('D50', np.array([96.72, 100.00, 81.45]), np.array([173.82, 58.13])), ('D60', np.array([95.21, 100.00, 99.60]), np.array([172.45, 64.28])), ('D65', np.array([94.83, 100.00, 107.38]), np.array([172.10, 66.70])),
""" COLOURSPACE_MODELS_AXIS_LABELS: CaseInsensitiveMapping = ( CaseInsensitiveMapping({ "CAM02LCD": ("$J^\\prime$", "$a^\\prime$", "$b^\\prime$"), "CAM02SCD": ("$J^\\prime$", "$a^\\prime$", "$b^\\prime$"), "CAM02UCS": ("$J^\\prime$", "$a^\\prime$", "$b^\\prime$"), "CAM16LCD": ("$J^\\prime$", "$a^\\prime$", "$b^\\prime$"), "CAM16SCD": ("$J^\\prime$", "$a^\\prime$", "$b^\\prime$"), "CAM16UCS": ("$J^\\prime$", "$a^\\prime$", "$b^\\prime$"), "CIE XYZ": ("X", "Y", "Z"), "CIE xyY": ("x", "y", "Y"), "CIE Lab": ("$L^*$", "$a^*$", "$b^*$"), "CIE Luv": ("$L^*$", "$u^\\prime$", "$v^\\prime$"), "CIE UCS": ("U", "V", "W"), "CIE UVW": ("U", "V", "W"), "DIN99": ("$L_{99}$", "$a_{99}$", "$b_{99}$"), "Hunter Lab": ("$L^*$", "$a^*$", "$b^*$"), "Hunter Rdab": ("Rd", "a", "b"), "ICaCb": ("$I$", "$C_a$", "$C_b$"), "ICtCp": ("$I$", "$C_T$", "$C_P$"), "IPT": ("I", "P", "T"), "IgPgTg": ("$I_G$", "$P_G$", "$T_G$"), "Jzazbz": ("$J_z$", "$a_z$", "$b_z$"), "OSA UCS": ("L", "j", "g"), "Oklab": ("$L$", "$a$", "$b$"), "hdr-CIELAB": ("L hdr", "a hdr", "b hdr"), "hdr-IPT": ("I hdr", "P hdr", "T hdr"), })) """Colourspace models labels mapping.""" attest(COLOURSPACE_MODELS == tuple(COLOURSPACE_MODELS_AXIS_LABELS.keys()))
Parameters ---------- F : numeric or array_like Maximum degree of adaptation :math:`F`. c : numeric or array_like Exponential non linearity :math:`c`. N_c : numeric or array_like Chromatic induction factor :math:`N_c`. """ CIECAM02_VIEWING_CONDITIONS = CaseInsensitiveMapping({ 'Average': CIECAM02_InductionFactors(1, 0.69, 1), 'Dim': CIECAM02_InductionFactors(0.9, 0.59, 0.95), 'Dark': CIECAM02_InductionFactors(0.8, 0.525, 0.8) }) """ Reference *CIECAM02* colour appearance model viewing conditions. CIECAM02_VIEWING_CONDITIONS : CaseInsensitiveMapping **{'Average', 'Dim', 'Dark'}** """ HUE_DATA_FOR_HUE_QUADRATURE = { 'h_i': np.array([20.14, 90.00, 164.25, 237.53, 380.14]), 'e_i': np.array([0.8, 0.7, 1.0, 1.2, 0.8]), 'H_i': np.array([0.0, 100.0, 200.0, 300.0, 400.0]) }
800: 6.40, 805: 5.95, 810: 5.50, 815: 5.80, 820: 6.10, 825: 6.30, 830: 6.50, } } SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES = CaseInsensitiveMapping({ 'S0': SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S0'], name='S0'), 'S1': SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S1'], name='S1'), 'S2': SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S2'], name='S2') }) SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES.__doc__ = """ *CIE Illuminant D Series* :math:`S_n(\\lambda)` spectral distributions. References ---------- :cite:`Lindbloom2007a`, :cite:`Wyszecki2000z` SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES : CaseInsensitiveMapping **{'S0', 'S1', 'S1'}** """