Beispiel #1
0
    M = S1 + np.dot(S2, T)
    M = np.array([M[2, :] / 2, -M[1, :], M[0, :] / 2])

    _w, v = np.linalg.eig(M)

    A1 = v[:, np.nonzero(4 * v[0, :] * v[2, :] - v[1, :]**2 > 0)[0]]
    A2 = np.dot(T, A1)

    A = np.ravel([A1, A2])

    return A


ELLIPSE_FITTING_METHODS = CaseInsensitiveMapping(
    {'Halir 1998': ellipse_fitting_Halir1998})
ELLIPSE_FITTING_METHODS.__doc__ = """
Supported ellipse fitting methods.

References
----------
:cite:`Halir1998`

ELLIPSE_FITTING_METHODS : CaseInsensitiveMapping
    **{'Halir 1998'}**
"""


def ellipse_fitting(a, method='Halir 1998'):
    """
    Returns the coefficients of the implicit second-order polynomial/quadratic
    curve that fits given point array :math:`a` using
__all__ += ['DatasetLoader_Luo1999', 'build_Luo1999']
__all__ += ['DatasetLoader_XRite2016', 'build_XRite2016']

DATASET_LOADERS = CaseInsensitiveMapping({
    DatasetLoader_Asano2015.ID: build_Asano2015,
    DatasetLoader_Brendel2020.ID: build_Brendel2020,
    DatasetLoader_Dyer2017.ID: build_Dyer2017,
    DatasetLoader_Ebner1998.ID: build_Ebner1998,
    DatasetLoader_Hung1995.ID: build_Hung1995,
    DatasetLoader_Jakob2019.ID: build_Jakob2019,
    DatasetLoader_Jiang2013.ID: build_Jiang2013,
    DatasetLoader_Labsphere2019.ID: build_Labsphere2019,
    DatasetLoader_Luo1999.ID: build_Luo1999,
    DatasetLoader_XRite2016.ID: build_XRite2016,
})
DATASET_LOADERS.__doc__ = """
Dataset loaders ids and callables.

DATASET_LOADERS : CaseInsensitiveMapping
"""

from .kuopio import DATASET_LOADERS_KUOPIO_UNIVERSITY  # noqa

DATASET_LOADERS.update(DATASET_LOADERS_KUOPIO_UNIVERSITY)

from . import kuopio  # noqa

_module = sys.modules['colour_datasets.loaders']

for _export in kuopio.__all__:
    if _export.startswith('DatasetLoader_') or _export.startswith('build_'):
    COLORCHECKER24_AFTER_NOV2014_ILLUMINANT)
"""
Reference *ColourChecker* data from *X-Rite (2015)* and matching the
*ColourChecker* edition after November 2014.

COLORCHECKER24_AFTER_NOV2014 : ColourChecker
"""

COLOURCHECKERS = CaseInsensitiveMapping({
    'ColorChecker 1976': COLORCHECKER_1976,
    'ColorChecker 2005': COLORCHECKER_2005,
    'BabelColor Average': BABELCOLOR_AVERAGE,
    'ColorChecker24 - Before November 2014': COLORCHECKER24_BEFORE_NOV2014,
    'ColorChecker24 - After November 2014': COLORCHECKER24_AFTER_NOV2014,
})
COLOURCHECKERS.__doc__ = """
Aggregated *ColourCheckers* chromaticity coordinates.

References
----------
:cite:`BabelColor2012b`, :cite:`BabelColor2012c`, :cite:`X-Rite2015`

COLOURCHECKERS : CaseInsensitiveMapping
    **{'ColorChecker 1976', 'ColorChecker 2005', 'BabelColor Average',
    'ColorChecker24 - Before November 2014',
    'ColorChecker24 - After November 2014'}**

Aliases:

-   'babel_average': 'BabelColor Average'
-   'cc2005': 'ColorChecker 2005'
Beispiel #4
0
# -*- coding: utf-8 -*-
"""
References
----------
-   :cite:`Darrodi2015a` : Darrodi, M. M., Finlayson, G., Goodman, T., &
    Mackiewicz, M. (2015). Reference data set for camera spectral sensitivity
    estimation. Journal of the Optical Society of America A, 32(3), 381.
    doi:10.1364/JOSAA.32.000381
"""

from __future__ import absolute_import

from .dslr import DSLR_CAMERAS_RGB_SPECTRAL_SENSITIVITIES
from colour.utilities import CaseInsensitiveMapping

CAMERAS_RGB_SPECTRAL_SENSITIVITIES = CaseInsensitiveMapping(
    DSLR_CAMERAS_RGB_SPECTRAL_SENSITIVITIES)
CAMERAS_RGB_SPECTRAL_SENSITIVITIES.__doc__ = """
Cameras *RGB* spectral sensitivities.

References
----------
:cite:`Darrodi2015a`

CAMERAS_RGB_SPECTRAL_SENSITIVITIES : CaseInsensitiveMapping
    **{Nikon 5100 (NPL), Sigma SDMerill (NPL)}**
"""

__all__ = ['CAMERAS_RGB_SPECTRAL_SENSITIVITIES']
Beispiel #5
0
    N_c : numeric or array_like
        Chromatic induction factor :math:`N_c`.

    References
    ----------
    :cite:`Fairchild2004c`, :cite:`Luo2013`, :cite:`Moroneya`,
    :cite:`Wikipedia2007a`
    """


CIECAM02_VIEWING_CONDITIONS = CaseInsensitiveMapping({
    'Average': CIECAM02_InductionFactors(1, 0.69, 1),
    'Dim': CIECAM02_InductionFactors(0.9, 0.59, 0.9),
    'Dark': CIECAM02_InductionFactors(0.8, 0.525, 0.8)
})
CIECAM02_VIEWING_CONDITIONS.__doc__ = """
Reference *CIECAM02* colour appearance model viewing conditions.

References
----------
:cite:`Fairchild2004c`, :cite:`Luo2013`, :cite:`Moroneya`,
:cite:`Wikipedia2007a`

CIECAM02_VIEWING_CONDITIONS : CaseInsensitiveMapping
    **{'Average', 'Dim', 'Dark'}**
"""

HUE_DATA_FOR_HUE_QUADRATURE = {
    'h_i': np.array([20.14, 90.00, 164.25, 237.53, 380.14]),
    'e_i': np.array([0.8, 0.7, 1.0, 1.2, 0.8]),
    'H_i': np.array([0.0, 100.0, 200.0, 300.0, 400.0])
Beispiel #6
0
    [1.9569, -1.1882, 0.2313],
    [0.3612, 0.6388, 0.0000],
    [0.0000, 0.0000, 1.0000],
])
"""
*RLAB* colour appearance model precomputed helper matrix.

MATRIX_R : array_like, (3, 3)
"""

VIEWING_CONDITIONS_RLAB = CaseInsensitiveMapping({
    'Average': 1 / 2.3,
    'Dim': 1 / 2.9,
    'Dark': 1 / 3.5
})
VIEWING_CONDITIONS_RLAB.__doc__ = """
Reference *RLAB* colour appearance model viewing conditions.

References
----------
:cite:`Fairchild1996a`, :cite:`Fairchild2013w`

VIEWING_CONDITIONS_RLAB : CaseInsensitiveMapping
    **{'Average', 'Dim', 'Dark'}**
"""

D_FACTOR_RLAB = CaseInsensitiveMapping({
    'Hard Copy Images':
    1,
    'Soft Copy Images':
    0,
Beispiel #7
0
-----
-   This chromatic adaptation transform has no negative lobes.
"""

CHROMATIC_ADAPTATION_TRANSFORMS = CaseInsensitiveMapping({
    'XYZ Scaling': XYZ_SCALING_CAT,
    'Von Kries': VON_KRIES_CAT,
    'Bradford': BRADFORD_CAT,
    'Sharp': SHARP_CAT,
    'Fairchild': FAIRCHILD_CAT,
    'CMCCAT97': CMCCAT97_CAT,
    'CMCCAT2000': CMCCAT2000_CAT,
    'CAT02': CAT02_CAT,
    'CAT02_BRILL_CAT': CAT02_BRILL_CAT,
    'Bianco': BS_CAT,
    'Bianco PC': BS_PC_CAT
})
CHROMATIC_ADAPTATION_TRANSFORMS.__doc__ = """
Supported chromatic adaptation transforms.

References
----------
:cite:`Bianco2010a`, :cite:`Brill2008a`, :cite:`Fairchildb`, :cite:`Li2007e`,
:cite:`Lindbloom2009g`, :cite:`Westland2012g`, :cite:`Westland2012k`,
:cite:`Wikipedia2007`

CHROMATIC_ADAPTATION_TRANSFORMS : CaseInsensitiveMapping
    **{'CAT02', 'XYZ Scaling', 'Von Kries', 'Bradford', 'Sharp', 'Fairchild,
    'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', 'Bianco PC'}**
"""
Beispiel #8
0
__all__ += ['chromatic_adaptation_Fairchild1990']
__all__ += [
    'CMCCAT2000_InductionFactors', 'CMCCAT2000_VIEWING_CONDITIONS',
    'chromatic_adaptation_forward_CMCCAT2000',
    'chromatic_adaptation_reverse_CMCCAT2000',
    'chromatic_adaptation_CMCCAT2000'
]
__all__ += ['chromatic_adaptation_CIE1994']

CHROMATIC_ADAPTATION_METHODS = CaseInsensitiveMapping({
    'CIE 1994': chromatic_adaptation_CIE1994,
    'CMCCAT2000': chromatic_adaptation_CMCCAT2000,
    'Fairchild 1990': chromatic_adaptation_Fairchild1990,
    'Von Kries': chromatic_adaptation_VonKries,
})
CHROMATIC_ADAPTATION_METHODS.__doc__ = """
Supported chromatic adaptation methods.

References
----------
:cite:`CIETC1-321994b`, :cite:`Fairchild1991a`, :cite:`Fairchild2013s`,
:cite:`Fairchild2013t`, :cite:`Li2002a`, :cite:`Westland2012k`

CHROMATIC_ADAPTATION_METHODS : CaseInsensitiveMapping
    **{'CIE 1994', 'CMCCAT2000', 'Fairchild 1990', 'Von Kries'}**
"""


def chromatic_adaptation(XYZ, XYZ_w, XYZ_wr, method='Von Kries', **kwargs):
    """
    Adapts given stimulus from test viewing conditions to reference viewing
Beispiel #9
0
        SpectralDistribution(
            SMITS_1999_SDS_DATA['yellow'],
            name='yellow'),
    'red':
        SpectralDistribution(
            SMITS_1999_SDS_DATA['red'],
            name='red'),
    'green':
        SpectralDistribution(
            SMITS_1999_SDS_DATA['green'],
            name='green'),
    'blue':
        SpectralDistribution(
            SMITS_1999_SDS_DATA['blue'],
            name='blue')
})  # yapf: disable
SMITS_1999_SDS.__doc__ = """
*Smits (1999)* spectral distributions.

References
----------
:cite:`Smits1999a`

SMITS_1999_SDS : CaseInsensitiveMapping
"""

# Using linear interpolation to preserve the shape of the basis spectral
# distributions once combined and interpolated.
for _sd in SMITS_1999_SDS.values():
    _sd.interpolator = LinearInterpolator
Beispiel #10
0
from colour.utilities import CaseInsensitiveMapping, filter_kwargs
from .barten1999 import (optical_MTF_Barten1999, pupil_diameter_Barten1999,
                         sigma_Barten1999, retinal_illuminance_Barten1999,
                         maximum_angular_size_Barten1999,
                         contrast_sensitivity_function_Barten1999)

__all__ = [
    'optical_MTF_Barten1999', 'pupil_diameter_Barten1999', 'sigma_Barten1999',
    'retinal_illuminance_Barten1999', 'maximum_angular_size_Barten1999',
    'contrast_sensitivity_function_Barten1999'
]

CONTRAST_SENSITIVITY_METHODS = CaseInsensitiveMapping({
    'Barten 1999': contrast_sensitivity_function_Barten1999,
})
CONTRAST_SENSITIVITY_METHODS.__doc__ = """
Supported contrast sensitivity methods.

References
----------
:cite:`Barten1999`, :cite:`Barten2003`, :cite:`Cowan2004`,
:cite:`InternationalTelecommunicationUnion2015`,

CONTRAST_SENSITIVITY_METHODS : CaseInsensitiveMapping
    **{'Barten 1999'}**
"""


def contrast_sensitivity_function(method='Barten 1999', **kwargs):
    """
    Returns the contrast sensitivity :math:`S` of the human eye according to
Beispiel #11
0
    N_c : numeric or array_like
        Chromatic induction factor :math:`N_c`.

    References
    ----------
    :cite:`Fairchild2004c`, :cite:`Luo2013`, :cite:`Moroneya`,
    :cite:`Wikipedia2007a`
    """


CIECAM02_VIEWING_CONDITIONS = CaseInsensitiveMapping({
    'Average': CIECAM02_InductionFactors(1, 0.69, 1),
    'Dim': CIECAM02_InductionFactors(0.9, 0.59, 0.9),
    'Dark': CIECAM02_InductionFactors(0.8, 0.525, 0.8)
})
CIECAM02_VIEWING_CONDITIONS.__doc__ = """
Reference *CIECAM02* colour appearance model viewing conditions.

References
----------
:cite:`Fairchild2004c`, :cite:`Luo2013`, :cite:`Moroneya`,
:cite:`Wikipedia2007a`

CIECAM02_VIEWING_CONDITIONS : CaseInsensitiveMapping
    **{'Average', 'Dim', 'Dark'}**
"""

HUE_DATA_FOR_HUE_QUADRATURE = {
    'h_i': np.array([20.14, 90.00, 164.25, 237.53, 380.14]),
    'e_i': np.array([0.8, 0.7, 1.0, 1.2, 0.8]),
    'H_i': np.array([0.0, 100.0, 200.0, 300.0, 400.0])
Beispiel #12
0
    """


LLAB_VIEWING_CONDITIONS = CaseInsensitiveMapping({
    'Reference Samples & Images, Average Surround, Subtending > 4': (
        LLAB_InductionFactors(1, 3, 0, 1)),
    'Reference Samples & Images, Average Surround, Subtending < 4': (
        LLAB_InductionFactors(1, 3, 1, 1)),
    'Television & VDU Displays, Dim Surround': (LLAB_InductionFactors(
        0.7, 3.5, 1, 1)),
    'Cut Sheet Transparency, Dim Surround': (LLAB_InductionFactors(
        1, 5, 1, 1.1)),
    '35mm Projection Transparency, Dark Surround': (LLAB_InductionFactors(
        0.7, 4, 1, 1))
})
LLAB_VIEWING_CONDITIONS.__doc__ = """
Reference :math:`LLAB(l:c)` colour appearance model viewing conditions.

References
----------
:cite:`Fairchild2013x`, :cite:`Luo1996b`, :cite:`Luo1996c`

LLAB_VIEWING_CONDITIONS : CaseInsensitiveMapping
    **{'Reference Samples & Images, Average Surround, Subtending > 4',
    'Reference Samples & Images, Average Surround, Subtending < 4',
    'Television & VDU Displays, Dim Surround',
    'Cut Sheet Transparency, Dim Surround':,
    '35mm Projection Transparency, Dark Surround'}**

Aliases:
Beispiel #13
0
    values[0] = (1 + ALPHA_STEARNS) * values[0] - ALPHA_STEARNS * values[1]
    values[-1] = (1 + ALPHA_STEARNS) * values[-1] - ALPHA_STEARNS * values[-2]
    for i in range(1, len(values) - 1):
        values[i] = (-ALPHA_STEARNS * values[i - 1] +
                     (1 + 2 * ALPHA_STEARNS) * values[i] -
                     ALPHA_STEARNS * values[i + 1])

    sd.values = values

    return sd


BANDPASS_CORRECTION_METHODS = CaseInsensitiveMapping({
    'Stearns 1988': bandpass_correction_Stearns1988
})
BANDPASS_CORRECTION_METHODS.__doc__ = """
Supported spectral bandpass dependence correction methods.

BANDPASS_CORRECTION_METHODS : CaseInsensitiveMapping
    **{'Stearns 1988', }**
"""


def bandpass_correction(sd, method='Stearns 1988'):
    """
    Implements spectral bandpass dependence correction on given spectral
    distribution using given method.

    Parameters
    ----------
    sd : SpectralDistribution
Beispiel #14
0
    T = (1000 if '1931' in observer else 900) * (x_n - x) - 650 * (y_n - y)

    WT = tstack([W, T])

    return from_range_100(WT)


WHITENESS_METHODS = CaseInsensitiveMapping({
    'Berger 1959': whiteness_Berger1959,
    'Taube 1960': whiteness_Taube1960,
    'Stensby 1968': whiteness_Stensby1968,
    'ASTM E313': whiteness_ASTME313,
    'Ganz 1979': whiteness_Ganz1979,
    'CIE 2004': whiteness_CIE2004
})
WHITENESS_METHODS.__doc__ = """
Supported *whiteness* computation methods.

References
----------
:cite:`CIETC1-482004k`, :cite:`X-Rite2012a`

WHITENESS_METHODS : CaseInsensitiveMapping
    **{'CIE 2004', 'Berger 1959', 'Taube 1960', 'Stensby 1968', 'ASTM E313',
    'Ganz 1979', 'CIE 2004'}**

Aliases:

-   'cie2004': 'CIE 2004'
"""
WHITENESS_METHODS['cie2004'] = WHITENESS_METHODS['CIE 2004']
Beispiel #15
0
    T = np.asarray(CCT)

    u = ((0.860117757 + 1.54118254 * 10e-4 * T + 1.28641212 * 10e-7 * T ** 2) /
         (1 + 8.42420235 * 10e-4 * T + 7.08145163 * 10e-7 * T ** 2))
    v = ((0.317398726 + 4.22806245 * 10e-5 * T + 4.20481691 * 10e-8 * T ** 2) /
         (1 - 2.89741816 * 10e-5 * T + 1.61456053 * 10e-7 * T ** 2))

    return tstack((u, v))


UV_TO_CCT_METHODS = CaseInsensitiveMapping({
    'Ohno 2013': uv_to_CCT_Ohno2013,
    'Robertson 1968': uv_to_CCT_Robertson1968
})
UV_TO_CCT_METHODS.__doc__ = """
Supported *CIE UCS* colourspace *uv* chromaticity coordinates to correlated
colour temperature :math:`T_{cp}` computation methods.

References
----------
-   :cite:`AdobeSystems2013`
-   :cite:`AdobeSystems2013a`
-   :cite:`Ohno2014a`
-   :cite:`Wyszecki2000y`

UV_TO_CCT_METHODS : CaseInsensitiveMapping
    **{'Ohno 2013', 'Robertson 1968'}**

Aliases:
    'FL3.14': np.array([0.347255078638291, 0.366808242504180]),
    'FL3.15': np.array([0.314613997909246, 0.333377149377113]),
    'HP1': np.array([0.543334600247307, 0.405289298480431]),
    'HP2': np.array([0.482647330648721, 0.410815644179685]),
    'HP3': np.array([0.435560034503954, 0.398801084399711]),
    'HP4': np.array([0.385193641123543, 0.368275479241015]),
    'HP5': np.array([0.380316415606638, 0.366617114797851])
})

ILLUMINANTS = CaseInsensitiveMapping({
    'CIE 1931 2 Degree Standard Observer':
        ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER,
    'CIE 1964 10 Degree Standard Observer':
        ILLUMINANTS_CIE_1964_10_DEGREE_STANDARD_OBSERVER
})
ILLUMINANTS.__doc__ = """
Aggregated *CIE* illuminants chromaticity coordinates.

Notes
-----

*CIE Illuminant D Series D60* illuminant chromaticity coordinates were
computed as follows::

    CCT = 6000 * 1.4388 / 1.438
    xy = colour.temperature.CCT_to_xy_CIE_D(CCT)

    sd = colour.sd_CIE_illuminant_D_series(xy)
    sd.interpolator = colour.LinearInterpolator
    colour.XYZ_to_xy(
        colour.sd_to_XYZ(
Beispiel #17
0
        maximum_perception = 246

    L_hdr = reaction_rate_MichealisMenten(
        spow(Y, epsilon), maximum_perception, 2 ** epsilon) + 0.02

    return from_range_100(L_hdr)


LIGHTNESS_METHODS = CaseInsensitiveMapping({
    'Glasser 1958': lightness_Glasser1958,
    'Wyszecki 1963': lightness_Wyszecki1963,
    'CIE 1976': lightness_CIE1976,
    'Fairchild 2010': lightness_Fairchild2010,
    'Fairchild 2011': lightness_Fairchild2011
})
LIGHTNESS_METHODS.__doc__ = """
Supported *Lightness* computation methods.

References
----------
:cite:`CIETC1-482004m`, :cite:`Fairchild2010`, :cite:`Fairchild2011`,
:cite:`Glasser1958a`, :cite:`Wyszecki1963b`, :cite:`Wyszecki2000bd`

LIGHTNESS_METHODS : CaseInsensitiveMapping
    **{'Glasser 1958', 'Wyszecki 1963', 'CIE 1976', 'Fairchild 2010',
    'Fairchild 2011'}**

Aliases:

-   'Lstar1976': 'CIE 1976'
"""
Beispiel #18
0
                [1.193214, -0.109812, -0.083402],
                [-0.058496, 0.979410, 0.079086],
                [-0.002346, 0.403492, 0.598854],
            ]),
        0.8:
            np.array([
                [1.257728, -0.139648, -0.118081],
                [-0.078003, 0.975409, 0.102594],
                [-0.003316, 0.501214, 0.502102],
            ]),
        0.9:
            np.array([
                [1.278864, -0.125333, -0.153531],
                [-0.084748, 0.957674, 0.127074],
                [-0.000989, 0.601151, 0.399838],
            ]),
        1.0:
            np.array([
                [1.255528, -0.076749, -0.178779],
                [-0.078411, 0.930809, 0.147602],
                [0.004733, 0.691367, 0.303900],
            ])
    }
})
CVD_MATRICES_MACHADO2010.__doc__ = """
Machado (2010) Simulation matrices :math:`\\Phi_{CVD}`.

CVD_MATRICES_MACHADO2010 : CaseInsensitiveMapping
    {'Protanomaly', 'Deuteranomaly', 'Tritanomaly'}
"""
Beispiel #19
0
    return from_range_1(Y)


LUMINANCE_METHODS = CaseInsensitiveMapping({
    'Newhall 1943':
    luminance_Newhall1943,
    'ASTM D1535-08':
    luminance_ASTMD153508,
    'CIE 1976':
    luminance_CIE1976,
    'Fairchild 2010':
    luminance_Fairchild2010,
    'Fairchild 2011':
    luminance_Fairchild2011
})
LUMINANCE_METHODS.__doc__ = """
Supported *luminance* computations methods.

References
----------
:cite:`ASTMInternational2008a`, :cite:`Fairchild2010`, :cite:`Fairchild2011`,
:cite:`Lindbloom2003d`, :cite:`Newhall1943a`, :cite:`Wyszecki2000bd`

LUMINANCE_METHODS : CaseInsensitiveMapping
    **{'Newhall 1943', 'ASTM D1535-08', 'CIE 1976', 'Fairchild 2010'}**

Aliases:

-   'astm2008': 'ASTM D1535-08'
-   'cie1976': 'CIE 1976'
"""
Beispiel #20
0
})
"""
Extension to *LUT* format.

EXTENSION_TO_LUT_FORMAT_MAPPING : CaseInsensitiveMapping
    **{'.cube', '.spi1d'}**
"""

LUT_READ_METHODS = CaseInsensitiveMapping({
    'Cinespace': read_LUT_Cinespace,
    'Iridas Cube': read_LUT_IridasCube,
    'Resolve Cube': read_LUT_ResolveCube,
    'Sony SPI1D': read_LUT_SonySPI1D,
    'Sony SPI3D': read_LUT_SonySPI3D,
})
LUT_READ_METHODS.__doc__ = """
Supported *LUT* reading methods.

References
----------
:cite:`AdobeSystems2013b`, :cite:`Chamberlain2015`

LUT_READ_METHODS : CaseInsensitiveMapping
    **{'Cinespace', 'Iridas Cube', 'Resolve Cube', 'Sony SPI1D',
    'Sony SPI3D'}**
"""


def read_LUT(path, method=None, **kwargs):
    """
    Reads given *LUT* file using given method.
Beispiel #21
0
    [0.3148, 0.3195, 95],
    [0.3103, 0.3214, 95],
    [0.3006, 0.3259, 95],
    [0.2900, 0.3308, 95],
])
"""
*CIE Standard Illuminant D Series D65* *Optimal Colour Stimuli*.

D65_OPTIMAL_COLOUR_STIMULI : ndarray

References
----------
:cite:`Wyszecki2000bh`
"""

ILLUMINANTS_OPTIMAL_COLOUR_STIMULI = CaseInsensitiveMapping({
    'A': A_OPTIMAL_COLOUR_STIMULI,
    'C': C_OPTIMAL_COLOUR_STIMULI,
    'D65': D65_OPTIMAL_COLOUR_STIMULI
})
ILLUMINANTS_OPTIMAL_COLOUR_STIMULI.__doc__ = """
Illuminants *Optimal Colour Stimuli*.

References
----------
:cite:`Wikipedia2004a`

ILLUMINANTS_OPTIMAL_COLOUR_STIMULI : CaseInsensitiveMapping
    **{'A', 'C', 'D65'}**
"""
Beispiel #22
0
    T = as_float_array(CCT)

    u = ((0.860117757 + 1.54118254 * 10e-4 * T + 1.28641212 * 10e-7 * T ** 2) /
         (1 + 8.42420235 * 10e-4 * T + 7.08145163 * 10e-7 * T ** 2))
    v = ((0.317398726 + 4.22806245 * 10e-5 * T + 4.20481691 * 10e-8 * T ** 2) /
         (1 - 2.89741816 * 10e-5 * T + 1.61456053 * 10e-7 * T ** 2))

    return tstack([u, v])


UV_TO_CCT_METHODS = CaseInsensitiveMapping({
    'Ohno 2013': uv_to_CCT_Ohno2013,
    'Robertson 1968': uv_to_CCT_Robertson1968
})
UV_TO_CCT_METHODS.__doc__ = """
Supported *CIE UCS* colourspace *uv* chromaticity coordinates to correlated
colour temperature :math:`T_{cp}` computation methods.

References
----------
:cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Ohno2014a`,
:cite:`Wyszecki2000y`

UV_TO_CCT_METHODS : CaseInsensitiveMapping
    **{'Ohno 2013', 'Robertson 1968'}**

Aliases:

-   'ohno2013': 'Ohno 2013'
-   'robertson1968': 'Robertson 1968'
Beispiel #23
0
    """

    wavelengths = shape.range()

    values = np.exp(-((wavelengths - peak_wavelength) / fwhm)**2)

    name = '{0}nm - {1} FWHM - Gaussian'.format(peak_wavelength, fwhm)

    return SpectralDistribution(values, wavelengths, name=name)


SD_GAUSSIAN_METHODS = CaseInsensitiveMapping({
    'Normal': sd_gaussian_normal,
    'FWHM': sd_gaussian_fwhm
})
SD_GAUSSIAN_METHODS.__doc__ = """
Supported gaussian spectral distribution computation methods.

SD_GAUSSIAN_METHODS : CaseInsensitiveMapping
    **{'Normal', 'FWHM'}**
"""


def sd_gaussian(mu_peak_wavelength,
                sigma_fwhm,
                shape=DEFAULT_SPECTRAL_SHAPE,
                method='Normal'):
    """
    Returns a gaussian spectral distribution of given spectral shape using
    given method.
Beispiel #24
0
    ----------
    F : numeric or array_like
        Maximum degree of adaptation :math:`F`.
    c : numeric or array_like
        Exponential non linearity :math:`c`.
    N_c : numeric or array_like
        Chromatic induction factor :math:`N_c`.

    References
    ----------
    :cite:`Li2017`
    """


CAM16_VIEWING_CONDITIONS = CaseInsensitiveMapping(CIECAM02_VIEWING_CONDITIONS)
CAM16_VIEWING_CONDITIONS.__doc__ = """
Reference *CAM16* colour appearance model viewing conditions.

References
----------
:cite:`Li2017`

CAM16_VIEWING_CONDITIONS : CaseInsensitiveMapping
    **{'Average', 'Dim', 'Dark'}**
"""


class CAM16_Specification(
        namedtuple('CAM16_Specification',
                   ('J', 'C', 'h', 's', 'Q', 'M', 'H', 'HC'))):
    """
Beispiel #25
0
    'chromatic_adaptation_reverse_CMCCAT2000',
    'chromatic_adaptation_CMCCAT2000'
]
__all__ += ['chromatic_adaptation_CIE1994']

CHROMATIC_ADAPTATION_METHODS = CaseInsensitiveMapping({
    'CIE 1994':
    chromatic_adaptation_CIE1994,
    'CMCCAT2000':
    chromatic_adaptation_CMCCAT2000,
    'Fairchild 1990':
    chromatic_adaptation_Fairchild1990,
    'Von Kries':
    chromatic_adaptation_VonKries,
})
CHROMATIC_ADAPTATION_METHODS.__doc__ = """
Supported chromatic adaptation methods.

References
----------
-   :cite:`CIETC1-321994b`
-   :cite:`Fairchild1991a`
-   :cite:`Fairchild2013s`
-   :cite:`Fairchild2013t`
-   :cite:`Li2002a`
-   :cite:`Westland2012k`

CHROMATIC_ADAPTATION_METHODS : CaseInsensitiveMapping
    **{'CIE 1994', 'CMCCAT2000', 'Fairchild 1990', 'Von Kries'}**
"""
Beispiel #26
0
    """

    a = as_float_array(a)

    a_e = np.transpose(np.vander(np.ravel(a), degree + 1))
    a_e = np.hstack(a_e.reshape(a_e.shape[0], -1, 3))

    return np.squeeze(a_e[:, 0:a_e.shape[-1] - a.shape[-1] + 1])


POLYNOMIAL_EXPANSION_METHODS = CaseInsensitiveMapping({
    'Cheung 2004': augmented_matrix_Cheung2004,
    'Finlayson 2015': polynomial_expansion_Finlayson2015,
    'Vandermonde': polynomial_expansion_Vandermonde,
})
POLYNOMIAL_EXPANSION_METHODS.__doc__ = """
Supported polynomial expansion methods.

References
----------
:cite:`Cheung2004`, :cite:`Finlayson2015`, :cite:`Westland2004`,
:cite:`Wikipedia2003e`

POLYNOMIAL_EXPANSION_METHODS : CaseInsensitiveMapping
    **{'Cheung 2004', 'Finlayson 2015', 'Vandermonde'}**
"""


def polynomial_expansion(a, method='Cheung 2004', **kwargs):
    """
    Performs polynomial expansion of given :math:`a` array.
Beispiel #27
0
__all__ += ['delta_E_DIN99']

DELTA_E_METHODS = CaseInsensitiveMapping({
    'CIE 1976': delta_E_CIE1976,
    'CIE 1994': delta_E_CIE1994,
    'CIE 2000': delta_E_CIE2000,
    'CMC': delta_E_CMC,
    'CAM02-LCD': delta_E_CAM02LCD,
    'CAM02-SCD': delta_E_CAM02SCD,
    'CAM02-UCS': delta_E_CAM02UCS,
    'CAM16-LCD': delta_E_CAM16LCD,
    'CAM16-SCD': delta_E_CAM16SCD,
    'CAM16-UCS': delta_E_CAM16UCS,
    'DIN99': delta_E_DIN99,
})
DELTA_E_METHODS.__doc__ = """
Supported :math:`\\Delta E_{ab}` computation methods.

References
----------
:cite:`ASTMInternational2007`, :cite:`Li2017`, :cite:`Lindbloom2003c`,
:cite:`Lindbloom2011a`, :cite:`Lindbloom2009e`, :cite:`Lindbloom2009f`,
:cite:`Luo2006b`, :cite:`Melgosa2013b`, :cite:`Wikipedia2008b`

DELTA_E_METHODS : CaseInsensitiveMapping
    **{'CIE 1976', 'CIE 1994', 'CIE 2000', 'CMC', 'CAM02-LCD', 'CAM02-SCD',
    'CAM02-UCS', 'CAM16-LCD', 'CAM16-SCD', 'CAM16-UCS', 'DIN99'}**

Aliases:

-   'cie1976': 'CIE 1976'
Beispiel #28
0
    [1.9569, -1.1882, 0.2313],
    [0.3612, 0.6388, 0.0000],
    [0.0000, 0.0000, 1.0000],
])
"""
*RLAB* colour appearance model precomputed helper matrix.

R_MATRIX : array_like, (3, 3)
"""

RLAB_VIEWING_CONDITIONS = CaseInsensitiveMapping({
    'Average': 1 / 2.3,
    'Dim': 1 / 2.9,
    'Dark': 1 / 3.5
})
RLAB_VIEWING_CONDITIONS.__doc__ = """
Reference *RLAB* colour appearance model viewing conditions.

References
----------
:cite:`Fairchild1996a`, :cite:`Fairchild2013w`

RLAB_VIEWING_CONDITIONS : CaseInsensitiveMapping
    **{'Average', 'Dim', 'Dark'}**
"""

RLAB_D_FACTOR = CaseInsensitiveMapping({
    'Hard Copy Images': 1,
    'Soft Copy Images': 0,
    'Projected Transparencies, Dark Room': 0.5
})
Beispiel #29
0
    ----------
    F : numeric or array_like
        Maximum degree of adaptation :math:`F`.
    c : numeric or array_like
        Exponential non linearity :math:`c`.
    N_c : numeric or array_like
        Chromatic induction factor :math:`N_c`.

    References
    ----------
    :cite:`Li2017`
    """


CAM16_VIEWING_CONDITIONS = CaseInsensitiveMapping(CIECAM02_VIEWING_CONDITIONS)
CAM16_VIEWING_CONDITIONS.__doc__ = """
Reference *CAM16* colour appearance model viewing conditions.

References
----------
:cite:`Li2017`

CAM16_VIEWING_CONDITIONS : CaseInsensitiveMapping
    **{'Average', 'Dim', 'Dark'}**
"""


class CAM16_Specification(
        namedtuple('CAM16_Specification',
                   ('J', 'C', 'h', 's', 'Q', 'M', 'H', 'HC'))):
    """
Beispiel #30
0
    Y = np.exp(
        np.log(
            substrate_concentration_MichealisMenten(
                L_hdr - 0.02, maximum_perception, 2 ** epsilon)) / epsilon)

    return from_range_1(Y)


LUMINANCE_METHODS = CaseInsensitiveMapping({
    'Newhall 1943': luminance_Newhall1943,
    'ASTM D1535-08': luminance_ASTMD153508,
    'CIE 1976': luminance_CIE1976,
    'Fairchild 2010': luminance_Fairchild2010,
    'Fairchild 2011': luminance_Fairchild2011
})
LUMINANCE_METHODS.__doc__ = """
Supported *luminance* computation methods.

References
----------
:cite:`ASTMInternational2008a`, :cite:`CIETC1-482004m`, :cite:`Fairchild2010`,
:cite:`Fairchild2011`, :cite:`Newhall1943a`, :cite:`Wyszecki2000bd`

LUMINANCE_METHODS : CaseInsensitiveMapping
    **{'Newhall 1943', 'ASTM D1535-08', 'CIE 1976', 'Fairchild 2010'}**

Aliases:

-   'astm2008': 'ASTM D1535-08'
-   'cie1976': 'CIE 1976'
"""
Beispiel #31
0
    np.array([0.482647330648721, 0.410815644179685]),
    'HP3':
    np.array([0.435560034503954, 0.398801084399711]),
    'HP4':
    np.array([0.385193641123543, 0.368275479241015]),
    'HP5':
    np.array([0.380316415606638, 0.366617114797851])
})

ILLUMINANTS = CaseInsensitiveMapping({
    'CIE 1931 2 Degree Standard Observer':
    ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER,
    'CIE 1964 10 Degree Standard Observer':
    ILLUMINANTS_CIE_1964_10_DEGREE_STANDARD_OBSERVER
})
ILLUMINANTS.__doc__ = """
Aggregated *CIE* illuminants chromaticity coordinates.

Notes
-----

*CIE Illuminant D Series D60* illuminant chromaticity coordinates were
computed as follows::

    CCT = 6000 * 1.4388 / 1.438
    xy = colour.temperature.CCT_to_xy_CIE_D(CCT)

    sd = colour.sd_CIE_illuminant_D_series(xy)
    sd.interpolator = colour.LinearInterpolator
    colour.XYZ_to_xy(
        colour.sd_to_XYZ(
Beispiel #32
0
    'Filmic Pro 6': log_encoding_FilmicPro6,
    'Log3G10': log_encoding_Log3G10,
    'Log3G12': log_encoding_Log3G12,
    'Panalog': log_encoding_Panalog,
    'PLog': log_encoding_PivotedLog,
    'Protune': log_encoding_Protune,
    'REDLog': log_encoding_REDLog,
    'REDLogFilm': log_encoding_REDLogFilm,
    'S-Log': log_encoding_SLog,
    'S-Log2': log_encoding_SLog2,
    'S-Log3': log_encoding_SLog3,
    'T-Log': log_encoding_FilmLightTLog,
    'V-Log': log_encoding_VLog,
    'ViperLog': log_encoding_ViperLog
})
LOG_ENCODING_CURVES.__doc__ = """
Supported *log* encoding curves.

LOG_ENCODING_CURVES : CaseInsensitiveMapping
    **{'ACEScc', 'ACEScct', 'ACESproxy', 'ALEXA Log C', 'Canon Log 2',
    'Canon Log 3', 'Canon Log', 'Cineon', 'D-Log', 'ERIMM RGB', 'Filmic Pro 6',
    'Log3G10', 'Log3G12', 'Panalog', 'PLog', 'Protune', 'REDLog', 'REDLogFilm',
    'S-Log', 'S-Log2', 'S-Log3', 'T-Log', 'V-Log', 'ViperLog'}**
"""


def log_encoding_curve(value, curve='Cineon', **kwargs):
    """
    Encodes linear-light values to :math:`R'G'B'` video component signal
    value using given *log* curve.
Beispiel #33
0
                     cls).__new__(cls, N_c, N_b, N_cb, N_bb)


HUNT_VIEWING_CONDITIONS = CaseInsensitiveMapping({
    'Small Areas, Uniform Background & Surrounds':
    Hunt_InductionFactors(1, 300),
    'Normal Scenes':
    Hunt_InductionFactors(1, 75),
    'Television & CRT, Dim Surrounds':
    Hunt_InductionFactors(1, 25),
    'Large Transparencies On Light Boxes':
    Hunt_InductionFactors(0.7, 25),
    'Projected Transparencies, Dark Surrounds':
    Hunt_InductionFactors(0.7, 10)
})
HUNT_VIEWING_CONDITIONS.__doc__ = """
Reference *Hunt* colour appearance model viewing conditions.

References
----------
:cite:`Fairchild2013u`, :cite:`Hunt2004b`

HUNT_VIEWING_CONDITIONS : CaseInsensitiveMapping
    **{'Small Areas, Uniform Background & Surrounds',
    'Normal Scenes',
    'Television & CRT, Dim Surrounds',
    'Large Transparencies On Light Boxes',
    'Projected Transparencies, Dark Surrounds'}**

Aliases:
Projectors and Xenon Arc Lamps. [3_]

LIGHT_SOURCES_PROJECTORS_CIE_1964_10_DEGREE_STANDARD_OBSERVER :
    CaseInsensitiveMapping
    **{'Kinoton 75P', }**
"""

LIGHT_SOURCES = CaseInsensitiveMapping({
    'CIE 1931 2 Degree Standard Observer':
        CaseInsensitiveMapping(
            LIGHT_SOURCES_RIT_CIE_1931_2_DEGREE_STANDARD_OBSERVER),
    'CIE 1964 10 Degree Standard Observer':
        CaseInsensitiveMapping(
            LIGHT_SOURCES_RIT_CIE_1964_10_DEGREE_STANDARD_OBSERVER)
})
LIGHT_SOURCES.__doc__ = """
Aggregated light sources chromaticity coordinates.

LIGHT_SOURCES : CaseInsensitiveMapping
    **{'CIE 1931 2 Degree Standard Observer',
    'CIE 1964 10 Degree Standard Observer'}**

Aliases:

-   'cie_2_1931': 'CIE 1931 2 Degree Standard Observer'
-   'cie_10_1964': 'CIE 1964 10 Degree Standard Observer'
"""
LIGHT_SOURCES['cie_2_1931'] = (
    LIGHT_SOURCES['CIE 1931 2 Degree Standard Observer'])
LIGHT_SOURCES['cie_10_1964'] = (
    LIGHT_SOURCES['CIE 1964 10 Degree Standard Observer'])
Beispiel #35
0
    T = (1000 if '1931' in observer else 900) * (x_n - x) - 650 * (y_n - y)

    WT = tstack([W, T])

    return from_range_100(WT)


WHITENESS_METHODS = CaseInsensitiveMapping({
    'Berger 1959': whiteness_Berger1959,
    'Taube 1960': whiteness_Taube1960,
    'Stensby 1968': whiteness_Stensby1968,
    'ASTM E313': whiteness_ASTME313,
    'Ganz 1979': whiteness_Ganz1979,
    'CIE 2004': whiteness_CIE2004
})
WHITENESS_METHODS.__doc__ = """
Supported *whiteness* computation methods.

References
----------
:cite:`CIETC1-482004k`, :cite:`X-Rite2012a`

WHITENESS_METHODS : CaseInsensitiveMapping
    **{'CIE 2004', 'Berger 1959', 'Taube 1960', 'Stensby 1968', 'ASTM E313',
    'Ganz 1979', 'CIE 2004'}**

Aliases:

-   'cie2004': 'CIE 2004'
"""
WHITENESS_METHODS['cie2004'] = WHITENESS_METHODS['CIE 2004']
Beispiel #36
0
References
----------
:cite:`HunterLab2008b`, :cite:`HunterLab2008c`

HUNTERLAB_ILLUMINANTS_CIE_1964_10_DEGREE_STANDARD_OBSERVER :
    CaseInsensitiveMapping
"""

HUNTERLAB_ILLUMINANTS = CaseInsensitiveMapping({
    'CIE 1931 2 Degree Standard Observer':
        HUNTERLAB_ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER,
    'CIE 1964 10 Degree Standard Observer':
        HUNTERLAB_ILLUMINANTS_CIE_1964_10_DEGREE_STANDARD_OBSERVER
})
HUNTERLAB_ILLUMINANTS.__doc__ = """
Aggregated *Hunter L,a,b* illuminant dataset.

References
----------
:cite:`HunterLab2008b`, :cite:`HunterLab2008c`

HUNTERLAB_ILLUMINANTS : CaseInsensitiveMapping
    **{'CIE 1931 2 Degree Standard Observer',
    'CIE 1964 10 Degree Standard Observer'}**

Aliases:

-   'cie_2_1931': 'CIE 1931 2 Degree Standard Observer'
-   'cie_10_1964': 'CIE 1964 10 Degree Standard Observer'
"""
Beispiel #37
0
    >>> yellowness_ASTME313(XYZ)  # doctest: +ELLIPSIS
    11.0650000...
    """

    _X, Y, Z = tsplit(to_domain_100(XYZ))

    WI = 100 * (1 - (0.847 * Z) / Y)

    return from_range_100(WI)


YELLOWNESS_METHODS = CaseInsensitiveMapping({
    'ASTM D1925': yellowness_ASTMD1925,
    'ASTM E313': yellowness_ASTME313
})
YELLOWNESS_METHODS.__doc__ = """
Supported *yellowness* computation methods.

References
----------
:cite:`X-Rite2012a`

YELLOWNESS_METHODS : CaseInsensitiveMapping
    **{'ASTM E313', 'ASTM D1925'}**
"""


def yellowness(XYZ, method='ASTM E313'):
    """
    Returns the *yellowness* :math:`W` using given method.
Beispiel #38
0
    a_e = np.transpose(np.vander(np.ravel(a), degree + 1))
    a_e = np.hstack(a_e.reshape(a_e.shape[0], -1, 3))

    return np.squeeze(a_e[:, 0:a_e.shape[-1] - a.shape[-1] + 1])


POLYNOMIAL_EXPANSION_METHODS = CaseInsensitiveMapping({
    'Cheung 2004':
    matrix_augmented_Cheung2004,
    'Finlayson 2015':
    polynomial_expansion_Finlayson2015,
    'Vandermonde':
    polynomial_expansion_Vandermonde,
})
POLYNOMIAL_EXPANSION_METHODS.__doc__ = """
Supported polynomial expansion methods.

References
----------
:cite:`Cheung2004`, :cite:`Finlayson2015`, :cite:`Westland2004`,
:cite:`Wikipedia2003e`

POLYNOMIAL_EXPANSION_METHODS : CaseInsensitiveMapping
    **{'Cheung 2004', 'Finlayson 2015', 'Vandermonde'}**
"""


def polynomial_expansion(a, method='Cheung 2004', **kwargs):
    """
    Performs polynomial expansion of given :math:`a` array.
Beispiel #39
0
})
"""
Extension to *LUT* format.

EXTENSION_TO_LUT_FORMAT_MAPPING : CaseInsensitiveMapping
    **{'.cube', '.spi1d'}**
"""

LUT_READ_METHODS = CaseInsensitiveMapping({
    'Cinespace': read_LUT_Cinespace,
    'Iridas Cube': read_LUT_IridasCube,
    'Resolve Cube': read_LUT_ResolveCube,
    'Sony SPI1D': read_LUT_SonySPI1D,
    'Sony SPI3D': read_LUT_SonySPI3D,
})
LUT_READ_METHODS.__doc__ = """
Supported *LUT* reading methods.

References
----------
:cite:`AdobeSystems2013b`, :cite:`Chamberlain2015`

LUT_READ_METHODS : CaseInsensitiveMapping
    **{'Cinespace', 'Iridas Cube', 'Resolve Cube', 'Sony SPI1D',
    'Sony SPI3D'}**
"""


def read_LUT(path, method=None, **kwargs):
    """
    Reads given *LUT* file using given method.
Beispiel #40
0
    """


VIEWING_CONDITIONS_LLAB = CaseInsensitiveMapping({
    'Reference Samples & Images, Average Surround, Subtending > 4':
    (InductionFactors_LLAB(1, 3, 0, 1)),
    'Reference Samples & Images, Average Surround, Subtending < 4':
    (InductionFactors_LLAB(1, 3, 1, 1)),
    'Television & VDU Displays, Dim Surround':
    (InductionFactors_LLAB(0.7, 3.5, 1, 1)),
    'Cut Sheet Transparency, Dim Surround':
    (InductionFactors_LLAB(1, 5, 1, 1.1)),
    '35mm Projection Transparency, Dark Surround':
    (InductionFactors_LLAB(0.7, 4, 1, 1))
})
VIEWING_CONDITIONS_LLAB.__doc__ = """
Reference :math:`LLAB(l:c)` colour appearance model viewing conditions.

References
----------
:cite:`Fairchild2013x`, :cite:`Luo1996b`, :cite:`Luo1996c`

VIEWING_CONDITIONS_LLAB : CaseInsensitiveMapping
    **{'Reference Samples & Images, Average Surround, Subtending > 4',
    'Reference Samples & Images, Average Surround, Subtending < 4',
    'Television & VDU Displays, Dim Surround',
    'Cut Sheet Transparency, Dim Surround':,
    '35mm Projection Transparency, Dark Surround'}**

Aliases:
COLORCHECKER24_AFTER_NOV2014 : ColourChecker
"""

COLOURCHECKERS = CaseInsensitiveMapping({
    'ColorChecker 1976':
    COLORCHECKER_1976,
    'ColorChecker 2005':
    COLORCHECKER_2005,
    'BabelColor Average':
    BABELCOLOR_AVERAGE,
    'ColorChecker24 - Before November 2014':
    COLORCHECKER24_BEFORE_NOV2014,
    'ColorChecker24 - After November 2014':
    COLORCHECKER24_AFTER_NOV2014,
})
COLOURCHECKERS.__doc__ = """
Aggregated *ColourCheckers* chromaticity coordinates.

References
----------
:cite:`BabelColor2012b`, :cite:`BabelColor2012c`, :cite:`X-Rite2015`

COLOURCHECKERS : CaseInsensitiveMapping
    **{'ColorChecker 1976', 'ColorChecker 2005', 'BabelColor Average',
    'ColorChecker24 - Before November 2014',
    'ColorChecker24 - After November 2014'}**

Aliases:

-   'babel_average': 'BabelColor Average'
-   'cc2005': 'ColorChecker 2005'
Beispiel #42
0
    0.3333336...
    """

    method = validate_method(method, LOG3G10_ENCODING_METHODS)

    return LOG3G10_ENCODING_METHODS[method](x)


LOG3G10_DECODING_METHODS = CaseInsensitiveMapping(
    {
        "v1": log_decoding_Log3G10_v1,
        "v2": log_decoding_Log3G10_v2,
        "v3": log_decoding_Log3G10_v3,
    }
)
LOG3G10_DECODING_METHODS.__doc__ = """
Supported *Log3G10* log decoding curve / electro-optical transfer function
methods.

References
----------
:cite:`Nattress2016a`, :cite:`REDDigitalCinema2017`
"""


def log_decoding_Log3G10(
    y, method: Union[Literal["v1", "v2", "v3"], str] = "v3"
) -> FloatingOrNDArray:
    """
    Define the *Log3G10* log decoding curve / electro-optical transfer
    function.
Beispiel #43
0
        uv_p = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_wr), xy_wr)

        return tuple([
            CorrespondingChromaticitiesPrediction(experiment_results.name,
                                                  uv_t[i], uv_m[i], uv_p[i])
            for i in range(len(uv_t))
        ])


CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS = CaseInsensitiveMapping({
    'CIE 1994': corresponding_chromaticities_prediction_CIE1994,
    'CMCCAT2000': corresponding_chromaticities_prediction_CMCCAT2000,
    'Fairchild 1990': corresponding_chromaticities_prediction_Fairchild1990,
    'Von Kries': corresponding_chromaticities_prediction_VonKries
})
CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS.__doc__ = """
Aggregated corresponding chromaticities prediction models.

References
----------
:cite:`Breneman1987b`, :cite:`CIETC1-321994b`, :cite:`Fairchild1991a`,
:cite:`Fairchild2013s`, :cite:`Fairchild2013t`, :cite:`Li2002a`,
:cite:`Westland2012k`

CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS : CaseInsensitiveMapping
    **{'CIE 1994', 'CMCCAT2000', 'Fairchild 1990', 'Von Kries'}**

Aliases:

-   'vonkries': 'Von Kries'
"""
Beispiel #44
0
    SMPTE_240M_COLOURSPACE.name:
    SMPTE_240M_COLOURSPACE,
    S_GAMUT_COLOURSPACE.name:
    S_GAMUT_COLOURSPACE,
    S_GAMUT3_COLOURSPACE.name:
    S_GAMUT3_COLOURSPACE,
    S_GAMUT3_CINE_COLOURSPACE.name:
    S_GAMUT3_CINE_COLOURSPACE,
    sRGB_COLOURSPACE.name:
    sRGB_COLOURSPACE,
    V_GAMUT_COLOURSPACE.name:
    V_GAMUT_COLOURSPACE,
    XTREME_RGB_COLOURSPACE.name:
    XTREME_RGB_COLOURSPACE
})
RGB_COLOURSPACES.__doc__ = """
Aggregated *RGB* colourspaces.

RGB_COLOURSPACES : CaseInsensitiveMapping

Aliases:

-   'aces': ACES_2065_1_COLOURSPACE.name
-   'adobe1998': ADOBE_RGB_1998_COLOURSPACE.name
-   'prophoto': PROPHOTO_RGB_COLOURSPACE.name
"""
# yapf: disable
RGB_COLOURSPACES['aces'] = (
    RGB_COLOURSPACES[ACES_2065_1_COLOURSPACE.name])
RGB_COLOURSPACES['adobe1998'] = (
    RGB_COLOURSPACES[ADOBE_RGB_1998_COLOURSPACE.name])
Projectors and Xenon Arc Lamps. [3_]

LIGHT_SOURCES_PROJECTORS_CIE_1964_10_DEGREE_STANDARD_OBSERVER :
    CaseInsensitiveMapping
    **{'Kinoton 75P', }**
"""

LIGHT_SOURCES = CaseInsensitiveMapping({
    'CIE 1931 2 Degree Standard Observer':
    CaseInsensitiveMapping(
        LIGHT_SOURCES_RIT_CIE_1931_2_DEGREE_STANDARD_OBSERVER),
    'CIE 1964 10 Degree Standard Observer':
    CaseInsensitiveMapping(
        LIGHT_SOURCES_RIT_CIE_1964_10_DEGREE_STANDARD_OBSERVER)
})
LIGHT_SOURCES.__doc__ = """
Aggregated light sources chromaticity coordinates.

LIGHT_SOURCES : CaseInsensitiveMapping
    **{'CIE 1931 2 Degree Standard Observer',
    'CIE 1964 10 Degree Standard Observer'}**

Aliases:

-   'cie_2_1931': 'CIE 1931 2 Degree Standard Observer'
-   'cie_10_1964': 'CIE 1964 10 Degree Standard Observer'
"""
LIGHT_SOURCES['cie_2_1931'] = (
    LIGHT_SOURCES['CIE 1931 2 Degree Standard Observer'])
LIGHT_SOURCES['cie_10_1964'] = (
    LIGHT_SOURCES['CIE 1964 10 Degree Standard Observer'])
Beispiel #46
0
    values[0] = (1 + ALPHA_STEARNS) * values[0] - ALPHA_STEARNS * values[1]
    values[-1] = (1 + ALPHA_STEARNS) * values[-1] - ALPHA_STEARNS * values[-2]
    for i in range(1, len(values) - 1):
        values[i] = (-ALPHA_STEARNS * values[i - 1] +
                     (1 + 2 * ALPHA_STEARNS) * values[i] -
                     ALPHA_STEARNS * values[i + 1])

    sd.values = values

    return sd


BANDPASS_CORRECTION_METHODS = CaseInsensitiveMapping({
    'Stearns 1988': bandpass_correction_Stearns1988
})
BANDPASS_CORRECTION_METHODS.__doc__ = """
Supported spectral bandpass dependence correction methods.

BANDPASS_CORRECTION_METHODS : CaseInsensitiveMapping
    **{'Stearns 1988', }**
"""


def bandpass_correction(sd, method='Stearns 1988'):
    """
    Implements spectral bandpass dependence correction on given spectral
    distribution using given method.

    Parameters
    ----------
    sd : SpectralDistribution
Beispiel #47
0
        (lambda x: parse_exif_array(x, np.float_,
                                    (3, 3)), '1 0 0 0 1 0 0 0 1'),
        'Reduction Matrix 2':
        (lambda x: parse_exif_array(x, np.float_,
                                    (3, 3)), '1 0 0 0 1 0 0 0 1'),
        'Forward Matrix 1': (lambda x: parse_exif_array(x, np.float_, (3, 3)),
                             '1 0 0 0 1 0 0 0 1'),
        'Forward Matrix 2': (lambda x: parse_exif_array(x, np.float_, (3, 3)),
                             '1 0 0 0 1 0 0 0 1'),
        'As Shot Neutral': (lambda x: parse_exif_array(x, np.float_), '1 1 1'),
        'Baseline Exposure': (lambda x: parse_exif_numeric(x, np.float_),
                              None),
        'Baseline Noise': (lambda x: parse_exif_numeric(x, np.float_), None)
    })
})
DNG_EXIF_TAGS_BINDING.__doc__ = """
Exif tags binding for a *dng* file.

DNG_EXIF_TAGS_BINDING : CaseInsensitiveMapping
"""


def convert_raw_files_to_dng_files(raw_files, output_directory):
    """
    Converts given raw files to *dng* files using given output directory.

    Parameters
    ----------
    raw_files : array_like
        Raw files to convert to *dng* files.
    output_directory : unicode
Beispiel #48
0
    [1.9569, -1.1882, 0.2313],
    [0.3612, 0.6388, 0.0000],
    [0.0000, 0.0000, 1.0000],
])
"""
*RLAB* colour appearance model precomputed helper matrix.

R_MATRIX : array_like, (3, 3)
"""

RLAB_VIEWING_CONDITIONS = CaseInsensitiveMapping({
    'Average': 1 / 2.3,
    'Dim': 1 / 2.9,
    'Dark': 1 / 3.5
})
RLAB_VIEWING_CONDITIONS.__doc__ = """
Reference *RLAB* colour appearance model viewing conditions.

References
----------
:cite:`Fairchild1996a`, :cite:`Fairchild2013w`

RLAB_VIEWING_CONDITIONS : CaseInsensitiveMapping
    **{'Average', 'Dim', 'Dark'}**
"""

RLAB_D_FACTOR = CaseInsensitiveMapping({
    'Hard Copy Images':
    1,
    'Soft Copy Images':
    0,
        805: 5.95,
        810: 5.50,
        815: 5.80,
        820: 6.10,
        825: 6.30,
        830: 6.50,
    }
}

SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES = CaseInsensitiveMapping({
    'S0':
    SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S0'],
                         name='S0'),
    'S1':
    SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S1'],
                         name='S1'),
    'S2':
    SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S2'],
                         name='S2')
})
SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES.__doc__ = """
*CIE Illuminant D Series* :math:`S_n(\\lambda)` spectral distributions.

References
----------
:cite:`Lindbloom2007a`, :cite:`Wyszecki2000z`

SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES : CaseInsensitiveMapping
   **{'S0', 'S1', 'S1'}**
"""
Beispiel #50
0
        maximum_perception = 246

    L_hdr = reaction_rate_MichealisMenten(
        spow(Y, epsilon), maximum_perception, 2 ** epsilon) + 0.02

    return from_range_100(L_hdr)


LIGHTNESS_METHODS = CaseInsensitiveMapping({
    'Glasser 1958': lightness_Glasser1958,
    'Wyszecki 1963': lightness_Wyszecki1963,
    'CIE 1976': lightness_CIE1976,
    'Fairchild 2010': lightness_Fairchild2010,
    'Fairchild 2011': lightness_Fairchild2011
})
LIGHTNESS_METHODS.__doc__ = """
Supported *Lightness* computations methods.

References
----------
:cite:`CIETC1-482004m`, :cite:`Fairchild2010`, :cite:`Fairchild2011`,
:cite:`Glasser1958a`, :cite:`Wyszecki1963b`, :cite:`Wyszecki2000bd`

LIGHTNESS_METHODS : CaseInsensitiveMapping
    **{'Glasser 1958', 'Wyszecki 1963', 'CIE 1976', 'Fairchild 2010',
    'Fairchild 2011'}**

Aliases:

-   'Lstar1976': 'CIE 1976'
"""
Beispiel #51
0
__all__ += [
    "ColourRendering_Specification_CQS",
    "COLOUR_QUALITY_SCALE_METHODS",
    "colour_quality_scale",
]
__all__ += [
    "spectral_similarity_index",
]

COLOUR_FIDELITY_INDEX_METHODS = CaseInsensitiveMapping({
    "CIE 2017":
    colour_fidelity_index_CIE2017,
    "ANSI/IES TM-30-18":
    colour_fidelity_index_ANSIIESTM3018,
})
COLOUR_FIDELITY_INDEX_METHODS.__doc__ = """
Supported *Colour Fidelity Index* (CFI) computation methods.

References
----------
:cite:`CIETC1-902017`, :cite:`ANSI2018`
"""


def colour_fidelity_index(
    sd_test: SpectralDistribution,
    additional_data=False,
    method: Union[Literal["CIE 2017", "ANSI/IES TM-30-18"], str] = "CIE 2017",
) -> Union[Floating, ColourRendering_Specification_CIE2017,
           ColourQuality_Specification_ANSIIESTM3018, ]:
    """
Beispiel #52
0
    ----------
    F : numeric or array_like
        :math:`F` surround condition.

    References
    ----------
    :cite:`Li2002a`, :cite:`Westland2012k`
    """


CMCCAT2000_VIEWING_CONDITIONS = CaseInsensitiveMapping({
    'Average': CMCCAT2000_InductionFactors(1),
    'Dim': CMCCAT2000_InductionFactors(0.8),
    'Dark': CMCCAT2000_InductionFactors(0.8)
})
CMCCAT2000_VIEWING_CONDITIONS.__doc__ = """
Reference *CMCCAT2000* chromatic adaptation model viewing conditions.

References
----------
:cite:`Li2002a`, :cite:`Westland2012k`

CMCCAT2000_VIEWING_CONDITIONS : CaseInsensitiveMapping
    ('Average', 'Dim', 'Dark')
"""


def chromatic_adaptation_forward_CMCCAT2000(
        XYZ,
        XYZ_w,
        XYZ_wr,
Beispiel #53
0
        SpectralDistribution(
            SMITS_1999_SDS_DATA['yellow'],
            name='yellow'),
    'red':
        SpectralDistribution(
            SMITS_1999_SDS_DATA['red'],
            name='red'),
    'green':
        SpectralDistribution(
            SMITS_1999_SDS_DATA['green'],
            name='green'),
    'blue':
        SpectralDistribution(
            SMITS_1999_SDS_DATA['blue'],
            name='blue')
})  # yapf: disable
SMITS_1999_SDS.__doc__ = """
*Smits (1999)* spectral distributions.

References
----------
:cite:`Smits1999a`

SMITS_1999_SDS : CaseInsensitiveMapping
"""

# Using linear interpolation to preserve the shape of the basis spectral
# distributions once combined and interpolated.
for _sd in SMITS_1999_SDS.values():
    _sd.interpolator = LinearInterpolator
Beispiel #54
0
-----
-   This chromatic adaptation transform has no negative lobes.
"""

CHROMATIC_ADAPTATION_TRANSFORMS = CaseInsensitiveMapping({
    'XYZ Scaling': XYZ_SCALING_CAT,
    'Von Kries': VON_KRIES_CAT,
    'Bradford': BRADFORD_CAT,
    'Sharp': SHARP_CAT,
    'Fairchild': FAIRCHILD_CAT,
    'CMCCAT97': CMCCAT97_CAT,
    'CMCCAT2000': CMCCAT2000_CAT,
    'CAT02': CAT02_CAT,
    'CAT02_BRILL_CAT': CAT02_BRILL_CAT,
    'Bianco': BS_CAT,
    'Bianco PC': BS_PC_CAT
})
CHROMATIC_ADAPTATION_TRANSFORMS.__doc__ = """
Supported chromatic adaptation transforms.

References
----------
:cite:`Bianco2010a`, :cite:`Brill2008a`, :cite:`Fairchildb`, :cite:`Li2007e`,
:cite:`Lindbloom2009g`, :cite:`Westland2012g`, :cite:`Westland2012k`,
:cite:`Wikipedia2007`

CHROMATIC_ADAPTATION_TRANSFORMS : CaseInsensitiveMapping
    **{'CAT02', 'XYZ Scaling', 'Von Kries', 'Bradford', 'Sharp', 'Fairchild,
    'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', 'Bianco PC'}**
"""