Colour 0.4.3 - Alpha Milestone
We worked on many optimisations around colour quality metrics that should result in overall performance increase, thanks again to @tjdcs for the heavy lifting!
@charliermarsh's ruff is now used as a replacement for:
We also replaced mypy with pyright for performance reasons. We took that opportunity to simplify our type annotations.
The colour.XYZ_to_RGB
and colour.RGB_to_XYZ
definition signatures have been changed to be easier to use, please update any code using them. See #1127 for more information.
With this release, the following scientific packages minimum versions are required:
- numpy >= 1.22
- scipy >= 1.8
- matplotlib >= 3.5
- networkx >= 2.7
- pandas >= 1.4
Features
colour.characterisation
- Add TE226 V2 colour checker reference values. (#1113, #901, @Rusching)
- Add
colour.apply_matrix_colour_correction
definition andcolour.APPLY_MATRIX_COLOUR_CORRECTION_METHODS
attribute to conveniently apply a colour-correction matrix computed with thecolour.matrix_colour_correction
definition. (@KelSolaar) - Add terms 4 and 35 to Cheung (2004) polynomial transformation. (#1160, @chnmasta05)
colour.colorimetry
- The continuous signal classes are now iterable, e.g.
colour.SpectralDistribution
andcolour.MultiSpectralDistributions
. (#1088, @KelSolaar)
import colour
sd = colour.SDS_ILLUMINANTS["A"]
for i in sd:
print(i)
[ 300. 0.930483]
[ 305. 1.12821]
[ 310. 1.35769]
...
[ 780. 241.675]
import colour
sd = colour.MSDS_CMFS["CIE 2012 2 Degree Standard Observer"]
for i in sd:
print(i)
[ 3.90000000e+02 3.76964700e-03 4.14616100e-04 1.84726000e-02]
[ 3.91000000e+02 4.53241600e-03 5.02833300e-04 2.22110100e-02]
[ 3.92000000e+02 5.44655300e-03 6.08499100e-04 2.66981900e-02]
...
[ 8.30000000e+02 1.76246500e-06 7.05386000e-07 0.00000000e+00]
colour.models
- Implement support for Kirk (2019) Yrg colourspace with
colour.XYZ_to_Yrg
andcolour.Yrg_to_XYZ
definitions. (#1152, @KelSolaar) - Implement support for Fujifilm F-Log2 encodings with
colour.models.log_decoding_FLog2
andcolour.models.log_encoding_FLog2
definitions. (#1076, @zachlewis) - Implement support for PLASA ANSI E1.54 colourspace with
colour.models.RGB_COLOURSPACE_PLASA_ANSI_E154
attribute. (#1193, @KelSolaar)
colour.notation
- Implement support for CSS Color 3 with
colour.notation.CSS_COLOR_3
attribute andcolour.notation.keyword_to_RGB_CSSColor3
definition. (#1140, @KelSolaar)
colour.plotting
- Make RGB encoding optional in
colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931
,colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS
andcolour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS
definitions. (@KelSolaar)
RGB = np.random.random((128, 128, 3))
plot_RGB_chromaticities_in_chromaticity_diagram(RGB, "ITU-R BT.709", scatter_kwargs={"apply_cctf_encoding": False})
- Add a new
colour.plotting.temperature.plot_daylight_locus
definition. (@KelSolaar) - Add a new
planckian_locus_use_mireds
keyword argument tocolour.plotting.temperature.plot_planckian_locus
definition. (@KelSolaar)
colour.temperature
- Add
colour.temperature.mired_to_CCT
andcolour.temperature.CCT_to_mired
definitions to perform micro reciprocal degree and CCT conversions. (#1114, @KelSolaar) - Add
colour.temperature.XYZ_to_CCT_Ohno2013
andcolour.temperature.CCT_to_XYZ_Ohno2013
convenient definitions. (#1120, @tjdcs)
colour.utilities
- Add
colour.utilities.int_digest
definition using xxhash to compute 64-bit integer hashes. (#1149, @KelSolaar, @tjdcs)
Performance
- The Colour Fidelity Index (2017), i.e.
colour.quality.colour_fidelity_index_CIE2017
definition, and TM 30-18, i.e.colour.quality.colour_fidelity_index_ANSIIESTM3018
definition, metrics performance has been improved by x100 thanks to overall optimizations, e.g.colour.temperature.uv_to_CCT_Ohno2013
definition is x5 faster. (#1120, @tjdcs, @KelSolaar)
Fixes
Dependencies
- Implement support for Numpy 1.24.0. (#1087, @KelSolaar)
colour.io
- Fix incorrect bit-depth conversion in
colour.io.write_image_OpenImageIO
definition when writing 16-bit integer images (82ef2c4, @nick-shaw, @KelSolaar)
colour.colorimetry
- Fix incorrect
colour.colorimetry.sd_gaussian_fwhm
definition output (#1184, @EricFlyMeToTheMoon, @tjdcs, @KelSolaar)
colour.models
- Implement various minor corrections from Sarifuddin (2021) to
colour.RGB_to_HCL
definition. (1a580ef, @KelSolaar)
colour.phenomena
- Fix incorrect CO2 concentration scaling in
colour.phenomena.rayleigh.F_air_Bodhaine1999
definition. (#307, #1167, @chnmasta05, @KelSolaar)
colour.utilities
- Fix dimensionality reduction issue in
colour.utilities.as_float
definition that was causing issue with 1-pixel images processing. (#1189, @KelSolaar, @MrLixm)
Changes
colour.colorimetry
Object | Signature | Author |
---|---|---|
colour.sd_single_led
| `sd_single_led(peak_wavelength: float, shape: SpectralShape = SPECTRAL_SHAPE_DEFAULT, method: Literal["Ohno 2005"] | str = "Ohno 2005", **kwargs: Any) -> SpectralDistribution` |
colour.sd_multi_leds
| `sd_multi_leds(peak_wavelengths: ArrayLike, shape: SpectralShape = SPECTRAL_SHAPE_DEFAULT, method: Literal["Ohno 2005"] | str = "Ohno 2005", **kwargs: Any) -> SpectralDistribution` |
colour.colorimetry.sd_single_led_Ohno2005
| sd_single_led_Ohno2005(peak_wavelength: float, half_spectral_width: float, shape: SpectralShape = SPECTRAL_SHAPE_DEFAULT, **kwargs: Any) -> SpectralDistribution
| ... |
colour.colorimetry.sd_multi_leds_Ohno2005
| `sd_multi_leds_Ohno2005(peak_wavelengths: ArrayLike, half_spectral_widths: ArrayLike, peak_power_ratios: ArrayLike | None = None, shape: SpectralShape = SPECTRAL_SHAPE_DEFAULT, **kwargs: Any) -> SpectralDistribution` |
colour.characterisation
- Ensure that the matrix returned by
colour.matrix_idt
definition is whitepoint preserving using thecolour.characterisation.optimisation_factory_rawtoaces_v1
optimisation factory. (@KelSolaar) - Implement support for Finlayson et al. (2015) root-polynomials colour correction with
colour.characterisation.optimisation_factory_Oklab_15
optimisation factory. (@KelSolaar) - The
colour.matrix_idt
definition optimisation factories are now returning 4 objects. (@KelSolaar)
colour.models
- The
colour.XYZ_to_xy
andcolour.XYZ_to_xyY
definitions do no return the parameter illuminant chromaticities when the luminanceY
is equal to zero. This behaviour was motivated by a note from Bruce Justin Lindbloom but does not have a CIE or ASTM recommendation. (#1153, @KelSolaar)
Object | Name | Author |
---|---|---|
colour.XYZ_to_IPT_Munish2021
| XYZ_to_IPT_Ragoo2021
| @blue-j, @KelSolaar |
colour.IPT_Munish2021_to_XYZ
| IPT_Ragoo2021_to_XYZ
| ... |
Object | Signature | Author |
---|---|---|
colour.XYZ_to_RGB
| `XYZ_to_RGB(XYZ: ArrayLike, colourspace: RGB_Colourspace | str, illuminant: ArrayLike |
colour.RGB_to_XYZ
| `RGB_to_XYZ(RGB: ArrayLike, colourspace: RGB_Colourspace | str, illuminant: ArrayLike |
colour.matrix_RGB_to_RGB
| `matrix_RGB_to_RGB(input_colourspace: RGB_Colourspace | str, output_colourspace: RGB_Colourspace |
colour.RGB_to_RGB
| `RGB_to_RGB(RGB: ArrayLike, input_colourspace: RGB_Colourspace | str, output_colourspace: RGB_Colourspace |
colour.XYZ_to_xy
| XYZ_to_xy(XYZ: ArrayLike) -> NDArrayFloat
| ... |
colour.XYZ_to_xyY
| XYZ_to_xyY(XYZ: ArrayLike) -> NDArrayFloat
| ... |
colour.models.log_decoding_ACESproxy
| `log_decoding_ACESproxy(ACESproxy: ArrayLike, bit_depth: Literal[10, 12] = 10, in_int: bool = False, constants: dict | None = None) -> NDArrayFloat` |
colour.plotting
colour.plotting.plot_multi_sds
andcolour.plotting.diagram.plot_sds_in_chromaticity_diagram
definitions now default to use CIE Illuminant E when computing spectrum colours. (510860a, @KelSolaar)
colour.quality
- The
colour.spectral_similarity_index
definition has been updated to 2020 publication update. (#1163, @benjaminherb)
Object | Signature | Author |
---|---|---|
colour.spectral_similarity_index
| spectral_similarity_index(sd_test: SpectralDistribution, sd_reference: SpectralDistribution, round_result: bool = True) -> NDArrayFloat
| @tjdcs |