Skip to content

Instantly share code, notes, and snippets.

@KelSolaar KelSolaar/for_JetBrains.py
Last active Aug 29, 2015

Embed
What would you like to do?
Stuff to discuss with JetBrains
# PyCharm will complain the the parameters are missing in docstrings with
# Numpy style docstrings.
def XYZ_to_CIECAM02(XYZ,
XYZw,
LA,
Yb,
surround=CIECAM02_VIEWING_CONDITIONS.get(
'Average'),
discount_illuminant=False):
"""
Converts given *CIE XYZ* colourspace matrix to *CIECAM02* specification.
This is the *forward* implementation.
Parameters
----------
XYZ : array_like
*CIE XYZ* colourspace stimulus matrix.
XYZw : array_like
*CIE XYZ* colourspace whitepoint matrix.
LA : float
Adapting field *luminance* :math:`L_A` in cd/m2.
Yb : float
Adapting field *Y* tristimulus value :math:`Y_b`.
surround : CIECAM02_Surround
Surround viewing conditions.
discount_illuminant : bool
Discount the illuminant.
Returns
-------
CIECAM02_Specification
*CIECAM02* specification.
Warning
-------
The input domain of that definition is non standard!
Notes
-----
- Input *CIE XYZ* colourspace matrix is in domain [0, 100].
- Input *CIE XYZw* colourspace matrix is in domain [0, 100].
Examples
--------
>>> XYZ = np.array([19.01, 20.00, 21.78])
>>> XYZw = np.array([95.05, 100.00, 108.88])
>>> LA = 318.31
>>> Yb = 20.0
>>> colour.XYZ_to_CIECAM02(XYZ, XYZw, LA, Yb)
CIECAM02_Specification(J=41.731091132513917, C=0.1047077571711053, h=-140.9515673417281, Q=195.37132596607671, M=0.1088421756692261, s=2.3603053739204447, H=278.06073585662813)
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.