github colour-science/colour v0.4.2
Colour 0.4.2

latest releases: v0.4.4, v0.4.3
17 months ago

Colour 0.4.2 - Alpha Milestone

This release implements support for Python 3.11. It includes the remaining contributions of the GSoC 2021 work from Cédric (@villirion). New RGB colourspaces, transfer functions, colour models and colour appearance models have been added. Various performance improvements have been implemented.

We would like to especially thanks @tjdcs for his recent contributions.

With this release, the minimum Python version is 3.9 and the following scientific packages minimum versions are required:

  • Numpy >= 1.20
  • Scipy >= 1.7
  • Matplotlib >= 3.4
  • Networkx >= 2.6
  • pandas >= 1.3

Features

colour.appearance

  • Implement support for Hellwig and Fairchild (2022) colour appearance model with colour.XYZ_to_Hellwig2022 and colour.Hellwig2022_to_XYZ definitions. (#972 @KelSolaar)
  • Implement support for CIECAM16 colour appearance model with colour.XYZ_to_CIECAM16 and colour.CIECAM16_to_XYZ definitions. (#1015, @KelSolaar)

colour.colorimetry

  • Add convenient colour.SpectralShape.wavelengths property. (@KelSolaar)

colour.difference

  • Implement support for Recommendation ITU-R BT.2124 with colour.difference.delta_E_ITP definition. (#981, @sabarish-srinivasan)

colour.io

colour.models

  • Implement support for Munish Ragoo and Farup (2021) Optimised IPT colourspace with colour.XYZ_to_IPT_Munish2021 and colour.IPT_Munish2021_to_XYZ definitions. (#990, @KelSolaar)

  • Implement support for Leica L-Log log encoding curve with colour.models.log_encoding_LLog and colour.models.log_decoding_LLog definitions. (#986, @KelSolaar, @nick-shaw, @zachlewis)

  • Implement support for Recommendation ITU-T H.273 / INTERNATIONAL STANDARD ISO/IEC 23091-2 code points for video signal type identification with colour.COLOUR_PRIMARIES_ITUTH273, colour.TRANSFER_CHARACTERISTICS_ITUTH273 and colour.MATRIX_COEFFICIENTS_ITUTH273 attributes and colour.models.describe_video_signal_colour_primaries, colour.models.describe_video_signal_transfer_characteristics and colour.models.describe_video_signal_matrix_coefficients definitions. (#987, #1033, @fxthomas, @KelSolaar).

  • Implement support for ARRI Wide Gamut 4 colourspace and ARRI LogC4 log encoding with colour.models.RGB_COLOURSPACE_ARRI_WIDE_GAMUT_4 attribute and colour.models.log_encoding_ARRILogC4 and colour.models.log_decoding_ARRILogC4 definitions. (#1056, @KelSolaar)

    For consistency:

    • The colour.models.RGB_COLOURSPACE_ALEXA_WIDE_GAMUT attribute has been renamed to RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3.
    • The colour.models.log_encoding_ALEXALogC and colour.models.log_decoding_ALEXALogC definitions have been renamed to log_encoding_ARRILogC3 and log_decoding_ARRILogC3 respectively.
    • Keys in the various mappings, e.g. colour.RGB_COLOURSPACES, colour.LOG_ENCODINGS, have been renamed accordingly.

colour.recovery

GSoC - 2021

  • Implement support for Jiang et al. (2013) camera RGB sensitivities recovery with colour.recovery.RGB_to_msds_camera_sensitivities_Jiang2013 definition. (#1002, @villirion, @KelSolaar)

Camera RGB Sensitivities Recovery

colour.utilities

  • The colour.utilities.CanonicalMapping and colour.utilities.LazyCanonicalMapping, fomerly colour.utilities.CaseInsensitiveMapping and colour.utilities.LazyCaseInsensitiveMapping, respectively, support canonical (and sluggified) keys: (#993, @KelSolaar, @zachlewis)
>>> import colour
>>> colour.RGB_COLOURSPACES['ALEXA Wide Gamut'].name
'ALEXA Wide Gamut'
>>> colour.RGB_COLOURSPACES['alexa-wide-gamut'].name
'ALEXA Wide Gamut'
>>> colour.RGB_COLOURSPACES['alexawidegamut'].name
'ALEXA Wide Gamut'
>>> 'ALEXA Wide Gamut' in colour.RGB_COLOURSPACES
True
>>> 'alexa-wide-gamut' in colour.RGB_COLOURSPACES
True
>>> 'alexawidegamut' in colour.RGB_COLOURSPACES
True
>>> del colour.RGB_COLOURSPACES['alexa-wide-gamut']
>>> 'ALEXA Wide Gamut' in colour.RGB_COLOURSPACES
False
>>> list(colour.RGB_COLOURSPACES.slugified_keys())
['aces2065-1', 'acescc', 'acescct', 'acescg', 'acesproxy', 'adobe-rgb-1998', 'adobe-wide-gamut-rgb', 'apple-rgb', 'best-rgb', 'beta-rgb', 'blackmagic-wide-gamut', 'cie-rgb', 'cinema-gamut', 'colormatch-rgb', 'dcdm-xyz', 'dci-p3', 'dci-p3-p', 'dji-d-gamut', 'dragoncolor', 'dragoncolor2', 'davinci-wide-gamut', 'display-p3', 'don-rgb-4', 'eci-rgb-v2', 'erimm-rgb', 'ekta-space-ps-5', 'f-gamut', 'filmlight-e-gamut', 'itu-r-bt2020', 'itu-r-bt470-525', 'itu-r-bt470-625', 'itu-r-bt709', 'max-rgb', 'n-gamut', 'ntsc-1953', 'ntsc-1987', 'p3-d65', 'palsecam', 'prophoto-rgb', 'protune-native', 'redwidegamutrgb', 'redcolor', 'redcolor2', 'redcolor3', 'redcolor4', 'rimm-rgb', 'romm-rgb', 'russell-rgb', 's-gamut', 's-gamut3', 's-gamut3cine', 'smpte-240m', 'smpte-c', 'sharp-rgb', 'v-gamut', 'venice-s-gamut3', 'venice-s-gamut3cine', 'xtreme-rgb', 'srgb', 'aces', 'adobe1998', 'prophoto']
>>> list(colour.RGB_COLOURSPACES.canonical_keys())
['aces20651', 'acescc', 'acescct', 'acescg', 'acesproxy', 'adobergb1998', 'adobewidegamutrgb', 'applergb', 'bestrgb', 'betargb', 'blackmagicwidegamut', 'ciergb', 'cinemagamut', 'colormatchrgb', 'dcdmxyz', 'dcip3', 'dcip3p', 'djidgamut', 'dragoncolor', 'dragoncolor2', 'davinciwidegamut', 'displayp3', 'donrgb4', 'ecirgbv2', 'erimmrgb', 'ektaspaceps5', 'fgamut', 'filmlightegamut', 'iturbt2020', 'iturbt470525', 'iturbt470625', 'iturbt709', 'maxrgb', 'ngamut', 'ntsc1953', 'ntsc1987', 'p3d65', 'palsecam', 'prophotorgb', 'protunenative', 'redwidegamutrgb', 'redcolor', 'redcolor2', 'redcolor3', 'redcolor4', 'rimmrgb', 'rommrgb', 'russellrgb', 'sgamut', 'sgamut3', 'sgamut3cine', 'smpte240m', 'smptec', 'sharprgb', 'vgamut', 'venicesgamut3', 'venicesgamut3cine', 'xtremergb', 'srgb', 'aces', 'adobe1998', 'prophoto']
>>> list(colour.MSDS_CMFS.slugified_keys())
['stockman-sharpe-2-degree-cone-fundamentals', 'stockman-sharpe-10-degree-cone-fundamentals', 'smith-pokorny-1975-normal-trichromats', 'wright-guild-1931-2-degree-rgb-cmfs', 'stiles-burch-1955-2-degree-rgb-cmfs', 'stiles-burch-1959-10-degree-rgb-cmfs', 'cie-1931-2-degree-standard-observer', 'cie-1964-10-degree-standard-observer', 'cie-2012-2-degree-standard-observer', 'cie-2012-10-degree-standard-observer', 'cie-2015-2-degree-standard-observer', 'cie-2015-10-degree-standard-observer', 'cie_2_1931', 'cie_10_1964']
>>> list(colour.MSDS_CMFS.canonical_keys())
['stockmansharpe2degreeconefundamentals', 'stockmansharpe10degreeconefundamentals', 'smithpokorny1975normaltrichromats', 'wrightguild19312degreergbcmfs', 'stilesburch19552degreergbcmfs', 'stilesburch195910degreergbcmfs', 'cie19312degreestandardobserver', 'cie196410degreestandardobserver', 'cie20122degreestandardobserver', 'cie201210degreestandardobserver', 'cie20152degreestandardobserver', 'cie201510degreestandardobserver', 'cie21931', 'cie101964']

Most of the datasets Colour ship with benefit from this new feature.

Performance

  • colour.temperature.uv_to_CCT_Ohno2013 definition isn ~100x faster. (#951, @KelSolaar)
  • colour.temperature.CCT_to_uv_Ohno2013 definition is ~425x faster. (#951, @KelSolaar)
  • Creation of the colour.Signal class underlying continuous function now happens lazilly. (#1057, @tjdcs)
  • colour.SpectralDistribution.shape property getter is faster by ensuring monotonicity of the colour.SpectralDistribution.domain property. (#1067, 85f6a57, @tjdcs, @KelSolaar)

Fixes

colour.contrast

  • Fix incorrect log function in the pupil diameter computation of Barten (1999) contrast sensitivity function. (#1022, @xmsguan, @KelSolaar)

Changes

colour.algebra

Object Access Change Author
colour.algebra.ellipse_coefficients_general_form colour.geometry.ellipse_coefficients_general_form @KelSolaar
colour.algebra.ellipse_coefficients_canonical_form colour.geometry.ellipse_coefficients_canonical_form ...
colour.algebra.point_at_angle_on_ellipse colour.geometry.point_at_angle_on_ellipse ...
colour.algebra.ellipse_fitting_Halir1998 colour.geometry.ellipse_fitting_Halir1998 ...
colour.algebra.ELLIPSE_FITTING_METHODS colour.geometry.ELLIPSE_FITTING_METHODS ...
colour.algebra.ellipse_fitting colour.geometry.ellipse_fitting ...
colour.algebra.extend_line_segment colour.geometry.extend_line_segment ...
colour.algebra.extend_line_segment colour.geometry.extend_line_segment ...
colour.algebra.extend_line_segment colour.geometry.extend_line_segment ...

colour.characterisation

Object Signature Author
colour.sd_to_aces_relative_exposure_values sd_to_aces_relative_exposure_values(sd: SpectralDistribution, illuminant: Optional[SpectralDistribution] = None, chromatic_adaptation_transform: Optional[Union[Literal["Bianco 2010", "Bianco PC 2010", "Bradford", "CAT02 Brill 2008", "CAT02", "CAT16", "CMCCAT2000", "CMCCAT97", "Fairchild", "Sharp", "Von Kries", "XYZ Scaling", ], str, ]]= "CAT02") -> NDArray @KelSolaar

colour.colorimetry

  • The return value of the colour.sd_to_XYZ and colour.msds_to_XYZ definition is by default divided by 100 when k is not None. (#1020, @KelSolaar, @tjdcs)
  • The CIE 2012 2 Degree Standard Observer and CIE 2012 10 Degree Standard Observer keys in the colour.MSDS_CMFS attribute have been renamed to CIE 2015 2 Degree Standard Observer and CIE 2015 10 Degree Standard Observer respectively for consistency with their official CIE names. (@KelSolaar)
Object Signature Author
colour.colorimetry.msds_to_XYZ_ASTME308 msds_to_XYZ_ASTME308(msds: MultiSpectralDistributions, cmfs: Optional[MultiSpectralDistributions] = None, illuminant: Optional[SpectralDistribution] = None, use_practice_range: Boolean = True, mi_5nm_omission_method: Boolean = True, mi_20nm_interpolation_method: Boolean = True, k: Optional[Number] = None ) -> NDArray @tjdcs

colour.graph

  • The conversion paths starting from Spectral Distribution do not use CIE Standard Illuminant D65 anymore by default during the conversion to CIE XYZ tristimulus values. (#1059, @ema2159, @KelSolaar)

colour.io

colour.models

  • The DCI-P3+ key in the colour.RGB_COLOURSPACES mapping has been renamed to DCI-P3-P to avoid canonical key collisions. (@KelSolaar, @zachlewis)
Object Name Author
colour.models.RGB_COLOURSPACE_ALEXA_WIDE_GAMUT RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3 @KelSolaar
colour.models.eotf_inverse_BT2020 oetf_BT2020 @KelSolaar, @fxthomas
colour.models.eotf_BT2020 oetf_inverse_BT2020 ...
colour.models.oetf_PQ_BT2100 oetf_BT2100_PQ @KelSolaar
colour.models.oetf_inverse_PQ_BT2100 oetf_inverse_BT2100_PQ ...
colour.models.eotf_PQ_BT2100 eotf_BT2100_PQ ...
colour.models.eotf_inverse_PQ_BT2100 eotf_inverse_BT2100_PQ ...
colour.models.ootf_PQ_BT2100 ootf_BT2100_PQ ...
colour.models.ootf_inverse_PQ_BT2100 ootf_inverse_BT2100_PQ ...
colour.models.oetf_HLG_BT2100 oetf_BT2100_HLG ...
colour.models.oetf_inverse_HLG_BT2100 oetf_inverse_BT2100_HLG ...
colour.models.eotf_HLG_BT2100 eotf_BT2100_HLG ...
colour.models.eotf_inverse_HLG_BT2100 eotf_inverse_BT2100_HLG ...
colour.models.log_encoding_ALEXALogC log_encoding_ARRILogC3 ...
colour.models.log_decoding_ALEXALogC log_decoding_ARRILogC3 ...
colour.models.ootf_HLG_BT2100 ootf_BT2100_HLG ...
colour.models.ootf_inverse_HLG_BT2100 ootf_inverse_BT2100_HLG ...

colour.plotting

  • Fix incorrect value for CRI R9 in TM-30-18 report. (@kohler-t)

  • All the plotting definitions relying on the colour.plotting.common.filter_RGB_colourspaces, colour.plotting.common.filter_cmfs, colour.plotting.common.filter_illuminants and colour.plotting.common.filter_colour_checkers definitions do not accept a RegEx pattern anymore but a basic string.
    It is possible to also use any of the lower, slugified or canonical values:

  • ntsc (1953)

  • ntsc-1953

  • ntsc1953

Object Signature Author
colour.plotting.common.filter_RGB_colourspaces filter_RGB_colourspaces(filterers: Union[RGB_Colourspace, str, Sequence[Union[RGB_Colourspace, str]]], allow_non_siblings: Boolean = True) -> Dict[str, RGB_Colourspace] @KelSolaar
colour.plotting.common.filter_cmfs filter_cmfs(filterers: Union[MultiSpectralDistributions,str,Sequence[Union[MultiSpectralDistributions, str]],], allow_non_siblings: Boolean = True) -> Dict[str, MultiSpectralDistributions] ...
colour.plotting.common.filter_illuminants filter_illuminants(filterers: Union[SpectralDistribution, str, Sequence[Union[SpectralDistribution, str]]], allow_non_siblings: Boolean = True) -> Dict[str, SpectralDistribution] ...
colour.plotting.common.filter_colour_checkers filter_colour_checkers(filterers: Union[ColourChecker, str, Sequence[Union[ColourChecker, str]]], allow_non_siblings: Boolean = True) -> Dict[str, ColourChecker] ...
colour.plotting.plot_RGB_colourspaces_gamuts plot_RGB_colourspaces_gamuts(colourspaces: Union[RGB_Colourspace, str, Sequence[Union[RGB_Colourspace, str]]], model: Union[Literal["CAM02LCD", "CAM02SCD", "CAM02UCS", "CAM16LCD", "CAM16SCD", "CAM16UCS", "CIE XYZ", "CIE xyY", "CIE Lab", "CIE Luv", "CIE UCS", "CIE UVW", "DIN99", "Hunter Lab", "Hunter Rdab", "ICaCb", "ICtCp", "IPT", "IgPgTg", "Jzazbz", "OSA UCS", "Oklab", "hdr-CIELAB", "hdr-IPT",], str,] = "CIE xyY", segments: Integer = 8, show_grid: Boolean = True, grid_segments: Integer = 10, show_spectral_locus: Boolean = False, spectral_locus_colour: Optional[Union[ArrayLike, str]] = None, cmfs: Union[MultiSpectralDistributions, str, Sequence[Union[MultiSpectralDistributions, str]],] = "CIE 1931 2 Degree Standard Observer", chromatically_adapt: Boolean = False, convert_kwargs: Optional[Dict] = None, **kwargs: Any,) -> Tuple[plt.Figure, plt.Axes] ...
colour.plotting.plot_RGB_colourspaces_gamuts plot_RGB_scatter(RGB: ArrayLike, colourspace: Union[RGB_Colourspace, str, Sequence[Union[RGB_Colourspace, str]]] = "sRGB", model: Union[Literal["CAM02LCD", "CAM02SCD", "CAM02UCS", "CAM16LCD", "CAM16SCD", "CAM16UCS", "CIE XYZ", "CIE xyY", "CIE Lab", "CIE Luv", "CIE UCS", "CIE UVW", "DIN99", "Hunter Lab", "Hunter Rdab", "ICaCb", "ICtCp", "IPT", "IgPgTg", "Jzazbz", "OSA UCS", "Oklab", "hdr-CIELAB", "hdr-IPT",],str,] = "CIE xyY",colourspaces: Optional[Union[RGB_Colourspace, str, Sequence[Union[RGB_Colourspace, str]]]] = None, segments: Integer = 8, show_grid: Boolean = True, grid_segments: Integer = 10, show_spectral_locus: Boolean = False, spectral_locus_colour: Optional[Union[ArrayLike, str]] = None, points_size: Floating = 12, cmfs: Union[MultiSpectralDistributions, str, Sequence[Union[MultiSpectralDistributions, str]],] = "CIE 1931 2 Degree Standard Observer", chromatically_adapt: Boolean = False, convert_kwargs: Optional[Dict] = None, **kwargs: Any,) -> Tuple[plt.Figure, plt.Axes] ...

colour.utilities

Object Name Author
colour.utilities.CaseInsensitiveMapping CanonicalMapping @KelSolaar, @zachlewis
colour.utilities.LazyCaseInsensitiveMapping LazyCanonicalMapping ...

Don't miss a new colour release

NewReleases is sending notifications on new releases.