├── .coveragerc ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.yml │ ├── documentation-improvement.yml │ ├── feature-request.yml │ └── question.yml ├── PULL_REQUEST_TEMPLATE.md ├── funding.yml └── workflows │ ├── continuous-integration-documentation.yml │ ├── continuous-integration-quality-unit-tests.yml │ └── continuous-integration-static-type-checking.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .readthedocs.yaml ├── BIBLIOGRAPHY.bib ├── CHANGES.rst ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.rst ├── CONTRIBUTORS.rst ├── GRANTS ├── LICENSE ├── README.rst ├── SPONSORS.rst ├── THIRD_PARTY ├── TODO.rst ├── colour ├── __init__.py ├── adaptation │ ├── __init__.py │ ├── cie1994.py │ ├── cmccat2000.py │ ├── datasets │ │ ├── __init__.py │ │ └── cat.py │ ├── fairchild1990.py │ ├── fairchild2020.py │ ├── tests │ │ ├── __init__.py │ │ ├── test__init__.py │ │ ├── test_cie1994.py │ │ ├── test_cmccat2000.py │ │ ├── test_fairchild1990.py │ │ ├── test_fairchild2020.py │ │ ├── test_vonkries.py │ │ └── test_zhai2018.py │ ├── vonkries.py │ └── zhai2018.py ├── algebra │ ├── __init__.py │ ├── common.py │ ├── coordinates │ │ ├── __init__.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── test_transformations.py │ │ └── transformations.py │ ├── extrapolation.py │ ├── interpolation.py │ ├── prng.py │ ├── regression.py │ └── tests │ │ ├── __init__.py │ │ ├── test_common.py │ │ ├── test_extrapolation.py │ │ ├── test_interpolation.py │ │ ├── test_prng.py │ │ └── test_regression.py ├── appearance │ ├── __init__.py │ ├── atd95.py │ ├── cam16.py │ ├── ciecam02.py │ ├── ciecam16.py │ ├── hellwig2022.py │ ├── hke.py │ ├── hunt.py │ ├── kim2009.py │ ├── llab.py │ ├── nayatani95.py │ ├── rlab.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_atd95.py │ │ ├── test_cam16.py │ │ ├── test_ciecam02.py │ │ ├── test_ciecam16.py │ │ ├── test_hellwig2022.py │ │ ├── test_hke.py │ │ ├── test_hunt.py │ │ ├── test_kim2009.py │ │ ├── test_llab.py │ │ ├── test_nayatani95.py │ │ ├── test_rlab.py │ │ └── test_zcam.py │ └── zcam.py ├── biochemistry │ ├── __init__.py │ ├── michaelis_menten.py │ └── tests │ │ ├── __init__.py │ │ └── test_michaelis_menten.py ├── blindness │ ├── __init__.py │ ├── datasets │ │ ├── __init__.py │ │ └── machado2010.py │ ├── machado2009.py │ └── tests │ │ ├── __init__.py │ │ └── test_machado2009.py ├── characterisation │ ├── __init__.py │ ├── aces_it.py │ ├── cameras.py │ ├── correction.py │ ├── datasets │ │ ├── __init__.py │ │ ├── aces_it.py │ │ ├── cameras │ │ │ ├── __init__.py │ │ │ └── dslr │ │ │ │ ├── __init__.py │ │ │ │ └── sensitivities.py │ │ ├── colour_checkers │ │ │ ├── __init__.py │ │ │ ├── chromaticity_coordinates.py │ │ │ └── sds.py │ │ ├── displays │ │ │ ├── __init__.py │ │ │ ├── crt │ │ │ │ ├── __init__.py │ │ │ │ └── primaries.py │ │ │ └── lcd │ │ │ │ ├── __init__.py │ │ │ │ └── primaries.py │ │ ├── filters │ │ │ ├── __init__.py │ │ │ └── sds.py │ │ ├── lenses │ │ │ ├── __init__.py │ │ │ └── sds.py │ │ └── rawtoaces │ │ │ ├── 190_Patches.csv │ │ │ ├── AMPAS_ISO_7589_Tungsten.csv │ │ │ └── CANON_EOS_5DMark_II_RGB_Sensitivities.csv │ ├── displays.py │ └── tests │ │ ├── __init__.py │ │ ├── test_aces_it.py │ │ └── test_correction.py ├── colorimetry │ ├── __init__.py │ ├── blackbody.py │ ├── cmfs.py │ ├── correction.py │ ├── datasets │ │ ├── __init__.py │ │ ├── cmfs.py │ │ ├── illuminants │ │ │ ├── __init__.py │ │ │ ├── chromaticity_coordinates.py │ │ │ ├── hunterlab.py │ │ │ ├── sds.py │ │ │ ├── sds_d_illuminant_series.py │ │ │ └── tristimulus_values.py │ │ ├── lefs.py │ │ └── light_sources │ │ │ ├── __init__.py │ │ │ ├── chromaticity_coordinates.py │ │ │ └── sds.py │ ├── dominant.py │ ├── generation.py │ ├── illuminants.py │ ├── lefs.py │ ├── lightness.py │ ├── luminance.py │ ├── photometry.py │ ├── spectrum.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_blackbody.py │ │ ├── test_correction.py │ │ ├── test_dominant.py │ │ ├── test_generation.py │ │ ├── test_illuminants.py │ │ ├── test_lefs.py │ │ ├── test_lightness.py │ │ ├── test_luminance.py │ │ ├── test_photometry.py │ │ ├── test_spectrum.py │ │ ├── test_transformations.py │ │ ├── test_tristimulus_values.py │ │ ├── test_uniformity.py │ │ ├── test_whiteness.py │ │ └── test_yellowness.py │ ├── transformations.py │ ├── tristimulus_values.py │ ├── uniformity.py │ ├── whiteness.py │ └── yellowness.py ├── constants │ ├── __init__.py │ ├── cie.py │ ├── codata.py │ └── common.py ├── continuous │ ├── __init__.py │ ├── abstract.py │ ├── multi_signals.py │ ├── signal.py │ └── tests │ │ ├── __init__.py │ │ ├── test_abstract.py │ │ ├── test_multi_signal.py │ │ └── test_signal.py ├── contrast │ ├── __init__.py │ ├── barten1999.py │ └── tests │ │ ├── __init__.py │ │ └── test_barten1999.py ├── corresponding │ ├── __init__.py │ ├── datasets │ │ ├── __init__.py │ │ └── breneman1987.py │ ├── prediction.py │ └── tests │ │ ├── __init__.py │ │ └── test_prediction.py ├── difference │ ├── __init__.py │ ├── cam02_ucs.py │ ├── cam16_ucs.py │ ├── delta_e.py │ ├── din99.py │ ├── huang2015.py │ ├── stress.py │ └── tests │ │ ├── __init__.py │ │ ├── test__init__.py │ │ ├── test_cam02_ucs.py │ │ ├── test_cam16_ucs.py │ │ ├── test_delta_e.py │ │ ├── test_din99.py │ │ ├── test_huang2015.py │ │ └── test_stress.py ├── examples │ ├── adaptation │ │ ├── examples_cie1994.py │ │ ├── examples_cmccat2000.py │ │ ├── examples_fairchild1990.py │ │ ├── examples_vonkries.py │ │ └── examples_zhai2018.py │ ├── algebra │ │ └── examples_interpolation.py │ ├── appearance │ │ ├── examples_atd95.py │ │ ├── examples_cam16.py │ │ ├── examples_ciecam02.py │ │ ├── examples_ciecam16.py │ │ ├── examples_hellwig2022.py │ │ ├── examples_hke.py │ │ ├── examples_hunt.py │ │ ├── examples_kim2009.py │ │ ├── examples_llab.py │ │ ├── examples_nayatani95.py │ │ ├── examples_rlab.py │ │ └── examples_zcam.py │ ├── blindness │ │ └── examples_machado2009.py │ ├── characterisation │ │ ├── examples_aces_it.py │ │ ├── examples_colour_checkers.py │ │ └── examples_correction.py │ ├── colorimetry │ │ ├── examples_blackbody.py │ │ ├── examples_cmfs.py │ │ ├── examples_correction.py │ │ ├── examples_dominant.py │ │ ├── examples_illuminants.py │ │ ├── examples_lefs.py │ │ ├── examples_light_sources.py │ │ ├── examples_lightness.py │ │ ├── examples_luminance.py │ │ ├── examples_photometry.py │ │ ├── examples_spectrum.py │ │ ├── examples_tristimulus_values.py │ │ ├── examples_uniformity.py │ │ ├── examples_whiteness.py │ │ └── examples_yellowness.py │ ├── contrast │ │ └── examples_contrast.py │ ├── corresponding │ │ └── examples_prediction.py │ ├── difference │ │ └── examples_delta_e.py │ ├── examples_colour.py │ ├── geometry │ │ └── examples_geometry.py │ ├── graph │ │ └── examples_graph.py │ ├── io │ │ ├── examples_ctl.py │ │ ├── examples_fichet2021.py │ │ ├── examples_ies_tm2714.py │ │ ├── examples_luts.py │ │ ├── examples_tabular.py │ │ └── resources │ │ │ ├── TM27 Sample Spectral Data.spdx │ │ │ └── babelcolor_average.csv │ ├── models │ │ ├── examples_cmyk.py │ │ ├── examples_cylindrical.py │ │ ├── examples_derivation.py │ │ ├── examples_ictcp.py │ │ ├── examples_models.py │ │ ├── examples_prismatic.py │ │ ├── examples_rgb.py │ │ ├── examples_transfer_functions.py │ │ ├── examples_ycbcr.py │ │ └── examples_ycocg.py │ ├── notation │ │ ├── examples_hexadecimal.py │ │ └── examples_munsell.py │ ├── phenomena │ │ └── examples_rayleigh.py │ ├── plotting │ │ ├── examples_blindness.py │ │ ├── examples_characterisation_plots.py │ │ ├── examples_colorimetry_plots.py │ │ ├── examples_common_plots.py │ │ ├── examples_corresponding.py │ │ ├── examples_diagrams_plots.py │ │ ├── examples_models_plots.py │ │ ├── examples_notation_plots.py │ │ ├── examples_phenomena_plots.py │ │ ├── examples_quality_plots.py │ │ ├── examples_section_plots.py │ │ ├── examples_temperature_plots.py │ │ ├── examples_tm3018.py │ │ ├── examples_volume_plots.py │ │ └── resources │ │ │ └── Ishihara_Colour_Blindness_Test_Plate_3.png │ ├── quality │ │ ├── examples_cfi.py │ │ ├── examples_cqs.py │ │ ├── examples_cri.py │ │ └── examples_ssi.py │ ├── recovery │ │ ├── examples_jakob2019.py │ │ ├── examples_jiang2013.py │ │ ├── examples_mallet2019.py │ │ ├── examples_meng2015.py │ │ ├── examples_otsu2018.py │ │ └── examples_smits1999.py │ ├── temperature │ │ └── examples_cct.py │ └── volume │ │ └── examples_rgb.py ├── geometry │ ├── __init__.py │ ├── ellipse.py │ ├── intersection.py │ ├── primitives.py │ ├── section.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_ellipse.py │ │ ├── test_intersection.py │ │ ├── test_primitives.py │ │ ├── test_section.py │ │ └── test_vertices.py │ └── vertices.py ├── graph │ ├── __init__.py │ ├── conversion.py │ └── tests │ │ ├── __init__.py │ │ └── test_conversion.py ├── hints │ └── __init__.py ├── io │ ├── __init__.py │ ├── ctl.py │ ├── fichet2021.py │ ├── image.py │ ├── luts │ │ ├── __init__.py │ │ ├── cinespace_csp.py │ │ ├── common.py │ │ ├── iridas_cube.py │ │ ├── lut.py │ │ ├── operator.py │ │ ├── resolve_cube.py │ │ ├── sequence.py │ │ ├── sony_spi1d.py │ │ ├── sony_spi3d.py │ │ ├── sony_spimtx.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── resources │ │ │ ├── cinespace │ │ │ │ ├── ACES_Proxy_10_to_ACES.csp │ │ │ │ ├── Colour_Correct.csp │ │ │ │ ├── Demo.csp │ │ │ │ ├── Explicit_Domain.csp │ │ │ │ ├── RGB_1_0.5_0.25.csp │ │ │ │ ├── Ragged_Domain.csp │ │ │ │ ├── Three_Dimensional_Table.csp │ │ │ │ ├── Three_Dimensional_Table_With_Shaper.csp │ │ │ │ ├── Uncommon_3x1D_With_Pre_Lut.csp │ │ │ │ ├── Unit.csp │ │ │ │ └── eotf_sRGB_3D.csp │ │ │ ├── iridas_cube │ │ │ │ ├── ACES_Proxy_10_to_ACES.cube │ │ │ │ ├── Colour_Correct.cube │ │ │ │ ├── Demo.cube │ │ │ │ ├── RGB_1_0.5_0.25.cube │ │ │ │ ├── Three_Dimensional_Table.cube │ │ │ │ ├── Unit.cube │ │ │ │ └── eotf_sRGB_3D.cube │ │ │ ├── resolve_cube │ │ │ │ ├── ACES_Proxy_10_to_ACES.cube │ │ │ │ ├── Colour_Correct.cube │ │ │ │ ├── Demo.cube │ │ │ │ ├── LogC_Video.cube │ │ │ │ ├── RGB_1_0.5_0.25.cube │ │ │ │ ├── Three_Dimensional_Table.cube │ │ │ │ ├── Three_Dimensional_Table_With_Shaper.cube │ │ │ │ ├── Unit.cube │ │ │ │ └── eotf_sRGB_3D.cube │ │ │ ├── sony_spi1d │ │ │ │ ├── Exception_Raising.spi1d │ │ │ │ ├── eotf_sRGB_1D.spi1d │ │ │ │ └── eotf_sRGB_3x1D.spi1d │ │ │ ├── sony_spi3d │ │ │ │ ├── Colour_Correct.spi3d │ │ │ │ └── Colour_Correct_Unordered.spi3d │ │ │ └── sony_spimtx │ │ │ │ ├── Matrix_Offset.spimtx │ │ │ │ ├── dt.spimtx │ │ │ │ └── p3_to_xyz16.spimtx │ │ │ ├── test__init__.py │ │ │ ├── test_cinespace_csp.py │ │ │ ├── test_common.py │ │ │ ├── test_iridas_cube.py │ │ │ ├── test_lut.py │ │ │ ├── test_operator.py │ │ │ ├── test_resolve_cube.py │ │ │ ├── test_sequence.py │ │ │ ├── test_sony_spi1d.py │ │ │ ├── test_sony_spi3d.py │ │ │ └── test_sony_spimtx.py │ ├── ocio.py │ ├── tabular.py │ ├── tests │ │ ├── __init__.py │ │ ├── resources │ │ │ ├── Adjust_Exposure_Float.ctl │ │ │ ├── Adjust_Exposure_Float3.ctl │ │ │ ├── BiSpectral.exr │ │ │ ├── CMS_Test_Pattern.exr │ │ │ ├── Colour_Logo.png │ │ │ ├── D65.exr │ │ │ ├── ESPD2021_0104_231446.xls │ │ │ ├── Fluorescent.spdx │ │ │ ├── Invalid.spdx │ │ │ ├── Ohta1997.exr │ │ │ ├── Overflowing_Gradient.png │ │ │ ├── Polarised.exr │ │ │ ├── RANDOM_001_02._3262K.csv │ │ │ ├── Single_Channel.exr │ │ │ ├── X-Rite_Digital_Colour_Checker.txt │ │ │ ├── colorchecker_n_ohta.csv │ │ │ ├── colorchecker_n_ohta_transposed.csv │ │ │ ├── config-aces-reference.ocio.yaml │ │ │ ├── linss2_10e_5.csv │ │ │ └── uprtek.xls.txt │ │ ├── test_ctl.py │ │ ├── test_fichet2021.py │ │ ├── test_image.py │ │ ├── test_ocio.py │ │ ├── test_tabular.py │ │ ├── test_tm2714.py │ │ ├── test_uprtek_sekonic.py │ │ └── test_xrite.py │ ├── tm2714.py │ ├── uprtek_sekonic.py │ └── xrite.py ├── models │ ├── __init__.py │ ├── cam02_ucs.py │ ├── cam16_ucs.py │ ├── cie_lab.py │ ├── cie_luv.py │ ├── cie_ucs.py │ ├── cie_uvw.py │ ├── cie_xyy.py │ ├── common.py │ ├── datasets │ │ ├── __init__.py │ │ ├── macadam_ellipses.py │ │ └── pointer_gamut.py │ ├── din99.py │ ├── hdr_cie_lab.py │ ├── hdr_ipt.py │ ├── hunter_lab.py │ ├── hunter_rdab.py │ ├── icacb.py │ ├── igpgtg.py │ ├── ipt.py │ ├── jzazbz.py │ ├── oklab.py │ ├── osa_ucs.py │ ├── prolab.py │ ├── ragoo2021.py │ ├── rgb │ │ ├── __init__.py │ │ ├── cmyk.py │ │ ├── common.py │ │ ├── cylindrical.py │ │ ├── datasets │ │ │ ├── __init__.py │ │ │ ├── aces.py │ │ │ ├── adobe_rgb_1998.py │ │ │ ├── adobe_wide_gamut_rgb.py │ │ │ ├── apple_rgb.py │ │ │ ├── arri.py │ │ │ ├── best_rgb.py │ │ │ ├── beta_rgb.py │ │ │ ├── blackmagic_design.py │ │ │ ├── canon_cinema_gamut.py │ │ │ ├── cie_rgb.py │ │ │ ├── color_interop_forum.py │ │ │ ├── color_match_rgb.py │ │ │ ├── davinci_wide_gamut.py │ │ │ ├── dcdm_xyz.py │ │ │ ├── dci_p3.py │ │ │ ├── display_p3.py │ │ │ ├── dji_d_gamut.py │ │ │ ├── don_rgb_4.py │ │ │ ├── ebu_3213_e.py │ │ │ ├── eci_rgb_v2.py │ │ │ ├── ekta_space_ps5.py │ │ │ ├── filmlight.py │ │ │ ├── fujifilm.py │ │ │ ├── gopro.py │ │ │ ├── itur_bt_2020.py │ │ │ ├── itur_bt_470.py │ │ │ ├── itur_bt_709.py │ │ │ ├── itut_h_273.py │ │ │ ├── max_rgb.py │ │ │ ├── nikon_n_gamut.py │ │ │ ├── ntsc.py │ │ │ ├── p3_d65.py │ │ │ ├── pal_secam.py │ │ │ ├── panasonic_v_gamut.py │ │ │ ├── plasa_ansi_e154.py │ │ │ ├── red.py │ │ │ ├── rimm_romm_rgb.py │ │ │ ├── russell_rgb.py │ │ │ ├── sharp.py │ │ │ ├── smpte_240m.py │ │ │ ├── smpte_c.py │ │ │ ├── sony.py │ │ │ ├── srgb.py │ │ │ ├── tests │ │ │ │ ├── __init__.py │ │ │ │ └── test__init__.py │ │ │ └── xtreme_rgb.py │ │ ├── derivation.py │ │ ├── hanbury2003.py │ │ ├── ictcp.py │ │ ├── itut_h_273.py │ │ ├── prismatic.py │ │ ├── rgb_colourspace.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ ├── test_cmyk.py │ │ │ ├── test_common.py │ │ │ ├── test_cylindrical.py │ │ │ ├── test_derivation.py │ │ │ ├── test_hanbury2003.py │ │ │ ├── test_ictcp.py │ │ │ ├── test_itut_h_273.py │ │ │ ├── test_prismatic.py │ │ │ ├── test_rgb_colourspace.py │ │ │ ├── test_ycbcr.py │ │ │ └── test_ycocg.py │ │ ├── transfer_functions │ │ │ ├── __init__.py │ │ │ ├── aces.py │ │ │ ├── apple_log_profile.py │ │ │ ├── arib_std_b67.py │ │ │ ├── arri.py │ │ │ ├── blackmagic_design.py │ │ │ ├── canon.py │ │ │ ├── cineon.py │ │ │ ├── common.py │ │ │ ├── davinci_intermediate.py │ │ │ ├── dcdm.py │ │ │ ├── dicom_gsdf.py │ │ │ ├── dji_d_log.py │ │ │ ├── exponent.py │ │ │ ├── filmic_pro.py │ │ │ ├── filmlight_t_log.py │ │ │ ├── fujifilm_f_log.py │ │ │ ├── gamma.py │ │ │ ├── gopro.py │ │ │ ├── itur_bt_1361.py │ │ │ ├── itur_bt_1886.py │ │ │ ├── itur_bt_2020.py │ │ │ ├── itur_bt_2100.py │ │ │ ├── itur_bt_601.py │ │ │ ├── itur_bt_709.py │ │ │ ├── itut_h_273.py │ │ │ ├── leica_l_log.py │ │ │ ├── linear.py │ │ │ ├── log.py │ │ │ ├── nikon_n_log.py │ │ │ ├── panalog.py │ │ │ ├── panasonic_v_log.py │ │ │ ├── pivoted_log.py │ │ │ ├── red.py │ │ │ ├── rimm_romm_rgb.py │ │ │ ├── smpte_240m.py │ │ │ ├── sony.py │ │ │ ├── srgb.py │ │ │ ├── st_2084.py │ │ │ ├── tests │ │ │ │ ├── __init__.py │ │ │ │ ├── test__init__.py │ │ │ │ ├── test_aces.py │ │ │ │ ├── test_apple_log_profile.py │ │ │ │ ├── test_arib_std_b67.py │ │ │ │ ├── test_arri.py │ │ │ │ ├── test_blackmagic_design.py │ │ │ │ ├── test_canon.py │ │ │ │ ├── test_cineon.py │ │ │ │ ├── test_common.py │ │ │ │ ├── test_davinci_intermediate.py │ │ │ │ ├── test_dcdm.py │ │ │ │ ├── test_dicom_gsdf.py │ │ │ │ ├── test_dji_d_log.py │ │ │ │ ├── test_exponent.py │ │ │ │ ├── test_filmic_pro.py │ │ │ │ ├── test_filmlight_t_log.py │ │ │ │ ├── test_fujifilm_f_log.py │ │ │ │ ├── test_gamma.py │ │ │ │ ├── test_gopro.py │ │ │ │ ├── test_itur_bt_1361.py │ │ │ │ ├── test_itur_bt_1886.py │ │ │ │ ├── test_itur_bt_2020.py │ │ │ │ ├── test_itur_bt_2100.py │ │ │ │ ├── test_itur_bt_601.py │ │ │ │ ├── test_itur_bt_709.py │ │ │ │ ├── test_itut_h_273.py │ │ │ │ ├── test_leica_l_log.py │ │ │ │ ├── test_linear.py │ │ │ │ ├── test_log.py │ │ │ │ ├── test_nikon_n_log.py │ │ │ │ ├── test_panalog.py │ │ │ │ ├── test_panasonic_vlog.py │ │ │ │ ├── test_pivoted_log.py │ │ │ │ ├── test_red.py │ │ │ │ ├── test_rimm_romm_rgb.py │ │ │ │ ├── test_smpte_240m.py │ │ │ │ ├── test_sony.py │ │ │ │ ├── test_srgb.py │ │ │ │ ├── test_st_2084.py │ │ │ │ └── test_viper_log.py │ │ │ └── viper_log.py │ │ ├── ycbcr.py │ │ └── ycocg.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_cam02_ucs.py │ │ ├── test_cam16_ucs.py │ │ ├── test_cie_lab.py │ │ ├── test_cie_luv.py │ │ ├── test_cie_ucs.py │ │ ├── test_cie_uvw.py │ │ ├── test_cie_xyy.py │ │ ├── test_common.py │ │ ├── test_din99.py │ │ ├── test_hdr_cie_lab.py │ │ ├── test_hdr_ipt.py │ │ ├── test_hunter_lab.py │ │ ├── test_hunter_rdab.py │ │ ├── test_icacb.py │ │ ├── test_igpgtg.py │ │ ├── test_ipt.py │ │ ├── test_jzazbz.py │ │ ├── test_oklab.py │ │ ├── test_osa_ucs.py │ │ ├── test_prolab.py │ │ ├── test_ragoo2021.py │ │ └── test_yrg.py │ └── yrg.py ├── notation │ ├── __init__.py │ ├── css_color_3.py │ ├── datasets │ │ ├── __init__.py │ │ ├── css_color_3.py │ │ └── munsell │ │ │ ├── __init__.py │ │ │ ├── all.py │ │ │ ├── experimental.py │ │ │ └── real.py │ ├── hexadecimal.py │ ├── munsell.py │ └── tests │ │ ├── __init__.py │ │ ├── test_css_color_3.py │ │ ├── test_hexadecimal.py │ │ └── test_munsell.py ├── phenomena │ ├── __init__.py │ ├── rayleigh.py │ └── tests │ │ ├── __init__.py │ │ └── test_rayleigh.py ├── plotting │ ├── __init__.py │ ├── blindness.py │ ├── characterisation.py │ ├── colorimetry.py │ ├── common.py │ ├── conftest.py │ ├── corresponding.py │ ├── datasets │ │ ├── __init__.py │ │ └── astm_g_173.py │ ├── diagrams.py │ ├── graph.py │ ├── models.py │ ├── notation.py │ ├── phenomena.py │ ├── quality.py │ ├── section.py │ ├── temperature.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_blindness.py │ │ ├── test_characterisation.py │ │ ├── test_colorimetry.py │ │ ├── test_common.py │ │ ├── test_corresponding.py │ │ ├── test_diagrams.py │ │ ├── test_graph.py │ │ ├── test_models.py │ │ ├── test_notation.py │ │ ├── test_phenomena.py │ │ ├── test_quality.py │ │ ├── test_section.py │ │ ├── test_temperature.py │ │ └── test_volume.py │ ├── tm3018 │ │ ├── __init__.py │ │ ├── components.py │ │ ├── report.py │ │ ├── resources │ │ │ └── CVG_Background.jpg │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── test_components.py │ │ │ └── test_report.py │ └── volume.py ├── py.typed ├── quality │ ├── __init__.py │ ├── cfi2017.py │ ├── cqs.py │ ├── cri.py │ ├── datasets │ │ ├── __init__.py │ │ ├── tcs.py │ │ ├── tcs_cfi2017_1_nm.csv.gz │ │ ├── tcs_cfi2017_5_nm.csv.gz │ │ └── vs.py │ ├── ssi.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_cfi2017.py │ │ ├── test_cqs.py │ │ ├── test_cri.py │ │ ├── test_ssi.py │ │ └── test_tm3018.py │ └── tm3018.py ├── recovery │ ├── __init__.py │ ├── datasets │ │ ├── __init__.py │ │ ├── dyer2017.py │ │ ├── mallett2019.py │ │ ├── otsu2018.py │ │ └── smits1999.py │ ├── jakob2019.py │ ├── jiang2013.py │ ├── mallett2019.py │ ├── meng2015.py │ ├── otsu2018.py │ ├── smits1999.py │ └── tests │ │ ├── __init__.py │ │ ├── test__init__.py │ │ ├── test_jakob2019.py │ │ ├── test_jiang2013.py │ │ ├── test_mallett2019.py │ │ ├── test_meng2015.py │ │ ├── test_otsu2018.py │ │ └── test_smits1999.py ├── temperature │ ├── __init__.py │ ├── cie_d.py │ ├── hernandez1999.py │ ├── kang2002.py │ ├── krystek1985.py │ ├── mccamy1992.py │ ├── ohno2013.py │ ├── planck1900.py │ ├── robertson1968.py │ └── tests │ │ ├── __init__.py │ │ ├── test_cie_d.py │ │ ├── test_hernandez1999.py │ │ ├── test_kang2002.py │ │ ├── test_krystek1985.py │ │ ├── test_mccamy1992.py │ │ ├── test_ohno2013.py │ │ ├── test_planck1900.py │ │ └── test_robertson1968.py ├── utilities │ ├── __init__.py │ ├── array.py │ ├── callback.py │ ├── common.py │ ├── deprecation.py │ ├── documentation.py │ ├── metrics.py │ ├── network.py │ ├── requirements.py │ ├── structures.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_array.py │ │ ├── test_callback.py │ │ ├── test_common.py │ │ ├── test_deprecated.py │ │ ├── test_deprecation.py │ │ ├── test_documentation.py │ │ ├── test_metrics.py │ │ ├── test_network.py │ │ ├── test_structures.py │ │ └── test_verbose.py │ └── verbose.py └── volume │ ├── __init__.py │ ├── datasets │ ├── __init__.py │ └── optimal_colour_stimuli.py │ ├── macadam_limits.py │ ├── mesh.py │ ├── pointer_gamut.py │ ├── rgb.py │ ├── spectrum.py │ └── tests │ ├── __init__.py │ ├── test_macadam_limits.py │ ├── test_mesh.py │ ├── test_pointer_gamut.py │ ├── test_rgb.py │ └── test_spectrum.py ├── docs ├── Makefile ├── _static │ ├── Logo_Dark_001.svg │ ├── Logo_Light_001.svg │ ├── Logo_Medium_001.png │ └── Logo_Small_001.png ├── _templates │ └── class.rst ├── advanced.rst ├── basics.rst ├── bibliography.bib ├── bibliography.rst ├── colour.adaptation.rst ├── colour.algebra.rst ├── colour.appearance.rst ├── colour.biochemistry.rst ├── colour.blindness.rst ├── colour.characterisation.rst ├── colour.colorimetry.rst ├── colour.constants.rst ├── colour.continuous.rst ├── colour.contrast.rst ├── colour.corresponding.rst ├── colour.difference.rst ├── colour.geometry.rst ├── colour.graph.rst ├── colour.hints.rst ├── colour.io.rst ├── colour.models.rst ├── colour.notation.rst ├── colour.phenomena.rst ├── colour.plotting.rst ├── colour.quality.rst ├── colour.recovery.rst ├── colour.rst ├── colour.temperature.rst ├── colour.utilities.rst ├── colour.volume.rst ├── conf.py ├── how-to.rst ├── index.rst ├── make.bat ├── reference.rst ├── requirements.txt ├── tutorial.rst └── user-guide.rst ├── pyproject.toml ├── requirements.txt ├── tasks.py └── utilities ├── export_todo.py ├── generate_plots.py ├── literalise.py ├── mock_for_colour.py └── unicode_to_ascii.py /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | source = colour 3 | concurrency = multiprocessing 4 | sigterm = True 5 | [report] 6 | exclude_lines = 7 | if TYPE_CHECKING: 8 | if __name__ == .__main__.: 9 | if typing.TYPE_CHECKING: 10 | pass 11 | pragma: no cover 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: Report an issue or a bug. 3 | title: "[BUG]: << Please use a comprehensive title... >>" 4 | labels: [Defect] 5 | 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: > 10 | Thank you for taking the time to file a bug report. Before continuing, please take some time to check the existing [issues](https://github.com/colour-science/colour/issues) and also the [draft release notes](https://gist.github.com/KelSolaar/4a6ebe9ec3d389f0934b154fec8df51d). 11 | The issue could already be fixed in the [develop](https://github.com/colour-science/colour) branch. If you have an installation problem, the [installation guide](https://www.colour-science.org/installation-guide/) describes the recommended process. 12 | 13 | - type: textarea 14 | attributes: 15 | label: "Description" 16 | description: > 17 | Please describe the issue in a few short sentences. 18 | validations: 19 | required: true 20 | 21 | - type: textarea 22 | attributes: 23 | label: "Code for Reproduction" 24 | description: > 25 | If possible, please provide a minimum self-contained example reproducing the issue. 26 | placeholder: | 27 | << Your code here... >> 28 | render: python 29 | 30 | - type: textarea 31 | attributes: 32 | label: "Exception Message" 33 | description: > 34 | If any, please paste the *full* exception message. 35 | placeholder: | 36 | << Full traceback starting from `Traceback (most recent call last):`... >> 37 | render: shell 38 | 39 | - type: textarea 40 | attributes: 41 | label: "Environment Information" 42 | description: If possible, please paste the output from `import colour; colour.utilities.describe_environment()`. 43 | render: shell 44 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation-improvement.yml: -------------------------------------------------------------------------------- 1 | name: Documentation Improvement 2 | description: Report a documentation improvement. 3 | title: "[DOCUMENTATION]: << Please use a comprehensive title... >>" 4 | labels: [Documentation] 5 | 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: > 10 | Thank you for taking the time to file a documentation improvement report. Before continuing, please take some time to check the existing [issues](https://github.com/colour-science/colour/issues). 11 | 12 | - type: input 13 | attributes: 14 | label: Documentation Link 15 | description: > 16 | Please link to any documentation or examples that you are referencing. Suggested improvements should be based on the [development version of the documentation](https://colour.readthedocs.io/en/develop/). 17 | placeholder: > 18 | << https://colour.readthedocs.io/en/develop/... >> 19 | validations: 20 | required: true 21 | 22 | - type: textarea 23 | attributes: 24 | label: Description 25 | description: > 26 | Please describe what is missing, unclear or incorrect. 27 | validations: 28 | required: true 29 | 30 | - type: textarea 31 | attributes: 32 | label: Suggested Improvement 33 | description: > 34 | Please describe how the documentation could be improved. 35 | 36 | - type: textarea 37 | attributes: 38 | label: "Environment Information" 39 | description: If possible, please paste the output from `import colour; colour.utilities.describe_environment()`. 40 | render: shell 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: Suggest a new feature to implement. 3 | title: "[FEATURE]: << Please use a comprehensive title... >>" 4 | labels: [Feature] 5 | 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: > 10 | Thank you for taking the time to file a feature request. Before continuing, please take some time to check the existing [issues](https://github.com/colour-science/colour/issues) and also the [draft release notes](https://gist.github.com/KelSolaar/4a6ebe9ec3d389f0934b154fec8df51d). 11 | 12 | - type: textarea 13 | attributes: 14 | label: "Description" 15 | description: > 16 | Please describe the new feature in a few short sentences. 17 | validations: 18 | required: true 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.yml: -------------------------------------------------------------------------------- 1 | name: Question 2 | description: Ask a question. 3 | title: "[DISCUSSION]: << Please use a comprehensive title... >>" 4 | labels: [Discussion] 5 | 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: Thank you for taking the time to ask a question or discuss. Before continuing, we would be glad if you were to start this discussion in the dedicated [discussions](https://github.com/colour-science/colour/discussions) area. 10 | 11 | - type: textarea 12 | attributes: 13 | label: "Question" 14 | description: > 15 | If you are still here, please consider using the dedicated [discussions](https://github.com/colour-science/colour/discussions) area. 16 | placeholder: > 17 | << The discussions area is this way: https://github.com/colour-science/colour/discussions... >> 18 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | # Summary 8 | 9 | 10 | 11 | # Preflight 12 | 13 | 14 | 15 | **Code Style and Quality** 16 | 17 | - [ ] Unit tests have been implemented and passed. 18 | - [ ] Pyright static checking has been run and passed. 19 | - [ ] Pre-commit hooks have been run and passed. 20 | - [ ] New transformations have been added to the _Automatic Colour Conversion Graph_. 21 | - [ ] New transformations have been exported to the relevant namespaces, e.g. `colour`, `colour.models`. 22 | 23 | 24 | 25 | 26 | **Documentation** 27 | 28 | - [ ] New features are documented along with examples if relevant. 29 | - [ ] The documentation is [Sphinx](https://www.sphinx-doc.org/en/master/) and [numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) compliant. 30 | 31 | 34 | -------------------------------------------------------------------------------- /.github/funding.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: colour-science # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/workflows/continuous-integration-documentation.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration - Documentation 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | continuous-integration-documentation: 7 | name: ${{ matrix.os }} - Python ${{ matrix.python-version }} 8 | strategy: 9 | matrix: 10 | os: [ubuntu-latest] 11 | python-version: [3.13] 12 | fail-fast: false 13 | runs-on: ${{ matrix.os }} 14 | steps: 15 | - uses: actions/checkout@v4 16 | - name: Environment Variables 17 | run: | 18 | echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV 19 | echo "CI_PACKAGE=colour" >> $GITHUB_ENV 20 | echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV 21 | echo "MPLBACKEND=AGG" >> $GITHUB_ENV 22 | echo "COLOUR_SCIENCE__DOCUMENTATION_BUILD=True" >> $GITHUB_ENV 23 | shell: bash 24 | - name: Set up Python ${{ matrix.python-version }} 25 | uses: actions/setup-python@v5 26 | with: 27 | python-version: ${{ matrix.python-version }} 28 | - name: Install Dependencies 29 | run: | 30 | sudo apt-get update 31 | sudo apt-get --yes install graphviz graphviz-dev latexmk texlive-full 32 | - name: Install uv 33 | run: | 34 | pip install uv 35 | shell: bash 36 | - name: Install Package Dependencies 37 | run: | 38 | uv sync --all-extras --no-dev 39 | uv run python -c "import imageio;imageio.plugins.freeimage.download()" 40 | shell: bash 41 | - name: Build Documentation 42 | run: | 43 | uv run invoke docs 44 | shell: bash 45 | - uses: actions/upload-artifact@v4 46 | with: 47 | name: ${{ env.CI_PACKAGE }}-plots 48 | path: | 49 | docs/_static/Basics_*.png 50 | docs/_static/Examples_*.png 51 | docs/_static/Plotting_*.png 52 | docs/_static/Tutorial_*.png 53 | -------------------------------------------------------------------------------- /.github/workflows/continuous-integration-static-type-checking.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration - Static Type Checking 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | continuous-integration-static-type-checking: 7 | name: ${{ matrix.os }} - Python ${{ matrix.python-version }} 8 | strategy: 9 | matrix: 10 | os: [macOS-latest] 11 | python-version: [3.13] 12 | fail-fast: false 13 | runs-on: ${{ matrix.os }} 14 | steps: 15 | - uses: actions/checkout@v4 16 | - name: Environment Variables 17 | run: | 18 | echo "CI_PACKAGE=colour" >> $GITHUB_ENV 19 | shell: bash 20 | - name: Set up Python ${{ matrix.python-version }} 21 | uses: actions/setup-python@v5 22 | with: 23 | python-version: ${{ matrix.python-version }} 24 | - name: Install Dependencies (macOS) 25 | if: matrix.os == 'macOS-latest' 26 | run: | 27 | brew install freeimage graphviz 28 | pip install --no-cache-dir --config-settings="--global-option=build_ext" --config-settings="--global-option=-I$(brew --prefix graphviz)/include/" --config-settings="--global-option=-L$(brew --prefix graphviz)/lib/" pygraphviz 29 | # TODO: Drop when https://github.com/imageio/imageio/issues/628 is addressed 30 | echo "IMAGEIO_FREEIMAGE_LIB=/opt/homebrew/Cellar/freeimage/3.18.0/lib/libfreeimage.3.18.0.dylib" >> $GITHUB_ENV 31 | - name: Install Package Dependencies 32 | run: | 33 | cat requirements.txt | grep -Eo '(^[^#]+)' | xargs -n 1 pip install || true 34 | - name: Static Type Checking 35 | run: | 36 | pyright --threads --skipunannotated 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Common Files 2 | *.egg-info 3 | *.pyc 4 | *.pyo 5 | .DS_Store 6 | .coverage* 7 | CLAUDE.md 8 | uv.lock 9 | 10 | # Common Directories 11 | .fleet/ 12 | .idea/ 13 | .ipynb_checkpoints/ 14 | .python-version 15 | .vs/ 16 | .vscode/ 17 | .sandbox/ 18 | build/ 19 | dist/ 20 | docs/_build/ 21 | docs/generated/ 22 | node_modules/ 23 | references/ 24 | 25 | __pycache__ 26 | 27 | # Project Files 28 | docs/_static/Basics_*.png 29 | docs/_static/Examples_*.png 30 | docs/_static/Plotting_*.png 31 | docs/_static/Tutorial_*.png 32 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: "v5.0.0" 4 | hooks: 5 | - id: check-added-large-files 6 | - id: check-case-conflict 7 | - id: check-merge-conflict 8 | - id: check-symlinks 9 | - id: check-yaml 10 | exclude: config-aces-reference.ocio.yaml 11 | - id: debug-statements 12 | - id: end-of-file-fixer 13 | - id: mixed-line-ending 14 | - id: name-tests-test 15 | args: ["--pytest-test-first"] 16 | - id: requirements-txt-fixer 17 | - id: trailing-whitespace 18 | - repo: https://github.com/codespell-project/codespell 19 | rev: v2.3.0 20 | hooks: 21 | - id: codespell 22 | args: 23 | [ 24 | "--ignore-words-list=co-ordinates,exitance,hart,ist,rIn,socio-economic", 25 | ] 26 | exclude: "BIBLIOGRAPHY.bib|CONTRIBUTORS.rst" 27 | - repo: https://github.com/PyCQA/isort 28 | rev: "5.13.2" 29 | hooks: 30 | - id: isort 31 | - repo: https://github.com/astral-sh/ruff-pre-commit 32 | rev: "v0.8.2" 33 | hooks: 34 | - id: ruff-format 35 | - id: ruff 36 | args: [--fix] 37 | - repo: https://github.com/adamchainz/blacken-docs 38 | rev: 1.19.1 39 | hooks: 40 | - id: blacken-docs 41 | language_version: python3.10 42 | - repo: https://github.com/pre-commit/mirrors-prettier 43 | rev: "v4.0.0-alpha.8" 44 | hooks: 45 | - id: prettier 46 | exclude: config-aces-reference.ocio.yaml 47 | - repo: https://github.com/pre-commit/pygrep-hooks 48 | rev: "v1.10.0" 49 | hooks: 50 | - id: rst-backticks 51 | - id: rst-directive-colons 52 | - id: rst-inline-touching-normal 53 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: ubuntu-20.04 5 | tools: 6 | python: "3.11" 7 | apt_packages: 8 | - graphviz 9 | - graphviz-dev 10 | 11 | sphinx: 12 | configuration: docs/conf.py 13 | 14 | formats: 15 | - htmlzip 16 | - pdf 17 | 18 | python: 19 | install: 20 | - requirements: docs/requirements.txt 21 | -------------------------------------------------------------------------------- /CHANGES.rst: -------------------------------------------------------------------------------- 1 | Colour - Changes 2 | ================ 3 | 4 | Changes 5 | ======= 6 | 7 | The releases changes are available on Github: https://github.com/colour-science/colour/releases 8 | 9 | About 10 | ----- 11 | 12 | | **Colour** by Colour Developers 13 | | Copyright 2013 Colour Developers – `colour-developers@colour-science.org `__ 14 | | This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause 15 | | `https://github.com/colour-science/colour `__ 16 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | Contributing to Colour 5 | ---------------------- 6 | 7 | If you would like to contribute to **Colour**, please refer to the following guide: https://www.colour-science.org/contributing/ 8 | 9 | About 10 | ----- 11 | 12 | | **Colour** by Colour Developers 13 | | Copyright 2013 Colour Developers – `colour-developers@colour-science.org `__ 14 | | This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause 15 | | `https://github.com/colour-science/colour `__ 16 | -------------------------------------------------------------------------------- /GRANTS: -------------------------------------------------------------------------------- 1 | Paul Centore - The Munsell and Kubelka-Munk Toolbox 2 | --------------------------------------------------- 3 | 4 | I hereby give permission to "Colour Developers,” with the email colour-developers@colour-science.org , 5 | to use any current, past, or future versions of my Munsell and Kubelka-Munk Toolbox, 6 | available at http://www.munsellcolourscienceforpainters.com/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html , 7 | as long as a proper reference to its origin is provided in the 8 | Colour Developers' code and documentation, e.g. 9 | 10 | Reference: http://www.munsellcolourscienceforpainters.com/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html 11 | Copyright © 2010-2018 Paul Centore (Gales Ferry, CT 06335, USA); used by permission. 12 | 13 | I also grant permission for the Colour Developers to distribute, 14 | under the BSD-3-Clause, any portions of my code that they use. 15 | 16 | Paul Centore 17 | 18 | 19 | Danny Pascale - BabelColor 20 | -------------------------- 21 | 22 | Montreal, October 4, 2017 23 | 24 | I hereby give permission to "Colour Developers" with the following email 25 | (colour-developers@colour-science.org) to use the "BabelColor ColorChecker data" 26 | from the http://www.babelcolor.com/index_htm_files/ColorChecker_RGB_and_spectra.xls 27 | spreadsheet (2012 version) as long as a proper reference to the data origin is 28 | provided in the code and documentation. 29 | 30 | Reference: 31 | 32 | http://www.babelcolor.com/index_htm_files/ColorChecker_RGB_and_spectra.xls 33 | BabelColor ColorChecker data: Copyright © 2004-2012 Danny Pascale (www.babelcolor.com); used by permission. 34 | 35 | Danny Pascale 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Colour Developers 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 12 | -------------------------------------------------------------------------------- /THIRD_PARTY: -------------------------------------------------------------------------------- 1 | Copyright for portions of project Adobe DNG Software Development Kit (SDK) are 2 | held by Adobe Systems, 2013 as part of project Adobe DNG SDK and are distributed 3 | under the DNG SDK License Agreement. 4 | 5 | Copyright for portions of project The Munsell and Kubelka-Munk Toolbox are 6 | held by Paul Centore, 2010-2018 as part of project The Munsell and Kubelka-Munk 7 | Toolbox and are distributed under the BSD-3-Clause by explicit permission 8 | of the author. 9 | 10 | Copyright for portions of project The ColorChecker (since 1976!) are 11 | held by Danny Pascale, 2004-2012 as part of project The ColorChecker 12 | (since 1976!) and are used by explicit permission of the author. 13 | -------------------------------------------------------------------------------- /colour/adaptation/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .cat import CHROMATIC_ADAPTATION_TRANSFORMS 4 | from .cat import ( 5 | CAT_XYZ_SCALING, 6 | CAT_VON_KRIES, 7 | CAT_BRADFORD, 8 | CAT_SHARP, 9 | CAT_FAIRCHILD, 10 | CAT_CMCCAT97, 11 | CAT_CMCCAT2000, 12 | CAT_CAT02, 13 | CAT_CAT02_BRILL2008, 14 | CAT_CAT16, 15 | CAT_BIANCO2010, 16 | CAT_PC_BIANCO2010, 17 | ) 18 | 19 | __all__ = [ 20 | "CHROMATIC_ADAPTATION_TRANSFORMS", 21 | ] 22 | __all__ += [ 23 | "CAT_XYZ_SCALING", 24 | "CAT_VON_KRIES", 25 | "CAT_BRADFORD", 26 | "CAT_SHARP", 27 | "CAT_FAIRCHILD", 28 | "CAT_CMCCAT97", 29 | "CAT_CMCCAT2000", 30 | "CAT_CAT02", 31 | "CAT_CAT02_BRILL2008", 32 | "CAT_CAT16", 33 | "CAT_BIANCO2010", 34 | "CAT_PC_BIANCO2010", 35 | ] 36 | -------------------------------------------------------------------------------- /colour/adaptation/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/adaptation/tests/__init__.py -------------------------------------------------------------------------------- /colour/algebra/coordinates/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .transformations import ( 4 | cartesian_to_spherical, 5 | spherical_to_cartesian, 6 | cartesian_to_polar, 7 | polar_to_cartesian, 8 | cartesian_to_cylindrical, 9 | cylindrical_to_cartesian, 10 | ) 11 | 12 | __all__ = [ 13 | "cartesian_to_spherical", 14 | "spherical_to_cartesian", 15 | "cartesian_to_polar", 16 | "polar_to_cartesian", 17 | "cartesian_to_cylindrical", 18 | "cylindrical_to_cartesian", 19 | ] 20 | -------------------------------------------------------------------------------- /colour/algebra/coordinates/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/algebra/coordinates/tests/__init__.py -------------------------------------------------------------------------------- /colour/algebra/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/algebra/tests/__init__.py -------------------------------------------------------------------------------- /colour/appearance/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/appearance/tests/__init__.py -------------------------------------------------------------------------------- /colour/biochemistry/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .michaelis_menten import ( 4 | REACTION_RATE_MICHAELISMENTEN_METHODS, 5 | reaction_rate_MichaelisMenten, 6 | SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS, 7 | substrate_concentration_MichaelisMenten, 8 | ) 9 | from .michaelis_menten import ( 10 | reaction_rate_MichaelisMenten_Michaelis1913, 11 | substrate_concentration_MichaelisMenten_Michaelis1913, 12 | reaction_rate_MichaelisMenten_Abebe2017, 13 | substrate_concentration_MichaelisMenten_Abebe2017, 14 | ) 15 | 16 | __all__ = [ 17 | "REACTION_RATE_MICHAELISMENTEN_METHODS", 18 | "reaction_rate_MichaelisMenten", 19 | "SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS", 20 | "substrate_concentration_MichaelisMenten", 21 | ] 22 | __all__ += [ 23 | "reaction_rate_MichaelisMenten_Michaelis1913", 24 | "substrate_concentration_MichaelisMenten_Michaelis1913", 25 | "reaction_rate_MichaelisMenten_Abebe2017", 26 | "substrate_concentration_MichaelisMenten_Abebe2017", 27 | ] 28 | -------------------------------------------------------------------------------- /colour/biochemistry/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/biochemistry/tests/__init__.py -------------------------------------------------------------------------------- /colour/blindness/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .datasets import * # noqa: F403 4 | from . import datasets 5 | from .machado2009 import ( 6 | msds_cmfs_anomalous_trichromacy_Machado2009, 7 | matrix_anomalous_trichromacy_Machado2009, 8 | matrix_cvd_Machado2009, 9 | ) 10 | 11 | __all__ = [] 12 | __all__ += datasets.__all__ 13 | __all__ += [ 14 | "msds_cmfs_anomalous_trichromacy_Machado2009", 15 | "matrix_anomalous_trichromacy_Machado2009", 16 | "matrix_cvd_Machado2009", 17 | ] 18 | -------------------------------------------------------------------------------- /colour/blindness/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | from .machado2010 import CVD_MATRICES_MACHADO2010 2 | 3 | __all__ = [ 4 | "CVD_MATRICES_MACHADO2010", 5 | ] 6 | -------------------------------------------------------------------------------- /colour/blindness/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/blindness/tests/__init__.py -------------------------------------------------------------------------------- /colour/characterisation/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .aces_it import MSDS_ACES_RICD 4 | from .cameras import MSDS_CAMERA_SENSITIVITIES 5 | from .colour_checkers import ( 6 | CCS_COLOURCHECKERS, 7 | ColourChecker, 8 | SDS_COLOURCHECKERS, 9 | ) 10 | from .displays import MSDS_DISPLAY_PRIMARIES 11 | from .filters import SDS_FILTERS 12 | from .lenses import SDS_LENSES 13 | 14 | __all__ = [ 15 | "MSDS_ACES_RICD", 16 | ] 17 | __all__ += [ 18 | "MSDS_CAMERA_SENSITIVITIES", 19 | ] 20 | __all__ += [ 21 | "CCS_COLOURCHECKERS", 22 | "ColourChecker", 23 | "SDS_COLOURCHECKERS", 24 | ] 25 | __all__ += [ 26 | "MSDS_DISPLAY_PRIMARIES", 27 | ] 28 | __all__ += [ 29 | "SDS_FILTERS", 30 | ] 31 | __all__ += [ 32 | "SDS_LENSES", 33 | ] 34 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/cameras/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | References 3 | ---------- 4 | - :cite:`Darrodi2015a` : Darrodi, M. M., Finlayson, G., Goodman, T., & 5 | Mackiewicz, M. (2015). Reference data set for camera spectral sensitivity 6 | estimation. Journal of the Optical Society of America A, 32(3), 381. 7 | doi:10.1364/JOSAA.32.000381 8 | """ 9 | 10 | from __future__ import annotations 11 | 12 | from colour.utilities import LazyCanonicalMapping 13 | 14 | from .dslr import MSDS_CAMERA_SENSITIVITIES_DSLR 15 | 16 | MSDS_CAMERA_SENSITIVITIES: LazyCanonicalMapping = LazyCanonicalMapping( 17 | MSDS_CAMERA_SENSITIVITIES_DSLR 18 | ) 19 | MSDS_CAMERA_SENSITIVITIES.__doc__ = """ 20 | Multi-spectral distributions of camera sensitivities. 21 | 22 | References 23 | ---------- 24 | :cite:`Darrodi2015a` 25 | """ 26 | 27 | __all__ = [ 28 | "MSDS_CAMERA_SENSITIVITIES", 29 | ] 30 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/cameras/dslr/__init__.py: -------------------------------------------------------------------------------- 1 | from .sensitivities import MSDS_CAMERA_SENSITIVITIES_DSLR 2 | 3 | __all__ = [ 4 | "MSDS_CAMERA_SENSITIVITIES_DSLR", 5 | ] 6 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/colour_checkers/__init__.py: -------------------------------------------------------------------------------- 1 | from .chromaticity_coordinates import CCS_COLOURCHECKERS, ColourChecker 2 | from .sds import SDS_COLOURCHECKERS 3 | 4 | __all__ = [ 5 | "CCS_COLOURCHECKERS", 6 | "ColourChecker", 7 | ] 8 | __all__ += [ 9 | "SDS_COLOURCHECKERS", 10 | ] 11 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/displays/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | References 3 | ---------- 4 | - :cite:`Fairchild1998b` : Fairchild, M., & Wyble, D. (1998). Colorimetric 5 | Characterization of The Apple Studio Display (flat panel LCD) (p. 22). 6 | http://scholarworks.rit.edu/cgi/viewcontent.cgi?article=1922&\ 7 | context=article 8 | - :cite:`Machado2010a` : Machado, Gustavo Mello. (2010). A model for 9 | simulation of color vision deficiency and a color contrast enhancement 10 | technique for dichromats. (pp. 1-94). 11 | http://www.lume.ufrgs.br/handle/10183/26950 12 | """ 13 | 14 | from colour.utilities import LazyCanonicalMapping 15 | 16 | from .crt import MSDS_DISPLAY_PRIMARIES_CRT 17 | from .lcd import MSDS_DISPLAY_PRIMARIES_LCD 18 | 19 | MSDS_DISPLAY_PRIMARIES = LazyCanonicalMapping(MSDS_DISPLAY_PRIMARIES_CRT) 20 | MSDS_DISPLAY_PRIMARIES.update(MSDS_DISPLAY_PRIMARIES_LCD) 21 | MSDS_DISPLAY_PRIMARIES.__doc__ = """ 22 | Primaries multi-spectral distributions of displays. 23 | 24 | References 25 | ---------- 26 | :cite:`Fairchild1998b`, :cite:`Machado2010a` 27 | """ 28 | 29 | __all__ = [ 30 | "MSDS_DISPLAY_PRIMARIES", 31 | ] 32 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/displays/crt/__init__.py: -------------------------------------------------------------------------------- 1 | from .primaries import MSDS_DISPLAY_PRIMARIES_CRT 2 | 3 | __all__ = [ 4 | "MSDS_DISPLAY_PRIMARIES_CRT", 5 | ] 6 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/displays/lcd/__init__.py: -------------------------------------------------------------------------------- 1 | from .primaries import MSDS_DISPLAY_PRIMARIES_LCD 2 | 3 | __all__ = [ 4 | "MSDS_DISPLAY_PRIMARIES_LCD", 5 | ] 6 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/filters/__init__.py: -------------------------------------------------------------------------------- 1 | from .sds import SDS_FILTERS 2 | 3 | __all__ = [ 4 | "SDS_FILTERS", 5 | ] 6 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/lenses/__init__.py: -------------------------------------------------------------------------------- 1 | from .sds import SDS_LENSES 2 | 3 | __all__ = [ 4 | "SDS_LENSES", 5 | ] 6 | -------------------------------------------------------------------------------- /colour/characterisation/datasets/rawtoaces/AMPAS_ISO_7589_Tungsten.csv: -------------------------------------------------------------------------------- 1 | wavelength,iso7589 2 | 380.0,0.04 3 | 385.0,0.05 4 | 390.0,0.06 5 | 395.0,0.07 6 | 400.0,0.08 7 | 405.0,0.09 8 | 410.0,0.1 9 | 415.0,0.11 10 | 420.0,0.12 11 | 425.0,0.1325 12 | 430.0,0.145 13 | 435.0,0.1575 14 | 440.0,0.17 15 | 445.0,0.18 16 | 450.0,0.19 17 | 455.0,0.2025 18 | 460.0,0.215 19 | 465.0,0.2275 20 | 470.0,0.24 21 | 475.0,0.2525 22 | 480.0,0.265 23 | 485.0,0.28 24 | 490.0,0.295 25 | 495.0,0.3075 26 | 500.0,0.32 27 | 505.0,0.335 28 | 510.0,0.35 29 | 515.0,0.365 30 | 520.0,0.38 31 | 525.0,0.3925 32 | 530.0,0.405 33 | 535.0,0.4225 34 | 540.0,0.44 35 | 545.0,0.455 36 | 550.0,0.47 37 | 555.0,0.485 38 | 560.0,0.5 39 | 565.0,0.5125 40 | 570.0,0.525 41 | 575.0,0.54 42 | 580.0,0.555 43 | 585.0,0.5675 44 | 590.0,0.58 45 | 595.0,0.595 46 | 600.0,0.61 47 | 605.0,0.6225 48 | 610.0,0.635 49 | 615.0,0.6475 50 | 620.0,0.66 51 | 625.0,0.675 52 | 630.0,0.69 53 | 635.0,0.7025 54 | 640.0,0.715 55 | 645.0,0.7275 56 | 650.0,0.74 57 | 655.0,0.7525 58 | 660.0,0.765 59 | 665.0,0.775 60 | 670.0,0.785 61 | 675.0,0.7975 62 | 680.0,0.81 63 | 685.0,0.8225 64 | 690.0,0.835 65 | 695.0,0.8475 66 | 700.0,0.86 67 | 705.0,0.87 68 | 710.0,0.88 69 | 715.0,0.89 70 | 720.0,0.9 71 | 725.0,0.91 72 | 730.0,0.92 73 | 735.0,0.9275 74 | 740.0,0.935 75 | 745.0,0.945 76 | 750.0,0.955 77 | 755.0,0.965 78 | 760.0,0.975 79 | 765.0,0.98 80 | 770.0,0.985 81 | 775.0,0.9925 82 | 780.0,1.0 83 | -------------------------------------------------------------------------------- /colour/characterisation/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/characterisation/tests/__init__.py -------------------------------------------------------------------------------- /colour/colorimetry/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .cmfs import ( 4 | MSDS_CMFS, 5 | MSDS_CMFS_LMS, 6 | MSDS_CMFS_RGB, 7 | MSDS_CMFS_STANDARD_OBSERVER, 8 | ) 9 | from .illuminants import * # noqa: F403 10 | from . import illuminants 11 | from .light_sources import * # noqa: F403 12 | from . import light_sources 13 | from .lefs import SDS_LEFS, SDS_LEFS_PHOTOPIC, SDS_LEFS_SCOTOPIC 14 | 15 | __all__ = [ 16 | "MSDS_CMFS", 17 | "MSDS_CMFS_LMS", 18 | "MSDS_CMFS_RGB", 19 | "MSDS_CMFS_STANDARD_OBSERVER", 20 | ] 21 | __all__ += illuminants.__all__ 22 | __all__ += light_sources.__all__ 23 | __all__ += [ 24 | "SDS_LEFS", 25 | "SDS_LEFS_PHOTOPIC", 26 | "SDS_LEFS_SCOTOPIC", 27 | ] 28 | -------------------------------------------------------------------------------- /colour/colorimetry/datasets/illuminants/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .chromaticity_coordinates import CCS_ILLUMINANTS 4 | from .sds_d_illuminant_series import ( 5 | SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES, 6 | ) 7 | from .hunterlab import TVS_ILLUMINANTS_HUNTERLAB 8 | from .sds import SDS_ILLUMINANTS 9 | from .tristimulus_values import TVS_ILLUMINANTS 10 | 11 | __all__ = [ 12 | "CCS_ILLUMINANTS", 13 | "SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES", 14 | "TVS_ILLUMINANTS_HUNTERLAB", 15 | "SDS_ILLUMINANTS", 16 | "TVS_ILLUMINANTS", 17 | ] 18 | -------------------------------------------------------------------------------- /colour/colorimetry/datasets/light_sources/__init__.py: -------------------------------------------------------------------------------- 1 | from .chromaticity_coordinates import CCS_LIGHT_SOURCES 2 | from .sds import SDS_LIGHT_SOURCES 3 | 4 | __all__ = [ 5 | "CCS_LIGHT_SOURCES", 6 | "SDS_LIGHT_SOURCES", 7 | ] 8 | -------------------------------------------------------------------------------- /colour/colorimetry/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/colorimetry/tests/__init__.py -------------------------------------------------------------------------------- /colour/constants/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .cie import CONSTANT_K_M, CONSTANT_KP_M 4 | from .codata import ( 5 | CONSTANT_AVOGADRO, 6 | CONSTANT_BOLTZMANN, 7 | CONSTANT_LIGHT_SPEED, 8 | CONSTANT_PLANCK, 9 | ) 10 | from .common import ( 11 | PATTERN_FLOATING_POINT_NUMBER, 12 | THRESHOLD_INTEGER, 13 | EPSILON, 14 | DTYPE_INT_DEFAULT, 15 | DTYPE_FLOAT_DEFAULT, 16 | TOLERANCE_ABSOLUTE_DEFAULT, 17 | TOLERANCE_RELATIVE_DEFAULT, 18 | TOLERANCE_ABSOLUTE_TESTS, 19 | TOLERANCE_RELATIVE_TESTS, 20 | ) 21 | 22 | __all__ = [ 23 | "CONSTANT_K_M", 24 | "CONSTANT_KP_M", 25 | ] 26 | __all__ += [ 27 | "CONSTANT_AVOGADRO", 28 | "CONSTANT_BOLTZMANN", 29 | "CONSTANT_LIGHT_SPEED", 30 | "CONSTANT_PLANCK", 31 | ] 32 | __all__ += [ 33 | "PATTERN_FLOATING_POINT_NUMBER", 34 | "THRESHOLD_INTEGER", 35 | "EPSILON", 36 | "DTYPE_INT_DEFAULT", 37 | "DTYPE_FLOAT_DEFAULT", 38 | "TOLERANCE_ABSOLUTE_DEFAULT", 39 | "TOLERANCE_RELATIVE_DEFAULT", 40 | "TOLERANCE_ABSOLUTE_TESTS", 41 | "TOLERANCE_RELATIVE_TESTS", 42 | ] 43 | -------------------------------------------------------------------------------- /colour/constants/cie.py: -------------------------------------------------------------------------------- 1 | """ 2 | CIE Constants 3 | ============= 4 | 5 | Define *CIE* constants. 6 | 7 | References 8 | ---------- 9 | - :cite:`Wyszecki2000s` : Wyszecki, Günther, & Stiles, W. S. (2000). 10 | Standard Photometric Observers. In Color Science: Concepts and Methods, 11 | Quantitative Data and Formulae (pp. 256-259,395). Wiley. 12 | ISBN:978-0-471-39918-6 13 | """ 14 | 15 | from colour.utilities.documentation import DocstringFloat, is_documentation_building 16 | 17 | __author__ = "Colour Developers" 18 | __copyright__ = "Copyright 2013 Colour Developers" 19 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 20 | __maintainer__ = "Colour Developers" 21 | __email__ = "colour-developers@colour-science.org" 22 | __status__ = "Production" 23 | 24 | __all__ = [ 25 | "CONSTANT_K_M", 26 | "CONSTANT_KP_M", 27 | ] 28 | 29 | CONSTANT_K_M: float = 683 30 | if is_documentation_building(): # pragma: no cover 31 | CONSTANT_K_M = DocstringFloat(CONSTANT_K_M) 32 | CONSTANT_K_M.__doc__ = """ 33 | Rounded maximum photopic luminous efficiency :math:`K_m` value in 34 | :math:`lm\\cdot W^{-1}`. 35 | 36 | Notes 37 | ----- 38 | - To be adequate for all practical applications the :math:`K_m` value has 39 | been rounded from the original 683.002 value. 40 | 41 | References 42 | ---------- 43 | :cite:`Wyszecki2000s` 44 | """ 45 | 46 | CONSTANT_KP_M: float = 1700 47 | if is_documentation_building(): # pragma: no cover 48 | CONSTANT_KP_M = DocstringFloat(CONSTANT_KP_M) 49 | CONSTANT_KP_M.__doc__ = """ 50 | Rounded maximum scotopic luminous efficiency :math:`K^{\\prime}_m` value in 51 | :math:`lm\\cdot W^{-1}`. 52 | 53 | Notes 54 | ----- 55 | - To be adequate for all practical applications the :math:`K^{\\prime}_m` 56 | value has been rounded from the original 1700.06 value. 57 | 58 | References 59 | ---------- 60 | :cite:`Wyszecki2000s` 61 | """ 62 | -------------------------------------------------------------------------------- /colour/constants/codata.py: -------------------------------------------------------------------------------- 1 | """ 2 | Fundamental Physical Constants 3 | ============================== 4 | 5 | Define various constants from recommended values by the Committee on Data for 6 | Science and Technology (CODATA). 7 | """ 8 | 9 | from colour.utilities.documentation import DocstringFloat, is_documentation_building 10 | 11 | __author__ = "Colour Developers" 12 | __copyright__ = "Copyright 2013 Colour Developers" 13 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 14 | __maintainer__ = "Colour Developers" 15 | __email__ = "colour-developers@colour-science.org" 16 | __status__ = "Production" 17 | 18 | __all__ = [ 19 | "CONSTANT_AVOGADRO", 20 | "CONSTANT_BOLTZMANN", 21 | "CONSTANT_LIGHT_SPEED", 22 | "CONSTANT_PLANCK", 23 | ] 24 | 25 | CONSTANT_AVOGADRO: float = 6.02214179e23 26 | if is_documentation_building(): # pragma: no cover 27 | CONSTANT_AVOGADRO = DocstringFloat(CONSTANT_AVOGADRO) 28 | CONSTANT_AVOGADRO.__doc__ = """ 29 | Avogadro constant. 30 | """ 31 | 32 | CONSTANT_BOLTZMANN: float = 1.38065e-23 33 | if is_documentation_building(): # pragma: no cover 34 | CONSTANT_BOLTZMANN = DocstringFloat(CONSTANT_BOLTZMANN) 35 | CONSTANT_BOLTZMANN.__doc__ = """ 36 | Boltzmann constant. 37 | """ 38 | 39 | CONSTANT_LIGHT_SPEED: float = 299792458 40 | if is_documentation_building(): # pragma: no cover 41 | CONSTANT_LIGHT_SPEED = DocstringFloat(CONSTANT_LIGHT_SPEED) 42 | CONSTANT_LIGHT_SPEED.__doc__ = """ 43 | Speed of light in vacuum. 44 | """ 45 | 46 | CONSTANT_PLANCK: float = 6.62607e-34 47 | if is_documentation_building(): # pragma: no cover 48 | CONSTANT_PLANCK = DocstringFloat(CONSTANT_PLANCK) 49 | CONSTANT_PLANCK.__doc__ = """ 50 | Planck constant. 51 | """ 52 | -------------------------------------------------------------------------------- /colour/continuous/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .abstract import AbstractContinuousFunction 4 | from .signal import Signal 5 | from .multi_signals import MultiSignals 6 | 7 | __all__ = [] 8 | __all__ += [ 9 | "AbstractContinuousFunction", 10 | ] 11 | __all__ += [ 12 | "Signal", 13 | ] 14 | __all__ += [ 15 | "MultiSignals", 16 | ] 17 | -------------------------------------------------------------------------------- /colour/continuous/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/continuous/tests/__init__.py -------------------------------------------------------------------------------- /colour/contrast/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/contrast/tests/__init__.py -------------------------------------------------------------------------------- /colour/corresponding/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .datasets import * # noqa: F403 4 | from . import datasets 5 | from .prediction import ( 6 | CorrespondingColourDataset, 7 | CorrespondingChromaticitiesPrediction, 8 | corresponding_chromaticities_prediction_CIE1994, 9 | corresponding_chromaticities_prediction_CMCCAT2000, 10 | corresponding_chromaticities_prediction_Fairchild1990, 11 | corresponding_chromaticities_prediction_VonKries, 12 | corresponding_chromaticities_prediction_Zhai2018, 13 | CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS, 14 | corresponding_chromaticities_prediction, 15 | ) 16 | 17 | __all__ = [] 18 | __all__ += datasets.__all__ 19 | __all__ += [ 20 | "CorrespondingColourDataset", 21 | "CorrespondingChromaticitiesPrediction", 22 | "corresponding_chromaticities_prediction_CIE1994", 23 | "corresponding_chromaticities_prediction_CMCCAT2000", 24 | "corresponding_chromaticities_prediction_Fairchild1990", 25 | "corresponding_chromaticities_prediction_VonKries", 26 | "corresponding_chromaticities_prediction_Zhai2018", 27 | "CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS", 28 | "corresponding_chromaticities_prediction", 29 | ] 30 | -------------------------------------------------------------------------------- /colour/corresponding/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .breneman1987 import ( 4 | BRENEMAN_EXPERIMENTS, 5 | BRENEMAN_EXPERIMENT_PRIMARIES_CHROMATICITIES, 6 | ) 7 | 8 | __all__ = [ 9 | "BRENEMAN_EXPERIMENTS", 10 | "BRENEMAN_EXPERIMENT_PRIMARIES_CHROMATICITIES", 11 | ] 12 | -------------------------------------------------------------------------------- /colour/corresponding/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/corresponding/tests/__init__.py -------------------------------------------------------------------------------- /colour/difference/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/difference/tests/__init__.py -------------------------------------------------------------------------------- /colour/difference/tests/test__init__.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.difference` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | import numpy as np 6 | 7 | from colour.constants import TOLERANCE_ABSOLUTE_TESTS 8 | from colour.difference import delta_E 9 | from colour.utilities import domain_range_scale 10 | 11 | __author__ = "Colour Developers" 12 | __copyright__ = "Copyright 2013 Colour Developers" 13 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 14 | __maintainer__ = "Colour Developers" 15 | __email__ = "colour-developers@colour-science.org" 16 | __status__ = "Production" 17 | 18 | __all__ = [ 19 | "TestDelta_E", 20 | ] 21 | 22 | 23 | class TestDelta_E: 24 | """Define :func:`colour.difference.delta_E` definition unit tests methods.""" 25 | 26 | def test_domain_range_scale_delta_E(self) -> None: 27 | """ 28 | Test :func:`colour.difference.delta_E` definition domain and range 29 | scale support. 30 | """ 31 | 32 | Lab_1 = np.array([48.99183622, -0.10561667, 400.65619925]) 33 | Lab_2 = np.array([50.65907324, -0.11671910, 402.82235718]) 34 | 35 | m = ("CIE 1976", "CIE 1994", "CIE 2000", "CMC", "DIN99") 36 | v = [delta_E(Lab_1, Lab_2, method) for method in m] 37 | 38 | d_r = (("reference", 1), ("1", 0.01), ("100", 1)) 39 | for method, value in zip(m, v, strict=True): 40 | for scale, factor in d_r: 41 | with domain_range_scale(scale): 42 | np.testing.assert_allclose( 43 | delta_E(Lab_1 * factor, Lab_2 * factor, method), 44 | value, 45 | atol=TOLERANCE_ABSOLUTE_TESTS, 46 | ) 47 | -------------------------------------------------------------------------------- /colour/difference/tests/test_cam16_ucs.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.difference.cam16_ucs` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | from colour.difference.tests.test_cam02_ucs import TestDelta_E_Luo2006 6 | 7 | __author__ = "Colour Developers" 8 | __copyright__ = "Copyright 2013 Colour Developers" 9 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 10 | __maintainer__ = "Colour Developers" 11 | __email__ = "colour-developers@colour-science.org" 12 | __status__ = "Production" 13 | 14 | __all__ = [ 15 | "TestDelta_E_Li2017", 16 | ] 17 | 18 | 19 | class TestDelta_E_Li2017(TestDelta_E_Luo2006): 20 | """ 21 | Define :func:`colour.difference.cam16_ucs.delta_E_Li2017` definition unit 22 | tests methods. 23 | 24 | Notes 25 | ----- 26 | - :func:`colour.difference.cam16_ucs.delta_E_Li2017` is a wrapper 27 | of :func:`colour.difference.cam02_ucs.delta_E_Luo2006` and thus 28 | currently adopts the same unittests. 29 | """ 30 | -------------------------------------------------------------------------------- /colour/difference/tests/test_huang2015.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.difference.huang2015` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | import numpy as np 6 | 7 | from colour.constants import TOLERANCE_ABSOLUTE_TESTS 8 | from colour.difference import power_function_Huang2015 9 | 10 | __author__ = "Colour Developers" 11 | __copyright__ = "Copyright 2013 Colour Developers" 12 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 13 | __maintainer__ = "Colour Developers" 14 | __email__ = "colour-developers@colour-science.org" 15 | __status__ = "Production" 16 | 17 | __all__ = [ 18 | "TestPowerFunctionHuang2015", 19 | ] 20 | 21 | 22 | class TestPowerFunctionHuang2015: 23 | """ 24 | Define :func:`colour.difference.huang2015.power_function_Huang2015` 25 | definition unit tests methods. 26 | """ 27 | 28 | def test_power_function_Huang2015(self) -> None: 29 | """ 30 | Test :func:`colour.difference.huang2015.power_function_Huang2015` 31 | definition. 32 | """ 33 | 34 | d_E = np.array([2.0425, 2.8615, 3.4412]) 35 | 36 | np.testing.assert_allclose( 37 | power_function_Huang2015(d_E), 38 | np.array([2.35748796, 2.98505036, 3.39651062]), 39 | atol=TOLERANCE_ABSOLUTE_TESTS, 40 | ) 41 | -------------------------------------------------------------------------------- /colour/difference/tests/test_stress.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.difference.stress` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | import numpy as np 6 | 7 | from colour.constants import TOLERANCE_ABSOLUTE_TESTS 8 | from colour.difference import index_stress 9 | 10 | __author__ = "Colour Developers" 11 | __copyright__ = "Copyright 2013 Colour Developers" 12 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 13 | __maintainer__ = "Colour Developers" 14 | __email__ = "colour-developers@colour-science.org" 15 | __status__ = "Production" 16 | 17 | __all__ = [ 18 | "TestIndexStress", 19 | ] 20 | 21 | 22 | class TestIndexStress: 23 | """ 24 | Define :func:`colour.difference.stress.index_stress_Garcia2007` definition 25 | unit tests methods. 26 | """ 27 | 28 | def test_index_stress(self) -> None: 29 | """ 30 | Test :func:`colour.difference.stress.index_stress_Garcia2007` 31 | definition. 32 | """ 33 | 34 | d_E = np.array([2.0425, 2.8615, 3.4412]) 35 | d_V = np.array([1.2644, 1.2630, 1.8731]) 36 | 37 | np.testing.assert_allclose( 38 | index_stress(d_E, d_V), 39 | 0.121170939369957, 40 | atol=TOLERANCE_ABSOLUTE_TESTS, 41 | ) 42 | -------------------------------------------------------------------------------- /colour/examples/adaptation/examples_cie1994.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *CIE 1994* chromatic adaptation model computations. 3 | 4 | This module provides examples of chromatic adaptation computations using the 5 | *CIE 1994* chromatic adaptation model, illustrating forward adaptation 6 | calculations between different illumination conditions. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('"CIE 1994" Chromatic Adaptation Model Computations') 15 | 16 | XYZ_1 = np.array([0.2800, 0.2126, 0.0527]) 17 | xy_o1 = np.array([0.4476, 0.4074]) 18 | xy_o2 = np.array([0.3127, 0.3290]) 19 | Y_o = 20 20 | E_o1 = 1000 21 | E_o2 = 1000 22 | message_box( 23 | f'Compute chromatic adaptation using "CIE 1994" chromatic adaptation ' 24 | f"model.\n\n" 25 | f'\t"XYZ_1": {XYZ_1}\n' 26 | f'\t"xy_o1": {xy_o1}\n' 27 | f'\t"xy_o2": {xy_o2}\n' 28 | f'\t"Y_o": {Y_o}\n' 29 | f'\t"E_o1": {E_o1}\n' 30 | f'\t"E_o2": {E_o2}' 31 | ) 32 | print( 33 | colour.chromatic_adaptation( 34 | XYZ_1, 35 | colour.xy_to_XYZ(xy_o1), 36 | colour.xy_to_XYZ(xy_o2), 37 | method="CIE 1994", 38 | Y_o=Y_o, 39 | E_o1=E_o1, 40 | E_o2=E_o2, 41 | ) 42 | ) 43 | print( 44 | colour.adaptation.chromatic_adaptation_CIE1994( 45 | XYZ_1 * 100, xy_o1, xy_o2, Y_o, E_o1, E_o2 46 | ) 47 | / 100 48 | ) 49 | -------------------------------------------------------------------------------- /colour/examples/adaptation/examples_cmccat2000.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *CMCCAT2000* chromatic adaptation model computations. 3 | 4 | This module provides examples of chromatic adaptation computations using the 5 | *CMCCAT2000* chromatic adaptation model, illustrating both forward and 6 | inverse adaptation calculations under various luminance adaptation conditions. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('"CMCCAT200" Chromatic Adaptation Model Computations') 15 | 16 | XYZ = np.array([0.2248, 0.2274, 0.0854]) 17 | XYZ_w = np.array([1.1115, 1.0000, 0.3520]) 18 | XYZ_wr = np.array([0.9481, 1.0000, 1.0730]) 19 | L_A1 = 200 20 | L_A2 = 200 21 | message_box( 22 | f'Compute chromatic adaptation using "CMCCAT200" forward chromatic ' 23 | f"adaptation model.\n\n" 24 | f'\t"XYZ":\n\t\t{XYZ}\n' 25 | f'\t"XYZ_w":\n\t\t{XYZ_w}\n' 26 | f'\t"XYZ_wr":\n\t\t{XYZ_wr}\n' 27 | f'\t"L_A1":\n\t\t{L_A1}\n' 28 | f'\t"L_A2":\n\t\t{L_A2}' 29 | ) 30 | print( 31 | colour.chromatic_adaptation( 32 | XYZ, XYZ_w, XYZ_wr, method="CMCCAT2000", L_A1=L_A1, L_A2=L_A2 33 | ) 34 | ) 35 | print( 36 | colour.adaptation.chromatic_adaptation_CMCCAT2000( 37 | XYZ * 100, XYZ_w, XYZ_wr, L_A1, L_A2 38 | ) 39 | / 100 40 | ) 41 | 42 | print("\n") 43 | 44 | XYZ_c = np.array([0.19526983, 0.23068340, 0.24971752]) 45 | message_box( 46 | f'Compute chromatic adaptation using "CMCCAT200" inverse chromatic ' 47 | f"adaptation model.\n\n" 48 | f'\t"XYZ_c": {XYZ_c}\n' 49 | f'\t"XYZ_w": {XYZ_w}\n' 50 | f'\t"XYZ_wr": {XYZ_wr}\n' 51 | f'\t"L_A1": {L_A1}\n' 52 | f'\t"L_A2": {L_A2}' 53 | ) 54 | print( 55 | colour.chromatic_adaptation( 56 | XYZ_c, 57 | XYZ_w, 58 | XYZ_wr, 59 | method="CMCCAT2000", 60 | L_A1=L_A1, 61 | L_A2=L_A2, 62 | direction="Inverse", 63 | ) 64 | ) 65 | print( 66 | colour.adaptation.chromatic_adaptation_CMCCAT2000( 67 | XYZ_c * 100, XYZ_w, XYZ_wr, L_A1, L_A2, direction="Inverse" 68 | ) 69 | / 100 70 | ) 71 | -------------------------------------------------------------------------------- /colour/examples/adaptation/examples_fairchild1990.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Fairchild (1990)* chromatic adaptation model computations. 3 | 4 | This module provides examples of chromatic adaptation computations using the 5 | *Fairchild (1990)* chromatic adaptation model, illustrating colour 6 | transformations under different viewing conditions. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('"Fairchild (1990)" Chromatic Adaptation Model Computations') 15 | 16 | XYZ_1 = np.array([0.1953, 0.2307, 0.2497]) 17 | XYZ_n = np.array([1.1115, 1.0000, 0.3520]) 18 | XYZ_r = np.array([0.9481, 1.0000, 1.0730]) 19 | Y_n = 200 20 | message_box( 21 | f'Compute chromatic adaptation using "Fairchild (1990)" chromatic ' 22 | f"adaptation model.\n\n" 23 | f'\t"XYZ_1": {XYZ_1}\n' 24 | f'\t"XYZ_n": {XYZ_n}\n' 25 | f'\t"XYZ_r": {XYZ_r}\n' 26 | f'\t"Y_n": {Y_n}' 27 | ) 28 | print( 29 | colour.chromatic_adaptation(XYZ_1, XYZ_n, XYZ_r, method="Fairchild 1990", Y_n=Y_n) 30 | ) 31 | print( 32 | colour.adaptation.chromatic_adaptation_Fairchild1990(XYZ_1 * 100, XYZ_n, XYZ_r, Y_n) 33 | / 100 34 | ) 35 | -------------------------------------------------------------------------------- /colour/examples/adaptation/examples_zhai2018.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Zhai and Luo (2018)* chromatic adaptation model computations. 3 | 4 | This module provides examples of chromatic adaptation computations using the 5 | *Zhai and Luo (2018)* chromatic adaptation model, illustrating advanced 6 | colour transformation techniques under varying degree of adaptation 7 | conditions. 8 | """ 9 | 10 | import numpy as np 11 | 12 | import colour 13 | from colour.utilities import message_box 14 | 15 | message_box('"Zhai and Luo (2018)" Chromatic Adaptation Model Computations') 16 | 17 | XYZ_b = np.array([0.48900, 0.43620, 0.06250]) 18 | XYZ_wb = np.array([1.09850, 1, 0.35585]) 19 | XYZ_wd = np.array([0.95047, 1, 1.08883]) 20 | D_b = 0.9407 21 | D_d = 0.9800 22 | XYZ_wo = np.array([1, 1, 1]) 23 | message_box( 24 | f'Compute chromatic adaptation using "Zhai and Luo (2018)" chromatic ' 25 | f"adaptation model.\n\n" 26 | f'\t"XYZ_b": {XYZ_b}\n' 27 | f'\t"XYZ_wb": {XYZ_wb}\n' 28 | f'\t"XYZ_wd": {XYZ_wd}\n' 29 | f'\t"D_b": {D_b}\n' 30 | f'\t"D_d": {D_d}\n' 31 | f'\t"XYZ_wo": {XYZ_wo}' 32 | ) 33 | print( 34 | colour.chromatic_adaptation( 35 | XYZ_b, 36 | XYZ_wb, 37 | XYZ_wd, 38 | method="Zhai 2018", 39 | D_b=D_b, 40 | D_d=D_d, 41 | XYZ_wo=XYZ_wo, 42 | ) 43 | ) 44 | print( 45 | colour.adaptation.chromatic_adaptation_Zhai2018( 46 | XYZ_b * 100, XYZ_wb * 100, XYZ_wd * 100, D_b, D_d, XYZ_wo * 100 47 | ) 48 | / 100 49 | ) 50 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_atd95.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *ATD (1995)* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *ATD (1995)* model, illustrating forward transformation from tristimulus values 6 | to colour appearance correlates and reference specification broadcasting. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.appearance.atd95 import CAM_ReferenceSpecification_ATD95 13 | from colour.utilities import message_box 14 | 15 | message_box('Compute "ATD (1995)" Colour Appearance Model Correlates') 16 | 17 | XYZ = np.array([19.01, 20.00, 21.78]) 18 | XYZ_0 = np.array([95.05, 100.00, 108.88]) 19 | Y_0 = 318.31 20 | k_1 = 0.0 21 | k_2 = 50.0 22 | message_box( 23 | f'Convert to the "ATD (1995)" colour appearance model specification ' 24 | f"using given parameters:\n\n" 25 | f"\tXYZ: {XYZ}\n" 26 | f"\tXYZ_0: {XYZ_0}\n" 27 | f"\tY_0: {Y_0}\n" 28 | f"\tk_1: {k_1}\n" 29 | f"\tk_2: {k_2}" 30 | ) 31 | specification = colour.XYZ_to_ATD95(XYZ, XYZ_0, Y_0, k_1, k_2) 32 | print(specification) 33 | 34 | print("\n") 35 | 36 | message_box( 37 | 'Broadcast the current output "ATD (1995)" colour appearance ' 38 | "model specification to the reference specification.\n" 39 | "The intent of this reference specification is to provide names " 40 | 'as closest as possible to the "Mark D. Fairchild" reference.\n' 41 | "The current output specification is meant to be consistent with " 42 | "the other colour appearance model specification by using same " 43 | "argument names for consistency wherever possible." 44 | ) 45 | 46 | print(CAM_ReferenceSpecification_ATD95(*specification.values)) 47 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_cam16.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *CAM16* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *CAM16* model, illustrating both forward and inverse transformations between 6 | tristimulus values and colour appearance correlates. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('Compute "CAM16" Colour Appearance Model Correlates') 15 | 16 | XYZ = np.array([19.01, 20.00, 21.78]) 17 | XYZ_w = np.array([95.05, 100.00, 108.88]) 18 | L_A = 318.31 19 | Y_b = 20.0 20 | surround = colour.VIEWING_CONDITIONS_CAM16["Average"] 21 | message_box( 22 | f'Convert to the "CAM16" colour appearance model specification ' 23 | f"using given parameters:\n\n" 24 | f"\tXYZ: {XYZ}\n" 25 | f"\tXYZ_w: {XYZ_w}\n" 26 | f"\tL_A: {L_A}\n" 27 | f"\tY_b: {Y_b}\n" 28 | f"\tSurround: {surround}" 29 | ) 30 | specification = colour.XYZ_to_CAM16(XYZ, XYZ_w, L_A, Y_b, surround) 31 | print(specification) 32 | 33 | print("\n") 34 | 35 | J = 41.73120791 36 | C = 0.10335574 37 | h = 217.06795977 38 | specification = colour.CAM_Specification_CAM16(J, C, h) 39 | message_box( 40 | f'Convert to "CIE XYZ" tristimulus values using given parameters:\n\n' 41 | f"\tJ: {J}\n" 42 | f"\tC: {C}\n" 43 | f"\th: {h}\n" 44 | f"\tXYZ_w: {XYZ_w}\n" 45 | f"\tL_A: {L_A}\n" 46 | f"\tY_b: {Y_b}\n" 47 | f"\tSurround: {surround}" 48 | ) 49 | print(colour.CAM16_to_XYZ(specification, XYZ_w, L_A, Y_b, surround)) 50 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_ciecam02.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *CIECAM02* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *CIECAM02* model, illustrating both forward and inverse transformations between 6 | tristimulus values and colour appearance correlates. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('Compute "CIECAM02" Colour Appearance Model Correlates') 15 | 16 | XYZ = np.array([19.01, 20.00, 21.78]) 17 | XYZ_w = np.array([95.05, 100.00, 108.88]) 18 | L_A = 318.31 19 | Y_b = 20.0 20 | surround = colour.VIEWING_CONDITIONS_CIECAM02["Average"] 21 | message_box( 22 | f'Convert to the "CIECAM02" colour appearance model specification ' 23 | f"using given parameters:\n\n" 24 | f"\tXYZ: {XYZ}\n" 25 | f"\tXYZ_w: {XYZ_w}\n" 26 | f"\tL_A: {L_A}\n" 27 | f"\tY_b: {Y_b}\n" 28 | f"\tSurround: {surround}" 29 | ) 30 | specification = colour.XYZ_to_CIECAM02(XYZ, XYZ_w, L_A, Y_b, surround) 31 | print(specification) 32 | 33 | print("\n") 34 | 35 | J = 41.73109113 36 | C = 0.10470776 37 | h = 219.04843266 38 | specification = colour.CAM_Specification_CIECAM02(J, C, h) 39 | message_box( 40 | f'Convert to "CIE XYZ" tristimulus values using given parameters:\n\n' 41 | f"\tJ: {J}\n" 42 | f"\tC: {C}\n" 43 | f"\th: {h}\n" 44 | f"\tXYZ_w: {XYZ_w}\n" 45 | f"\tL_A: {L_A}\n" 46 | f"\tY_b: {Y_b}\n" 47 | f"\tSurround: {surround}" 48 | ) 49 | print(colour.CIECAM02_to_XYZ(specification, XYZ_w, L_A, Y_b, surround)) 50 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_ciecam16.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *CIECAM16* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *CIECAM16* model, illustrating both forward and inverse transformations between 6 | tristimulus values and colour appearance correlates. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('Compute "CIECAM16" Colour Appearance Model Correlates') 15 | 16 | XYZ = np.array([19.01, 20.00, 21.78]) 17 | XYZ_w = np.array([95.05, 100.00, 108.88]) 18 | L_A = 318.31 19 | Y_b = 20.0 20 | surround = colour.VIEWING_CONDITIONS_CIECAM16["Average"] 21 | message_box( 22 | f'Convert to the "CIECAM16" colour appearance model specification ' 23 | f"using given parameters:\n\n" 24 | f"\tXYZ: {XYZ}\n" 25 | f"\tXYZ_w: {XYZ_w}\n" 26 | f"\tL_A: {L_A}\n" 27 | f"\tY_b: {Y_b}\n" 28 | f"\tSurround: {surround}" 29 | ) 30 | specification = colour.XYZ_to_CIECAM16(XYZ, XYZ_w, L_A, Y_b, surround) 31 | print(specification) 32 | 33 | print("\n") 34 | 35 | J = 41.73120791 36 | C = 0.10335574 37 | h = 217.06795977 38 | specification = colour.CAM_Specification_CIECAM16(J, C, h) 39 | message_box( 40 | f'Convert to "CIE XYZ" tristimulus values using given parameters:\n\n' 41 | f"\tJ: {J}\n" 42 | f"\tC: {C}\n" 43 | f"\th: {h}\n" 44 | f"\tXYZ_w: {XYZ_w}\n" 45 | f"\tL_A: {L_A}\n" 46 | f"\tY_b: {Y_b}\n" 47 | f"\tSurround: {surround}" 48 | ) 49 | print(colour.CIECAM16_to_XYZ(specification, XYZ_w, L_A, Y_b, surround)) 50 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_hellwig2022.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Hellwig and Fairchild (2022)* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *Hellwig and Fairchild (2022)* model, illustrating both forward and inverse 6 | transformations between tristimulus values and colour appearance correlates. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('Compute "Hellwig and Fairchild (2022)" Colour Appearance Model Correlates') 15 | 16 | XYZ = np.array([19.01, 20.00, 21.78]) 17 | XYZ_w = np.array([95.05, 100.00, 108.88]) 18 | L_A = 318.31 19 | Y_b = 20.0 20 | surround = colour.VIEWING_CONDITIONS_HELLWIG2022["Average"] 21 | message_box( 22 | f'Convert to the "Hellwig and Fairchild (2022)" colour appearance ' 23 | f"model specification " 24 | f"using given parameters:\n\n" 25 | f"\tXYZ: {XYZ}\n" 26 | f"\tXYZ_w: {XYZ_w}\n" 27 | f"\tL_A: {L_A}\n" 28 | f"\tY_b: {Y_b}\n" 29 | f"\tSurround: {surround}" 30 | ) 31 | specification = colour.XYZ_to_Hellwig2022(XYZ, XYZ_w, L_A, Y_b, surround) 32 | print(specification) 33 | 34 | print("\n") 35 | 36 | J = 41.73120791 37 | C = 0.02576362 38 | h = 217.06795977 39 | specification = colour.CAM_Specification_Hellwig2022(J, C, h) 40 | message_box( 41 | f'Convert to "CIE XYZ" tristimulus values using given parameters:\n\n' 42 | f"\tJ: {J}\n" 43 | f"\tC: {C}\n" 44 | f"\th: {h}\n" 45 | f"\tXYZ_w: {XYZ_w}\n" 46 | f"\tL_A: {L_A}\n" 47 | f"\tY_b: {Y_b}\n" 48 | f"\tSurround: {surround}" 49 | ) 50 | print(colour.Hellwig2022_to_XYZ(specification, XYZ_w, L_A, Y_b, surround)) 51 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_hunt.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Hunt* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *Hunt* model, illustrating forward transformations from tristimulus values to 6 | colour appearance correlates and reference specification broadcasting. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.appearance.hunt import CAM_ReferenceSpecification_Hunt 13 | from colour.utilities import message_box 14 | 15 | message_box('Compute "Hunt" Colour Appearance Model Correlates') 16 | 17 | XYZ = np.array([19.01, 20.00, 21.78]) 18 | XYZ_w = np.array([95.05, 100.00, 108.88]) 19 | XYZ_b = np.array([95.05, 100.00, 108.88]) 20 | L_A = 318.31 21 | surround = colour.VIEWING_CONDITIONS_HUNT["Normal Scenes"] 22 | CCT_w = 6504.0 23 | message_box( 24 | f'Convert to the "Hunt" colour appearance model specification using ' 25 | f"given parameters:\n\n" 26 | f"\tXYZ: {XYZ}\n" 27 | f"\tXYZ_w: {XYZ_w}\n" 28 | f"\tXYZ_b: {XYZ_b}\n" 29 | f"\tL_A: {L_A}\n" 30 | f"\tsurround: {surround}\n" 31 | f"\tCCT_w: {CCT_w}" 32 | ) 33 | 34 | specification = colour.XYZ_to_Hunt(XYZ, XYZ_w, XYZ_b, L_A, surround, CCT_w=CCT_w) 35 | print(specification) 36 | 37 | print("\n") 38 | 39 | message_box( 40 | 'Broadcast the current output "Hunt" colour appearance ' 41 | "model specification to the reference specification.\n" 42 | "The intent of this reference specification is to provide names " 43 | 'as closest as possible to the "Mark D. Fairchild" reference.\n' 44 | "The current output specification is meant to be consistent with " 45 | "the other colour appearance model specification by using same " 46 | "argument names for consistency wherever possible." 47 | ) 48 | 49 | print(CAM_ReferenceSpecification_Hunt(*specification.values)) 50 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_kim2009.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Kim, Weyrich and Kautz (2009)* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *Kim, Weyrich and Kautz (2009)* model, illustrating both forward and inverse 6 | transformations between tristimulus values and colour appearance correlates. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box( 15 | 'Compute "Kim, Weyrich and Kautz (2009)" Colour Appearance Model Correlates' 16 | ) 17 | 18 | XYZ = np.array([19.01, 20.00, 21.78]) 19 | XYZ_w = np.array([95.05, 100.00, 108.88]) 20 | L_A = 318.31 21 | media = colour.MEDIA_PARAMETERS_KIM2009["CRT Displays"] 22 | surround = colour.VIEWING_CONDITIONS_KIM2009["Average"] 23 | message_box( 24 | f'Convert to the "Kim, Weyrich and Kautz (2009)" colour appearance ' 25 | f"model specification using given parameters:\n\n" 26 | f"\tXYZ: {XYZ}\n" 27 | f"\tXYZ_w: {XYZ_w}\n" 28 | f"\tL_A: {L_A}\n" 29 | f"\tMedia: {media}\n" 30 | f"\tSurround: {surround}" 31 | ) 32 | specification = colour.XYZ_to_Kim2009(XYZ, XYZ_w, L_A, media, surround) 33 | print(specification) 34 | 35 | print("\n") 36 | 37 | J = 28.861908975839647 38 | C = 0.559245592437371 39 | h = 219.048066776629530 40 | specification = colour.CAM_Specification_Kim2009(J, C, h) 41 | message_box( 42 | f'Convert to "CIE XYZ" tristimulus values using given parameters:\n\n' 43 | f"\tJ: {J}\n" 44 | f"\tC: {C}\n" 45 | f"\th: {h}\n" 46 | f"\tXYZ_w: {XYZ_w}\n" 47 | f"\tL_A: {L_A}\n" 48 | f"\tMedia: {media}\n" 49 | f"\tSurround: {surround}" 50 | ) 51 | print(colour.Kim2009_to_XYZ(specification, XYZ_w, L_A, media, surround)) 52 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_llab.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *LLAB(l:c)* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *LLAB(l:c)* model, illustrating forward transformations from tristimulus values 6 | to colour appearance correlates with reference specification broadcasting. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.appearance.llab import CAM_ReferenceSpecification_LLAB 13 | from colour.utilities import message_box 14 | 15 | message_box('Compute "LLAB(l:c)" Colour Appearance Model Correlates') 16 | 17 | XYZ = np.array([19.01, 20.00, 21.78]) 18 | XYZ_0 = np.array([95.05, 100.00, 108.88]) 19 | Y_b = 20.0 20 | L = 318.31 21 | surround = colour.VIEWING_CONDITIONS_LLAB["ref_average_4_minus"] 22 | message_box( 23 | f'Convert to the "LLAB(l:c)" colour appearance model specification ' 24 | f"using given parameters:\n\n" 25 | f"\tXYZ: {XYZ}\n" 26 | f"\tXYZ_0: {XYZ_0}\n" 27 | f"\tY_b: {Y_b}\n" 28 | f"\tL: {L}\n" 29 | f"\tsurround: {surround}" 30 | ) 31 | specification = colour.XYZ_to_LLAB(XYZ, XYZ_0, Y_b, L, surround) 32 | print(specification) 33 | 34 | print("\n") 35 | 36 | message_box( 37 | 'Broadcast the current output "LLAB(l:c)" colour appearance ' 38 | "model specification to the reference specification.\n" 39 | "The intent of this reference specification is to provide names " 40 | 'as closest as possible to the "Mark D. Fairchild" reference.\n' 41 | "The current output specification is meant to be consistent with " 42 | "the other colour appearance model specification by using same " 43 | "argument names for consistency wherever possible." 44 | ) 45 | 46 | print(CAM_ReferenceSpecification_LLAB(*specification.values)) 47 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_nayatani95.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Nayatani (1995)* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *Nayatani (1995)* model, illustrating forward transformations from tristimulus 6 | values to colour appearance correlates with reference specification broadcasting. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.appearance.nayatani95 import CAM_ReferenceSpecification_Nayatani95 13 | from colour.utilities import message_box 14 | 15 | message_box('Compute "Nayatani (1995)" Colour Appearance Model Correlates') 16 | 17 | XYZ = np.array([19.01, 20.00, 21.78]) 18 | XYZ_n = np.array([95.05, 100.00, 108.88]) 19 | Y_o = 20.0 20 | E_o = 5000.0 21 | E_or = 1000.0 22 | message_box( 23 | f'Convert to the "Nayatani (1995)" colour appearance model ' 24 | f"specification using given parameters:\n\n" 25 | f"\tXYZ: {XYZ}\n" 26 | f"\tXYZ_n: {XYZ_n}\n" 27 | f"\tY_o: {Y_o}\n" 28 | f"\tE_o: {E_o}\n" 29 | f"\tE_or: {E_or}" 30 | ) 31 | specification = colour.XYZ_to_Nayatani95(XYZ, XYZ_n, Y_o, E_o, E_or) 32 | print(specification) 33 | 34 | print("\n") 35 | 36 | message_box( 37 | 'Broadcast the current output "Nayatani (1995)" colour appearance ' 38 | "model specification to the reference specification.\n" 39 | "The intent of this reference specification is to provide names " 40 | 'as closest as possible to the "Mark D. Fairchild" reference.\n' 41 | "The current output specification is meant to be consistent with " 42 | "the other colour appearance model specification by using same " 43 | "argument names for consistency wherever possible." 44 | ) 45 | 46 | print(CAM_ReferenceSpecification_Nayatani95(*specification.values)) 47 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_rlab.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *RLAB* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *RLAB* model, illustrating forward transformations from tristimulus values to 6 | colour appearance correlates with reference specification broadcasting. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.appearance.rlab import CAM_ReferenceSpecification_RLAB 13 | from colour.utilities import message_box 14 | 15 | message_box('Compute "RLAB" Colour Appearance Model Correlates') 16 | 17 | XYZ = np.array([19.01, 20.00, 21.78]) 18 | XYZ_n = np.array([109.85, 100, 35.58]) 19 | Y_n = 31.83 20 | sigma = colour.VIEWING_CONDITIONS_RLAB["Average"] 21 | D = colour.appearance.D_FACTOR_RLAB["Hard Copy Images"] 22 | message_box( 23 | f'Convert to the "RLAB" colour appearance model specification using ' 24 | f"given parameters:\n\n" 25 | f"\tXYZ: {XYZ}\n" 26 | f"\tXYZ_n: {XYZ_n}\n" 27 | f"\tY_n: {Y_n}\n" 28 | f"\tsigma: {sigma}\n" 29 | f"\tD: {D}" 30 | ) 31 | specification = colour.XYZ_to_RLAB(XYZ, XYZ_n, Y_n, sigma, D) 32 | print(specification) 33 | 34 | print("\n") 35 | 36 | message_box( 37 | 'Broadcast the current output "RLAB" colour appearance ' 38 | "model specification to the reference specification.\n" 39 | "The intent of this reference specification is to provide names " 40 | 'as closest as possible to the "Mark D. Fairchild" reference.\n' 41 | "The current output specification is meant to be consistent with " 42 | "the other colour appearance model specification by using same " 43 | "argument names for consistency wherever possible." 44 | ) 45 | 46 | print(CAM_ReferenceSpecification_RLAB(*specification.values)) 47 | -------------------------------------------------------------------------------- /colour/examples/appearance/examples_zcam.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *ZCAM* colour appearance model computations. 3 | 4 | This module provides examples of colour appearance model computations using the 5 | *ZCAM* model, illustrating both forward and inverse transformations between 6 | tristimulus values and colour appearance correlates with reference 7 | specification broadcasting. 8 | """ 9 | 10 | import numpy as np 11 | 12 | import colour 13 | from colour.appearance.zcam import CAM_ReferenceSpecification_ZCAM 14 | from colour.utilities import message_box 15 | 16 | message_box('Compute "ZCAM" Colour Appearance Model Correlates') 17 | 18 | XYZ = np.array([19.01, 20.00, 21.78]) 19 | XYZ_w = np.array([95.05, 100.00, 108.88]) 20 | L_A = 318.31 21 | Y_b = 20.0 22 | surround = colour.VIEWING_CONDITIONS_ZCAM["Average"] 23 | message_box( 24 | f'Convert to the "ZCAM" colour appearance model specification using ' 25 | f"given parameters:\n\n" 26 | f"\tXYZ: {XYZ}\n" 27 | f"\tXYZ_w: {XYZ_w}\n" 28 | f"\tL_A: {L_A}\n" 29 | f"\tY_b: {Y_b}\n" 30 | f"\tSurround: {surround}" 31 | ) 32 | specification = colour.XYZ_to_ZCAM(XYZ, XYZ_w, L_A, Y_b, surround) 33 | print(specification) 34 | 35 | print("\n") 36 | 37 | message_box( 38 | 'Broadcast the current output "ZCAM" colour appearance model ' 39 | "specification to the reference specification." 40 | ) 41 | 42 | print(CAM_ReferenceSpecification_ZCAM(*specification.values)) 43 | 44 | 45 | print("\n") 46 | 47 | J = 48.095883049811491 48 | C = 0.18427174878137914 49 | h = 219.74741565783773 50 | specification = colour.CAM_Specification_ZCAM(J, C, h) 51 | message_box( 52 | f'Convert to "CIE XYZ" tristimulus values using given parameters:\n\n' 53 | f"\tJ: {J}\n" 54 | f"\tC: {C}\n" 55 | f"\th: {h}\n" 56 | f"\tXYZ_w: {XYZ_w}\n" 57 | f"\tL_A: {L_A}\n" 58 | f"\tY_b: {Y_b}\n" 59 | f"\tSurround: {surround}" 60 | ) 61 | print(colour.ZCAM_to_XYZ(specification, XYZ_w, L_A, Y_b, surround)) 62 | -------------------------------------------------------------------------------- /colour/examples/characterisation/examples_colour_checkers.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate colour rendition chart computations. 3 | 4 | This module demonstrates the usage of colour rendition chart datasets, 5 | including chromaticity coordinates and spectral distributions, and 6 | their conversion to various colourspaces. 7 | """ 8 | 9 | from pprint import pprint 10 | 11 | import numpy as np 12 | 13 | import colour 14 | from colour.utilities import message_box 15 | 16 | message_box("Colour Rendition Charts Computations") 17 | 18 | message_box("Colour rendition charts chromaticity coordinates dataset.") 19 | pprint(sorted(colour.CCS_COLOURCHECKERS.keys())) 20 | 21 | print("\n") 22 | 23 | message_box("Colour rendition charts spectral distributions dataset.") 24 | pprint(colour.SDS_COLOURCHECKERS.keys()) 25 | 26 | print("\n") 27 | 28 | message_box( 29 | '"ColorChecker 2005" colour rendition chart chromaticity coordinates data:\n\n' 30 | '\t("Patch Number", "Patch Name", "xyY")' 31 | ) 32 | name, data, illuminant, rows, columns = colour.CCS_COLOURCHECKERS["ColorChecker 2005"] 33 | for name, xyY in data.items(): 34 | print(name, xyY) 35 | 36 | print("\n") 37 | 38 | message_box( 39 | 'Convert the "ColorChecker 2005" colour rendition chart "CIE xyY" ' 40 | 'colourspace values to "sRGB" colourspace "RGB" values:\n\n' 41 | '\t("Patch Name", ["R", "G", "B"])' 42 | ) 43 | for name, xyY in data.items(): 44 | RGB = colour.XYZ_to_RGB( 45 | colour.xyY_to_XYZ(xyY), 46 | colour.RGB_COLOURSPACES["sRGB"], 47 | illuminant, 48 | "Bradford", 49 | apply_cctf_encoding=True, 50 | ) 51 | 52 | RGB_i = [int(round(x * 255)) if x >= 0 else 0 for x in np.ravel(RGB)] 53 | print(f'"{name}": {RGB_i}') 54 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_blackbody.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate blackbody / planckian radiator computations. 3 | 4 | This module provides examples of blackbody radiator spectral distribution 5 | computations and related colorimetric calculations, illustrating planckian 6 | locus operations and correlated colour temperature determinations. 7 | """ 8 | 9 | import colour 10 | from colour.utilities import message_box 11 | 12 | message_box("Blackbody / Planckian Radiator Computations") 13 | 14 | message_box( 15 | "Computing the spectral distribution of a blackbody at temperature 5000K" 16 | 'degrees and converting to "CIE XYZ" tristimulus values.' 17 | ) 18 | cmfs = colour.MSDS_CMFS["CIE 1931 2 Degree Standard Observer"] 19 | sd_blackbody = colour.sd_blackbody(5000, cmfs.shape) 20 | print(sd_blackbody) 21 | XYZ = colour.sd_to_XYZ(sd_blackbody, cmfs) 22 | print(XYZ) 23 | 24 | print("\n") 25 | 26 | message_box( 27 | "Computing the spectral radiance of a blackbody at wavelength 500nm and " 28 | "temperature 5000K degrees." 29 | ) 30 | print(colour.colorimetry.blackbody_spectral_radiance(500 * 1e-9, 5000)) 31 | print(colour.colorimetry.planck_law(500 * 1e-9, 5000)) 32 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_illuminants.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate illuminants datasets. 3 | 4 | This module provides examples of illuminants spectral distributions 5 | and chromaticity coordinates datasets. 6 | """ 7 | 8 | from pprint import pprint 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box("Illuminants Dataset") 14 | 15 | message_box("Illuminants spectral distributions dataset.") 16 | pprint(sorted(colour.SDS_ILLUMINANTS.keys())) 17 | 18 | print("\n") 19 | 20 | message_box("Illuminants chromaticity coordinates dataset.") 21 | # Filtering aliases. 22 | observers = { 23 | observer: dataset 24 | for observer, dataset in sorted(colour.CCS_ILLUMINANTS.items()) 25 | if " " in observer 26 | } 27 | for observer, illuminants in observers.items(): 28 | print(f'"{observer}".') 29 | for illuminant, xy in sorted(illuminants.items()): 30 | print(f'\t"{illuminant}": {xy}') 31 | print("\n") 32 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_lefs.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate luminous efficiency functions computations. 3 | 4 | This module provides examples of luminous efficiency functions and mesopic 5 | luminous efficiency function calculations. 6 | """ 7 | 8 | from pprint import pprint 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box("Luminous Efficiency Functions Computations") 14 | 15 | message_box("Luminous efficiency functions dataset.") 16 | pprint(sorted(colour.SDS_LEFS)) 17 | 18 | print("\n") 19 | 20 | message_box("Computing the mesopic luminous efficiency function for factor:\n\n\t0.2") 21 | print(colour.sd_mesopic_luminous_efficiency_function(0.2).values) 22 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_light_sources.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate light sources datasets. 3 | 4 | This module provides examples of light sources spectral distributions 5 | and chromaticity coordinates datasets. 6 | """ 7 | 8 | from pprint import pprint 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box("Light Sources Dataset") 14 | 15 | message_box("Light sources spectral distributions datasets.") 16 | pprint(sorted(colour.SDS_LIGHT_SOURCES.keys())) 17 | 18 | print("\n") 19 | 20 | message_box("Light sources chromaticity coordinates datasets.") 21 | # Filtering aliases. 22 | observers = { 23 | observer: dataset 24 | for observer, dataset in sorted(colour.CCS_LIGHT_SOURCES.items()) 25 | if " " in observer 26 | } 27 | for observer, light_source in observers.items(): 28 | print(f'"{observer}".') 29 | for illuminant, xy in sorted(light_source.items()): 30 | print(f'\t"{illuminant}": {xy}') 31 | print("\n") 32 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_lightness.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate lightness computations. 3 | 4 | This module provides examples of lightness calculations using various 5 | standard methods. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box('"Lightness" Computations') 14 | 15 | xyY = np.array([0.4316, 0.3777, 0.1008]) 16 | message_box( 17 | f'Computing "Lightness" "CIE L*a*b*" reference value for given "CIE xyY" ' 18 | f"colourspace values:\n\n\t{xyY}" 19 | ) 20 | print(np.ravel(colour.XYZ_to_Lab(colour.xyY_to_XYZ(xyY)))[0]) 21 | 22 | print("\n") 23 | 24 | Y = 12.19722535 25 | message_box( 26 | f'Computing "Lightness" using ' 27 | f'"Glasser, Mckinney, Reilly and Schnelle (1958)" method for given ' 28 | f'"luminance" value:\n\n\t{Y}' 29 | ) 30 | print(colour.lightness(Y, method="Glasser 1958")) 31 | print(colour.colorimetry.lightness_Glasser1958(Y)) 32 | 33 | print("\n") 34 | 35 | message_box( 36 | f'Computing "Lightness" using "Wyszecki (1963)" method for given ' 37 | f'"luminance" value:\n\n\t{Y}' 38 | ) 39 | print(colour.lightness(Y, method="Wyszecki 1963")) 40 | print(colour.colorimetry.lightness_Wyszecki1963(Y)) 41 | 42 | print("\n") 43 | 44 | message_box( 45 | f'Computing "Lightness" using "Fairchild and Wyble (2010)" method for ' 46 | f'given "luminance" value:\n\n\t{Y}' 47 | ) 48 | print(colour.lightness(Y, method="Fairchild 2010")) 49 | print(colour.colorimetry.lightness_Fairchild2010(Y / 100.0)) 50 | 51 | print("\n") 52 | 53 | message_box( 54 | f'Computing "Lightness" using "Fairchild and Chen (2011)" method for ' 55 | f'given "luminance" value:\n\n\t{Y}' 56 | ) 57 | print(colour.lightness(Y, method="Fairchild 2011")) 58 | print(colour.colorimetry.lightness_Fairchild2011(Y / 100.0)) 59 | 60 | print("\n") 61 | 62 | message_box( 63 | f'Computing "Lightness" using "CIE 1976" method for given "luminance" ' 64 | f"value:\n\n\t{Y}" 65 | ) 66 | print(colour.lightness(Y, method="CIE 1976")) 67 | print(colour.colorimetry.lightness_CIE1976(Y)) 68 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_luminance.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate luminance computations. 3 | 4 | This module provides examples of luminance calculations using various 5 | standard methods. 6 | """ 7 | 8 | import colour 9 | from colour.utilities import message_box 10 | 11 | message_box('"Luminance" Computations') 12 | 13 | V = 4.08244375 14 | message_box( 15 | f'Computing "luminance" using "Newhall, Nickerson, and Judd (1943)" ' 16 | f'method for given "Munsell" value:\n\n\t{V}' 17 | ) 18 | print(colour.luminance(V * 10, method="Newhall 1943")) 19 | print(colour.colorimetry.luminance_Newhall1943(V)) 20 | 21 | print("\n") 22 | 23 | L = 41.527875844653451 24 | message_box( 25 | f'Computing "luminance" using "CIE 1976" method for given "Lightness":\n\n\t{L}' 26 | ) 27 | print(colour.luminance(L)) 28 | print(colour.colorimetry.luminance_CIE1976(L)) 29 | 30 | print("\n") 31 | 32 | L = 31.996390226262736 33 | message_box( 34 | f'Computing "luminance" using "Fairchild and Wyble (2010)" method for ' 35 | f'given "Lightness":\n\n\t{L}' 36 | ) 37 | print(colour.luminance(L, method="Fairchild 2010") * 100) 38 | print(colour.colorimetry.luminance_Fairchild2010(L) * 100) 39 | 40 | print("\n") 41 | 42 | L = 51.852958445912506 43 | message_box( 44 | f'Computing "luminance" using "Fairchild and Chen (2011)" method for ' 45 | f'given "Lightness":\n\n\t{L}' 46 | ) 47 | print(colour.luminance(L, method="Fairchild 2011")) 48 | print(colour.colorimetry.luminance_Fairchild2011(L) * 100) 49 | 50 | print("\n") 51 | 52 | message_box( 53 | f'Computing "luminance" using "ASTM D1535-08e1" method for given ' 54 | f'"Munsell" value:\n\n\t{V}' 55 | ) 56 | print(colour.luminance(V * 10, method="ASTM D1535")) 57 | print(colour.colorimetry.luminance_ASTMD1535(V)) 58 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_photometry.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate photometry computations. 3 | 4 | This module provides examples of photometric calculations including luminous 5 | flux, efficiency and efficacy. 6 | """ 7 | 8 | import colour 9 | from colour.utilities import message_box 10 | 11 | message_box('"Photometry" Computations') 12 | 13 | sd_light_source = colour.SDS_LIGHT_SOURCES["Neodimium Incandescent"] 14 | message_box( 15 | f'Computing "Luminous Flux" for given spectral distribution:\n\n' 16 | f"\t{sd_light_source.name}" 17 | ) 18 | print(colour.luminous_flux(sd_light_source)) 19 | 20 | print("\n") 21 | 22 | message_box( 23 | f'Computing "Luminous Efficiency" for given spectral distribution:\n\n' 24 | f"\t{sd_light_source.name}" 25 | ) 26 | print(colour.luminous_efficiency(sd_light_source)) 27 | 28 | print("\n") 29 | 30 | message_box( 31 | f'Computing "Luminous Efficacy" for given spectral distribution:\n\n' 32 | f"\t{sd_light_source.name}" 33 | ) 34 | print(colour.luminous_efficacy(sd_light_source)) 35 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_uniformity.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate spectral uniformity computations. 3 | 4 | This module provides examples of spectral uniformity (or flatness) 5 | calculations for test colour samples. 6 | """ 7 | 8 | import colour 9 | from colour.quality.cfi2017 import load_TCS_CIE2017 10 | from colour.quality.datasets import SDS_TCS 11 | from colour.utilities import message_box 12 | 13 | message_box("Spectral Uniformity (or Flatness) Computations") 14 | 15 | message_box('Computing the spectral uniformity of the "CRI" test colour samples.') 16 | 17 | print(colour.spectral_uniformity(list(SDS_TCS.values()))) 18 | 19 | print("\n") 20 | 21 | message_box('Computing the spectral uniformity of the "CFI" test colour samples.') 22 | 23 | print(colour.spectral_uniformity(load_TCS_CIE2017(colour.SPECTRAL_SHAPE_DEFAULT))) 24 | -------------------------------------------------------------------------------- /colour/examples/colorimetry/examples_yellowness.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate yellowness computations. 3 | 4 | This module provides examples of yellowness calculations using various 5 | standard methods. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box('"Yellowness" Computations') 14 | 15 | XYZ = np.array([95.00000000, 100.00000000, 105.00000000]) 16 | message_box( 17 | f'Computing "yellowness" using "ASTM D1925" method for given sample ' 18 | f'"CIE XYZ" tristimulus values:\n\n\t{XYZ}' 19 | ) 20 | print(colour.yellowness(XYZ=XYZ, method="ASTM D1925")) 21 | print(colour.colorimetry.yellowness_ASTMD1925(XYZ)) 22 | 23 | print("\n") 24 | 25 | message_box( 26 | f'Computing "yellowness" using "ASTM E313" method for given sample ' 27 | f'"CIE XYZ" tristimulus values:\n\n\t{XYZ}' 28 | ) 29 | print(colour.yellowness(XYZ=XYZ, method="ASTM E313")) 30 | print(colour.colorimetry.yellowness_ASTME313(XYZ)) 31 | 32 | message_box( 33 | f'Computing "yellowness" using the alternative "ASTM E313" method for ' 34 | f'given sample "CIE XYZ" tristimulus values:\n\n\t{XYZ}' 35 | ) 36 | print(colour.yellowness(XYZ=XYZ, method="ASTM E313 Alternative")) 37 | print(colour.colorimetry.yellowness_ASTME313_alternative(XYZ)) 38 | -------------------------------------------------------------------------------- /colour/examples/corresponding/examples_prediction.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate corresponding chromaticities prediction computations. 3 | 4 | This module demonstrates the prediction of corresponding chromaticities 5 | using various chromatic adaptation models including *Von Kries*, *CIE 1994*, 6 | *CMCCAT2000*, and *Fairchild (1990)* methods. 7 | """ 8 | 9 | from pprint import pprint 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box("Corresponding Chromaticities Prediction Computations") 15 | 16 | message_box( 17 | 'Compute corresponding chromaticities prediction with "Von Kries" ' 18 | 'chromatic adaptation model for "Breneman (1987)" experiment number "3" ' 19 | 'and "Bianco" CAT.' 20 | ) 21 | pprint( 22 | colour.corresponding_chromaticities_prediction( 23 | 3, model="Von Kries", transform="Bianco 2010" 24 | ) 25 | ) 26 | pprint( 27 | colour.corresponding.corresponding_chromaticities_prediction_VonKries( 28 | 3, "Bianco 2010" 29 | ) 30 | ) 31 | 32 | print("\n") 33 | 34 | message_box( 35 | 'Compute corresponding chromaticities prediction with "CIE 1994" ' 36 | 'chromatic adaptation model for "Breneman (1987)" experiment number "1".' 37 | ) 38 | pprint(colour.corresponding_chromaticities_prediction(3, model="CIE 1994")) 39 | pprint(colour.corresponding.corresponding_chromaticities_prediction_CIE1994(1)) 40 | 41 | print("\n") 42 | 43 | message_box( 44 | 'Compute corresponding chromaticities prediction with "CMCCAT2000" ' 45 | 'chromatic adaptation model for "Breneman (1987)" experiment number "1".' 46 | ) 47 | pprint(colour.corresponding_chromaticities_prediction(3, model="CMCCAT2000")) 48 | pprint(colour.corresponding.corresponding_chromaticities_prediction_CMCCAT2000(1)) 49 | 50 | print("\n") 51 | 52 | message_box( 53 | 'Compute corresponding chromaticities prediction with Fairchild (1990)" ' 54 | 'chromatic adaptation model for "Breneman (1987)" experiment number "1".' 55 | ) 56 | pprint(colour.corresponding_chromaticities_prediction(3, model="Fairchild 1990")) 57 | pprint(colour.corresponding.corresponding_chromaticities_prediction_Fairchild1990(1)) 58 | -------------------------------------------------------------------------------- /colour/examples/io/examples_fichet2021.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Fichet, Pacanowski and Wilkie (2021)* OpenEXR Layout for Spectral Images. 3 | 4 | This module provides examples of reading and writing spectral images 5 | using the OpenEXR layout format. 6 | """ 7 | 8 | import os 9 | import tempfile 10 | 11 | import colour 12 | from colour.utilities import is_imageio_installed, message_box 13 | 14 | if is_imageio_installed(): 15 | ROOT_RESOURCES = os.path.join( 16 | os.path.dirname(__file__), "..", "..", "io", "tests", "resources" 17 | ) 18 | 19 | message_box( 20 | '"Fichet, Pacanowski and Wilkie (2021)" Spectral Image Reading and Writing' 21 | ) 22 | 23 | message_box("Reading a spectral image.") 24 | path = os.path.join(ROOT_RESOURCES, "Ohta1997.exr") 25 | components, specification = colour.read_spectral_image_Fichet2021( 26 | path, additional_data=True 27 | ) 28 | print(components) 29 | print(specification) 30 | 31 | print("\n") 32 | 33 | message_box("Writing a spectral image.") 34 | _descriptor, path = tempfile.mkstemp(suffix=".exr") 35 | colour.write_spectral_image_Fichet2021(components, path) # pyright: ignore 36 | components = colour.read_spectral_image_Fichet2021(path) 37 | print(components) 38 | -------------------------------------------------------------------------------- /colour/examples/io/examples_ies_tm2714.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *IES TM-27-14* spectral data XML file input/output. 3 | 4 | This module provides examples of reading and writing spectral data 5 | from XML files following the *IES TM-27-14* standard. 6 | """ 7 | 8 | import os 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | ROOT_RESOURCES = os.path.join(os.path.dirname(__file__), "resources") 14 | 15 | message_box('"IES TM-27-14" Spectral Data "XML" File IO') 16 | 17 | message_box('Reading spectral data from "IES TM-27-14" "XML" file.') 18 | sd_tm2714 = colour.SpectralDistribution_IESTM2714( 19 | os.path.join(ROOT_RESOURCES, "TM27 Sample Spectral Data.spdx") 20 | ).read() 21 | print(sd_tm2714) 22 | 23 | print("\n") 24 | 25 | message_box('"IES TM-27-14" spectral data "XML" file header:') 26 | print(f"Manufacturer: {sd_tm2714.header.manufacturer}") 27 | print(f"Catalog Number: {sd_tm2714.header.catalog_number}") 28 | print(f"Description: {sd_tm2714.header.description}") 29 | print(f"Document Creator: {sd_tm2714.header.document_creator}") 30 | print(f"Unique Identifier: {sd_tm2714.header.unique_identifier}") 31 | print(f"Measurement Equipment: {sd_tm2714.header.measurement_equipment}") 32 | print(f"Laboratory: {sd_tm2714.header.laboratory}") 33 | print(f"Report Number: {sd_tm2714.header.report_number}") 34 | print(f"Report Date: {sd_tm2714.header.report_date}") 35 | print(f"Document Creation Date: {sd_tm2714.header.document_creation_date}") 36 | print(f"Comments: {sd_tm2714.header.comments}") 37 | 38 | print("\n") 39 | 40 | message_box('"IES TM-27-14" spectral data "XML" file spectral distribution:') 41 | print(f"Spectral Quantity: {sd_tm2714.spectral_quantity}") 42 | print(f"Reflection Geometry: {sd_tm2714.reflection_geometry}") 43 | print(f"Transmission Geometry: {sd_tm2714.transmission_geometry}") 44 | print(f"Bandwidth FWHM: {sd_tm2714.bandwidth_FWHM}") 45 | print(f"Bandwidth Corrected: {sd_tm2714.bandwidth_corrected}") 46 | 47 | print("\n") 48 | 49 | message_box('"IES TM-27-14" spectral data "XML" file spectral data:') 50 | print(sd_tm2714) 51 | -------------------------------------------------------------------------------- /colour/examples/io/examples_tabular.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate CSV tabular data input/output operations. 3 | 4 | This module provides examples of reading and writing CSV tabular data 5 | for spectral distributions. 6 | """ 7 | 8 | import os 9 | from pprint import pprint 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | ROOT_RESOURCES = os.path.join(os.path.dirname(__file__), "resources") 15 | 16 | message_box('"CSV" Tabular Data IO') 17 | 18 | message_box('Reading tabular data from "CSV" file.') 19 | data_babelcolor_average = colour.read_spectral_data_from_csv_file( 20 | os.path.join(ROOT_RESOURCES, "babelcolor_average.csv") 21 | ) 22 | pprint(sorted(data_babelcolor_average.keys())) 23 | 24 | print("\n") 25 | 26 | message_box( 27 | 'Reading spectral data from a "CSV" file directly as spectral distributions.' 28 | ) 29 | sds_babelcolor_average = colour.read_sds_from_csv_file( 30 | os.path.join(ROOT_RESOURCES, "babelcolor_average.csv") 31 | ) 32 | pprint(sds_babelcolor_average) 33 | -------------------------------------------------------------------------------- /colour/examples/models/examples_cmyk.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate Cyan-Magenta-Yellow (Black) (CMY(K)) colour transformations. 3 | 4 | This module provides examples of colour transformations between RGB, 5 | CMY and CMYK colour models. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box("Cyan-Magenta-Yellow (Black) (CMY(K)) Colour Transformations") 14 | 15 | RGB = np.array([0.45620519, 0.03081071, 0.04091952]) 16 | message_box( 17 | f'Converting to the "CMY" colourspace from given "RGB" colourspace ' 18 | f"values:\n\n\t{RGB}" 19 | ) 20 | print(colour.RGB_to_CMY(RGB)) 21 | 22 | print("\n") 23 | 24 | CMY = np.array([0.54379481, 0.96918929, 0.95908048]) 25 | message_box( 26 | f'Converting to the "RGB" colourspace from given "CMY" colourspace ' 27 | f"values:\n\n\t{CMY}" 28 | ) 29 | print(colour.CMY_to_RGB(CMY)) 30 | 31 | print("\n") 32 | 33 | message_box( 34 | f'Converting to the "CMYK" colourspace from given "CMY" colourspace ' 35 | f"values:\n\n\t{CMY}" 36 | ) 37 | print(colour.CMY_to_CMYK(CMY)) 38 | 39 | print("\n") 40 | 41 | CMYK = np.array([0.00000000, 0.93246304, 0.91030457, 0.54379481]) 42 | message_box( 43 | f'Converting to the "CMY" colourspace from given "CMYK" colourspace ' 44 | f"values:\n\n\t{CMYK}" 45 | ) 46 | print(colour.CMYK_to_CMY(CMYK)) 47 | -------------------------------------------------------------------------------- /colour/examples/models/examples_cylindrical.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate cylindrical and spherical colour models computations. 3 | 4 | This module provides examples of colour transformations between RGB 5 | and cylindrical colour models like HSV, HSL and HCL. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box("Cylindrical & Spherical Colour Models") 14 | 15 | RGB = np.array([0.45620519, 0.03081071, 0.04091952]) 16 | message_box( 17 | f'Converting to the "HSV" colourspace from given "RGB" colourspace ' 18 | f"values:\n\n\t{RGB}" 19 | ) 20 | print(colour.RGB_to_HSV(RGB)) 21 | 22 | print("\n") 23 | 24 | HSV = np.array([0.99603944, 0.93246304, 0.45620519]) 25 | message_box( 26 | f'Converting to the "RGB" colourspace from given "HSV" colourspace ' 27 | f"values:\n\n\t{HSV}" 28 | ) 29 | print(colour.HSV_to_RGB(HSV)) 30 | 31 | print("\n") 32 | 33 | message_box( 34 | f'Converting to the "HSL" colourspace from given "RGB" colourspace ' 35 | f"values:\n\n\t{RGB}" 36 | ) 37 | print(colour.RGB_to_HSL(RGB)) 38 | 39 | print("\n") 40 | 41 | HSL = np.array([0.99603944, 0.87347144, 0.24350795]) 42 | message_box( 43 | f'Converting to the "RGB" colourspace from given "HSL" colourspace ' 44 | f"values:\n\n\t{HSL}" 45 | ) 46 | print(colour.HSL_to_RGB(HSL)) 47 | 48 | print("\n") 49 | 50 | message_box( 51 | f'Converting to the "HCL" colourspace from given "RGB" colourspace ' 52 | f"values:\n\n\t{RGB}" 53 | ) 54 | print(colour.RGB_to_HCL(RGB)) 55 | 56 | print("\n") 57 | 58 | HCL = np.array([0.99603944, 0.87347144, 0.24350795]) 59 | message_box( 60 | f'Converting to the "RGB" colourspace from given "HCL" colourspace ' 61 | f"values:\n\n\t{HCL}" 62 | ) 63 | print(colour.HCL_to_RGB(HCL)) 64 | 65 | print("\n") 66 | -------------------------------------------------------------------------------- /colour/examples/models/examples_ictcp.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *ICtCp* colour encoding computations. 3 | 4 | This module provides examples of conversions between RGB colourspaces 5 | and the *ICtCp* colour encoding. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box('"ICtCp" Colour Encoding Computations') 14 | 15 | RGB = np.array([0.45620519, 0.03081071, 0.04091952]) 16 | message_box( 17 | f'Converting from the "ITU-R BT.2020" colourspace to the "ICtCp" colour ' 18 | f'encoding given "RGB" values:\n\n\t{RGB}' 19 | ) 20 | print(colour.RGB_to_ICtCp(RGB)) 21 | 22 | print("\n") 23 | 24 | ICtCp = np.array([0.07351364, 0.00475253, 0.09351596]) 25 | message_box( 26 | f'Converting from the "ICtCp" colour encoding to the "ITU-R BT.2020" ' 27 | f'colourspace given "ICtCp" values:\n\n\t{ICtCp}' 28 | ) 29 | print(colour.ICtCp_to_RGB(ICtCp)) 30 | -------------------------------------------------------------------------------- /colour/examples/models/examples_prismatic.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate Prismatic colourspace computations. 3 | 4 | This module provides examples of conversions between RGB and Prismatic 5 | colourspaces, including desaturation operations. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box('"Prismatic" Colourspace Computations') 14 | 15 | RGB = np.array([0.25, 0.50, 0.75]) 16 | message_box( 17 | f'Converting from the "RGB" colourspace to the "Prismatic" colourspace ' 18 | f'given "RGB" values:\n\n\t{RGB}' 19 | ) 20 | print(colour.RGB_to_Prismatic(RGB)) 21 | 22 | print("\n") 23 | 24 | Lrgb = np.array([0.7500000, 0.1666667, 0.3333333, 0.5000000]) 25 | message_box( 26 | f'Converting from the "Prismatic" colourspace to the "RGB" colourspace ' 27 | f'given "Lrgb" values:\n\n\t{Lrgb}' 28 | ) 29 | print(colour.Prismatic_to_RGB(Lrgb)) 30 | 31 | print("\n") 32 | 33 | message_box( 34 | f'Applying 50% desaturation in the "Prismatic" colourspace to the given ' 35 | f'"RGB" values:\n\n\t{RGB}' 36 | ) 37 | saturation = 0.5 38 | Lrgb = colour.RGB_to_Prismatic(RGB) 39 | Lrgb[..., 1:] = 1.0 / 3.0 + saturation * (Lrgb[..., 1:] - 1.0 / 3.0) 40 | print(colour.Prismatic_to_RGB(Lrgb)) 41 | -------------------------------------------------------------------------------- /colour/examples/models/examples_ycbcr.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Y'CbCr* colour encoding computations. 3 | 4 | This module provides examples of conversions between RGB colourspaces 5 | and *Y'CbCr 6 | 8colour encodings. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('"Y\'CbCr" Colour Encoding Computations') 15 | 16 | RGB = np.array([0.45620519, 0.03081071, 0.04091952]) 17 | message_box( 18 | f'Converting to the "Y\'CbCr" colour encoding from given "ITU-R BT.709" ' 19 | f"colourspace values:\n\n\t{RGB}" 20 | ) 21 | print(colour.RGB_to_YCbCr(RGB)) 22 | 23 | print("\n") 24 | 25 | message_box( 26 | f'Converting to the "Y\'CbCr" colour encoding from given"ITU-R BT.601" ' 27 | f"colourspace values using legal range and int output:\n\n\t{RGB}" 28 | ) 29 | print( 30 | colour.RGB_to_YCbCr( 31 | RGB, colour.WEIGHTS_YCBCR["ITU-R BT.601"], out_legal=True, out_int=True 32 | ) 33 | ) 34 | 35 | print("\n") 36 | 37 | YCbCr = np.array([101, 111, 124]) 38 | message_box( 39 | f'Converting to the "ITU-R BT.601" colourspace from given "Y\'CbCr" ' 40 | f"values using legal range and int input:\n\n\t{RGB}" 41 | ) 42 | print(colour.YCbCr_to_RGB(YCbCr, in_legal=True, in_int=True)) 43 | 44 | print("\n") 45 | 46 | RGB = np.array([0.18, 0.18, 0.18]) 47 | message_box( 48 | f"Converting to the \"Yc'Cbc'Crc'\" colour encoding from given " 49 | f'"ITU-R BT.2020" values using legal range, int output on a 10-bit ' 50 | f"system:\n\n\t{RGB}" 51 | ) 52 | print( 53 | colour.RGB_to_YcCbcCrc( 54 | RGB, out_bits=10, out_legal=True, out_int=True, is_12_bits_system=False 55 | ) 56 | ) 57 | 58 | print("\n") 59 | 60 | YcCbcCrc = np.array([422, 512, 512]) 61 | message_box( 62 | f'Converting to the "ITU-R BT.2020" colourspace from given "RGB" values ' 63 | f"using legal range, int input on a 10-bit system:\n\n\t{RGB}" 64 | ) 65 | print( 66 | colour.YcCbcCrc_to_RGB( 67 | YcCbcCrc, 68 | in_bits=10, 69 | in_legal=True, 70 | in_int=True, 71 | is_12_bits_system=False, 72 | ) 73 | ) 74 | -------------------------------------------------------------------------------- /colour/examples/models/examples_ycocg.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *YCoCg* colour encoding computations. 3 | 4 | This module provides examples of conversions between RGB colourspaces 5 | and *YCoCg* colour encoding. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box('"YCoCg" Colour Encoding Computations') 14 | 15 | RGB = np.array([0.45620519, 0.03081071, 0.04091952]) 16 | message_box( 17 | f'Converting to the "YCoCg" colour encoding from given "RGB" colourspace ' 18 | f"values:\n\n\t{RGB}" 19 | ) 20 | print(colour.RGB_to_YCoCg(RGB)) 21 | 22 | print("\n") 23 | 24 | YCoCg = np.array([0.13968653, 0.20764283, -0.10887582]) 25 | message_box( 26 | f'Converting to the "RGB" colourspace values from "YCoCg" colour encoding ' 27 | f"values:\n\n\t{YCoCg}" 28 | ) 29 | print(colour.YCoCg_to_RGB(YCoCg)) 30 | -------------------------------------------------------------------------------- /colour/examples/notation/examples_hexadecimal.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate hexadecimal colour notation computations. 3 | 4 | This module demonstrates conversions between RGB colourspace values and 5 | hexadecimal colour notation representations. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour.notation.hexadecimal 11 | from colour.utilities import message_box 12 | 13 | message_box("Hexadecimal Computations") 14 | 15 | RGB = np.array([0.45620519, 0.03081071, 0.04091952]) 16 | message_box( 17 | f'Convert to the "hexadecimal" representation from given "RGB"' 18 | f"colourspace values:\n\n\t{RGB}" 19 | ) 20 | print(colour.notation.hexadecimal.RGB_to_HEX(RGB)) 21 | 22 | print("\n") 23 | 24 | hex_triplet = "#74070a" 25 | message_box( 26 | f'Convert to the "RGB" colourspace from given "hexadecimal" ' 27 | f"representation:\n\n\t{hex_triplet}" 28 | ) 29 | print(colour.notation.hexadecimal.HEX_to_RGB(hex_triplet)) 30 | -------------------------------------------------------------------------------- /colour/examples/phenomena/examples_rayleigh.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Rayleigh Optical Depth* computations. 3 | 4 | This module demonstrates *Rayleigh* scattering computations including optical 5 | depth calculations and spectral distribution generation for atmospheric 6 | scattering phenomena. 7 | """ 8 | 9 | import colour 10 | from colour.utilities import message_box 11 | 12 | message_box('"Rayleigh" Optical Depth Computations') 13 | 14 | message_box( 15 | f'Create a "Rayleigh" spectral distribution with default spectral ' 16 | f"shape:\n\n\t{colour.SPECTRAL_SHAPE_DEFAULT}" 17 | ) 18 | sd_rayleigh = colour.sd_rayleigh_scattering() 19 | print(sd_rayleigh[555]) 20 | 21 | print("\n") 22 | 23 | wavelength = 555 * 10e-8 24 | message_box( 25 | f"Compute the scattering cross-section per molecule at given wavelength " 26 | f"in cm:\n\n\tWavelength: {wavelength}cm" 27 | ) 28 | print(colour.phenomena.scattering_cross_section(wavelength)) 29 | 30 | print("\n") 31 | 32 | message_box( 33 | f'Compute the "Rayleigh" optical depth as function of wavelength in ' 34 | f"cm:\n\n\tWavelength: {wavelength}cm" 35 | ) 36 | print(colour.phenomena.rayleigh_optical_depth(wavelength)) 37 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_characterisation_plots.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate characterisation plotting. 3 | 4 | This module provides examples of plotting colour rendition charts and 5 | spectral distributions for colour characterisation. 6 | """ 7 | 8 | from pprint import pprint 9 | 10 | import colour 11 | from colour.plotting import colour_style, plot_multi_sds, plot_single_colour_checker 12 | from colour.utilities import message_box 13 | 14 | message_box("Characterisation Plots") 15 | 16 | colour_style() 17 | 18 | message_box("Plotting colour rendition charts.") 19 | pprint(sorted(colour.CCS_COLOURCHECKERS.keys())) 20 | plot_single_colour_checker("ColorChecker 1976") 21 | plot_single_colour_checker("BabelColor Average", text_kwargs={"visible": False}) 22 | plot_single_colour_checker("ColorChecker 1976", text_kwargs={"visible": False}) 23 | plot_single_colour_checker("ColorChecker 2005", text_kwargs={"visible": False}) 24 | 25 | print("\n") 26 | 27 | message_box( 28 | 'Plotting "BabelColor Average" colour rendition charts spectral distributions.' 29 | ) 30 | plot_multi_sds( 31 | colour.SDS_COLOURCHECKERS["BabelColor Average"].values(), 32 | title="BabelColor Average - Spectral Distributions", 33 | plot_kwargs={ 34 | "use_sd_colours": True, 35 | }, 36 | ) 37 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_common_plots.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate common plotting operations. 3 | 4 | This module provides examples of basic plotting operations including 5 | colour swatches and common plot elements. 6 | """ 7 | 8 | from colour.plotting import ( 9 | ColourSwatch, 10 | colour_style, 11 | plot_multi_colour_swatches, 12 | plot_single_colour_swatch, 13 | ) 14 | from colour.utilities import message_box 15 | 16 | message_box("Common Plots") 17 | 18 | colour_style() 19 | 20 | message_box("Plotting a single colour.") 21 | plot_single_colour_swatch( 22 | ColourSwatch((0.32315746, 0.32983556, 0.33640183), "Neutral 5 (.70 D)"), 23 | text_size=32, 24 | ) 25 | 26 | print("\n") 27 | 28 | message_box("Plotting multiple colours.") 29 | plot_multi_colour_swatches( 30 | ( 31 | ColourSwatch((0.45293517, 0.31732158, 0.26414773), "Dark Skin"), 32 | ColourSwatch((0.77875824, 0.57726450, 0.50453169), "Light Skin"), 33 | ), 34 | text_size=32, 35 | ) 36 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_corresponding.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate corresponding chromaticities prediction plotting. 3 | 4 | This module provides examples of plotting corresponding chromaticities 5 | prediction using various chromatic adaptation models. 6 | """ 7 | 8 | from colour.plotting import colour_style, plot_corresponding_chromaticities_prediction 9 | from colour.utilities import message_box 10 | 11 | message_box("Corresponding Chromaticities Prediction Plots") 12 | 13 | colour_style() 14 | 15 | message_box( 16 | 'Plotting corresponding chromaticities prediction with "Von Kries" ' 17 | 'chromatic adaptation model for "Breneman (1987)" experiment number "2" ' 18 | 'using "Bianco" CAT.' 19 | ) 20 | plot_corresponding_chromaticities_prediction( 21 | 2, 22 | "Von Kries", 23 | corresponding_chromaticities_prediction_kwargs={"transform": "Bianco 2010"}, 24 | ) 25 | 26 | print("\n") 27 | 28 | message_box( 29 | 'Plotting corresponding chromaticities prediction with "CMCCAT200" ' 30 | 'chromatic adaptation model for "Breneman (1987)" experiment number "4" ' 31 | 'using "Bianco" CAT.' 32 | ) 33 | plot_corresponding_chromaticities_prediction(4, "CMCCAT2000") 34 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_diagrams_plots.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate CIE chromaticity diagrams plotting. 3 | 4 | This module provides examples of plotting various CIE chromaticity 5 | diagrams and spectral distributions. 6 | """ 7 | 8 | from colour import SDS_ILLUMINANTS 9 | from colour.plotting import ( 10 | colour_style, 11 | plot_chromaticity_diagram_CIE1931, 12 | plot_chromaticity_diagram_CIE1960UCS, 13 | plot_chromaticity_diagram_CIE1976UCS, 14 | plot_sds_in_chromaticity_diagram_CIE1931, 15 | plot_sds_in_chromaticity_diagram_CIE1960UCS, 16 | plot_sds_in_chromaticity_diagram_CIE1976UCS, 17 | ) 18 | from colour.utilities import message_box 19 | 20 | message_box('"CIE" Chromaticity Diagrams Plots') 21 | 22 | colour_style() 23 | 24 | message_box('Plotting "CIE 1931 Chromaticity Diagram".') 25 | plot_chromaticity_diagram_CIE1931() 26 | 27 | print("\n") 28 | 29 | message_box('Plotting "CIE 1960 UCS Chromaticity Diagram".') 30 | plot_chromaticity_diagram_CIE1960UCS() 31 | 32 | print("\n") 33 | 34 | message_box('Plotting "CIE 1976 UCS Chromaticity Diagram".') 35 | plot_chromaticity_diagram_CIE1976UCS() 36 | 37 | print("\n") 38 | 39 | message_box( 40 | 'Plotting "CIE Standard Illuminant A" and "CIE Standard Illuminant D65" ' 41 | "spectral distribution chromaticity coordinates in " 42 | '"CIE 1931 Chromaticity Diagram".' 43 | ) 44 | sd_A = SDS_ILLUMINANTS["A"] 45 | sd_D65 = SDS_ILLUMINANTS["D65"] 46 | plot_sds_in_chromaticity_diagram_CIE1931((sd_A, sd_D65)) 47 | 48 | print("\n") 49 | 50 | message_box( 51 | 'Plotting "CIE Standard Illuminant A" and "CIE Standard Illuminant D65" ' 52 | "spectral distribution chromaticity coordinates in " 53 | '"CIE 1960 UCS Chromaticity Diagram".' 54 | ) 55 | plot_sds_in_chromaticity_diagram_CIE1960UCS((sd_A, sd_D65)) 56 | 57 | print("\n") 58 | 59 | message_box( 60 | 'Plotting "CIE Standard Illuminant A" and "CIE Standard Illuminant D65" ' 61 | "spectral distribution chromaticity coordinates in " 62 | '"CIE 1976 UCS Chromaticity Diagram".' 63 | ) 64 | plot_sds_in_chromaticity_diagram_CIE1976UCS((sd_A, sd_D65)) 65 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_notation_plots.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate colour notation systems plotting. 3 | 4 | This module provides examples of plotting Munsell value functions 5 | and other colour notation systems. 6 | """ 7 | 8 | from colour.plotting import ( 9 | colour_style, 10 | plot_multi_munsell_value_functions, 11 | plot_single_munsell_value_function, 12 | ) 13 | from colour.utilities import message_box 14 | 15 | message_box("Colour Notation Systems Plots") 16 | 17 | colour_style() 18 | 19 | message_box('Plotting a single "Munsell" value function.') 20 | plot_single_munsell_value_function("Ladd 1955") 21 | 22 | print("\n") 23 | 24 | message_box('Plotting multiple "Munsell" value functions.') 25 | plot_multi_munsell_value_functions(["Ladd 1955", "Saunderson 1944"]) 26 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_phenomena_plots.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate optical phenomena plotting. 3 | 4 | This module provides examples of plotting Rayleigh scattering and 5 | other optical phenomena. 6 | """ 7 | 8 | from colour.phenomena import sd_rayleigh_scattering 9 | from colour.plotting import ( 10 | colour_style, 11 | plot_multi_sds, 12 | plot_single_sd_rayleigh_scattering, 13 | plot_the_blue_sky, 14 | ) 15 | from colour.utilities import message_box 16 | 17 | message_box("Optical Phenomena Plots") 18 | 19 | colour_style() 20 | 21 | message_box('Plotting a single "Rayleigh" scattering spectral "distribution."') 22 | plot_single_sd_rayleigh_scattering() 23 | 24 | print("\n") 25 | 26 | message_box( 27 | 'Comparing multiple "Rayleigh" scattering spectral distributions with ' 28 | "different CO_2 concentrations." 29 | ) 30 | name_template = "Rayleigh Scattering - CO2: {0} ppm" 31 | sds_rayleigh = [] 32 | for ppm in (0, 50, 300): 33 | sd_rayleigh = sd_rayleigh_scattering(CO2_concentration=ppm) 34 | sd_rayleigh.name = name_template.format(ppm) 35 | sds_rayleigh.append(sd_rayleigh) 36 | plot_multi_sds( 37 | sds_rayleigh, 38 | title='Rayleigh Optical Depth - Comparing "C02" Concentration Influence', 39 | y_label="Optical Depth", 40 | ) 41 | 42 | print("\n") 43 | 44 | message_box('Plotting "The Blue Sky".') 45 | plot_the_blue_sky() 46 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_quality_plots.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate colour quality plotting. 3 | 4 | This module provides examples of plotting colour rendering indices 5 | and colour quality scales for various light sources. 6 | """ 7 | 8 | import colour 9 | from colour.plotting import ( 10 | colour_style, 11 | plot_multi_sds_colour_quality_scales_bars, 12 | plot_multi_sds_colour_rendering_indexes_bars, 13 | plot_single_sd_colour_quality_scale_bars, 14 | plot_single_sd_colour_rendering_index_bars, 15 | ) 16 | from colour.utilities import message_box 17 | 18 | message_box("Colour Quality Plots") 19 | 20 | colour_style() 21 | 22 | message_box('Plotting "F2" illuminant "Colour Rendering Index (CRI)".') 23 | plot_single_sd_colour_rendering_index_bars(colour.SDS_ILLUMINANTS["FL2"]) 24 | 25 | print("\n") 26 | 27 | message_box( 28 | 'Plotting various illuminants and light sources "Colour Rendering Index (CRI)".' 29 | ) 30 | plot_multi_sds_colour_rendering_indexes_bars( 31 | ( 32 | colour.SDS_ILLUMINANTS["FL2"], 33 | colour.SDS_LIGHT_SOURCES["F32T8/TL841 (Triphosphor)"], 34 | colour.SDS_LIGHT_SOURCES["Kinoton 75P"], 35 | ) 36 | ) 37 | 38 | print("\n") 39 | 40 | message_box('Plotting "F2" illuminant "Colour Quality Scale (CQS)".') 41 | plot_single_sd_colour_quality_scale_bars(colour.SDS_ILLUMINANTS["FL2"]) 42 | 43 | print("\n") 44 | 45 | message_box( 46 | 'Plotting various illuminants and light sources "Colour Quality Scale (CQS)".' 47 | ) 48 | plot_multi_sds_colour_quality_scales_bars( 49 | ( 50 | colour.SDS_ILLUMINANTS["FL2"], 51 | colour.SDS_LIGHT_SOURCES["F32T8/TL841 (Triphosphor)"], 52 | colour.SDS_LIGHT_SOURCES["Kinoton 75P"], 53 | ) 54 | ) 55 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_temperature_plots.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate colour temperature and correlated colour temperature plotting. 3 | 4 | This module provides examples of plotting planckian locus in various 5 | chromaticity diagrams. 6 | """ 7 | 8 | from colour.plotting import ( 9 | colour_style, 10 | plot_planckian_locus_in_chromaticity_diagram_CIE1931, 11 | plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS, 12 | ) 13 | from colour.utilities import message_box 14 | 15 | message_box("Colour Temperature and Correlated Colour Temperature Plots") 16 | 17 | colour_style() 18 | 19 | message_box('Plotting planckian locus in the "CIE 1931 Chromaticity Diagram".') 20 | plot_planckian_locus_in_chromaticity_diagram_CIE1931(["A", "B", "C"]) 21 | 22 | print("\n") 23 | 24 | message_box('Plotting planckian locus in the "CIE 1960 UCS Chromaticity Diagram".') 25 | plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS(["A", "B", "C"]) 26 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_tm3018.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *ANSI/IES TM-30-18* Colour Rendition Report plotting. 3 | 4 | This module provides examples of generating colour rendition reports 5 | using the *ANSI/IES TM-30-18* standard. 6 | """ 7 | 8 | import colour 9 | from colour.plotting import colour_style, plot_single_sd_colour_rendition_report 10 | from colour.utilities import message_box 11 | 12 | message_box("ANSI/IES TM-30-18 Colour Rendition Report") 13 | 14 | colour_style() 15 | 16 | sd = colour.SDS_ILLUMINANTS["FL2"] 17 | 18 | message_box('Plotting a full "ANSI/IES TM-30-18 Colour Rendition Report".') 19 | plot_single_sd_colour_rendition_report(sd) 20 | 21 | print("\n") 22 | 23 | message_box('Plotting an intermediate "ANSI/IES TM-30-18 Colour Rendition Report".') 24 | plot_single_sd_colour_rendition_report(sd, "Intermediate") 25 | 26 | print("\n") 27 | 28 | message_box('Plotting a simple "ANSI/IES TM-30-18 Colour Rendition Report".') 29 | plot_single_sd_colour_rendition_report(sd, "Simple") 30 | -------------------------------------------------------------------------------- /colour/examples/plotting/examples_volume_plots.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate colour models volume and gamut plotting. 3 | 4 | This module provides examples of plotting RGB colourspace volumes and 5 | gamuts in various reference colourspaces. 6 | """ 7 | 8 | import numpy as np 9 | 10 | from colour.plotting import colour_style, plot_RGB_colourspaces_gamuts, plot_RGB_scatter 11 | from colour.utilities import message_box 12 | 13 | message_box("Colour Models Volume and Gamut Plots") 14 | 15 | colour_style() 16 | 17 | message_box( 18 | 'Plotting "ITU-R BT.709" RGB colourspace volume in the "CIE xyY" colourspace.' 19 | ) 20 | plot_RGB_colourspaces_gamuts(("ITU-R BT.709",), reference_colourspace="CIE xyY") 21 | 22 | print("\n") 23 | 24 | message_box( 25 | 'Comparing "ITU-R BT.709" and "ACEScg" RGB colourspaces volume in the ' 26 | '"CIE L*a*b*" colourspace.' 27 | ) 28 | plot_RGB_colourspaces_gamuts( 29 | ("ITU-R BT.709", "ACEScg"), 30 | reference_colourspace="CIE Lab", 31 | face_colours=(None, (0.25, 0.25, 0.25)), 32 | edge_colours=(None, (0.25, 0.25, 0.25)), 33 | edge_alpha=(1.0, 0.1), 34 | face_alpha=(1.0, 0.0), 35 | ) 36 | 37 | print("\n") 38 | 39 | message_box('Plotting "ACEScg" colourspaces values in the "CIE L*a*b*" colourspace.') 40 | 41 | RGB = np.random.random((32, 32, 3)) 42 | 43 | plot_RGB_scatter( 44 | RGB, 45 | "ACEScg", 46 | reference_colourspace="CIE Lab", 47 | colourspaces=("ACEScg", "ITU-R BT.709"), 48 | face_colours=((0.25, 0.25, 0.25), None), 49 | edge_colours=((0.25, 0.25, 0.25), None), 50 | edge_alpha=(0.1, 0.5), 51 | face_alpha=(0.1, 0.5), 52 | grid_face_colours=(0.1, 0.1, 0.1), 53 | grid_edge_colours=(0.1, 0.1, 0.1), 54 | grid_edge_alpha=0.5, 55 | grid_face_alpha=0.1, 56 | ) 57 | -------------------------------------------------------------------------------- /colour/examples/plotting/resources/Ishihara_Colour_Blindness_Test_Plate_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/examples/plotting/resources/Ishihara_Colour_Blindness_Test_Plate_3.png -------------------------------------------------------------------------------- /colour/examples/quality/examples_ssi.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate *Academy Spectral Similarity Index* (SSI) computations. 3 | 4 | This module provides examples of spectral similarity index calculations 5 | for comparing light sources. 6 | """ 7 | 8 | import colour 9 | from colour.utilities import message_box 10 | 11 | message_box("Academy Spectral Similarity Index Computations") 12 | 13 | message_box( 14 | 'Computing the "CIE Illuminant B" "Academy Spectral Similarity Index (SSI)" ' 15 | 'with "CIE Standard Illuminant D65".' 16 | ) 17 | print( 18 | colour.spectral_similarity_index( 19 | colour.SDS_ILLUMINANTS["B"], colour.SDS_ILLUMINANTS["D65"] 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /colour/examples/recovery/examples_jakob2019.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate reflectance recovery computations using *Jakob et al. (2019)* method. 3 | 4 | This module provides examples of reflectance recovery from tristimulus 5 | values using the *Jakob et al. (2019)* method. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box('"Jakob et al. (2019)" - Reflectance Recovery Computations') 14 | 15 | illuminant = colour.SDS_ILLUMINANTS["D65"] 16 | 17 | XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) 18 | message_box( 19 | f'Recovering reflectance using "Jakob et al. (2019)" method from given ' 20 | f'"XYZ" tristimulus values:\n\n\tXYZ: {XYZ}' 21 | ) 22 | sd = colour.XYZ_to_sd(XYZ, method="Jakob 2019") 23 | print(sd) 24 | print(colour.recovery.XYZ_to_sd_Jakob2019(XYZ)) 25 | print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100) 26 | 27 | print("\n") 28 | 29 | message_box( 30 | 'Generating a LUT according to the "Jakob et al. (2019)" method for the ' 31 | '"sRGB" colourspace:' 32 | ) 33 | LUT = colour.recovery.LUT3D_Jakob2019() 34 | LUT.generate(colour.models.RGB_COLOURSPACE_sRGB, size=5) 35 | RGB = np.array([0.70573936, 0.19248266, 0.22354169]) 36 | print(LUT.RGB_to_sd(RGB)) 37 | -------------------------------------------------------------------------------- /colour/examples/recovery/examples_jiang2013.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate camera RGB sensitivities recovery using *Jiang et al. (2013)* method. 3 | 4 | This module provides examples of camera RGB sensitivities recovery 5 | computations using the *Jiang et al. (2013)* method. 6 | """ 7 | 8 | import colour 9 | from colour.utilities import message_box 10 | 11 | message_box('"Jiang et al. (2013)" - Camera Sensitivities Recovery') 12 | 13 | shape = colour.recovery.SPECTRAL_SHAPE_BASIS_FUNCTIONS_DYER2017 14 | 15 | illuminant = colour.SDS_ILLUMINANTS["D65"] 16 | sensitivities = colour.MSDS_CAMERA_SENSITIVITIES["Nikon 5100 (NPL)"] 17 | reflectances = colour.colorimetry.sds_and_msds_to_msds( 18 | [ 19 | sd.copy().align(shape) 20 | for sd in colour.SDS_COLOURCHECKERS["BabelColor Average"].values() 21 | ] 22 | ) 23 | RGB = colour.msds_to_XYZ( 24 | reflectances, 25 | method="Integration", 26 | cmfs=sensitivities, 27 | illuminant=illuminant, 28 | k=1, 29 | shape=colour.recovery.SPECTRAL_SHAPE_BASIS_FUNCTIONS_DYER2017, 30 | ) 31 | msds_camera_sensitivities = colour.recovery.RGB_to_msds_camera_sensitivities_Jiang2013( 32 | RGB, 33 | illuminant, 34 | reflectances, 35 | colour.recovery.BASIS_FUNCTIONS_DYER2017, 36 | colour.recovery.SPECTRAL_SHAPE_BASIS_FUNCTIONS_DYER2017, 37 | ) 38 | 39 | message_box( 40 | f'Recovering camera *RGB* sensitivities using "Jiang et al. (2013)" method:' 41 | f"\n\n{msds_camera_sensitivities}" 42 | ) 43 | -------------------------------------------------------------------------------- /colour/examples/recovery/examples_mallet2019.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate reflectance recovery computations using *Mallett et al. (2019)* method. 3 | 4 | This module provides examples of reflectance recovery from tristimulus 5 | values and spectral primary decomposition using the *Mallett et al. (2019)* 6 | method. 7 | """ 8 | 9 | import numpy as np 10 | 11 | import colour 12 | from colour.utilities import message_box 13 | 14 | message_box('"Mallett et al. (2019)" - Reflectance Recovery Computations') 15 | 16 | illuminant = colour.SDS_ILLUMINANTS["D65"] 17 | 18 | XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) 19 | RGB = colour.XYZ_to_sRGB(XYZ, apply_cctf_encoding=False) 20 | message_box( 21 | f'Recovering reflectance using "Mallett et al. (2019)" method from given ' 22 | f'"XYZ" tristimulus values:\n\n\tXYZ: {XYZ}' 23 | ) 24 | sd = colour.XYZ_to_sd(XYZ, method="Mallett 2019") 25 | print(sd) 26 | print(colour.recovery.RGB_to_sd_Mallett2019(RGB)) 27 | print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100) 28 | 29 | print("\n") 30 | 31 | message_box( 32 | 'Generating the "Mallett et al. (2019)" basis functions for the ' 33 | "*Pal/Secam* colourspace:" 34 | ) 35 | cmfs = ( 36 | colour.MSDS_CMFS["CIE 1931 2 Degree Standard Observer"] 37 | .copy() 38 | .align(colour.SpectralShape(360, 780, 10)) 39 | ) 40 | illuminant = colour.SDS_ILLUMINANTS["D65"].copy().align(cmfs.shape) 41 | 42 | print( 43 | colour.recovery.spectral_primary_decomposition_Mallett2019( 44 | colour.models.RGB_COLOURSPACE_PAL_SECAM, 45 | cmfs, 46 | illuminant, 47 | optimisation_kwargs={"options": {"ftol": 1e-5}}, 48 | ) 49 | ) 50 | -------------------------------------------------------------------------------- /colour/examples/recovery/examples_meng2015.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate reflectance recovery computations using *Meng et al. (2015)* method. 3 | 4 | This module provides examples of reflectance recovery from tristimulus 5 | values using the *Meng et al. (2015)* method. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box('"Meng et al. (2015)" - Reflectance Recovery Computations') 14 | 15 | illuminant = colour.SDS_ILLUMINANTS["D65"] 16 | 17 | XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) 18 | message_box( 19 | f'Recovering reflectance using "Meng et al. (2015)" method from given ' 20 | f'"XYZ" tristimulus values:\n\n\tXYZ: {XYZ}' 21 | ) 22 | sd = colour.XYZ_to_sd(XYZ, method="Meng 2015") 23 | print(sd) 24 | print(colour.recovery.XYZ_to_sd_Meng2015(XYZ)) 25 | print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100) 26 | -------------------------------------------------------------------------------- /colour/examples/recovery/examples_otsu2018.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate reflectance recovery computations using *Otsu et al. (2018)* method. 3 | 4 | This module provides examples of reflectance recovery from tristimulus 5 | values using the *Otsu et al. (2018)* method. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.utilities import message_box 12 | 13 | message_box('"Otsu et al. (2018)" - Reflectance Recovery Computations') 14 | 15 | illuminant = colour.SDS_ILLUMINANTS["D65"] 16 | 17 | XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) 18 | message_box( 19 | f'Recovering reflectance using "Otsu et al. (2018)" method from given ' 20 | f'"XYZ" tristimulus values:\n\n\tXYZ: {XYZ}' 21 | ) 22 | sd = colour.XYZ_to_sd(XYZ, method="Otsu 2018") 23 | print(sd) 24 | print(colour.recovery.XYZ_to_sd_Otsu2018(XYZ)) 25 | print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100) 26 | 27 | print("\n") 28 | 29 | message_box( 30 | 'Generating a spectral dataset according to the "Otsu et al. (2018) method :' 31 | ) 32 | XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) 33 | reflectances = colour.colorimetry.sds_and_msds_to_msds( 34 | colour.SDS_COLOURCHECKERS["ColorChecker N Ohta"].values() 35 | ).align(colour.recovery.SPECTRAL_SHAPE_OTSU2018) 36 | node_tree = colour.recovery.Tree_Otsu2018(reflectances) 37 | node_tree.optimise() 38 | dataset = node_tree.to_dataset() 39 | print(colour.recovery.XYZ_to_sd_Otsu2018(XYZ, dataset=dataset)) 40 | -------------------------------------------------------------------------------- /colour/examples/recovery/examples_smits1999.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate reflectance recovery computations using *Smits (1999)* method. 3 | 4 | This module provides examples of reflectance recovery from RGB colourspace 5 | values using the *Smits (1999)* method. 6 | """ 7 | 8 | import numpy as np 9 | 10 | import colour 11 | from colour.recovery.smits1999 import XYZ_to_RGB_Smits1999 12 | from colour.utilities import message_box 13 | 14 | message_box('"Smits (1999)" - Reflectance Recovery Computations') 15 | 16 | XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) 17 | RGB = XYZ_to_RGB_Smits1999(XYZ) 18 | message_box( 19 | f'Recovering reflectance using "Smits (1999)" method from given "RGB" ' 20 | f"colourspace array:\n\n\tRGB: {RGB}" 21 | ) 22 | sd = colour.XYZ_to_sd(XYZ, method="Smits 1999") 23 | print(sd) 24 | print(colour.recovery.RGB_to_sd_Smits1999(XYZ)) 25 | print(colour.sd_to_XYZ(sd.align(colour.SPECTRAL_SHAPE_DEFAULT)) / 100) 26 | 27 | print("\n") 28 | 29 | message_box( 30 | 'An analysis of "Smits (1999)" method is available at the ' 31 | "following url : " 32 | "http://nbviewer.jupyter.org/github/colour-science/colour-website/" 33 | "blob/master/ipython/about_reflectance_recovery.ipynb" 34 | ) 35 | -------------------------------------------------------------------------------- /colour/examples/volume/examples_rgb.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrate RGB colourspace volume computations. 3 | 4 | This module demonstrates the computation of RGB colourspace limits, volumes, 5 | and gamut coverage using Monte Carlo methods for colourspace analysis. 6 | """ 7 | 8 | import colour 9 | from colour.utilities import message_box 10 | 11 | # NOTE: Because the MonteCarlo methods use multiprocessing, it is recommended 12 | # to wrap the execution in a definition or a *__main__* block. 13 | if __name__ == "__main__": 14 | message_box("RGB Colourspace Volume Computations") 15 | 16 | message_box('Compute the "ProPhoto RGB" RGB colourspace limits.') 17 | limits = colour.RGB_colourspace_limits(colour.RGB_COLOURSPACES["ProPhoto RGB"]) 18 | print(limits) 19 | 20 | print("\n") 21 | 22 | samples = int(10e4) 23 | message_box( 24 | f'Compute the "ProPhoto RGB" RGB colourspace volume using {samples} ' 25 | f"samples." 26 | ) 27 | print( 28 | colour.RGB_colourspace_volume_MonteCarlo( 29 | colour.RGB_COLOURSPACES["ProPhoto RGB"], 30 | samples=samples, 31 | limits=limits * 1.1, 32 | ) 33 | ) 34 | 35 | print("\n") 36 | 37 | message_box( 38 | f'Compute "ProPhoto RGB" RGB colourspace coverage of ' 39 | f'"Pointer\'s Gamut" using {samples} samples.' 40 | ) 41 | print( 42 | colour.RGB_colourspace_pointer_gamut_coverage_MonteCarlo( 43 | colour.RGB_COLOURSPACES["ProPhoto RGB"], samples=samples 44 | ) 45 | ) 46 | -------------------------------------------------------------------------------- /colour/geometry/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .ellipse import ( 4 | ellipse_coefficients_general_form, 5 | ellipse_coefficients_canonical_form, 6 | point_at_angle_on_ellipse, 7 | ellipse_fitting_Halir1998, 8 | ELLIPSE_FITTING_METHODS, 9 | ellipse_fitting, 10 | ) 11 | from .intersection import ( 12 | extend_line_segment, 13 | LineSegmentsIntersections_Specification, 14 | intersect_line_segments, 15 | ) 16 | from .primitives import MAPPING_PLANE_TO_AXIS, primitive_grid, primitive_cube 17 | from .primitives import PRIMITIVE_METHODS, primitive 18 | from .section import hull_section 19 | from .vertices import ( 20 | primitive_vertices_quad_mpl, 21 | primitive_vertices_grid_mpl, 22 | primitive_vertices_cube_mpl, 23 | primitive_vertices_sphere, 24 | ) 25 | from .vertices import PRIMITIVE_VERTICES_METHODS, primitive_vertices 26 | 27 | 28 | __all__ = [ 29 | "ellipse_coefficients_general_form", 30 | "ellipse_coefficients_canonical_form", 31 | "point_at_angle_on_ellipse", 32 | "ellipse_fitting_Halir1998", 33 | "ELLIPSE_FITTING_METHODS", 34 | "ellipse_fitting", 35 | ] 36 | __all__ += [ 37 | "extend_line_segment", 38 | "LineSegmentsIntersections_Specification", 39 | "intersect_line_segments", 40 | ] 41 | __all__ += [ 42 | "MAPPING_PLANE_TO_AXIS", 43 | "primitive_grid", 44 | "primitive_cube", 45 | ] 46 | __all__ += [ 47 | "hull_section", 48 | ] 49 | __all__ += [ 50 | "PRIMITIVE_METHODS", 51 | "primitive", 52 | ] 53 | __all__ += [ 54 | "primitive_vertices_quad_mpl", 55 | "primitive_vertices_grid_mpl", 56 | "primitive_vertices_cube_mpl", 57 | "primitive_vertices_sphere", 58 | ] 59 | __all__ += [ 60 | "PRIMITIVE_VERTICES_METHODS", 61 | "primitive_vertices", 62 | ] 63 | -------------------------------------------------------------------------------- /colour/geometry/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/geometry/tests/__init__.py -------------------------------------------------------------------------------- /colour/graph/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .conversion import ( 4 | CONVERSION_GRAPH, 5 | CONVERSION_GRAPH_NODE_LABELS, 6 | describe_conversion_path, 7 | convert, 8 | ) 9 | 10 | __all__ = [ 11 | "CONVERSION_GRAPH", 12 | "CONVERSION_GRAPH_NODE_LABELS", 13 | "describe_conversion_path", 14 | "convert", 15 | ] 16 | -------------------------------------------------------------------------------- /colour/graph/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/graph/tests/__init__.py -------------------------------------------------------------------------------- /colour/io/luts/common.py: -------------------------------------------------------------------------------- 1 | """ 2 | LUT Processing Common Utilities 3 | =============================== 4 | 5 | Define the *LUT* processing common utilities objects that don't fall in any 6 | specific category. 7 | """ 8 | 9 | from __future__ import annotations 10 | 11 | import os 12 | import re 13 | import typing 14 | 15 | if typing.TYPE_CHECKING: 16 | from colour.hints import PathLike 17 | 18 | __author__ = "Colour Developers" 19 | __copyright__ = "Copyright 2013 Colour Developers" 20 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 21 | __maintainer__ = "Colour Developers" 22 | __email__ = "colour-developers@colour-science.org" 23 | __status__ = "Production" 24 | 25 | __all__ = [ 26 | "path_to_title", 27 | ] 28 | 29 | 30 | def path_to_title(path: str | PathLike) -> str: 31 | """ 32 | Convert the specified file path to a title. 33 | 34 | Parameters 35 | ---------- 36 | path 37 | File path to convert to title. 38 | 39 | Returns 40 | ------- 41 | :class:`str` 42 | File path converted to title. 43 | 44 | Examples 45 | -------- 46 | >>> path_to_title("colour/io/luts/tests/resources/sony_spi3d/Colour_Correct.spi3d") 47 | 'Colour Correct' 48 | """ 49 | 50 | path = str(path) 51 | 52 | return re.sub("_|-|\\.", " ", os.path.splitext(os.path.basename(path))[0]) 53 | -------------------------------------------------------------------------------- /colour/io/luts/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/luts/tests/__init__.py -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/cinespace/ACES_Proxy_10_to_ACES.csp: -------------------------------------------------------------------------------- 1 | CSPLUTV100 2 | 1D 3 | 4 | BEGIN METADATA 5 | ACES Proxy 10 to ACES 6 | END METADATA 7 | 8 | 2 9 | 0.0000000 1.0000000 10 | 0.0 1.0 11 | 2 12 | 0.0000000 1.0000000 13 | 0.0 1.0 14 | 2 15 | 0.0000000 1.0000000 16 | 0.0 1.0 17 | 18 | 32 19 | 0.0004883 0.0004883 0.0004883 20 | 0.0007714 0.0007714 0.0007714 21 | 0.0012190 0.0012190 0.0012190 22 | 0.0019260 0.0019260 0.0019260 23 | 0.0030440 0.0030440 0.0030440 24 | 0.0048090 0.0048090 0.0048090 25 | 0.0075990 0.0075990 0.0075990 26 | 0.0120100 0.0120100 0.0120100 27 | 0.0189700 0.0189700 0.0189700 28 | 0.0299800 0.0299800 0.0299800 29 | 0.0473700 0.0473700 0.0473700 30 | 0.0748400 0.0748400 0.0748400 31 | 0.1183000 0.1183000 0.1183000 32 | 0.1869000 0.1869000 0.1869000 33 | 0.2952000 0.2952000 0.2952000 34 | 0.4665000 0.4665000 0.4665000 35 | 0.7371000 0.7371000 0.7371000 36 | 1.1650000 1.1650000 1.1650000 37 | 1.8400000 1.8400000 1.8400000 38 | 2.9080000 2.9080000 2.9080000 39 | 4.5950000 4.5950000 4.5950000 40 | 7.2600000 7.2600000 7.2600000 41 | 11.4700000 11.4700000 11.4700000 42 | 18.1300000 18.1300000 18.1300000 43 | 28.6400000 28.6400000 28.6400000 44 | 45.2500000 45.2500000 45.2500000 45 | 71.5100000 71.5100000 71.5100000 46 | 113.0000000 113.0000000 113.0000000 47 | 178.5000000 178.5000000 178.5000000 48 | 282.1000000 282.1000000 282.1000000 49 | 445.7000000 445.7000000 445.7000000 50 | 704.3000000 704.3000000 704.3000000 51 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/cinespace/Demo.csp: -------------------------------------------------------------------------------- 1 | CSPLUTV100 2 | 1D 3 | 4 | BEGIN METADATA 5 | Demo 6 | Comments are ignored by most parsers 7 | END METADATA 8 | 9 | 2 10 | 0.0000000 1.0000000 11 | 0.0 1.0 12 | 2 13 | 0.0000000 2.0000000 14 | 0.0 1.0 15 | 2 16 | 0.0000000 3.0000000 17 | 0.0 1.0 18 | 19 | 3 20 | 0.0000000 0.0000000 0.0000000 21 | 0.5000000 1.0000000 1.5000000 22 | 1.0000000 1.0000000 1.0000000 23 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/cinespace/Explicit_Domain.csp: -------------------------------------------------------------------------------- 1 | CSPLUTV100 2 | 3D 3 | 4 | BEGIN METADATA 5 | LUT with non-uniform shaper and cube 6 | The cube's transform is the identity. 7 | END METADATA 8 | 9 | 11 10 | 0.0000000 0.1000000 0.2000000 0.3000000 0.4000000 0.5000000 0.6000000 0.7000000 0.8000000 0.9000000 1.0000000 11 | 0.0000000 0.1000000 0.2000000 0.3000000 0.4000000 0.5000000 0.6000000 0.7000000 0.8000000 0.9000000 1.0000000 12 | 6 13 | 0.0000000 0.2000000 0.4000000 0.6000000 0.8000000 1.0000000 14 | 0.0000000 0.2000000 0.4000000 0.6000000 0.8000000 1.0000000 15 | 5 16 | 0.0000000 0.2500000 0.5000000 0.7500000 1.0000000 17 | 0.0000000 0.2500000 0.5000000 0.7500000 1.0000000 18 | 19 | 2 3 4 20 | 0.0000000 0.0000000 0.0000000 21 | 1.0000000 0.0000000 0.0000000 22 | 0.0000000 0.5000000 0.0000000 23 | 1.0000000 0.5000000 0.0000000 24 | 0.0000000 1.0000000 0.0000000 25 | 1.0000000 1.0000000 0.0000000 26 | 0.0000000 0.0000000 0.3300000 27 | 1.0000000 0.0000000 0.3300000 28 | 0.0000000 0.5000000 0.3300000 29 | 1.0000000 0.5000000 0.3300000 30 | 0.0000000 1.0000000 0.3300000 31 | 1.0000000 1.0000000 0.3300000 32 | 0.0000000 0.0000000 0.6600000 33 | 1.0000000 0.0000000 0.6600000 34 | 0.0000000 0.5000000 0.6600000 35 | 1.0000000 0.5000000 0.6600000 36 | 0.0000000 1.0000000 0.6600000 37 | 1.0000000 1.0000000 0.6600000 38 | 0.0000000 0.0000000 1.0000000 39 | 1.0000000 0.0000000 1.0000000 40 | 0.0000000 0.5000000 1.0000000 41 | 1.0000000 0.5000000 1.0000000 42 | 0.0000000 1.0000000 1.0000000 43 | 1.0000000 1.0000000 1.0000000 44 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/cinespace/Ragged_Domain.csp: -------------------------------------------------------------------------------- 1 | CSPLUTV100 2 | 1D 3 | 4 | BEGIN METADATA 5 | Ragged 3x1D 6 | END METADATA 7 | 8 | 6 9 | 0.0000000 0.1000000 0.2000000 0.4000000 0.8000000 1.2000000 10 | 0.4545455 0.5000000 0.5454545 0.6363636 0.8181818 1.0000000 11 | 3 12 | -0.1000000 0.5000000 1.0000000 13 | 0.4090909 0.6818182 0.9090909 14 | 5 15 | -1.0000000 -0.5000000 0.0000000 0.5000000 1.0000000 16 | 0.0000000 0.2272727 0.4545455 0.6818182 0.9090909 17 | 18 | 2 19 | -2.0000000 -2.0000000 -2.0000000 20 | 2.4000000 2.4000000 2.4000000 21 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/cinespace/Three_Dimensional_Table.csp: -------------------------------------------------------------------------------- 1 | CSPLUTV100 2 | 3D 3 | 4 | BEGIN METADATA 5 | LUT3D without My Shaper 6 | END METADATA 7 | 8 | 2 9 | 0.0000000 1.0000000 10 | 0.0 1.0 11 | 2 12 | 0.0000000 1.0000000 13 | 0.0 1.0 14 | 2 15 | 0.0000000 1.0000000 16 | 0.0 1.0 17 | 18 | 2 2 2 19 | 0.0000000 0.0000000 0.0000000 20 | 1.0000000 0.0000000 0.0000000 21 | 0.0000000 0.7500000 0.0000000 22 | 1.0000000 0.7500000 0.0000000 23 | 0.0000000 0.2500000 1.0000000 24 | 1.0000000 0.2500000 1.0000000 25 | 0.0000000 1.0000000 1.0000000 26 | 1.0000000 1.0000000 1.0000000 27 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/cinespace/Three_Dimensional_Table_With_Shaper.csp: -------------------------------------------------------------------------------- 1 | CSPLUTV100 2 | 3D 3 | 4 | BEGIN METADATA 5 | LUT3D with My Shaper 6 | A first "Shaper" comment. 7 | A second "Shaper" comment. 8 | A first "LUT3D" comment. 9 | A second "LUT3D" comment. 10 | END METADATA 11 | 12 | 10 13 | -0.1000000 0.2444444 0.5888889 0.9333333 1.2777778 1.6222222 1.9666667 2.3111111 2.6555556 3.0000000 14 | -0.3511192 0.5271086 0.7860854 0.9691262 1.1178635 1.2459617 1.3599219 1.4634339 1.5588269 1.6476816 15 | 10 16 | -0.1000000 0.2444444 0.5888889 0.9333333 1.2777778 1.6222222 1.9666667 2.3111111 2.6555556 3.0000000 17 | -0.3511192 0.5271086 0.7860854 0.9691262 1.1178635 1.2459617 1.3599219 1.4634339 1.5588269 1.6476816 18 | 10 19 | -0.1000000 0.2444444 0.5888889 0.9333333 1.2777778 1.6222222 1.9666667 2.3111111 2.6555556 3.0000000 20 | -0.3511192 0.5271086 0.7860854 0.9691262 1.1178635 1.2459617 1.3599219 1.4634339 1.5588269 1.6476816 21 | 22 | 3 3 3 23 | 0.9277778 0.9063014 0.9020062 24 | 1.4500000 -0.1000000 -0.1000000 25 | 3.0000000 -0.1000000 -0.1000000 26 | 0.4315560 0.4777778 0.4392596 27 | 1.4500000 1.4500000 -0.1000000 28 | 3.0000000 1.4500000 -0.1000000 29 | 1.9038580 2.0277778 1.9245113 30 | 1.4500000 3.0000000 -0.1000000 31 | 3.0000000 3.0000000 -0.1000000 32 | 0.4392596 0.4315560 0.4777778 33 | 1.4500000 -0.1000000 1.4500000 34 | 3.0000000 -0.1000000 1.4500000 35 | 0.4315560 0.4700741 0.4777778 36 | 1.4500000 1.4500000 1.4500000 37 | 3.0000000 1.4500000 1.4500000 38 | 1.9038580 2.0277778 1.9864712 39 | 1.4500000 3.0000000 1.4500000 40 | 3.0000000 3.0000000 1.4500000 41 | 1.9245113 1.9038580 2.0277778 42 | 1.4500000 -0.1000000 3.0000000 43 | 3.0000000 -0.1000000 3.0000000 44 | 1.9038580 1.9451646 2.0277778 45 | 1.4500000 1.4500000 3.0000000 46 | 3.0000000 1.4500000 3.0000000 47 | 1.9038580 2.0071245 2.0277778 48 | 1.4500000 3.0000000 3.0000000 49 | 3.0000000 3.0000000 3.0000000 50 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/cinespace/Uncommon_3x1D_With_Pre_Lut.csp: -------------------------------------------------------------------------------- 1 | CSPLUTV100 2 | 1D 3 | 4 | BEGIN METADATA 5 | Linear to LogC 6 | LogC to Linear 7 | END METADATA 8 | 9 | 5 10 | -0.0172904 0.0415196 0.5133834 5.3571636 55.0795767 11 | 0.0000000 0.2500000 0.5000000 0.7500000 1.0000000 12 | 5 13 | -0.0172904 0.0415196 0.5133834 5.3571636 55.0795767 14 | 0.0000000 0.2500000 0.5000000 0.7500000 1.0000000 15 | 5 16 | -0.0172904 0.0415196 0.5133834 5.3571636 55.0795767 17 | 0.0000000 0.2500000 0.5000000 0.7500000 1.0000000 18 | 19 | 5 20 | -0.0172904 -0.0172904 -0.0172904 21 | 0.0415196 0.0415196 0.0415196 22 | 0.5133834 0.5133834 0.5133834 23 | 5.3571636 5.3571636 5.3571636 24 | 55.0795767 55.0795767 55.0795767 25 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/iridas_cube/ACES_Proxy_10_to_ACES.cube: -------------------------------------------------------------------------------- 1 | TITLE "ACES Proxy 10 to ACES" 2 | LUT_1D_SIZE 32 3 | 0.0004883 0.0004883 0.0004883 4 | 0.0007714 0.0007714 0.0007714 5 | 0.001219 0.001219 0.001219 6 | 0.001926 0.001926 0.001926 7 | 0.003044 0.003044 0.003044 8 | 0.004809 0.004809 0.004809 9 | 0.007599 0.007599 0.007599 10 | 0.01201 0.01201 0.01201 11 | 0.01897 0.01897 0.01897 12 | 0.02998 0.02998 0.02998 13 | 0.04737 0.04737 0.04737 14 | 0.07484 0.07484 0.07484 15 | 0.1183 0.1183 0.1183 16 | 0.1869 0.1869 0.1869 17 | 0.2952 0.2952 0.2952 18 | 0.4665 0.4665 0.4665 19 | 0.7371 0.7371 0.7371 20 | 1.165 1.165 1.165 21 | 1.84 1.84 1.84 22 | 2.908 2.908 2.908 23 | 4.595 4.595 4.595 24 | 7.26 7.26 7.26 25 | 11.47 11.47 11.47 26 | 18.13 18.13 18.13 27 | 28.64 28.64 28.64 28 | 45.25 45.25 45.25 29 | 71.51 71.51 71.51 30 | 113 113 113 31 | 178.5 178.5 178.5 32 | 282.1 282.1 282.1 33 | 445.7 445.7 445.7 34 | 704.3 704.3 704.3 35 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/iridas_cube/Colour_Correct.cube: -------------------------------------------------------------------------------- 1 | TITLE "Generated by Foundry::LUT" 2 | LUT_3D_SIZE 4 3 | 0.000000 0.000000 0.000000 4 | 0.398947 -0.017706 -0.017706 5 | 0.797894 -0.035412 -0.035412 6 | 1.196841 -0.053117 -0.053117 7 | -0.026231 0.377102 -0.026231 8 | 0.294597 0.294597 0.069582 9 | 0.633333 0.316667 0.000000 10 | 1.038439 0.310899 -0.052870 11 | -0.052463 0.754204 -0.052463 12 | 0.349416 0.657749 0.041083 13 | 0.589195 0.589195 0.139164 14 | 0.891318 0.619823 0.076833 15 | -0.078694 1.131306 -0.078694 16 | 0.344991 1.050213 -0.007621 17 | 0.663432 0.930188 0.129920 18 | 0.883792 0.883792 0.208746 19 | 0.000000 0.000000 0.416653 20 | 0.333333 0.000000 0.333333 21 | 0.752767 -0.028479 0.362144 22 | 1.162588 -0.050372 0.353948 23 | 0.019686 0.244702 0.244702 24 | 0.416655 0.416655 0.416655 25 | 0.732278 0.315626 0.315626 26 | 1.131225 0.297920 0.297920 27 | 0.000000 0.616667 0.308333 28 | 0.340435 0.743769 0.340435 29 | 0.594601 0.594601 0.369586 30 | 0.950000 0.633333 0.316667 31 | -0.035927 1.021908 0.316685 32 | 0.314204 1.120871 0.314204 33 | 0.682749 0.991082 0.374416 34 | 0.889199 0.889199 0.439168 35 | 0.000000 0.000000 0.833306 36 | 0.390623 0.000000 0.781246 37 | 0.666667 0.000000 0.666667 38 | 1.089003 -0.031363 0.715547 39 | 0.014327 0.330993 0.647660 40 | 0.416655 0.416655 0.833308 41 | 0.666667 0.333333 0.666667 42 | 1.086101 0.304855 0.695478 43 | 0.039372 0.489403 0.489403 44 | 0.269700 0.494715 0.494715 45 | 0.833311 0.833311 0.833311 46 | 1.065610 0.648957 0.648957 47 | 0.030904 0.831171 0.564415 48 | 0.308333 0.925000 0.616667 49 | 0.707102 1.110435 0.707102 50 | 0.894606 0.894606 0.669590 51 | 0.000001 0.000001 1.249959 52 | 0.404320 0.000000 1.212960 53 | 0.746911 0.000000 1.120366 54 | 1.000000 0.000000 1.000000 55 | 0.009022 0.372791 1.100331 56 | 0.416656 0.416656 1.249961 57 | 0.781246 0.390623 1.171869 58 | 1.000000 0.333333 1.000000 59 | 0.035773 0.578763 0.850258 60 | 0.347660 0.664327 0.980993 61 | 0.833311 0.833311 1.249963 62 | 1.000000 0.666667 1.000000 63 | 0.059059 0.734105 0.734105 64 | 0.289386 0.739417 0.739417 65 | 0.519714 0.744729 0.744729 66 | 1.249966 1.249966 1.249966 67 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/iridas_cube/Demo.cube: -------------------------------------------------------------------------------- 1 | TITLE "Demo" 2 | LUT_1D_SIZE 3 3 | DOMAIN_MIN 0 0 0 4 | DOMAIN_MAX 1 2 3 5 | 0 0 0 6 | # Comments can go anywhere 7 | 0.5 1 1.5 8 | 1 1 1 9 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/iridas_cube/RGB_1_0.5_0.25.cube: -------------------------------------------------------------------------------- 1 | TITLE "Generated by Foundry::LUT" 2 | LUT_3D_SIZE 4 3 | 0.000000 0.000000 0.000000 4 | 0.333333 0.000000 0.000000 5 | 0.666667 0.000000 0.000000 6 | 1.000000 0.000000 0.000000 7 | 0.000000 0.166667 0.000000 8 | 0.333333 0.166667 0.000000 9 | 0.666667 0.166667 0.000000 10 | 1.000000 0.166667 0.000000 11 | 0.000000 0.333333 0.000000 12 | 0.333333 0.333333 0.000000 13 | 0.666667 0.333333 0.000000 14 | 1.000000 0.333333 0.000000 15 | 0.000000 0.500000 0.000000 16 | 0.333333 0.500000 0.000000 17 | 0.666667 0.500000 0.000000 18 | 1.000000 0.500000 0.000000 19 | 0.000000 0.000000 0.083333 20 | 0.333333 0.000000 0.083333 21 | 0.666667 0.000000 0.083333 22 | 1.000000 0.000000 0.083333 23 | 0.000000 0.166667 0.083333 24 | 0.333333 0.166667 0.083333 25 | 0.666667 0.166667 0.083333 26 | 1.000000 0.166667 0.083333 27 | 0.000000 0.333333 0.083333 28 | 0.333333 0.333333 0.083333 29 | 0.666667 0.333333 0.083333 30 | 1.000000 0.333333 0.083333 31 | 0.000000 0.500000 0.083333 32 | 0.333333 0.500000 0.083333 33 | 0.666667 0.500000 0.083333 34 | 1.000000 0.500000 0.083333 35 | 0.000000 0.000000 0.166667 36 | 0.333333 0.000000 0.166667 37 | 0.666667 0.000000 0.166667 38 | 1.000000 0.000000 0.166667 39 | 0.000000 0.166667 0.166667 40 | 0.333333 0.166667 0.166667 41 | 0.666667 0.166667 0.166667 42 | 1.000000 0.166667 0.166667 43 | 0.000000 0.333333 0.166667 44 | 0.333333 0.333333 0.166667 45 | 0.666667 0.333333 0.166667 46 | 1.000000 0.333333 0.166667 47 | 0.000000 0.500000 0.166667 48 | 0.333333 0.500000 0.166667 49 | 0.666667 0.500000 0.166667 50 | 1.000000 0.500000 0.166667 51 | 0.000000 0.000000 0.250000 52 | 0.333333 0.000000 0.250000 53 | 0.666667 0.000000 0.250000 54 | 1.000000 0.000000 0.250000 55 | 0.000000 0.166667 0.250000 56 | 0.333333 0.166667 0.250000 57 | 0.666667 0.166667 0.250000 58 | 1.000000 0.166667 0.250000 59 | 0.000000 0.333333 0.250000 60 | 0.333333 0.333333 0.250000 61 | 0.666667 0.333333 0.250000 62 | 1.000000 0.333333 0.250000 63 | 0.000000 0.500000 0.250000 64 | 0.333333 0.500000 0.250000 65 | 0.666667 0.500000 0.250000 66 | 1.000000 0.500000 0.250000 67 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/iridas_cube/Three_Dimensional_Table.cube: -------------------------------------------------------------------------------- 1 | LUT_3D_SIZE 2 2 | 0 0 0 3 | 1 0 0 4 | 0 .75 0 5 | 1 .75 0 6 | 0 .25 1 7 | 1 .25 1 8 | 0 1 1 9 | 1 1 1 10 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/iridas_cube/Unit.cube: -------------------------------------------------------------------------------- 1 | TITLE "Generated by Foundry::LUT" 2 | LUT_3D_SIZE 4 3 | 0.000000 0.000000 0.000000 4 | 0.333333 0.000000 0.000000 5 | 0.666667 0.000000 0.000000 6 | 1.000000 0.000000 0.000000 7 | 0.000000 0.333333 0.000000 8 | 0.333333 0.333333 0.000000 9 | 0.666667 0.333333 0.000000 10 | 1.000000 0.333333 0.000000 11 | 0.000000 0.666667 0.000000 12 | 0.333333 0.666667 0.000000 13 | 0.666667 0.666667 0.000000 14 | 1.000000 0.666667 0.000000 15 | 0.000000 1.000000 0.000000 16 | 0.333333 1.000000 0.000000 17 | 0.666667 1.000000 0.000000 18 | 1.000000 1.000000 0.000000 19 | 0.000000 0.000000 0.333333 20 | 0.333333 0.000000 0.333333 21 | 0.666667 0.000000 0.333333 22 | 1.000000 0.000000 0.333333 23 | 0.000000 0.333333 0.333333 24 | 0.333333 0.333333 0.333333 25 | 0.666667 0.333333 0.333333 26 | 1.000000 0.333333 0.333333 27 | 0.000000 0.666667 0.333333 28 | 0.333333 0.666667 0.333333 29 | 0.666667 0.666667 0.333333 30 | 1.000000 0.666667 0.333333 31 | 0.000000 1.000000 0.333333 32 | 0.333333 1.000000 0.333333 33 | 0.666667 1.000000 0.333333 34 | 1.000000 1.000000 0.333333 35 | 0.000000 0.000000 0.666667 36 | 0.333333 0.000000 0.666667 37 | 0.666667 0.000000 0.666667 38 | 1.000000 0.000000 0.666667 39 | 0.000000 0.333333 0.666667 40 | 0.333333 0.333333 0.666667 41 | 0.666667 0.333333 0.666667 42 | 1.000000 0.333333 0.666667 43 | 0.000000 0.666667 0.666667 44 | 0.333333 0.666667 0.666667 45 | 0.666667 0.666667 0.666667 46 | 1.000000 0.666667 0.666667 47 | 0.000000 1.000000 0.666667 48 | 0.333333 1.000000 0.666667 49 | 0.666667 1.000000 0.666667 50 | 1.000000 1.000000 0.666667 51 | 0.000000 0.000000 1.000000 52 | 0.333333 0.000000 1.000000 53 | 0.666667 0.000000 1.000000 54 | 1.000000 0.000000 1.000000 55 | 0.000000 0.333333 1.000000 56 | 0.333333 0.333333 1.000000 57 | 0.666667 0.333333 1.000000 58 | 1.000000 0.333333 1.000000 59 | 0.000000 0.666667 1.000000 60 | 0.333333 0.666667 1.000000 61 | 0.666667 0.666667 1.000000 62 | 1.000000 0.666667 1.000000 63 | 0.000000 1.000000 1.000000 64 | 0.333333 1.000000 1.000000 65 | 0.666667 1.000000 1.000000 66 | 1.000000 1.000000 1.000000 67 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/resolve_cube/ACES_Proxy_10_to_ACES.cube: -------------------------------------------------------------------------------- 1 | TITLE "ACES Proxy 10 to ACES" 2 | LUT_1D_SIZE 32 3 | 0.0004883 0.0004883 0.0004883 4 | 0.0007714 0.0007714 0.0007714 5 | 0.001219 0.001219 0.001219 6 | 0.001926 0.001926 0.001926 7 | 0.003044 0.003044 0.003044 8 | 0.004809 0.004809 0.004809 9 | 0.007599 0.007599 0.007599 10 | 0.01201 0.01201 0.01201 11 | 0.01897 0.01897 0.01897 12 | 0.02998 0.02998 0.02998 13 | 0.04737 0.04737 0.04737 14 | 0.07484 0.07484 0.07484 15 | 0.1183 0.1183 0.1183 16 | 0.1869 0.1869 0.1869 17 | 0.2952 0.2952 0.2952 18 | 0.4665 0.4665 0.4665 19 | 0.7371 0.7371 0.7371 20 | 1.165 1.165 1.165 21 | 1.84 1.84 1.84 22 | 2.908 2.908 2.908 23 | 4.595 4.595 4.595 24 | 7.26 7.26 7.26 25 | 11.47 11.47 11.47 26 | 18.13 18.13 18.13 27 | 28.64 28.64 28.64 28 | 45.25 45.25 45.25 29 | 71.51 71.51 71.51 30 | 113 113 113 31 | 178.5 178.5 178.5 32 | 282.1 282.1 282.1 33 | 445.7 445.7 445.7 34 | 704.3 704.3 704.3 35 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/resolve_cube/Colour_Correct.cube: -------------------------------------------------------------------------------- 1 | TITLE "Generated by Foundry::LUT" 2 | LUT_3D_SIZE 4 3 | 0.000000 0.000000 0.000000 4 | 0.398947 -0.017706 -0.017706 5 | 0.797894 -0.035412 -0.035412 6 | 1.196841 -0.053117 -0.053117 7 | -0.026231 0.377102 -0.026231 8 | 0.294597 0.294597 0.069582 9 | 0.633333 0.316667 0.000000 10 | 1.038439 0.310899 -0.052870 11 | -0.052463 0.754204 -0.052463 12 | 0.349416 0.657749 0.041083 13 | 0.589195 0.589195 0.139164 14 | 0.891318 0.619823 0.076833 15 | -0.078694 1.131306 -0.078694 16 | 0.344991 1.050213 -0.007621 17 | 0.663432 0.930188 0.129920 18 | 0.883792 0.883792 0.208746 19 | 0.000000 0.000000 0.416653 20 | 0.333333 0.000000 0.333333 21 | 0.752767 -0.028479 0.362144 22 | 1.162588 -0.050372 0.353948 23 | 0.019686 0.244702 0.244702 24 | 0.416655 0.416655 0.416655 25 | 0.732278 0.315626 0.315626 26 | 1.131225 0.297920 0.297920 27 | 0.000000 0.616667 0.308333 28 | 0.340435 0.743769 0.340435 29 | 0.594601 0.594601 0.369586 30 | 0.950000 0.633333 0.316667 31 | -0.035927 1.021908 0.316685 32 | 0.314204 1.120871 0.314204 33 | 0.682749 0.991082 0.374416 34 | 0.889199 0.889199 0.439168 35 | 0.000000 0.000000 0.833306 36 | 0.390623 0.000000 0.781246 37 | 0.666667 0.000000 0.666667 38 | 1.089003 -0.031363 0.715547 39 | 0.014327 0.330993 0.647660 40 | 0.416655 0.416655 0.833308 41 | 0.666667 0.333333 0.666667 42 | 1.086101 0.304855 0.695478 43 | 0.039372 0.489403 0.489403 44 | 0.269700 0.494715 0.494715 45 | 0.833311 0.833311 0.833311 46 | 1.065610 0.648957 0.648957 47 | 0.030904 0.831171 0.564415 48 | 0.308333 0.925000 0.616667 49 | 0.707102 1.110435 0.707102 50 | 0.894606 0.894606 0.669590 51 | 0.000001 0.000001 1.249959 52 | 0.404320 0.000000 1.212960 53 | 0.746911 0.000000 1.120366 54 | 1.000000 0.000000 1.000000 55 | 0.009022 0.372791 1.100331 56 | 0.416656 0.416656 1.249961 57 | 0.781246 0.390623 1.171869 58 | 1.000000 0.333333 1.000000 59 | 0.035773 0.578763 0.850258 60 | 0.347660 0.664327 0.980993 61 | 0.833311 0.833311 1.249963 62 | 1.000000 0.666667 1.000000 63 | 0.059059 0.734105 0.734105 64 | 0.289386 0.739417 0.739417 65 | 0.519714 0.744729 0.744729 66 | 1.249966 1.249966 1.249966 67 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/resolve_cube/Demo.cube: -------------------------------------------------------------------------------- 1 | TITLE "Demo" 2 | # Comments can't go anywhere 3 | LUT_1D_SIZE 3 4 | LUT_1D_INPUT_RANGE 0 3 5 | 0 0 0 6 | 1.5 1.5 1.5 7 | 3 3 3 8 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/resolve_cube/RGB_1_0.5_0.25.cube: -------------------------------------------------------------------------------- 1 | TITLE "Generated by Foundry::LUT" 2 | LUT_3D_SIZE 4 3 | 0.000000 0.000000 0.000000 4 | 0.333333 0.000000 0.000000 5 | 0.666667 0.000000 0.000000 6 | 1.000000 0.000000 0.000000 7 | 0.000000 0.166667 0.000000 8 | 0.333333 0.166667 0.000000 9 | 0.666667 0.166667 0.000000 10 | 1.000000 0.166667 0.000000 11 | 0.000000 0.333333 0.000000 12 | 0.333333 0.333333 0.000000 13 | 0.666667 0.333333 0.000000 14 | 1.000000 0.333333 0.000000 15 | 0.000000 0.500000 0.000000 16 | 0.333333 0.500000 0.000000 17 | 0.666667 0.500000 0.000000 18 | 1.000000 0.500000 0.000000 19 | 0.000000 0.000000 0.083333 20 | 0.333333 0.000000 0.083333 21 | 0.666667 0.000000 0.083333 22 | 1.000000 0.000000 0.083333 23 | 0.000000 0.166667 0.083333 24 | 0.333333 0.166667 0.083333 25 | 0.666667 0.166667 0.083333 26 | 1.000000 0.166667 0.083333 27 | 0.000000 0.333333 0.083333 28 | 0.333333 0.333333 0.083333 29 | 0.666667 0.333333 0.083333 30 | 1.000000 0.333333 0.083333 31 | 0.000000 0.500000 0.083333 32 | 0.333333 0.500000 0.083333 33 | 0.666667 0.500000 0.083333 34 | 1.000000 0.500000 0.083333 35 | 0.000000 0.000000 0.166667 36 | 0.333333 0.000000 0.166667 37 | 0.666667 0.000000 0.166667 38 | 1.000000 0.000000 0.166667 39 | 0.000000 0.166667 0.166667 40 | 0.333333 0.166667 0.166667 41 | 0.666667 0.166667 0.166667 42 | 1.000000 0.166667 0.166667 43 | 0.000000 0.333333 0.166667 44 | 0.333333 0.333333 0.166667 45 | 0.666667 0.333333 0.166667 46 | 1.000000 0.333333 0.166667 47 | 0.000000 0.500000 0.166667 48 | 0.333333 0.500000 0.166667 49 | 0.666667 0.500000 0.166667 50 | 1.000000 0.500000 0.166667 51 | 0.000000 0.000000 0.250000 52 | 0.333333 0.000000 0.250000 53 | 0.666667 0.000000 0.250000 54 | 1.000000 0.000000 0.250000 55 | 0.000000 0.166667 0.250000 56 | 0.333333 0.166667 0.250000 57 | 0.666667 0.166667 0.250000 58 | 1.000000 0.166667 0.250000 59 | 0.000000 0.333333 0.250000 60 | 0.333333 0.333333 0.250000 61 | 0.666667 0.333333 0.250000 62 | 1.000000 0.333333 0.250000 63 | 0.000000 0.500000 0.250000 64 | 0.333333 0.500000 0.250000 65 | 0.666667 0.500000 0.250000 66 | 1.000000 0.500000 0.250000 67 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/resolve_cube/Three_Dimensional_Table.cube: -------------------------------------------------------------------------------- 1 | LUT_3D_SIZE 2 2 | 0 0 0 3 | 1 0 0 4 | 0 .75 0 5 | 1 .75 0 6 | 0 .25 1 7 | 1 .25 1 8 | 0 1 1 9 | 1 1 1 10 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/resolve_cube/Three_Dimensional_Table_With_Shaper.cube: -------------------------------------------------------------------------------- 1 | TITLE "LUT3D with My Shaper" 2 | # A first "Shaper" comment. 3 | # A second "Shaper" comment. 4 | # A first "LUT3D" comment. 5 | # A second "LUT3D" comment. 6 | LUT_1D_SIZE 10 7 | LUT_1D_INPUT_RANGE -0.1000000 3.0000000 8 | LUT_3D_SIZE 3 9 | LUT_3D_INPUT_RANGE -0.1000000 3.0000000 10 | -0.3511192 -0.3511192 -0.3511192 11 | 0.5271086 0.5271086 0.5271086 12 | 0.7860854 0.7860854 0.7860854 13 | 0.9691262 0.9691262 0.9691262 14 | 1.1178635 1.1178635 1.1178635 15 | 1.2459617 1.2459617 1.2459617 16 | 1.3599219 1.3599219 1.3599219 17 | 1.4634339 1.4634339 1.4634339 18 | 1.5588269 1.5588269 1.5588269 19 | 1.6476816 1.6476816 1.6476816 20 | 21 | 0.9277778 0.9063014 0.9020062 22 | 1.4500000 -0.1000000 -0.1000000 23 | 3.0000000 -0.1000000 -0.1000000 24 | 0.4315560 0.4777778 0.4392596 25 | 1.4500000 1.4500000 -0.1000000 26 | 3.0000000 1.4500000 -0.1000000 27 | 1.9038580 2.0277778 1.9245113 28 | 1.4500000 3.0000000 -0.1000000 29 | 3.0000000 3.0000000 -0.1000000 30 | 0.4392596 0.4315560 0.4777778 31 | 1.4500000 -0.1000000 1.4500000 32 | 3.0000000 -0.1000000 1.4500000 33 | 0.4315560 0.4700741 0.4777778 34 | 1.4500000 1.4500000 1.4500000 35 | 3.0000000 1.4500000 1.4500000 36 | 1.9038580 2.0277778 1.9864712 37 | 1.4500000 3.0000000 1.4500000 38 | 3.0000000 3.0000000 1.4500000 39 | 1.9245113 1.9038580 2.0277778 40 | 1.4500000 -0.1000000 3.0000000 41 | 3.0000000 -0.1000000 3.0000000 42 | 1.9038580 1.9451646 2.0277778 43 | 1.4500000 1.4500000 3.0000000 44 | 3.0000000 1.4500000 3.0000000 45 | 1.9038580 2.0071245 2.0277778 46 | 1.4500000 3.0000000 3.0000000 47 | 3.0000000 3.0000000 3.0000000 48 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/resolve_cube/Unit.cube: -------------------------------------------------------------------------------- 1 | TITLE "Generated by Foundry::LUT" 2 | LUT_3D_SIZE 4 3 | 0.000000 0.000000 0.000000 4 | 0.333333 0.000000 0.000000 5 | 0.666667 0.000000 0.000000 6 | 1.000000 0.000000 0.000000 7 | 0.000000 0.333333 0.000000 8 | 0.333333 0.333333 0.000000 9 | 0.666667 0.333333 0.000000 10 | 1.000000 0.333333 0.000000 11 | 0.000000 0.666667 0.000000 12 | 0.333333 0.666667 0.000000 13 | 0.666667 0.666667 0.000000 14 | 1.000000 0.666667 0.000000 15 | 0.000000 1.000000 0.000000 16 | 0.333333 1.000000 0.000000 17 | 0.666667 1.000000 0.000000 18 | 1.000000 1.000000 0.000000 19 | 0.000000 0.000000 0.333333 20 | 0.333333 0.000000 0.333333 21 | 0.666667 0.000000 0.333333 22 | 1.000000 0.000000 0.333333 23 | 0.000000 0.333333 0.333333 24 | 0.333333 0.333333 0.333333 25 | 0.666667 0.333333 0.333333 26 | 1.000000 0.333333 0.333333 27 | 0.000000 0.666667 0.333333 28 | 0.333333 0.666667 0.333333 29 | 0.666667 0.666667 0.333333 30 | 1.000000 0.666667 0.333333 31 | 0.000000 1.000000 0.333333 32 | 0.333333 1.000000 0.333333 33 | 0.666667 1.000000 0.333333 34 | 1.000000 1.000000 0.333333 35 | 0.000000 0.000000 0.666667 36 | 0.333333 0.000000 0.666667 37 | 0.666667 0.000000 0.666667 38 | 1.000000 0.000000 0.666667 39 | 0.000000 0.333333 0.666667 40 | 0.333333 0.333333 0.666667 41 | 0.666667 0.333333 0.666667 42 | 1.000000 0.333333 0.666667 43 | 0.000000 0.666667 0.666667 44 | 0.333333 0.666667 0.666667 45 | 0.666667 0.666667 0.666667 46 | 1.000000 0.666667 0.666667 47 | 0.000000 1.000000 0.666667 48 | 0.333333 1.000000 0.666667 49 | 0.666667 1.000000 0.666667 50 | 1.000000 1.000000 0.666667 51 | 0.000000 0.000000 1.000000 52 | 0.333333 0.000000 1.000000 53 | 0.666667 0.000000 1.000000 54 | 1.000000 0.000000 1.000000 55 | 0.000000 0.333333 1.000000 56 | 0.333333 0.333333 1.000000 57 | 0.666667 0.333333 1.000000 58 | 1.000000 0.333333 1.000000 59 | 0.000000 0.666667 1.000000 60 | 0.333333 0.666667 1.000000 61 | 0.666667 0.666667 1.000000 62 | 1.000000 0.666667 1.000000 63 | 0.000000 1.000000 1.000000 64 | 0.333333 1.000000 1.000000 65 | 0.666667 1.000000 1.000000 66 | 1.000000 1.000000 1.000000 67 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/sony_spi1d/Exception_Raising.spi1d: -------------------------------------------------------------------------------- 1 | Version 1 2 | From 0.0 3 | Length 2 4 | Components 1 5 | { 6 | 0.0 7 | 1.0 8 | } 9 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/sony_spi1d/eotf_sRGB_1D.spi1d: -------------------------------------------------------------------------------- 1 | Version 1 2 | From -0.1000000 1.5000000 3 | Length 16 4 | Components 1 5 | { 6 | -0.0077399 7 | 0.0005160 8 | 0.0122181 9 | 0.0396819 10 | 0.0871438 11 | 0.1574394 12 | 0.2529501 13 | 0.3757579 14 | 0.5277294 15 | 0.7105665 16 | 0.9258406 17 | 1.1750163 18 | 1.4594687 19 | 1.7804968 20 | 2.1393338 21 | 2.5371552 22 | } 23 | # Generated by "Colour 0.3.11". 24 | # "colour.models.eotf_sRGB". 25 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/sony_spi1d/eotf_sRGB_3x1D.spi1d: -------------------------------------------------------------------------------- 1 | Version 1 2 | From -0.1000000 1.5000000 3 | Length 16 4 | Components 3 5 | { 6 | -0.0077399 -0.0077399 -0.0077399 7 | 0.0005160 0.0005160 0.0005160 8 | 0.0122181 0.0122181 0.0122181 9 | 0.0396819 0.0396819 0.0396819 10 | 0.0871438 0.0871438 0.0871438 11 | 0.1574394 0.1574394 0.1574394 12 | 0.2529501 0.2529501 0.2529501 13 | 0.3757579 0.3757579 0.3757579 14 | 0.5277294 0.5277294 0.5277294 15 | 0.7105665 0.7105665 0.7105665 16 | 0.9258406 0.9258406 0.9258406 17 | 1.1750163 1.1750163 1.1750163 18 | 1.4594687 1.4594687 1.4594687 19 | 1.7804968 1.7804968 1.7804968 20 | 2.1393338 2.1393338 2.1393338 21 | 2.5371552 2.5371552 2.5371552 22 | } 23 | # Generated by "Colour 0.3.11". 24 | # "colour.models.eotf_sRGB". 25 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/sony_spimtx/Matrix_Offset.spimtx: -------------------------------------------------------------------------------- 1 | 1. 0. 0. 0. 2 | 0. 1. 0. 0. 3 | 0. 0. 1. 65535. 4 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/sony_spimtx/dt.spimtx: -------------------------------------------------------------------------------- 1 | 0.864274 0 0 0 0 0.864274 0 0 0 0 0.864274 0 2 | -------------------------------------------------------------------------------- /colour/io/luts/tests/resources/sony_spimtx/p3_to_xyz16.spimtx: -------------------------------------------------------------------------------- 1 | .44488 .27717 .17237 0 2 | .20936 .7217 .06895 0 3 | 0 .04707 .9078 0 4 | -------------------------------------------------------------------------------- /colour/io/luts/tests/test_common.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.io.luts.common` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | from colour.io.luts.common import path_to_title 6 | 7 | __author__ = "Colour Developers" 8 | __copyright__ = "Copyright 2013 Colour Developers" 9 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 10 | __maintainer__ = "Colour Developers" 11 | __email__ = "colour-developers@colour-science.org" 12 | __status__ = "Production" 13 | 14 | __all__ = [ 15 | "TestPathToTitle", 16 | ] 17 | 18 | 19 | class TestPathToTitle: 20 | """ 21 | Define :func:`colour.io.luts.common.path_to_title` definition unit tests 22 | methods. 23 | """ 24 | 25 | def test_path_to_title(self) -> None: 26 | """Test :func:`colour.io.luts.common.path_to_title` definition.""" 27 | 28 | assert ( 29 | path_to_title("colour/io/luts/tests/resources/cinespace/RGB_1_0.5_0.25.csp") 30 | == "RGB 1 0 5 0 25" 31 | ) 32 | -------------------------------------------------------------------------------- /colour/io/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/__init__.py -------------------------------------------------------------------------------- /colour/io/tests/resources/Adjust_Exposure_Float.ctl: -------------------------------------------------------------------------------- 1 | // Adjust Exposure 2 | 3 | void main 4 | ( 5 | output varying float rOut, 6 | output varying float gOut, 7 | output varying float bOut, 8 | output varying float aOut, 9 | input varying float rIn, 10 | input varying float gIn, 11 | input varying float bIn, 12 | input varying float aIn = 1.0, 13 | input float exposure = 0.0 14 | ) 15 | { 16 | rOut = rIn * pow(2, exposure); 17 | gOut = gIn * pow(2, exposure); 18 | bOut = bIn * pow(2, exposure); 19 | aOut = aIn; 20 | } 21 | -------------------------------------------------------------------------------- /colour/io/tests/resources/Adjust_Exposure_Float3.ctl: -------------------------------------------------------------------------------- 1 | // Adjust Exposure 2 | 3 | float[3] adjust_exposure(float rgbIn[3], float exposureIn) 4 | { 5 | float rgbOut[3]; 6 | 7 | float exposure = pow(2, exposureIn); 8 | 9 | rgbOut[0] = rgbIn[0] * exposure; 10 | rgbOut[1] = rgbIn[1] * exposure; 11 | rgbOut[2] = rgbIn[2] * exposure; 12 | 13 | return rgbOut; 14 | } 15 | 16 | void main 17 | ( 18 | output varying float rOut, 19 | output varying float gOut, 20 | output varying float bOut, 21 | output varying float aOut, 22 | input varying float rIn, 23 | input varying float gIn, 24 | input varying float bIn, 25 | input varying float aIn = 1.0, 26 | input float exposure = 0.0 27 | ) 28 | { 29 | float rgbIn[3] = {rIn, gIn, bIn}; 30 | 31 | float rgbOut[3] = adjust_exposure(rgbIn, exposure); 32 | 33 | rOut = rgbOut[0]; 34 | gOut = rgbOut[1]; 35 | bOut = rgbOut[2]; 36 | aOut = aIn; 37 | } 38 | -------------------------------------------------------------------------------- /colour/io/tests/resources/BiSpectral.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/resources/BiSpectral.exr -------------------------------------------------------------------------------- /colour/io/tests/resources/CMS_Test_Pattern.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/resources/CMS_Test_Pattern.exr -------------------------------------------------------------------------------- /colour/io/tests/resources/Colour_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/resources/Colour_Logo.png -------------------------------------------------------------------------------- /colour/io/tests/resources/D65.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/resources/D65.exr -------------------------------------------------------------------------------- /colour/io/tests/resources/Invalid.spdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /colour/io/tests/resources/Ohta1997.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/resources/Ohta1997.exr -------------------------------------------------------------------------------- /colour/io/tests/resources/Overflowing_Gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/resources/Overflowing_Gradient.png -------------------------------------------------------------------------------- /colour/io/tests/resources/Polarised.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/resources/Polarised.exr -------------------------------------------------------------------------------- /colour/io/tests/resources/Single_Channel.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/io/tests/resources/Single_Channel.exr -------------------------------------------------------------------------------- /colour/models/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .macadam_ellipses import DATA_MACADAM_1942_ELLIPSES 4 | from .pointer_gamut import ( 5 | CCS_ILLUMINANT_POINTER_GAMUT, 6 | DATA_POINTER_GAMUT_VOLUME, 7 | CCS_POINTER_GAMUT_BOUNDARY, 8 | ) 9 | 10 | __all__ = [ 11 | "DATA_MACADAM_1942_ELLIPSES", 12 | ] 13 | __all__ += [ 14 | "CCS_ILLUMINANT_POINTER_GAMUT", 15 | "DATA_POINTER_GAMUT_VOLUME", 16 | "CCS_POINTER_GAMUT_BOUNDARY", 17 | ] 18 | -------------------------------------------------------------------------------- /colour/models/rgb/datasets/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/models/rgb/datasets/tests/__init__.py -------------------------------------------------------------------------------- /colour/models/rgb/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/models/rgb/tests/__init__.py -------------------------------------------------------------------------------- /colour/models/rgb/transfer_functions/linear.py: -------------------------------------------------------------------------------- 1 | """ 2 | Linear Colour Component Transfer Function 3 | ========================================= 4 | 5 | Define the linear encoding / decoding colour component transfer function 6 | related objects: 7 | 8 | - :func:`colour.linear_function` 9 | """ 10 | 11 | from __future__ import annotations 12 | 13 | import typing 14 | 15 | if typing.TYPE_CHECKING: 16 | from colour.hints import ArrayLike, DTypeFloat, NDArray, NDArrayFloat 17 | 18 | from colour.utilities import as_float 19 | 20 | __author__ = "Colour Developers" 21 | __copyright__ = "Copyright 2013 Colour Developers" 22 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 23 | __maintainer__ = "Colour Developers" 24 | __email__ = "colour-developers@colour-science.org" 25 | __status__ = "Production" 26 | 27 | __all__ = [ 28 | "linear_function", 29 | ] 30 | 31 | 32 | @typing.overload 33 | def linear_function(a: float | DTypeFloat) -> DTypeFloat: ... 34 | @typing.overload 35 | def linear_function(a: NDArray) -> NDArrayFloat: ... 36 | @typing.overload 37 | def linear_function(a: ArrayLike) -> DTypeFloat | NDArrayFloat: ... 38 | def linear_function(a: ArrayLike) -> DTypeFloat | NDArrayFloat: 39 | """ 40 | Define a typical linear encoding / decoding function, essentially a 41 | pass-through function. 42 | 43 | Parameters 44 | ---------- 45 | a 46 | Array to encode / decode. 47 | 48 | Returns 49 | ------- 50 | :class:`numpy.ndarray` 51 | Encoded / decoded array. 52 | 53 | Examples 54 | -------- 55 | >>> linear_function(0.18) # doctest: +ELLIPSIS 56 | 0.1799999... 57 | """ 58 | 59 | return as_float(a) 60 | -------------------------------------------------------------------------------- /colour/models/rgb/transfer_functions/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/models/rgb/transfer_functions/tests/__init__.py -------------------------------------------------------------------------------- /colour/models/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/models/tests/__init__.py -------------------------------------------------------------------------------- /colour/models/tests/test_cam16_ucs.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.models.cam16_ucs` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | from colour.models.tests.test_cam02_ucs import ( 6 | TestJMh_CIECAM02_to_UCS_Luo2006, 7 | TestUCS_Luo2006_to_JMh_CIECAM02, 8 | TestUCS_Luo2006_to_XYZ, 9 | TestXYZ_to_UCS_Luo2006, 10 | ) 11 | 12 | __author__ = "Colour Developers" 13 | __copyright__ = "Copyright 2013 Colour Developers" 14 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 15 | __maintainer__ = "Colour Developers" 16 | __email__ = "colour-developers@colour-science.org" 17 | __status__ = "Production" 18 | 19 | __all__ = [ 20 | "TestJMh_CAM16_to_UCS_Li2017", 21 | "TestUCS_Li2017_to_JMh_CAM16", 22 | "TestXYZ_to_UCS_Li2017", 23 | "TestUCS_Li2017_to_XYZ", 24 | ] 25 | 26 | 27 | class TestJMh_CAM16_to_UCS_Li2017(TestJMh_CIECAM02_to_UCS_Luo2006): 28 | """ 29 | Define :func:`colour.models.cam16_ucs.JMh_CAM16_to_UCS_Li2017` 30 | definition unit tests methods. 31 | 32 | Notes 33 | ----- 34 | - :func:`colour.models.cam16_ucs.JMh_CAM16_to_UCS_Li2017` is a wrapper 35 | of :func:`colour.models.cam02_ucs.JMh_CIECAM02_to_UCS_Luo2006` and thus 36 | currently adopts the same unittests. 37 | """ 38 | 39 | 40 | class TestUCS_Li2017_to_JMh_CAM16(TestUCS_Luo2006_to_JMh_CIECAM02): 41 | """ 42 | Define :func:`colour.models.cam16_ucs.UCS_Li2017_to_JMh_CAM16` 43 | definition unit tests methods. 44 | 45 | Notes 46 | ----- 47 | - :func:`colour.models.cam16_ucs.UCS_Li2017_to_JMh_CAM16` is a wrapper 48 | of :func:`colour.models.cam02_ucs.UCS_Luo2006_to_JMh_CIECAM02` and thus 49 | currently adopts the same unittests. 50 | """ 51 | 52 | 53 | class TestXYZ_to_UCS_Li2017(TestXYZ_to_UCS_Luo2006): 54 | """ 55 | Define :func:`colour.models.cam16_ucs.XYZ_to_UCS_Li2017` 56 | definition unit tests methods. 57 | """ 58 | 59 | 60 | class TestUCS_Li2017_to_XYZ(TestUCS_Luo2006_to_XYZ): 61 | """ 62 | Define :func:`colour.models.cam16_ucs.UCS_Li2017_to_XYZ` 63 | definition unit tests methods. 64 | """ 65 | -------------------------------------------------------------------------------- /colour/notation/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .datasets import ( 4 | CSS_COLOR_3_BASIC, 5 | CSS_COLOR_3_EXTENDED, 6 | CSS_COLOR_3, 7 | MUNSELL_COLOURS_ALL, 8 | MUNSELL_COLOURS_1929, 9 | MUNSELL_COLOURS_REAL, 10 | MUNSELL_COLOURS, 11 | ) 12 | from .munsell import MUNSELL_VALUE_METHODS 13 | from .munsell import munsell_value 14 | from .munsell import ( 15 | munsell_value_Priest1920, 16 | munsell_value_Munsell1933, 17 | munsell_value_Moon1943, 18 | munsell_value_Saunderson1944, 19 | munsell_value_Ladd1955, 20 | munsell_value_McCamy1987, 21 | munsell_value_ASTMD1535, 22 | ) 23 | from .munsell import munsell_colour_to_xyY, xyY_to_munsell_colour 24 | from .hexadecimal import RGB_to_HEX, HEX_to_RGB 25 | from .css_color_3 import keyword_to_RGB_CSSColor3 26 | 27 | __all__ = [ 28 | "CSS_COLOR_3_BASIC", 29 | "CSS_COLOR_3_EXTENDED", 30 | "CSS_COLOR_3", 31 | "MUNSELL_COLOURS_ALL", 32 | "MUNSELL_COLOURS_1929", 33 | "MUNSELL_COLOURS_REAL", 34 | "MUNSELL_COLOURS", 35 | ] 36 | __all__ += [ 37 | "munsell_value", 38 | ] 39 | __all__ += [ 40 | "MUNSELL_VALUE_METHODS", 41 | ] 42 | __all__ += [ 43 | "munsell_value_Priest1920", 44 | "munsell_value_Munsell1933", 45 | "munsell_value_Moon1943", 46 | "munsell_value_Saunderson1944", 47 | "munsell_value_Ladd1955", 48 | "munsell_value_McCamy1987", 49 | "munsell_value_ASTMD1535", 50 | ] 51 | __all__ += [ 52 | "munsell_colour_to_xyY", 53 | "xyY_to_munsell_colour", 54 | ] 55 | __all__ += [ 56 | "RGB_to_HEX", 57 | "HEX_to_RGB", 58 | ] 59 | __all__ += ["keyword_to_RGB_CSSColor3"] 60 | -------------------------------------------------------------------------------- /colour/notation/css_color_3.py: -------------------------------------------------------------------------------- 1 | """ 2 | CSS Color Module Level 3 - Web Colours 3 | ====================================== 4 | 5 | Define the conversion of colour keywords to *RGB* colourspace: 6 | 7 | - :attr:`colour.notation.keyword_to_RGB_CSSColor3` 8 | 9 | References 10 | ---------- 11 | - :cite:`W3C2022` : W3C. (2022). CSS Color Module Level 3. 12 | https://www.w3.org/TR/css-color-3/ 13 | """ 14 | 15 | from __future__ import annotations 16 | 17 | import typing 18 | 19 | if typing.TYPE_CHECKING: 20 | from colour.hints import NDArrayFloat 21 | 22 | from colour.notation import CSS_COLOR_3, HEX_to_RGB 23 | from colour.utilities import attest 24 | 25 | __author__ = "Colour Developers" 26 | __copyright__ = "Copyright 2013 Colour Developers" 27 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 28 | __maintainer__ = "Colour Developers" 29 | __email__ = "colour-developers@colour-science.org" 30 | __status__ = "Production" 31 | 32 | __all__ = [ 33 | "keyword_to_RGB_CSSColor3", 34 | ] 35 | 36 | 37 | def keyword_to_RGB_CSSColor3(keyword: str) -> NDArrayFloat: 38 | """ 39 | Convert specified colour keyword to *RGB* colourspace according to 40 | *CSS Color Module Level 3* *W3C Recommendation*. 41 | 42 | Parameters 43 | ---------- 44 | keyword 45 | Colour keyword. 46 | 47 | Returns 48 | ------- 49 | :class:`numpy.array` 50 | *RGB* colourspace array. 51 | 52 | Notes 53 | ----- 54 | - All the RGB colors are specified in the *IEC 61966-2-1:1999* *sRGB* 55 | colourspace. 56 | 57 | Examples 58 | -------- 59 | >>> keyword_to_RGB_CSSColor3("black") 60 | array([ 0., 0., 0.]) 61 | >>> keyword_to_RGB_CSSColor3("white") 62 | array([ 1., 1., 1.]) 63 | >>> keyword_to_RGB_CSSColor3("aliceblue") # doctest: +ELLIPSIS 64 | array([ 0.9411764..., 0.9725490..., 1. ]) 65 | """ 66 | 67 | attest(keyword in CSS_COLOR_3, f'{keyword} is not defined in "CSS Color 3"!') 68 | 69 | return HEX_to_RGB(CSS_COLOR_3[keyword]) 70 | -------------------------------------------------------------------------------- /colour/notation/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .css_color_3 import CSS_COLOR_3_BASIC, CSS_COLOR_3_EXTENDED, CSS_COLOR_3 4 | from .munsell import ( 5 | MUNSELL_COLOURS_ALL, 6 | MUNSELL_COLOURS_1929, 7 | MUNSELL_COLOURS_REAL, 8 | MUNSELL_COLOURS, 9 | ) 10 | 11 | __all__ = [ 12 | "CSS_COLOR_3_BASIC", 13 | "CSS_COLOR_3_EXTENDED", 14 | "CSS_COLOR_3", 15 | ] 16 | __all__ += [ 17 | "MUNSELL_COLOURS_ALL", 18 | "MUNSELL_COLOURS_1929", 19 | "MUNSELL_COLOURS_REAL", 20 | "MUNSELL_COLOURS", 21 | ] 22 | -------------------------------------------------------------------------------- /colour/notation/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/notation/tests/__init__.py -------------------------------------------------------------------------------- /colour/notation/tests/test_css_color_3.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.notation.css_color_3` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | import numpy as np 6 | 7 | from colour.constants import TOLERANCE_ABSOLUTE_TESTS 8 | from colour.notation import keyword_to_RGB_CSSColor3 9 | 10 | __author__ = "Colour Developers" 11 | __copyright__ = "Copyright 2013 Colour Developers" 12 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 13 | __maintainer__ = "Colour Developers" 14 | __email__ = "colour-developers@colour-science.org" 15 | __status__ = "Production" 16 | 17 | __all__ = [ 18 | "TestKeywordToRGBCSSColor3", 19 | ] 20 | 21 | 22 | class TestKeywordToRGBCSSColor3: 23 | """ 24 | Define :func:`colour.notation.css_color_3.keyword_to_RGB_CSSColor3` 25 | definition unit tests methods. 26 | """ 27 | 28 | def test_keyword_to_RGB_CSSColor3(self) -> None: 29 | """ 30 | Test :func:`colour.notation.css_color_3.keyword_to_RGB_CSSColor3` 31 | definition. 32 | """ 33 | 34 | np.testing.assert_array_equal( 35 | keyword_to_RGB_CSSColor3("black"), np.array([0, 0, 0]) 36 | ) 37 | 38 | np.testing.assert_array_equal( 39 | keyword_to_RGB_CSSColor3("white"), np.array([1, 1, 1]) 40 | ) 41 | 42 | np.testing.assert_allclose( 43 | keyword_to_RGB_CSSColor3("aliceblue"), 44 | np.array([0.94117647, 0.97254902, 1.00000000]), 45 | atol=TOLERANCE_ABSOLUTE_TESTS, 46 | ) 47 | -------------------------------------------------------------------------------- /colour/phenomena/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .rayleigh import ( 4 | scattering_cross_section, 5 | rayleigh_optical_depth, 6 | rayleigh_scattering, 7 | sd_rayleigh_scattering, 8 | ) 9 | 10 | __all__ = [ 11 | "scattering_cross_section", 12 | "rayleigh_optical_depth", 13 | "rayleigh_scattering", 14 | "sd_rayleigh_scattering", 15 | ] 16 | -------------------------------------------------------------------------------- /colour/phenomena/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/phenomena/tests/__init__.py -------------------------------------------------------------------------------- /colour/plotting/conftest.py: -------------------------------------------------------------------------------- 1 | """ 2 | Plotting - Pytest Configuration 3 | =============================== 4 | 5 | Configure *pytest* to use the *Matplotlib* *AGG* headless backend. This allows 6 | the plotting unittests to run without creating windows in IDEs such as 7 | *VSCode*. 8 | """ 9 | 10 | import matplotlib as mpl 11 | import pytest 12 | 13 | from colour.hints import Generator 14 | 15 | __author__ = "Colour Developers" 16 | __copyright__ = "Copyright 2013 Colour Developers" 17 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 18 | __maintainer__ = "Colour Developers" 19 | __email__ = "colour-developers@colour-science.org" 20 | __status__ = "Production" 21 | 22 | __all__ = [ 23 | "mpl_headless_backend", 24 | ] 25 | 26 | 27 | @pytest.fixture(autouse=True, scope="session") 28 | def mpl_headless_backend() -> Generator[None, None, None]: 29 | """ 30 | Configure *Matplotlib* for headless testing. 31 | 32 | This pytest fixture is automatically applied to any tests in this package 33 | or any subpackages at the beginning of the pytest session. 34 | 35 | Yields 36 | ------ 37 | Generator 38 | *Matplotlib* unit tests. 39 | """ 40 | 41 | current_backend = mpl.get_backend() 42 | mpl.use("AGG") 43 | yield 44 | mpl.use(current_backend) 45 | -------------------------------------------------------------------------------- /colour/plotting/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .astm_g_173 import ( 4 | SD_ASTMG173_ETR, 5 | SD_ASTMG173_GLOBAL_TILT, 6 | SD_ASTMG173_DIRECT_CIRCUMSOLAR, 7 | ) 8 | 9 | __all__ = [ 10 | "SD_ASTMG173_ETR", 11 | "SD_ASTMG173_GLOBAL_TILT", 12 | "SD_ASTMG173_DIRECT_CIRCUMSOLAR", 13 | ] 14 | -------------------------------------------------------------------------------- /colour/plotting/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/plotting/tests/__init__.py -------------------------------------------------------------------------------- /colour/plotting/tests/test_blindness.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.plotting.blindness` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | import numpy as np 6 | from matplotlib.axes import Axes 7 | from matplotlib.figure import Figure 8 | 9 | from colour.plotting import plot_cvd_simulation_Machado2009 10 | 11 | __author__ = "Colour Developers" 12 | __copyright__ = "Copyright 2013 Colour Developers" 13 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 14 | __maintainer__ = "Colour Developers" 15 | __email__ = "colour-developers@colour-science.org" 16 | __status__ = "Production" 17 | 18 | __all__ = [ 19 | "TestPlotCvdSimulationMachado2009", 20 | ] 21 | 22 | 23 | class TestPlotCvdSimulationMachado2009: 24 | """ 25 | Define :func:`colour.plotting.blindness.plot_cvd_simulation_Machado2009` 26 | definition unit tests methods. 27 | """ 28 | 29 | def test_plot_cvd_simulation_Machado2009(self) -> None: 30 | """ 31 | Test :func:`colour.plotting.blindness.plot_cvd_simulation_Machado2009` 32 | definition. 33 | """ 34 | 35 | figure, axes = plot_cvd_simulation_Machado2009(np.random.rand(32, 32, 3)) 36 | 37 | assert isinstance(figure, Figure) 38 | assert isinstance(axes, Axes) 39 | -------------------------------------------------------------------------------- /colour/plotting/tests/test_characterisation.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.plotting.characterisation` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | from matplotlib.axes import Axes 6 | from matplotlib.figure import Figure 7 | 8 | from colour.plotting import plot_multi_colour_checkers, plot_single_colour_checker 9 | 10 | __author__ = "Colour Developers" 11 | __copyright__ = "Copyright 2013 Colour Developers" 12 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 13 | __maintainer__ = "Colour Developers" 14 | __email__ = "colour-developers@colour-science.org" 15 | __status__ = "Production" 16 | 17 | __all__ = [ 18 | "TestPlotSingleColourChecker", 19 | "TestPlotMultiColourCheckers", 20 | ] 21 | 22 | 23 | class TestPlotSingleColourChecker: 24 | """ 25 | Define :func:`colour.plotting.characterisation.plot_single_colour_checker` 26 | definition unit tests methods. 27 | """ 28 | 29 | def test_plot_single_colour_checker(self) -> None: 30 | """ 31 | Test :func:`colour.plotting.characterisation.\ 32 | plot_single_colour_checker` definition. 33 | """ 34 | 35 | figure, axes = plot_single_colour_checker() 36 | 37 | assert isinstance(figure, Figure) 38 | assert isinstance(axes, Axes) 39 | 40 | 41 | class TestPlotMultiColourCheckers: 42 | """ 43 | Define :func:`colour.plotting.characterisation.plot_multi_colour_checkers` 44 | definition unit tests methods. 45 | """ 46 | 47 | def test_plot_multi_colour_checkers(self) -> None: 48 | """ 49 | Test :func:`colour.plotting.characterisation.\ 50 | plot_multi_colour_checkers` definition. 51 | """ 52 | 53 | figure, axes = plot_multi_colour_checkers( 54 | ["ColorChecker 1976", "ColorChecker 2005"] 55 | ) 56 | 57 | assert isinstance(figure, Figure) 58 | assert isinstance(axes, Axes) 59 | -------------------------------------------------------------------------------- /colour/plotting/tests/test_corresponding.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.plotting.corresponding` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | from matplotlib.axes import Axes 6 | from matplotlib.figure import Figure 7 | 8 | from colour.plotting import plot_corresponding_chromaticities_prediction 9 | 10 | __author__ = "Colour Developers" 11 | __copyright__ = "Copyright 2013 Colour Developers" 12 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 13 | __maintainer__ = "Colour Developers" 14 | __email__ = "colour-developers@colour-science.org" 15 | __status__ = "Production" 16 | 17 | __all__ = [ 18 | "TestPlotCorrespondingChromaticitiesPrediction", 19 | ] 20 | 21 | 22 | class TestPlotCorrespondingChromaticitiesPrediction: 23 | """ 24 | Define :func:`colour.plotting.corresponding.\ 25 | plot_corresponding_chromaticities_prediction` definition unit tests methods. 26 | """ 27 | 28 | def test_plot_corresponding_chromaticities_prediction(self) -> None: 29 | """ 30 | Test :func:`colour.plotting.corresponding.\ 31 | plot_corresponding_chromaticities_prediction` definition. 32 | """ 33 | 34 | figure, axes = plot_corresponding_chromaticities_prediction() 35 | 36 | assert isinstance(figure, Figure) 37 | assert isinstance(axes, Axes) 38 | -------------------------------------------------------------------------------- /colour/plotting/tests/test_graph.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.plotting.graph` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | import tempfile 6 | 7 | from colour.plotting import plot_automatic_colour_conversion_graph 8 | from colour.utilities import is_networkx_installed, is_pydot_installed 9 | 10 | __author__ = "Colour Developers" 11 | __copyright__ = "Copyright 2013 Colour Developers" 12 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 13 | __maintainer__ = "Colour Developers" 14 | __email__ = "colour-developers@colour-science.org" 15 | __status__ = "Production" 16 | 17 | __all__ = [ 18 | "TestPlotAutomaticColourConversionGraph", 19 | ] 20 | 21 | 22 | class TestPlotAutomaticColourConversionGraph: 23 | """ 24 | Define :func:`colour.plotting.graph.\ 25 | plot_automatic_colour_conversion_graph` definition unit tests methods. 26 | """ 27 | 28 | def test_plot_automatic_colour_conversion_graph(self) -> None: 29 | """ 30 | Test :func:`colour.plotting.graph.\ 31 | plot_automatic_colour_conversion_graph` definition. 32 | """ 33 | 34 | if not is_pydot_installed() or not is_networkx_installed(): # pragma: no cover 35 | return 36 | 37 | plot_automatic_colour_conversion_graph( # pragma: no cover 38 | f"{tempfile.mkstemp()[-1]}.png" 39 | ) 40 | -------------------------------------------------------------------------------- /colour/plotting/tests/test_notation.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.plotting.notation` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | from matplotlib.axes import Axes 6 | from matplotlib.figure import Figure 7 | 8 | from colour.plotting import ( 9 | plot_multi_munsell_value_functions, 10 | plot_single_munsell_value_function, 11 | ) 12 | 13 | __author__ = "Colour Developers" 14 | __copyright__ = "Copyright 2013 Colour Developers" 15 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 16 | __maintainer__ = "Colour Developers" 17 | __email__ = "colour-developers@colour-science.org" 18 | __status__ = "Production" 19 | 20 | __all__ = [ 21 | "TestPlotSingleMunsellValueFunction", 22 | "TestPlotMultiMunsellValueFunctions", 23 | ] 24 | 25 | 26 | class TestPlotSingleMunsellValueFunction: 27 | """ 28 | Define :func:`colour.plotting.notation.plot_single_munsell_value_function` 29 | definition unit tests methods. 30 | """ 31 | 32 | def test_plot_single_munsell_value_function(self) -> None: 33 | """ 34 | Test :func:`colour.plotting.notation.\ 35 | plot_single_munsell_value_function` definition. 36 | """ 37 | 38 | figure, axes = plot_single_munsell_value_function("ASTM D1535") 39 | 40 | assert isinstance(figure, Figure) 41 | assert isinstance(axes, Axes) 42 | 43 | 44 | class TestPlotMultiMunsellValueFunctions: 45 | """ 46 | Define :func:`colour.plotting.notation.plot_multi_munsell_value_functions` 47 | definition unit tests methods. 48 | """ 49 | 50 | def test_plot_multi_munsell_value_functions(self) -> None: 51 | """ 52 | Test :func:`colour.plotting.notation.\ 53 | plot_multi_munsell_value_functions` definition. 54 | """ 55 | 56 | figure, axes = plot_multi_munsell_value_functions(["ASTM D1535", "McCamy 1987"]) 57 | 58 | assert isinstance(figure, Figure) 59 | assert isinstance(axes, Axes) 60 | -------------------------------------------------------------------------------- /colour/plotting/tests/test_phenomena.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.plotting.phenomena` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | from matplotlib.axes import Axes 6 | from matplotlib.figure import Figure 7 | 8 | from colour.plotting import plot_single_sd_rayleigh_scattering, plot_the_blue_sky 9 | 10 | __author__ = "Colour Developers" 11 | __copyright__ = "Copyright 2013 Colour Developers" 12 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 13 | __maintainer__ = "Colour Developers" 14 | __email__ = "colour-developers@colour-science.org" 15 | __status__ = "Production" 16 | 17 | __all__ = [ 18 | "TestPlotSingleSdRayleighScattering", 19 | "TestPlotTheBlueSky", 20 | ] 21 | 22 | 23 | class TestPlotSingleSdRayleighScattering: 24 | """ 25 | Define :func:`colour.plotting.phenomena.\ 26 | plot_single_sd_rayleigh_scattering` definition unit tests methods. 27 | """ 28 | 29 | def test_plot_single_sd_rayleigh_scattering(self) -> None: 30 | """ 31 | Test :func:`colour.plotting.phenomena.\ 32 | plot_single_sd_rayleigh_scattering` definition. 33 | """ 34 | 35 | figure, axes = plot_single_sd_rayleigh_scattering() 36 | 37 | assert isinstance(figure, Figure) 38 | assert isinstance(axes, Axes) 39 | 40 | 41 | class TestPlotTheBlueSky: 42 | """ 43 | Define :func:`colour.plotting.phenomena.plot_the_blue_sky` definition unit 44 | tests methods. 45 | """ 46 | 47 | def test_plot_the_blue_sky(self) -> None: 48 | """Test :func:`colour.plotting.phenomena.plot_the_blue_sky` definition.""" 49 | 50 | figure, axes = plot_the_blue_sky() 51 | 52 | assert isinstance(figure, Figure) 53 | assert isinstance(axes, Axes) 54 | -------------------------------------------------------------------------------- /colour/plotting/tm3018/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .report import ( 4 | plot_single_sd_colour_rendition_report_full, 5 | plot_single_sd_colour_rendition_report_intermediate, 6 | plot_single_sd_colour_rendition_report_simple, 7 | ) 8 | from .report import plot_single_sd_colour_rendition_report 9 | 10 | __all__ = [ 11 | "plot_single_sd_colour_rendition_report_full", 12 | "plot_single_sd_colour_rendition_report_intermediate", 13 | "plot_single_sd_colour_rendition_report_simple", 14 | ] 15 | __all__ += [ 16 | "plot_single_sd_colour_rendition_report", 17 | ] 18 | -------------------------------------------------------------------------------- /colour/plotting/tm3018/resources/CVG_Background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/plotting/tm3018/resources/CVG_Background.jpg -------------------------------------------------------------------------------- /colour/plotting/tm3018/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/plotting/tm3018/tests/__init__.py -------------------------------------------------------------------------------- /colour/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/py.typed -------------------------------------------------------------------------------- /colour/quality/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | from .tcs import SDS_TCS 2 | from .vs import SDS_VS 3 | 4 | __all__ = [ 5 | "SDS_TCS", 6 | "SDS_TCS", 7 | "SDS_VS", 8 | ] 9 | -------------------------------------------------------------------------------- /colour/quality/datasets/tcs_cfi2017_1_nm.csv.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/quality/datasets/tcs_cfi2017_1_nm.csv.gz -------------------------------------------------------------------------------- /colour/quality/datasets/tcs_cfi2017_5_nm.csv.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/quality/datasets/tcs_cfi2017_5_nm.csv.gz -------------------------------------------------------------------------------- /colour/quality/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/quality/tests/__init__.py -------------------------------------------------------------------------------- /colour/recovery/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .dyer2017 import ( 4 | SPECTRAL_SHAPE_BASIS_FUNCTIONS_DYER2017, 5 | BASIS_FUNCTIONS_DYER2017, 6 | ) 7 | from .mallett2019 import ( 8 | SPECTRAL_SHAPE_sRGB_MALLETT2019, 9 | MSDS_BASIS_FUNCTIONS_sRGB_MALLETT2019, 10 | ) 11 | from .otsu2018 import ( 12 | SPECTRAL_SHAPE_OTSU2018, 13 | BASIS_FUNCTIONS_OTSU2018, 14 | CLUSTER_MEANS_OTSU2018, 15 | SELECTOR_ARRAY_OTSU2018, 16 | ) 17 | from .smits1999 import SDS_SMITS1999 18 | 19 | __all__ = [ 20 | "SPECTRAL_SHAPE_BASIS_FUNCTIONS_DYER2017", 21 | "BASIS_FUNCTIONS_DYER2017", 22 | ] 23 | __all__ += [ 24 | "SPECTRAL_SHAPE_sRGB_MALLETT2019", 25 | "MSDS_BASIS_FUNCTIONS_sRGB_MALLETT2019", 26 | ] 27 | __all__ += [ 28 | "SPECTRAL_SHAPE_OTSU2018", 29 | "BASIS_FUNCTIONS_OTSU2018", 30 | "CLUSTER_MEANS_OTSU2018", 31 | "SELECTOR_ARRAY_OTSU2018", 32 | ] 33 | __all__ += [ 34 | "SDS_SMITS1999", 35 | ] 36 | -------------------------------------------------------------------------------- /colour/recovery/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/recovery/tests/__init__.py -------------------------------------------------------------------------------- /colour/temperature/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/temperature/tests/__init__.py -------------------------------------------------------------------------------- /colour/utilities/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/utilities/tests/__init__.py -------------------------------------------------------------------------------- /colour/utilities/tests/test_deprecated.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests helper module for the deprecation management.""" 2 | 3 | from __future__ import annotations 4 | 5 | import contextlib 6 | import sys 7 | import typing 8 | 9 | if typing.TYPE_CHECKING: 10 | from colour.hints import Any 11 | 12 | from colour.utilities.deprecation import ModuleAPI, ObjectRemoved, ObjectRenamed 13 | 14 | 15 | class deprecated(ModuleAPI): 16 | """Define a class acting like the *deprecated* module.""" 17 | 18 | def __getattr__(self, attribute: str) -> Any: 19 | """Return the value from the attribute with specified name.""" 20 | 21 | return super().__getattr__(attribute) 22 | 23 | 24 | NAME: Any = None 25 | """An non-deprecated module attribute.""" 26 | 27 | NEW_NAME: Any = None 28 | """A module attribute with a new name.""" 29 | 30 | with contextlib.suppress(KeyError): 31 | sys.modules["colour.utilities.tests.test_deprecated"] = deprecated( # pyright: ignore 32 | sys.modules["colour.utilities.tests.test_deprecated"], 33 | { 34 | "OLD_NAME": ObjectRenamed( 35 | name="colour.utilities.tests.test_deprecated.OLD_NAME", 36 | new_name="colour.utilities.tests.test_deprecated.NEW_NAME", 37 | ), 38 | "REMOVED": ObjectRemoved( 39 | name="colour.utilities.tests.test_deprecated.REMOVED" 40 | ), 41 | }, 42 | ) 43 | 44 | del ModuleAPI 45 | del ObjectRenamed 46 | del ObjectRemoved 47 | del sys 48 | -------------------------------------------------------------------------------- /colour/utilities/tests/test_documentation.py: -------------------------------------------------------------------------------- 1 | """Define the unit tests for the :mod:`colour.utilities.documentation` module.""" 2 | 3 | from __future__ import annotations 4 | 5 | import os 6 | 7 | from colour.utilities.documentation import is_documentation_building 8 | 9 | __author__ = "Colour Developers" 10 | __copyright__ = "Copyright 2013 Colour Developers" 11 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 12 | __maintainer__ = "Colour Developers" 13 | __email__ = "colour-developers@colour-science.org" 14 | __status__ = "Production" 15 | 16 | __all__ = [ 17 | "TestIsDocumentationBuilding", 18 | ] 19 | 20 | 21 | class TestIsDocumentationBuilding: 22 | """ 23 | Define :func:`colour.utilities.documentation.is_documentation_building` 24 | definition unit tests methods. 25 | """ 26 | 27 | def test_is_documentation_building(self) -> None: 28 | """ 29 | Test :func:`colour.utilities.documentation.is_documentation_building` 30 | definition. 31 | """ 32 | 33 | try: 34 | assert not is_documentation_building() 35 | 36 | os.environ["READTHEDOCS"] = "True" 37 | assert is_documentation_building() 38 | 39 | os.environ["READTHEDOCS"] = "False" 40 | assert is_documentation_building() 41 | 42 | del os.environ["READTHEDOCS"] 43 | assert not is_documentation_building() 44 | 45 | os.environ["COLOUR_SCIENCE__DOCUMENTATION_BUILD"] = "True" 46 | assert is_documentation_building() 47 | 48 | os.environ["COLOUR_SCIENCE__DOCUMENTATION_BUILD"] = "False" 49 | assert is_documentation_building() 50 | 51 | del os.environ["COLOUR_SCIENCE__DOCUMENTATION_BUILD"] 52 | assert not is_documentation_building() 53 | 54 | finally: # pragma: no cover 55 | if os.environ.get("READTHEDOCS"): 56 | del os.environ["READTHEDOCS"] 57 | 58 | if os.environ.get("COLOUR_SCIENCE__DOCUMENTATION_BUILD"): 59 | del os.environ["COLOUR_SCIENCE__DOCUMENTATION_BUILD"] 60 | -------------------------------------------------------------------------------- /colour/volume/__init__.py: -------------------------------------------------------------------------------- 1 | # isort: skip_file 2 | 3 | from .datasets import * # noqa: F403 4 | from . import datasets 5 | from .macadam_limits import is_within_macadam_limits 6 | from .mesh import is_within_mesh_volume 7 | from .pointer_gamut import is_within_pointer_gamut 8 | from .spectrum import ( 9 | generate_pulse_waves, 10 | XYZ_outer_surface, 11 | solid_RoschMacAdam, 12 | is_within_visible_spectrum, 13 | ) 14 | from .rgb import ( 15 | RGB_colourspace_limits, 16 | RGB_colourspace_volume_MonteCarlo, 17 | RGB_colourspace_volume_coverage_MonteCarlo, 18 | RGB_colourspace_pointer_gamut_coverage_MonteCarlo, 19 | RGB_colourspace_visible_spectrum_coverage_MonteCarlo, 20 | ) 21 | 22 | __all__ = [] 23 | __all__ += datasets.__all__ 24 | __all__ += [ 25 | "is_within_macadam_limits", 26 | ] 27 | __all__ += [ 28 | "is_within_mesh_volume", 29 | ] 30 | __all__ += [ 31 | "is_within_pointer_gamut", 32 | ] 33 | __all__ += [ 34 | "generate_pulse_waves", 35 | "XYZ_outer_surface", 36 | "solid_RoschMacAdam", 37 | "is_within_visible_spectrum", 38 | ] 39 | __all__ += [ 40 | "RGB_colourspace_limits", 41 | "RGB_colourspace_volume_MonteCarlo", 42 | "RGB_colourspace_volume_coverage_MonteCarlo", 43 | "RGB_colourspace_pointer_gamut_coverage_MonteCarlo", 44 | "RGB_colourspace_visible_spectrum_coverage_MonteCarlo", 45 | ] 46 | -------------------------------------------------------------------------------- /colour/volume/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | from .optimal_colour_stimuli import OPTIMAL_COLOUR_STIMULI_ILLUMINANTS 2 | 3 | __all__ = [ 4 | "OPTIMAL_COLOUR_STIMULI_ILLUMINANTS", 5 | ] 6 | -------------------------------------------------------------------------------- /colour/volume/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/colour/volume/tests/__init__.py -------------------------------------------------------------------------------- /docs/_static/Logo_Medium_001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/docs/_static/Logo_Medium_001.png -------------------------------------------------------------------------------- /docs/_static/Logo_Small_001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colour-science/colour/a17e2335c29e7b6f08080aa4c93cfa9b61f84757/docs/_static/Logo_Small_001.png -------------------------------------------------------------------------------- /docs/_templates/class.rst: -------------------------------------------------------------------------------- 1 | {{ fullname | escape | underline}} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. autoclass:: {{ objname }} 6 | :members: 7 | :special-members: 8 | :show-inheritance: 9 | -------------------------------------------------------------------------------- /docs/bibliography.bib: -------------------------------------------------------------------------------- 1 | ../BIBLIOGRAPHY.bib -------------------------------------------------------------------------------- /docs/bibliography.rst: -------------------------------------------------------------------------------- 1 | Bibliography 2 | ============ 3 | 4 | .. bibliography:: bibliography.bib 5 | :all: 6 | 7 | Indirect References 8 | ------------------- 9 | 10 | Some extra references used in the codebase but not directly part of the public api: 11 | 12 | - :cite:`Centore2014k` 13 | - :cite:`Centore2014l` 14 | - :cite:`Centore2014m` 15 | - :cite:`Centore2014n` 16 | - :cite:`Centore2014o` 17 | - :cite:`Centore2014p` 18 | - :cite:`Centore2014q` 19 | - :cite:`Centore2014r` 20 | - :cite:`Centore2014s` 21 | - :cite:`Centore2014t` 22 | - :cite:`Centore2014u` 23 | - :cite:`CIETC1-382005h` 24 | - :cite:`DJI2017` 25 | - :cite:`FiLMiCInc2017` 26 | - :cite:`Hanbury2003` 27 | - :cite:`Houston2015a` 28 | - :cite:`Laurent2012a` 29 | - :cite:`MacAdam1935a` 30 | - :cite:`Macadam1942` 31 | - :cite:`Morovic2000` 32 | - :cite:`MunsellColorSciencec` 33 | - :cite:`Pointer1980a` 34 | - :cite:`RenewableResourceDataCenter2003a` 35 | - :cite:`Sharma2005b` 36 | - :cite:`Siragusano2018a` 37 | - :cite:`Susstrunk2000` 38 | - :cite:`TheAcademyofMotionPictureArtsandSciences2020` 39 | - :cite:`Ward2002` 40 | - :cite:`Ward2016` 41 | - :cite:`Wyszecki2000` 42 | - :cite:`Wyszecki2000bb` 43 | - :cite:`Wyszecki2000bh` 44 | - :cite:`Wyszecki2000x` 45 | -------------------------------------------------------------------------------- /docs/colour.biochemistry.rst: -------------------------------------------------------------------------------- 1 | Biochemistry 2 | ============ 3 | 4 | Michaelis–Menten Kinetics 5 | ------------------------- 6 | 7 | ``colour.biochemistry`` 8 | 9 | .. currentmodule:: colour.biochemistry 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | REACTION_RATE_MICHAELISMENTEN_METHODS 15 | reaction_rate_MichaelisMenten 16 | SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS 17 | substrate_concentration_MichaelisMenten 18 | reaction_rate_MichaelisMenten_Michaelis1913 19 | substrate_concentration_MichaelisMenten_Michaelis1913 20 | reaction_rate_MichaelisMenten_Abebe2017 21 | substrate_concentration_MichaelisMenten_Abebe2017 22 | -------------------------------------------------------------------------------- /docs/colour.blindness.rst: -------------------------------------------------------------------------------- 1 | Colour Vision Deficiency 2 | ======================== 3 | 4 | Machado, Oliveira and Fernandes (2009) 5 | -------------------------------------- 6 | 7 | ``colour`` 8 | 9 | .. currentmodule:: colour 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | msds_cmfs_anomalous_trichromacy_Machado2009 15 | matrix_anomalous_trichromacy_Machado2009 16 | matrix_cvd_Machado2009 17 | 18 | **Dataset** 19 | 20 | ``colour`` 21 | 22 | .. currentmodule:: colour 23 | 24 | .. autosummary:: 25 | :toctree: generated/ 26 | 27 | CVD_MATRICES_MACHADO2010 28 | -------------------------------------------------------------------------------- /docs/colour.constants.rst: -------------------------------------------------------------------------------- 1 | Constants 2 | ========= 3 | 4 | CIE 5 | --- 6 | 7 | ``colour.constants`` 8 | 9 | .. currentmodule:: colour.constants 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | CONSTANT_K_M 15 | CONSTANT_KP_M 16 | 17 | CODATA 18 | ------ 19 | 20 | ``colour.constants`` 21 | 22 | .. currentmodule:: colour.constants 23 | 24 | .. autosummary:: 25 | :toctree: generated/ 26 | 27 | CONSTANT_AVOGADRO 28 | CONSTANT_BOLTZMANN 29 | CONSTANT_LIGHT_SPEED 30 | CONSTANT_PLANCK 31 | 32 | Common 33 | ------ 34 | 35 | ``colour.constants`` 36 | 37 | .. currentmodule:: colour.constants 38 | 39 | .. autosummary:: 40 | :toctree: generated/ 41 | 42 | PATTERN_FLOATING_POINT_NUMBER 43 | THRESHOLD_INTEGER 44 | EPSILON 45 | DTYPE_INT_DEFAULT 46 | DTYPE_FLOAT_DEFAULT 47 | TOLERANCE_ABSOLUTE_DEFAULT 48 | TOLERANCE_RELATIVE_DEFAULT 49 | TOLERANCE_ABSOLUTE_TESTS 50 | TOLERANCE_RELATIVE_TESTS 51 | -------------------------------------------------------------------------------- /docs/colour.continuous.rst: -------------------------------------------------------------------------------- 1 | Continuous Signal 2 | ================= 3 | 4 | Continuous Signal 5 | ----------------- 6 | 7 | ``colour.continuous`` 8 | 9 | .. currentmodule:: colour.continuous 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | :template: class.rst 14 | 15 | AbstractContinuousFunction 16 | Signal 17 | MultiSignals 18 | -------------------------------------------------------------------------------- /docs/colour.contrast.rst: -------------------------------------------------------------------------------- 1 | Contrast Sensitivity 2 | ==================== 3 | 4 | Contrast Sensitivity 5 | -------------------- 6 | 7 | ``colour`` 8 | 9 | .. currentmodule:: colour 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | contrast_sensitivity_function 15 | CONTRAST_SENSITIVITY_METHODS 16 | 17 | Barten (1999) Contrast Sensitivity Function 18 | ------------------------------------------- 19 | 20 | ``colour.contrast`` 21 | 22 | .. currentmodule:: colour.contrast 23 | 24 | .. autosummary:: 25 | :toctree: generated/ 26 | 27 | contrast_sensitivity_function_Barten1999 28 | 29 | **Ancillary Objects** 30 | 31 | ``colour.contrast`` 32 | 33 | .. currentmodule:: colour.contrast 34 | 35 | .. autosummary:: 36 | :toctree: generated/ 37 | 38 | optical_MTF_Barten1999 39 | pupil_diameter_Barten1999 40 | sigma_Barten1999 41 | retinal_illuminance_Barten1999 42 | maximum_angular_size_Barten1999 43 | -------------------------------------------------------------------------------- /docs/colour.corresponding.rst: -------------------------------------------------------------------------------- 1 | Corresponding Chromaticities 2 | ============================ 3 | 4 | Prediction 5 | ---------- 6 | 7 | ``colour`` 8 | 9 | .. currentmodule:: colour 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | corresponding_chromaticities_prediction 15 | CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS 16 | CorrespondingColourDataset 17 | CorrespondingChromaticitiesPrediction 18 | 19 | **Dataset** 20 | 21 | ``colour`` 22 | 23 | .. autosummary:: 24 | :toctree: generated/ 25 | 26 | BRENEMAN_EXPERIMENTS 27 | BRENEMAN_EXPERIMENT_PRIMARIES_CHROMATICITIES 28 | 29 | Fairchild (1990) 30 | ~~~~~~~~~~~~~~~~ 31 | 32 | ``colour.corresponding`` 33 | 34 | .. currentmodule:: colour.corresponding 35 | 36 | .. autosummary:: 37 | :toctree: generated/ 38 | 39 | corresponding_chromaticities_prediction_Fairchild1990 40 | 41 | CIE 1994 42 | ~~~~~~~~ 43 | 44 | ``colour.corresponding`` 45 | 46 | .. currentmodule:: colour.corresponding 47 | 48 | .. autosummary:: 49 | :toctree: generated/ 50 | 51 | corresponding_chromaticities_prediction_CIE1994 52 | 53 | CMCCAT2000 54 | ~~~~~~~~~~ 55 | 56 | ``colour.corresponding`` 57 | 58 | .. currentmodule:: colour.corresponding 59 | 60 | .. autosummary:: 61 | :toctree: generated/ 62 | 63 | corresponding_chromaticities_prediction_CMCCAT2000 64 | 65 | Von Kries 66 | ~~~~~~~~~ 67 | 68 | ``colour.corresponding`` 69 | 70 | .. currentmodule:: colour.corresponding 71 | 72 | .. autosummary:: 73 | :toctree: generated/ 74 | 75 | corresponding_chromaticities_prediction_VonKries 76 | -------------------------------------------------------------------------------- /docs/colour.graph.rst: -------------------------------------------------------------------------------- 1 | Automatic Colour Conversion Graph 2 | ================================= 3 | 4 | Conversion 5 | ---------- 6 | 7 | ``colour`` 8 | 9 | .. currentmodule:: colour 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | convert 15 | describe_conversion_path 16 | -------------------------------------------------------------------------------- /docs/colour.hints.rst: -------------------------------------------------------------------------------- 1 | Annotation Type Hints 2 | ===================== 3 | 4 | ``colour.hints`` 5 | 6 | .. currentmodule:: colour.hints 7 | 8 | .. autosummary:: 9 | :toctree: generated/ 10 | 11 | ArrayLike 12 | NDArray 13 | ModuleType 14 | Any 15 | Callable 16 | ClassVar 17 | Dict 18 | Generator 19 | Iterable 20 | Iterator 21 | List 22 | Literal 23 | Mapping 24 | NoReturn 25 | NewType 26 | PathLike 27 | Protocol 28 | Sequence 29 | Set 30 | SupportsIndex 31 | TextIO 32 | Tuple 33 | Type 34 | TypeVar 35 | TypedDict 36 | cast 37 | overload 38 | runtime_checkable 39 | Self 40 | RegexFlag 41 | DTypeInt 42 | DTypeFloat 43 | DTypeReal 44 | DTypeComplex 45 | DTypeBoolean 46 | DType 47 | Real 48 | Dataclass 49 | NDArrayInt 50 | NDArrayFloat 51 | NDArrayReal 52 | NDArrayComplex 53 | NDArrayBoolean 54 | NDArrayStr 55 | ProtocolInterpolator 56 | ProtocolExtrapolator 57 | ProtocolLUTSequenceItem 58 | LiteralWarning 59 | LiteralChromaticAdaptationTransform 60 | LiteralColourspaceModel 61 | LiteralRGBColourspace 62 | LiteralLogEncoding 63 | LiteralLogDecoding 64 | LiteralOETF 65 | LiteralOETFInverse 66 | LiteralEOTF 67 | LiteralEOTFInverse 68 | LiteralCCTFEncoding 69 | LiteralCCTFDecoding 70 | LiteralOOTF 71 | LiteralOOTFInverse 72 | LiteralLUTReadMethod 73 | LiteralLUTWriteMethod 74 | LiteralDeltaEMethod 75 | LiteralFontScaling 76 | -------------------------------------------------------------------------------- /docs/colour.phenomena.rst: -------------------------------------------------------------------------------- 1 | Optical Phenomena 2 | ================= 3 | 4 | Rayleigh Scattering 5 | ------------------- 6 | 7 | ``colour`` 8 | 9 | .. currentmodule:: colour 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | rayleigh_scattering 15 | sd_rayleigh_scattering 16 | scattering_cross_section 17 | 18 | ``colour.phenomena`` 19 | 20 | .. currentmodule:: colour.phenomena 21 | 22 | .. autosummary:: 23 | :toctree: generated/ 24 | 25 | rayleigh_optical_depth 26 | -------------------------------------------------------------------------------- /docs/colour.quality.rst: -------------------------------------------------------------------------------- 1 | Colour Quality 2 | ============== 3 | 4 | Colour Fidelity Index 5 | --------------------- 6 | 7 | ``colour`` 8 | 9 | .. currentmodule:: colour 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | COLOUR_FIDELITY_INDEX_METHODS 15 | colour_fidelity_index 16 | 17 | ``colour.quality`` 18 | 19 | .. currentmodule:: colour.quality 20 | 21 | .. autosummary:: 22 | :toctree: generated/ 23 | 24 | ColourRendering_Specification_CIE2017 25 | colour_fidelity_index_CIE2017 26 | ColourQuality_Specification_ANSIIESTM3018 27 | colour_fidelity_index_ANSIIESTM3018 28 | 29 | Colour Rendering Index 30 | ---------------------- 31 | 32 | ``colour`` 33 | 34 | .. currentmodule:: colour 35 | 36 | .. autosummary:: 37 | :toctree: generated/ 38 | 39 | COLOUR_RENDERING_INDEX_METHODS 40 | colour_rendering_index 41 | 42 | ``colour.quality`` 43 | 44 | .. currentmodule:: colour.quality 45 | 46 | .. autosummary:: 47 | :toctree: generated/ 48 | 49 | ColourRendering_Specification_CRI 50 | 51 | Colour Quality Scale 52 | -------------------- 53 | 54 | ``colour`` 55 | 56 | .. currentmodule:: colour 57 | 58 | .. autosummary:: 59 | :toctree: generated/ 60 | 61 | COLOUR_QUALITY_SCALE_METHODS 62 | colour_quality_scale 63 | 64 | ``colour.quality`` 65 | 66 | .. currentmodule:: colour.quality 67 | 68 | .. autosummary:: 69 | :toctree: generated/ 70 | 71 | ColourRendering_Specification_CQS 72 | 73 | Academy Spectral Similarity Index (SSI) 74 | --------------------------------------- 75 | 76 | ``colour`` 77 | 78 | .. currentmodule:: colour 79 | 80 | .. autosummary:: 81 | :toctree: generated/ 82 | 83 | spectral_similarity_index 84 | -------------------------------------------------------------------------------- /docs/colour.rst: -------------------------------------------------------------------------------- 1 | Colour 2 | ====== 3 | 4 | .. toctree:: 5 | :maxdepth: 3 6 | 7 | colour.adaptation 8 | colour.algebra 9 | colour.appearance 10 | colour.biochemistry 11 | colour.blindness 12 | colour.characterisation 13 | colour.colorimetry 14 | colour.constants 15 | colour.contrast 16 | colour.continuous 17 | colour.corresponding 18 | colour.difference 19 | colour.geometry 20 | colour.graph 21 | colour.hints 22 | colour.io 23 | colour.models 24 | colour.notation 25 | colour.phenomena 26 | colour.plotting 27 | colour.quality 28 | colour.recovery 29 | colour.temperature 30 | colour.utilities 31 | colour.volume 32 | -------------------------------------------------------------------------------- /docs/colour.volume.rst: -------------------------------------------------------------------------------- 1 | Colour Volume 2 | ============= 3 | 4 | Optimal Colour Stimuli - MacAdam Limits 5 | --------------------------------------- 6 | 7 | ``colour`` 8 | 9 | .. currentmodule:: colour 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | 14 | is_within_macadam_limits 15 | OPTIMAL_COLOUR_STIMULI_ILLUMINANTS 16 | 17 | Mesh Volume 18 | ----------- 19 | 20 | ``colour`` 21 | 22 | .. currentmodule:: colour 23 | 24 | .. autosummary:: 25 | :toctree: generated/ 26 | 27 | is_within_mesh_volume 28 | 29 | Pointer's Gamut 30 | --------------- 31 | 32 | ``colour`` 33 | 34 | .. currentmodule:: colour 35 | 36 | .. autosummary:: 37 | :toctree: generated/ 38 | 39 | is_within_pointer_gamut 40 | 41 | RGB Volume 42 | ---------- 43 | 44 | ``colour`` 45 | 46 | .. currentmodule:: colour 47 | 48 | .. autosummary:: 49 | :toctree: generated/ 50 | 51 | RGB_colourspace_limits 52 | RGB_colourspace_pointer_gamut_coverage_MonteCarlo 53 | RGB_colourspace_visible_spectrum_coverage_MonteCarlo 54 | RGB_colourspace_volume_MonteCarlo 55 | RGB_colourspace_volume_coverage_MonteCarlo 56 | 57 | Rösch-MacAdam Colour solid - Visible Spectrum 58 | --------------------------------------------- 59 | 60 | ``colour`` 61 | 62 | .. currentmodule:: colour 63 | 64 | .. autosummary:: 65 | :toctree: generated/ 66 | 67 | is_within_visible_spectrum 68 | 69 | **Ancillary Objects** 70 | 71 | ``colour.volume`` 72 | 73 | .. currentmodule:: colour.volume 74 | 75 | .. autosummary:: 76 | :toctree: generated/ 77 | 78 | generate_pulse_waves 79 | XYZ_outer_surface 80 | solid_RoschMacAdam 81 | -------------------------------------------------------------------------------- /docs/how-to.rst: -------------------------------------------------------------------------------- 1 | How-To 2 | ====== 3 | 4 | The `Google Colab How-To `__ 5 | guide for **Colour** shows various techniques to solve specific problems 6 | and highlights some interesting use cases. 7 | -------------------------------------------------------------------------------- /docs/reference.rst: -------------------------------------------------------------------------------- 1 | API Reference 2 | ============= 3 | 4 | .. toctree:: 5 | :titlesonly: 6 | 7 | colour 8 | 9 | Indices and tables 10 | ------------------ 11 | 12 | * :ref:`genindex` 13 | * :ref:`search` 14 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # This file was autogenerated by uv via the following command: 2 | # uv export --no-hashes --all-extras --no-dev 3 | accessible-pygments==0.0.5 4 | alabaster==1.0.0 5 | babel==2.16.0 6 | beautifulsoup4==4.12.3 7 | biblib-simple==0.1.2 8 | certifi==2024.12.14 9 | charset-normalizer==3.4.0 10 | colorama==0.4.6 ; sys_platform == 'win32' 11 | contourpy==1.3.1 12 | cycler==0.12.1 13 | docutils==0.21.2 14 | fonttools==4.55.3 15 | idna==3.10 16 | imageio==2.36.1 17 | imagesize==1.4.1 18 | jinja2==3.1.4 19 | kiwisolver==1.4.7 20 | latexcodec==3.0.0 21 | markupsafe==3.0.2 22 | matplotlib==3.10.0 23 | networkx==3.4.2 24 | numpy==2.2.0 25 | opencolorio==2.4.1 26 | openimageio==3.0.4.0 27 | packaging==24.2 28 | pandas==2.2.3 29 | pillow==11.0.0 30 | pybtex==0.24.0 31 | pybtex-docutils==1.0.3 32 | pydata-sphinx-theme==0.16.1 33 | pydot==3.0.3 34 | pygments==2.18.0 35 | pyparsing==3.2.0 36 | python-dateutil==2.9.0.post0 37 | pytz==2024.2 38 | pyyaml==6.0.2 39 | requests==2.32.3 40 | restructuredtext-lint==1.4.0 41 | scipy==1.14.1 42 | setuptools==75.6.0 ; python_full_version >= '3.12' 43 | six==1.17.0 44 | snowballstemmer==2.2.0 45 | soupsieve==2.6 46 | sphinx==8.1.3 47 | sphinxcontrib-applehelp==2.0.0 48 | sphinxcontrib-bibtex==2.6.3 49 | sphinxcontrib-devhelp==2.0.0 50 | sphinxcontrib-htmlhelp==2.1.0 51 | sphinxcontrib-jsmath==1.0.1 52 | sphinxcontrib-qthelp==2.0.0 53 | sphinxcontrib-serializinghtml==2.0.0 54 | tomli==2.2.1 ; python_full_version < '3.11' 55 | tqdm==4.67.1 56 | trimesh==4.5.3 57 | typing-extensions==4.12.2 58 | tzdata==2024.2 59 | urllib3==2.2.3 60 | xxhash==3.5.0 61 | -------------------------------------------------------------------------------- /docs/user-guide.rst: -------------------------------------------------------------------------------- 1 | User Guide 2 | ========== 3 | 4 | The user guide provides an overview of **Colour** and explains important 5 | concepts and features, details can be found in the `API Reference `__. 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | Installation 11 | tutorial 12 | how-to 13 | basics 14 | advanced 15 | Contributing 16 | Changes 17 | bibliography 18 | -------------------------------------------------------------------------------- /utilities/mock_for_colour.py: -------------------------------------------------------------------------------- 1 | """ 2 | Mock for Colour 3 | =============== 4 | 5 | Define various mock objects to use with 6 | `Colour `__. 7 | """ 8 | 9 | from unittest.mock import MagicMock 10 | 11 | __author__ = "Sphinx Team, Colour Developers" 12 | __copyright__ = "Copyright 2007-2019 - Sphinx Team" 13 | __copyright__ += ", " 14 | __copyright__ += "Copyright 2013 Colour Developers" 15 | __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 16 | __maintainer__ = "Colour Developers" 17 | __email__ = "colour-developers@colour-science.org" 18 | __status__ = "Production" 19 | 20 | __all__ = [ 21 | "mock_scipy_for_colour", 22 | ] 23 | 24 | 25 | def mock_scipy_for_colour() -> None: 26 | """Mock *Scipy* for *Colour*.""" 27 | 28 | import sys 29 | 30 | for module in ( 31 | "scipy", 32 | "scipy.interpolate", 33 | "scipy.linalg", 34 | "scipy.ndimage", 35 | "scipy.optimize", 36 | "scipy.spatial", 37 | "scipy.spatial.distance", 38 | ): 39 | sys.modules[module] = MagicMock() 40 | 41 | 42 | if __name__ == "__main__": 43 | mock_scipy_for_colour() 44 | 45 | import colour 46 | 47 | xyY = (0.4316, 0.3777, 0.1008) 48 | print(colour.xyY_to_XYZ(xyY)) # noqa: T201 49 | --------------------------------------------------------------------------------