### Install Colour Science using pip Source: https://github.com/colour-science/colour/blob/develop/README.rst Installs the Colour Science library and its primary dependencies using pip. ```bash pip install --user colour-science ``` -------------------------------- ### Install Colour Science using conda Source: https://github.com/colour-science/colour/blob/develop/README.rst Installs the Colour Science library from the conda-forge channel using conda. ```bash conda install -c conda-forge colour-science ``` -------------------------------- ### Get Lightness Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists available methods for computing lightness. ```python import colour sorted(colour.LIGHTNESS_METHODS) ``` ```text ['Abebe 2017', 'CIE 1976', 'Fairchild 2010', 'Fairchild 2011', 'Glasser 1958', 'Lstar1976', 'Wyszecki 1963'] ``` -------------------------------- ### JSON Environment File Configuration Source: https://github.com/colour-science/colour/blob/develop/docs/advanced.rst Configure Colour behaviour at runtime using a JSON file. This example shows how to enable warnings with tracebacks. ```json { "COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK": "True" } ``` -------------------------------- ### Get Multi-Spectral to XYZ Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists available methods for converting multi-spectral data to XYZ. ```python import colour sorted(colour.MSDS_TO_XYZ_METHODS) ``` ```text ['ASTM E308', 'Integration', 'astm2015'] ``` -------------------------------- ### Cache Registry State Output Source: https://github.com/colour-science/colour/blob/develop/docs/advanced.rst Example output showing the state of various internal caches within the Colour library. Indicates the number of items stored in each cache. ```text {'colour.colorimetry.spectrum._CACHE_RESHAPED_SDS_AND_MSDS': '0 item(s)', 'colour.colorimetry.tristimulus_values._CACHE_LAGRANGE_INTERPOLATING_COEFFICIENTS': '0 ' 'item(s)', 'colour.colorimetry.tristimulus_values._CACHE_SD_TO_XYZ': '0 item(s)', 'colour.colorimetry.tristimulus_values._CACHE_TRISTIMULUS_WEIGHTING_FACTORS': '0 ' 'item(s)', 'colour.quality.cfi2017._CACHE_TCS_CIE2017': '0 item(s)', 'colour.volume.macadam_limits._CACHE_OPTIMAL_COLOUR_STIMULI_XYZ': '0 item(s)', 'colour.volume.macadam_limits._CACHE_OPTIMAL_COLOUR_STIMULI_XYZ_TRIANGULATIONS': '0 ' 'item(s)', 'colour.volume.spectrum._CACHE_OUTER_SURFACE_XYZ': '0 item(s)', 'colour.volume.spectrum._CACHE_OUTER_SURFACE_XYZ_POINTS': '0 item(s)'} ``` -------------------------------- ### Get Spectral Data Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists available methods for converting spectral data to XYZ. ```python import colour sorted(colour.SD_TO_XYZ_METHODS) ``` ```text ['ASTM E308', 'Integration', 'astm2015'] ``` -------------------------------- ### Kernel Interpolation Example Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Performs kernel interpolation on a given set of y-values with corresponding x-values and evaluates the interpolator at specified points. Requires the 'colour' package. ```python import colour y = [5.9200, 9.3700, 10.8135, 4.5100, 69.5900, 27.8007, 86.0500] x = range(len(y)) colour.KernelInterpolator(x, y)([0.25, 0.75, 5.50]) ``` ```text [6.18062083 8.08238488 57.85783403] ``` -------------------------------- ### Kernel Interpolation Example Source: https://github.com/colour-science/colour/blob/develop/README.rst Performs kernel interpolation on a set of data points and evaluates the interpolator at specific query points. ```python import colour y = [5.9200, 9.3700, 10.8135, 4.5100, 69.5900, 27.8007, 86.0500] x = range(len(y)) colour.KernelInterpolator(x, y)([0.25, 0.75, 5.50]) ``` ```text [ 6.18062083 8.08238488 57.85783403] ``` -------------------------------- ### List Available Log Encodings Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of all supported log encoding names. No specific setup is required beyond importing the library. ```python import colour sorted(colour.LOG_ENCODINGS) ``` ```text ['ACEScc', 'ACEScct', 'ACESproxy', 'ARRI LogC3', 'ARRI LogC4', 'Apple Log Profile', 'Canon Log', 'Canon Log 2', 'Canon Log 3', 'Cineon', 'D-Log', 'ERIMM RGB', 'F-Log', 'F-Log2', 'Filmic Pro 6', 'L-Log', 'Log2', 'Log3G10', 'Log3G12', 'Mi-Log', 'N-Log', 'PLog', 'Panalog', 'Protune', 'REDLog', 'REDLogFilm', 'S-Log', 'S-Log2', 'S-Log3', 'T-Log', 'V-Log', 'ViperLog'] ``` -------------------------------- ### Sprague Interpolation Example Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Performs Sprague interpolation on a given set of y-values with corresponding x-values and evaluates the interpolator at specified points. Requires the 'colour' package. ```python import colour y = [5.9200, 9.3700, 10.8135, 4.5100, 69.5900, 27.8007, 86.0500] x = range(len(y)) colour.SpragueInterpolator(x, y)([0.25, 0.75, 5.50]) ``` ```text [6.72951612 7.81406251 43.77379185] ``` -------------------------------- ### Sprague Interpolation Example Source: https://github.com/colour-science/colour/blob/develop/README.rst Performs Sprague interpolation on a set of data points and evaluates the interpolator at specific query points. ```python import colour y = [5.9200, 9.3700, 10.8135, 4.5100, 69.5900, 27.8007, 86.0500] x = range(len(y)) colour.SpragueInterpolator(x, y)([0.25, 0.75, 5.50]) ``` ```text [ 6.72951612 7.81406251 43.77379185] ``` -------------------------------- ### Getting Spectral Distribution Shape Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Retrieve the shape of a spectral distribution object using the `.shape` attribute. This indicates the start, end, and interval of the spectral data. ```python print(sd.shape) ``` -------------------------------- ### List Colour Rendering Index Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of available methods for Colour Rendering Index calculation. Requires the 'colour' library. ```python import colour sorted(colour.COLOUR_RENDERING_INDEX_METHODS) ``` ```text [] ``` -------------------------------- ### Create Spectral Distribution from Dictionary Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Demonstrates creating a SpectralDistribution object from a dictionary. Ensure the dictionary keys are wavelengths and values are corresponding spectral data. ```python data_sample = { 380: 0.048, 385: 0.051, 390: 0.055, 395: 0.060, 400: 0.065, 405: 0.068, 410: 0.068, 415: 0.067, 420: 0.064, 425: 0.062, 430: 0.059, 435: 0.057, 440: 0.055, 445: 0.054, 450: 0.053, 455: 0.053, 460: 0.052, 465: 0.052, 470: 0.052, 475: 0.053, 480: 0.054, 485: 0.055, 490: 0.057, 495: 0.059, 500: 0.061, 505: 0.062, 510: 0.065, 515: 0.067, 520: 0.070, 525: 0.072, 530: 0.074, 535: 0.075, 540: 0.076, 545: 0.078, 550: 0.079, 555: 0.082, 560: 0.087, 565: 0.092, 570: 0.100, 575: 0.107, 580: 0.115, 585: 0.122, 590: 0.129, 595: 0.134, 600: 0.138, 605: 0.142, 610: 0.146, 615: 0.150, 620: 0.154, 625: 0.158, 630: 0.163, 635: 0.167, 640: 0.173, 645: 0.180, 650: 0.188, 655: 0.196, 660: 0.204, 665: 0.213, 670: 0.222, 675: 0.231, 680: 0.242, 685: 0.251, 690: 0.261, 695: 0.271, 700: 0.282, 705: 0.294, 710: 0.305, 715: 0.318, 720: 0.334, 725: 0.354, 730: 0.372, 735: 0.392, 740: 0.409, 745: 0.420, 750: 0.436, 755: 0.450, 760: 0.462, 765: 0.465, 770: 0.448, 775: 0.432, 780: 0.421, } sd = colour.SpectralDistribution(data_sample, name="Sample") print(repr(sd)) ``` -------------------------------- ### Requirement Checks Source: https://github.com/colour-science/colour/blob/develop/docs/colour.utilities.rst Functions to check if specific libraries are installed. ```APIDOC ## is_ctlrender_installed ### Description Checks if 'ctlrender' is installed. ### Function colour.utilities.is_ctlrender_installed ``` ```APIDOC ## is_imageio_installed ### Description Checks if 'imageio' is installed. ### Function colour.utilities.is_imageio_installed ``` ```APIDOC ## is_matplotlib_installed ### Description Checks if 'matplotlib' is installed. ### Function colour.utilities.is_matplotlib_installed ``` ```APIDOC ## is_networkx_installed ### Description Checks if 'networkx' is installed. ### Function colour.utilities.is_networkx_installed ``` ```APIDOC ## is_opencolorio_installed ### Description Checks if 'opencolorio' is installed. ### Function colour.utilities.is_opencolorio_installed ``` ```APIDOC ## is_openimageio_installed ### Description Checks if 'openimageio' is installed. ### Function colour.utilities.is_openimageio_installed ``` ```APIDOC ## is_pandas_installed ### Description Checks if 'pandas' is installed. ### Function colour.utilities.is_pandas_installed ``` ```APIDOC ## is_pydot_installed ### Description Checks if 'pydot' is installed. ### Function colour.utilities.is_pydot_installed ``` ```APIDOC ## is_tqdm_installed ### Description Checks if 'tqdm' is installed. ### Function colour.utilities.is_tqdm_installed ``` ```APIDOC ## is_trimesh_installed ### Description Checks if 'trimesh' is installed. ### Function colour.utilities.is_trimesh_installed ``` ```APIDOC ## is_xxhash_installed ### Description Checks if 'xxhash' is installed. ### Function colour.utilities.is_xxhash_installed ``` ```APIDOC ## required ### Description Checks if a library is required and raises an error if not installed. ### Function colour.utilities.required ``` -------------------------------- ### Import Colour Library Source: https://github.com/colour-science/colour/blob/develop/README.rst Import the main colour library for use. ```python import colour ``` -------------------------------- ### Get Primitive Vertices for Quad MPL Source: https://github.com/colour-science/colour/blob/develop/README.rst Retrieves the vertices for the 'Quad MPL' geometry primitive. ```python import colour colour.primitive_vertices("Quad MPL") ``` ```text [[ 0. 0. 0.] ``` -------------------------------- ### Prepare XYZ for CAM16 Conversions Source: https://github.com/colour-science/colour/blob/develop/README.rst Prepares CIE XYZ values for CAM16 colourspace conversions. Requires the 'colour' library. ```python import colour XYZ = [0.20654008 * 100, 0.12197225 * 100, 0.05136952 * 100] ``` -------------------------------- ### List Colour Rendering Index Methods Source: https://github.com/colour-science/colour/blob/develop/README.rst Lists the available methods for calculating the Colour Rendering Index. ```python import colour sorted(colour.COLOUR_RENDERING_INDEX_METHODS) ``` ```text ['CIE 1995', 'CIE 2024'] ``` -------------------------------- ### Spectral Shape Representation Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Get the string representation of a `colour.SpectralShape` object, which defines the spectral dimensions. ```python repr(sd.shape) ``` -------------------------------- ### List Available XYZ to SDS Conversion Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of available methods for converting XYZ to spectral distribution (SDS). ```python import colour sorted(colour.XYZ_TO_SD_METHODS) ``` ```text ['Gaussian', 'Jakob 2019', 'Mallett 2019', 'Meng 2015', 'Otsu 2018', 'Smits 1999'] ``` -------------------------------- ### Get Current Domain-Range Scale Source: https://github.com/colour-science/colour/blob/develop/docs/basics.rst Retrieves the current domain-range scale setting of the library. Defaults to 'reference'. ```python import colour colour.get_domain_range_scale() ``` -------------------------------- ### List Colour Quality Scale Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of available methods for Colour Quality Scale calculation. Requires the 'colour' library. ```python import colour sorted(colour.COLOUR_QUALITY_SCALE_METHODS) ``` ```text ['NIST CQS 7.4', 'NIST CQS 9.0'] ``` -------------------------------- ### Get Primitive Vertices in Colour Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves the vertices for a specified primitive method. Used to understand the geometric definition of primitives. ```python import colour colour.primitive_vertices("Quad MPL") ``` ```text [[0. 0. 0.] [1. 0. 0.] [1. 1. 0.] [0. 1. 0.]] ``` -------------------------------- ### List Whiteness Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists all available methods for whiteness computation. ```python import colour sorted(colour.WHITENESS_METHODS) ``` ```text ['ASTM E313', 'Berger 1959', 'CIE 2004', 'Ganz 1979', 'Stensby 1968', 'Taube 1960', 'cie2004'] ``` -------------------------------- ### List xyY to Munsell Colour Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of available methods for converting xyY to Munsell colour. Requires the 'colour' library. ```python import colour sorted(colour.XYY_TO_MUNSELL_COLOUR_METHODS) ``` ```text ['Centore 2014', 'ONNX'] ``` -------------------------------- ### Get Current Safe Division Mode Source: https://github.com/colour-science/colour/blob/develop/docs/basics.rst Retrieves the current mode for handling zero-division errors. The default mode is 'Ignore Zero Conversion'. ```python colour.algebra.get_sdiv_mode() ``` -------------------------------- ### Available Lightness Methods Source: https://github.com/colour-science/colour/blob/develop/README.rst Lists the available methods for lightness computation. ```APIDOC ## Available Lightness Methods ### Description Retrieves a sorted list of available methods for the `lightness` function. ### Method `sorted(colour.LIGHTNESS_METHODS)` ### Response Example ```text ['Abebe 2017', 'CIE 1976', 'Fairchild 2010', 'Fairchild 2011', 'Glasser 1958', 'Lstar1976', 'Wyszecki 1963'] ``` ``` -------------------------------- ### Arbitrary Precision Mapping Keys Source: https://github.com/colour-science/colour/blob/develop/docs/basics.rst Demonstrates how ArbitraryPrecisionMapping handles keys with different decimal precisions. ```python data_1 = {0.1999999998: "Nemo", 0.2000000000: "John"} apm_1 = ArbitraryPrecisionMapping(data_1, key_decimals=10) tuple(apm_1.keys()) ``` ```text (0.1999999998, 0.2) ``` ```python apm_2 = ArbitraryPrecisionMapping(data_1, key_decimals=7) tuple(apm_2.keys()) ``` ```text (0.2,) ``` -------------------------------- ### Convert XYZ to MSDS and Get Shape Source: https://github.com/colour-science/colour/blob/develop/README.rst Converts CIE XYZ colourspace values to Multispectral Data Structure (MSDS) and returns the shape of the result. ```python import colour colour.XYZ_to_msds( [ [0.20654008, 0.12197225, 0.05136952], [0.14223761, 0.23042375, 0.10498415], [0.07820260, 0.06157595, 0.28106183], ] ).shape ``` ```text (3, 421) ``` -------------------------------- ### List Delta E Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists all available methods for colour difference computation. ```python import colour sorted(colour.DELTA_E_METHODS) ``` ```text ['CAM02-LCD', 'CAM02-SCD', 'CAM02-UCS', 'CAM16-LCD', 'CAM16-SCD', 'CAM16-UCS', 'CIE 1976', 'CIE 1994', 'CIE 2000', 'CMC', 'DIN99', 'HyAB', 'HyCH', 'ITP', 'cie1976', 'cie1994', 'cie2000'] ``` -------------------------------- ### List Contrast Sensitivity Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists all available methods for contrast sensitivity function computation. ```python import colour sorted(colour.CONTRAST_SENSITIVITY_METHODS) ``` ```text ['Barten 1999'] ``` -------------------------------- ### Convert xyY to XYZ using a list Source: https://github.com/colour-science/colour/blob/develop/docs/basics.rst Demonstrates converting xyY colourspace values to XYZ colourspace values using a list input. ```python xyY = [0.4316, 0.3777, 0.1008] colour.xyY_to_XYZ(xyY) ``` ```text array([0.11518475, 0.1008 , 0.05089373]) ``` -------------------------------- ### Normalize Spectral Distribution Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Normalizes a spectral distribution by an arbitrary factor. The first example normalizes to a default factor (sum of values), and the second normalizes to a factor of 100. ```python print(sd.normalise().values) print(sd.normalise(100).values) ``` -------------------------------- ### Convert xyY to XYZ using a tuple Source: https://github.com/colour-science/colour/blob/develop/docs/basics.rst Demonstrates converting xyY colourspace values to XYZ colourspace values using a tuple input. ```python import colour xyY = (0.4316, 0.3777, 0.1008) colour.xyY_to_XYZ(xyY) ``` ```text array([0.11518475, 0.1008 , 0.05089373]) ``` -------------------------------- ### List Yellowness Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists all available methods for yellowness computation. ```python import colour sorted(colour.YELLOWNESS_METHODS) ``` ```text ['ASTM D1925', 'ASTM E313', 'ASTM E313 Alternative'] ``` -------------------------------- ### Get ITU-T H.273 Transfer Characteristics Keys Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves the keys for the ITU-T H.273 standard's transfer characteristics dictionary. This allows for querying available transfer functions. ```python import colour colour.TRANSFER_CHARACTERISTICS_ITUTH273.keys() ``` ```text dict_keys([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) ``` -------------------------------- ### Plot Visible Spectrum using Colour Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Applies the default colour style and plots the visible spectrum. Ensure the plotting sub-package is imported. ```python from colour.plotting import * colour_style() plot_visible_spectrum() ``` -------------------------------- ### Get ITU-T H.273 Colour Primaries Keys Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves the keys for the ITU-T H.273 standard's colour primaries dictionary. This is useful for identifying which colour primaries are available. ```python import colour colour.COLOUR_PRIMARIES_ITUTH273.keys() ``` ```text dict_keys([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 22, 23]) ``` -------------------------------- ### List Available CCTF Encodings Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of all supported Colourlight Transfer Function (CCTF) encoding names. No specific setup is required beyond importing the library. ```python import colour sorted(colour.CCTF_ENCODINGS) ``` ```text ['ACEScc', 'ACEScct', 'ACESproxy', 'ARIB STD-B67', 'ARRI LogC3', 'ARRI LogC4', 'Apple Log Profile', 'Blackmagic Film Generation 5', 'Canon Log', 'Canon Log 2', 'Canon Log 3', 'Cineon', 'D-Log', 'DCDM', 'DICOM GSDF', 'DaVinci Intermediate', 'ERIMM RGB', 'F-Log', 'F-Log2', 'Filmic Pro 6', 'Gamma 2.2', 'Gamma 2.4', 'Gamma 2.6', 'ITU-R BT.1886', 'ITU-R BT.2020', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', 'ITU-R BT.709', 'ITU-T H.273 IEC 61966-2', 'ITU-T H.273 Log', 'ITU-T H.273 Log Sqrt', 'ITU-T H.273 ST.428-1', 'L-Log', 'Log2', 'Log3G10', 'Log3G12', 'Mi-Log', 'N-Log', 'PLog', 'Panalog', 'ProPhoto RGB', 'Protune', 'REDLog', 'REDLogFilm', 'RIMM RGB', 'ROMM RGB', 'S-Log', 'S-Log2', 'S-Log3', 'SMPTE 240M', 'ST 2084', 'T-Log', 'V-Log', 'ViperLog', 'sRGB'] ``` -------------------------------- ### Get ITU-T H.273 Matrix Coefficients Keys Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves the keys for the ITU-T H.273 standard's matrix coefficients dictionary. This is used to identify available colour matrix coefficient sets. ```python import colour colour.MATRIX_COEFFICIENTS_ITUTH273.keys() ``` ```text dict_keys([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) ``` -------------------------------- ### List Colour Fidelity Index Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of available methods for Colour Fidelity Index calculation. Requires the 'colour' library. ```python import colour sorted(colour.COLOUR_FIDELITY_INDEX_METHODS) ``` ```text ['ANSI/IES TM-30-18', 'CIE 2017'] ``` -------------------------------- ### Get CCT_to_uv_Ohno2013 Docstring Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Retrieves the docstring for the CCT_to_uv_Ohno2013 function, which calculates CIE UCS uv chromaticity coordinates from correlated color temperature using Ohno (2013) method. Requires CCT_D_uv and cmfs as input. ```python print(colour.temperature.CCT_to_uv_Ohno2013.__doc__) ``` -------------------------------- ### Convert XYZ to ProLab Source: https://github.com/colour-science/colour/blob/develop/README.rst Converts XYZ colourspace values to ProLab colourspace. Requires XYZ values. ```python import colour colour.XYZ_to_ProLab([0.51634019, 0.15469500, 0.06289579]) ``` ```text [ 59.8466286 115.0396354 20.12510352] ``` -------------------------------- ### List Available Chromatic Adaptation Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves and sorts a list of all available chromatic adaptation methods within the 'colour' package. Requires the 'colour' package. ```python import colour sorted(colour.CHROMATIC_ADAPTATION_METHODS) ``` ```text ['CIE 1994', 'CMCCAT2000', 'Fairchild 1990', 'Li 2025', 'Von Kries', 'Zhai 2018', 'vK20'] ``` -------------------------------- ### List Luminance Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists all available methods for luminance computation. ```python sorted(colour.LUMINANCE_METHODS) ``` ```text ['ASTM D1535', 'Abebe 2017', 'CIE 1976', 'Fairchild 2010', 'Fairchild 2011', 'Newhall 1943', 'astm2008', 'cie1976'] ``` -------------------------------- ### Convert Spectral Distribution to sRGB with Verbose Output Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Converts a spectral distribution to sRGB, showing the conversion path and intermediate results. Requires the 'colour' package. ```python import colour sd = colour.SDS_COLOURCHECKERS["ColorChecker N Ohta"]["dark skin"] colour.convert(sd, "Spectral Distribution", "sRGB", verbose={"mode": "Short"}) ``` ```text =============================================================================== * * * [ Conversion Path ] * * * * "sd_to_XYZ" --> "XYZ_to_sRGB" * * * =============================================================================== [0.49034776 0.30185875 0.23587685] ``` -------------------------------- ### Convert XYZ to Oklab Source: https://github.com/colour-science/colour/blob/develop/README.rst Converts XYZ colourspace values to Oklab colourspace. Requires XYZ values. ```python import colour colour.XYZ_to_Oklab([0.20654008, 0.12197225, 0.05136952]) ``` ```text [ 0.51634019 0.154695 0.06289579] ``` -------------------------------- ### List Primitive Methods in Colour Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Lists all available primitive methods within the colour library. Useful for discovering available functionalities. ```python import colour sorted(colour.PRIMITIVE_METHODS) ``` ```text ['Cube', 'Grid'] ``` -------------------------------- ### Type Hints Reference Source: https://github.com/colour-science/colour/blob/develop/docs/colour.hints.rst This section lists the various type hints available in the `colour.hints` module. These are primarily for static analysis and code readability. ```APIDOC ## Type Hints This module provides a collection of type hints to enhance code readability and enable static analysis within the colour science library. ### Available Type Hints: - **Any** - **ArrayLike** - **Callable** - **cast** - **ClassVar** - **Dataclass** - **Dict** - **Domain1** - **Domain10** - **Domain100** - **Domain360** - **Domain100_100_360** - **DType** - **DTypeBoolean** - **DTypeComplex** - **DTypeFloat** - **DTypeInt** - **DTypeReal** - **Generator** - **Iterable** - **Iterator** - **List** - **Literal** - **LiteralCCTFDecoding** - **LiteralCCTFEncoding** - **LiteralChromaticAdaptationTransform** - **LiteralColourspaceModel** - **LiteralDeltaEMethod** - **LiteralEOTF** - **LiteralEOTFInverse** - **LiteralFontScaling** - **LiteralLogDecoding** - **LiteralLogEncoding** - **LiteralLUTReadMethod** - **LiteralLUTWriteMethod** - **LiteralOETF** - **LiteralOETFInverse** - **LiteralOOTF** - **LiteralOOTFInverse** - **LiteralRGBColourspace** - **LiteralWarning** - **Mapping** - **ModuleType** - **NDArray** - **NDArrayBoolean** - **NDArrayComplex** - **NDArrayFloat** - **NDArrayInt** - **NDArrayReal** - **NDArrayStr** - **NewType** - **NoReturn** - **overload** - **PathLike** - **Protocol** - **ProtocolExtrapolator** - **ProtocolInterpolator** - **ProtocolLUTSequenceItem** - **Range1** - **Range10** - **Range100** - **Range360** - **Range100_100_360** - **Real** - **RegexFlag** - **runtime_checkable** - **Self** - **Sequence** - **Set** - **SupportsIndex** - **TextIO** - **Tuple** - **Type** - **TypedDict** - **TypeVar** These type hints are intended for use by developers to improve code quality and maintainability. ``` -------------------------------- ### Available Whiteness Methods Source: https://github.com/colour-science/colour/blob/develop/README.rst Lists the available methods for whiteness computation. ```APIDOC ## Available Whiteness Methods ### Description Retrieves a sorted list of available methods for the `whiteness` function. ### Method `sorted(colour.WHITENESS_METHODS)` ### Response Example ```text ['ASTM E313', 'Berger 1959', 'CIE 2004', 'Ganz 1979', 'Stensby 1968', 'Taube 1960', 'cie2004'] ``` ``` -------------------------------- ### List Available OOTFs Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Returns a sorted list of all available Optical-OETF (OOTFs) defined in the 'colour' library. ```python import colour sorted(colour.OOTFS) ``` ```text [] ``` -------------------------------- ### List Available RGB Colourspaces Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Returns a sorted list of all available RGB colourspaces defined in the 'colour' library. ```python import colour sorted(colour.RGB_COLOURSPACES) ``` ```text ['ACES2065-1', 'ACEScc', 'ACEScct', 'ACEScg', 'ACESproxy', 'ARRI Wide Gamut 3', 'ARRI Wide Gamut 4', 'Adobe RGB (1998)', 'Adobe Wide Gamut RGB', 'Apple RGB', 'Best RGB', 'Beta RGB', 'Blackmagic Wide Gamut', 'CIE RGB', 'CIE XYZ-D65 - Scene-referred', 'Cinema Gamut', 'ColorMatch RGB', 'DCDM XYZ', 'DCI-P3', 'DCI-P3-P', 'DJI D-Gamut', 'DRAGONcolor', 'DRAGONcolor2', 'DaVinci Wide Gamut', 'Display P3', 'Don RGB 4', 'EBU Tech. 3213-E', 'ECI RGB v2', 'ERIMM RGB', 'Ekta Space PS 5', 'F-Gamut', 'F-Gamut C', 'FilmLight E-Gamut', 'FilmLight E-Gamut 2', 'Gamma 1.8 Encoded Rec.709', 'Gamma 2.2 Encoded AP1', 'Gamma 2.2 Encoded AdobeRGB', 'Gamma 2.2 Encoded Rec.709', 'ITU-R BT.2020', 'ITU-R BT.470 - 525', 'ITU-R BT.470 - 625', 'ITU-R BT.709', 'ITU-T H.273 - 22 Unspecified', 'ITU-T H.273 - Generic Film', 'Linear AdobeRGB', 'Linear P3-D65', 'Linear Rec.2020', 'Linear Rec.709 (sRGB)', 'Max RGB', 'N-Gamut', 'NTSC (1953)', 'NTSC (1987)', 'P3-D65', 'PLASA ANSI E1.54', 'Pal/Secam', 'ProPhoto RGB', 'Protune Native', 'REDWideGamutRGB', 'REDcolor', 'REDcolor2', 'REDcolor3', 'REDcolor4', 'RIMM RGB', 'ROMM RGB', 'Russell RGB', 'S-Gamut', 'S-Gamut3', 'S-Gamut3.Cine', 'SMPTE 240M', 'SMPTE C', 'Sharp RGB', 'V-Gamut', 'Venice S-Gamut3', 'Venice S-Gamut3.Cine', 'Xtreme RGB', 'aces', 'adobe1998', 'g18_rec709_scene', 'g22_adobergb_scene', 'g22_ap1_scene', 'g22_rec709_scene', 'lin_adobergb_scene', 'lin_ap0_scene', 'lin_ap1_scene', 'lin_ciexyzd65_scene', 'lin_p3d65_scene', 'lin_rec2020_scene', 'lin_rec709_scene', 'prophoto', 'sRGB', 'sRGB Encoded AP1', 'sRGB Encoded P3-D65', 'sRGB Encoded Rec.709 (sRGB)', 'srgb_ap1_scene', 'srgb_p3d65_scene', 'srgb_rec709_scene'] ``` -------------------------------- ### Calculate RGB Colourspace Volume using Monte Carlo Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Estimates the volume of an RGB colourspace using the Monte Carlo method. Requires the 'colour' library. ```python import colour colour.RGB_colourspace_volume_MonteCarlo(colour.RGB_COLOURSPACE_RGB["sRGB"]) ``` ```text np.float64(821958.30000000005) ``` -------------------------------- ### Convert a list of xyY to XYZ Source: https://github.com/colour-science/colour/blob/develop/docs/basics.rst Demonstrates converting a list of xyY colourspace values to XYZ colourspace values. ```python xyY = [ (0.4316, 0.3777, 0.1008), (0.4316, 0.3777, 0.1008), (0.4316, 0.3777, 0.1008), ] colour.xyY_to_XYZ(xyY) ``` ```text array([[0.11518475, 0.1008 , 0.05089373], [0.11518475, 0.1008 , 0.05089373], [0.11518475, 0.1008 , 0.05089373]]) ``` -------------------------------- ### List Available uv to CCT Conversion Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of available methods for converting uv chromaticity coordinates to Correlated Colour Temperature (CCT). ```python import colour sorted(colour.UV_TO_CCT_METHODS) ``` ```text ['Krystek 1985', 'Ohno 2013', 'Planck 1900', 'Robertson 1968', 'ohno2013', 'robertson1968'] ``` -------------------------------- ### List Colour Datasets Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Prints all available datasets within the colour.colorimetry.datasets module. These datasets include various colour matching functions, illuminants, and light sources. ```python import colour pprint(colour.colorimetry.datasets.__all__) ``` -------------------------------- ### Convert XYZ to hdr-CIELab Source: https://github.com/colour-science/colour/blob/develop/README.rst Converts XYZ colourspace values to the hdr-CIELab colourspace. Requires XYZ values. ```python import colour colour.XYZ_to_hdr_CIELab([0.20654008, 0.12197225, 0.05136952]) ``` ```text [ 51.87002062 60.4763385 32.14551912] ``` -------------------------------- ### Explore Spectral Distribution Objects Source: https://github.com/colour-science/colour/blob/develop/docs/basics.rst Use prefix 'sd_' to discover spectral distribution handling functions in IPython or Jupyter. ```text In [1]: import colour In [2]: colour.sd_ sd_blackbody() sd_gaussian() sd_rayleigh_scattering() sd_zeros sd_CIE_illuminant_D_series() sd_mesopic_luminous_efficiency_function() sd_single_led() sd_CIE_standard_illuminant_A() sd_multi_leds() sd_to_aces_relative_exposure_values() sd_constant() sd_ones() sd_to_XYZ ``` -------------------------------- ### Display Available Colourspace Models Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Prints a tuple of available colourspace models supported by the library. Useful for understanding the range of colour transformations available. ```python # Displaying objects interacting directly with the *CIE XYZ* colourspace. pprint(colour.COLOURSPACE_MODELS) ``` -------------------------------- ### Plot Multiple Blackbody Spectral Distributions Source: https://github.com/colour-science/colour/blob/develop/README.rst Generates and plots spectral distributions for multiple blackbody radiators across a range of temperatures. Requires importing the colour module and all plotting functions. ```python import colour from colour.plotting import * blackbody_sds = [ colour.sd_blackbody(i, colour.SpectralShape(1, 10001, 10)) for i in range(1000, 15000, 1000) ] plot_multi_sds( blackbody_sds, y_label="W / (sr m$^2$) / m", plot_kwargs={\"use_sd_colours\": True, \"normalise_sd_colours\": True}, legend_location="upper right", bounding_box=(0, 1250, 0, 2.5e6), ) ``` ```text (
, ) ``` -------------------------------- ### colour.describe_conversion_path Source: https://github.com/colour-science/colour/blob/develop/docs/colour.graph.rst Describes the automatic conversion path between two colourspaces. ```APIDOC ## colour.describe_conversion_path ### Description Describes the automatic conversion path between two colourspaces. ### Signature describe_conversion_path(colourspace_A, colourspace_B, method='Full, Pyblish') ### Parameters * **colourspace_A** (str) - The input colourspace name. * **colourspace_B** (str) - The output colourspace name. * **method** (str, optional) - The conversion method to use. Defaults to 'Full, Pyblish'. ### Returns * list - A list of colourspaces defining the conversion path. ``` -------------------------------- ### Primitive Methods Source: https://github.com/colour-science/colour/blob/develop/README.rst Lists the available methods for generating geometric primitives. ```APIDOC ## primitive_methods ### Description Lists the available methods for generating geometric primitives. ### Method ```python sorted(colour.PRIMITIVE_METHODS) ``` ### Response Example ```text ['Cube', 'Grid'] ``` ``` -------------------------------- ### List Munsell Value Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of available methods for Munsell value calculation. Requires the 'colour' library. ```python import colour sorted(colour.MUNSELL_VALUE_METHODS) ``` ```text ['ASTM D1535', 'Ladd 1955', 'McCamy 1987', 'Moon 1943', 'Munsell 1933', 'Priest 1920', 'Saunderson 1944', 'astm2008'] ``` -------------------------------- ### Accessing Top-Level API with Colour Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Prints the first five public API attributes available directly from the root 'colour' namespace. This demonstrates how to explore the library's main functionalities. ```python import colour print(colour.__all__[:5] + ["..."]) ``` -------------------------------- ### Oklab Colourspace Conversions Source: https://github.com/colour-science/colour/blob/develop/docs/colour.models.rst Functions for converting between Oklab and XYZ colourspaces. ```APIDOC ## Oklab_to_XYZ ### Description Converts a 'Oklab' colourspace to 'XYZ' colourspace. ### Method `colour.Oklab_to_XYZ(Oklab)` ### Parameters - **Oklab** (array_like): 'Oklab' colourspace. ### Response - **XYZ** (ndarray): 'XYZ' colourspace. ## XYZ_to_Oklab ### Description Converts a 'XYZ' colourspace to 'Oklab' colourspace. ### Method `colour.XYZ_to_Oklab(XYZ)` ### Parameters - **XYZ** (array_like): 'XYZ' colourspace. ### Response - **Oklab** (ndarray): 'Oklab' colourspace. ``` -------------------------------- ### Convert XYZ to CIECAM02 Colour Appearance Model Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Converts XYZ colourspace values to CIECAM02 colour appearance model parameters. Requires the 'colour' package. ```python import colour XYZ = [0.20654008 * 100, 0.12197225 * 100, 0.05136952 * 100] XYZ_w = [95.05, 100.00, 108.88] L_A = 318.31 Y_b = 20.0 colour.XYZ_to_CIECAM02(XYZ, XYZ_w, L_A, Y_b) ``` ```text CAM_Specification_CIECAM02(J=34.434525727858997, C=67.365010921125915, h=22.279164147957076, s=62.814855853327131, Q=177.47124941102123, M=70.024939419291385, H=2.689608534423904, HC=None) ``` -------------------------------- ### XYZ to Kim2009 Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Converts XYZ colourspace values to Kim2009 colour appearance model correlates. Requires XYZ tristimulus values, whitepoint XYZ, adapting luminance, and background luminance. ```python import colour XYZ = [0.20654008 * 100, 0.12197225 * 100, 0.05136952 * 100] XYZ_w = [95.05, 100.00, 108.88] L_A = 318.31 Y_b = 20.0 colour.XYZ_to_Kim2009(XYZ, XYZ_w, L_A) ``` ```text CAM_Specification_Kim2009(J=19.879918542450937, C=55.83905525087696, h=22.013388165090031, s=112.9797935493912, Q=36.309026130161513, M=46.346415858227871, H=2.3543198369639753, HC=None) ``` -------------------------------- ### List Available Luminance Computation Methods Source: https://github.com/colour-science/colour/blob/develop/README.rst Retrieves a sorted list of all available methods for computing luminance. ```python import colour sorted(colour.LUMINANCE_METHODS) ``` ```text ['ASTM D1535', 'Abebe 2017', 'CIE 1976', 'Fairchild 2010', 'Fairchild 2011', 'Newhall 1943', 'astm2008', 'cie1976'] ``` -------------------------------- ### Convert XYZ to Jzazbz Source: https://github.com/colour-science/colour/blob/develop/README.rst Converts XYZ colourspace values to Jzazbz colourspace. Requires XYZ values. ```python import colour colour.XYZ_to_Jzazbz([0.20654008, 0.12197225, 0.05136952]) ``` ```text [ 0.00535048 0.00924302 0.00526007] ``` -------------------------------- ### List Available xy to CCT Conversion Methods Source: https://github.com/colour-science/colour/blob/develop/docs/index.rst Retrieves a sorted list of available methods for converting xy chromaticity coordinates to Correlated Colour Temperature (CCT). ```python import colour sorted(colour.XY_TO_CCT_METHODS) ``` ```text ['CIE Illuminant D Series', 'Hernandez 1999', 'Kang 2002', 'McCamy 1992', 'daylight', 'hernandez1999', 'kang2002', 'mccamy1992'] ``` -------------------------------- ### Available Luminance Methods Source: https://github.com/colour-science/colour/blob/develop/README.rst Lists the available methods for luminance computation. ```APIDOC ## Available Luminance Methods ### Description Retrieves a sorted list of available methods for the `luminance` function. ### Method `sorted(colour.LUMINANCE_METHODS)` ### Response Example ```text ['ASTM D1535', 'Abebe 2017', 'CIE 1976', 'Fairchild 2010', 'Fairchild 2011', 'Newhall 1943', 'astm2008', 'cie1976'] ``` ``` -------------------------------- ### List Colour Rendition Chart Keys Source: https://github.com/colour-science/colour/blob/develop/docs/tutorial.rst Retrieves and prints sorted lists of keys for colour rendition charts, covering both chromaticity coordinates and spectral distributions. Useful for identifying available datasets. ```python # Colour rendition charts chromaticity coordinates. print(sorted(colour.characterisation.CCS_COLOURCHECKERS.keys())) # Colour rendition charts spectral distributions. print(sorted(colour.characterisation.SDS_COLOURCHECKERS.keys())) ```