Skip to content

Commit

Permalink
Update "colour.colorimetry.lightness" module references.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Sep 3, 2014
1 parent fc9b136 commit f3c42c3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
47 changes: 30 additions & 17 deletions colour/colorimetry/lightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- :func:`lightness_glasser1958`: *Lightness* :math:`L^*` computation of given
*luminance* :math:`Y` using *Glasser et al. (1958)* method.
- :func:`lightness_wyszecki1964`: *Lightness* :math:`W^*` computation of
- :func:`lightness_wyszecki1964`: *Lightness* :math:`W` computation of
given *luminance* :math:`Y` using *Wyszecki (1964)* method.
- :func:`lightness_1976`: *Lightness* :math:`L^*` computation of given
*luminance* :math:`Y` as per *CIE Lab* implementation.
Expand All @@ -20,6 +20,11 @@
--------
`Lightness IPython Notebook
<http://nbviewer.ipython.org/github/colour-science/colour-ipython/blob/master/notebooks/colorimetry/lightness.ipynb>`_ # noqa
References
----------
.. [1] http://en.wikipedia.org/wiki/Lightness
(Last accessed 13 April 2014)
"""

from __future__ import division, unicode_literals
Expand All @@ -43,7 +48,7 @@

def lightness_glasser1958(Y, **kwargs):
"""
Returns the *Lightness* :math:`L^*` of given *luminance* :math:`Y` using
Returns the *Lightness* :math:`L` of given *luminance* :math:`Y` using
*Glasser et al. (1958)* method.
Parameters
Expand All @@ -57,32 +62,33 @@ def lightness_glasser1958(Y, **kwargs):
Returns
-------
numeric
*Lightness* :math:`L^*`.
*Lightness* :math:`L`.
Notes
-----
- Input *luminance* :math:`Y` is in domain [0, 100].
- Output *Lightness* :math:`L^*` is in domain [0, 100].
- Output *Lightness* :math:`L` is in domain [0, 100].
References
----------
.. [1] http://en.wikipedia.org/wiki/Lightness
(Last accessed 13 April 2014)
.. [2] **Glasser et al.**, *Cube-Root Color Coordinate System*,
*JOSA, Vol. 48, Issue 10, pp. 736-740 (1958)*,
DOI: http://dx.doi.org/10.1364/JOSA.48.000736
Examples
--------
>>> lightness_glasser1958(10.08) # doctest: +ELLIPSIS
36.2505626...
"""

L_star = 25.29 * (Y ** (1 / 3)) - 18.38
L = 25.29 * (Y ** (1 / 3)) - 18.38

return L_star
return L


def lightness_wyszecki1964(Y, **kwargs):
"""
Returns the *Lightness* :math:`W^*` of given *luminance* :math:`Y` using
Returns the *Lightness* :math:`W` of given *luminance* :math:`Y` using
*Wyszecki (1964)* method.
Expand All @@ -97,17 +103,18 @@ def lightness_wyszecki1964(Y, **kwargs):
Returns
-------
numeric
*Lightness* :math:`W^*`.
*Lightness* :math:`W`.
Notes
-----
- Input *luminance* :math:`Y` is in domain [0, 100].
- Output *Lightness* :math:`W^*` is in domain [0, 100].
- Output *Lightness* :math:`W` is in domain [0, 100].
References
----------
.. [2] http://en.wikipedia.org/wiki/Lightness
(Last accessed 13 April 2014)
.. [3] **G. Wyszecki**, *Proposal for a New Color-Difference Formula*,
*JOSA, Vol. 53, Issue 11, pp. 1318-1319 (1963)*,
DOI: http://dx.doi.org/10.1364/JOSA.53.001318
Examples
--------
Expand Down Expand Up @@ -149,8 +156,14 @@ def lightness_1976(Y, Y_n=100):
References
----------
.. [3] http://www.poynton.com/PDFs/GammaFAQ.pdf
(Last accessed 12 April 2014)
.. [4] **Wyszecki & Stiles**,
*Color Science - Concepts and Methods Data and Formulae -
Second Edition*,
Wiley Classics Library Edition, published 2000,
ISBN-10: 0-471-39918-3,
page 167.
.. [5] http://brucelindbloom.com/index.html?LContinuity.html
(Last accessed 24 February 2014)
Examples
--------
Expand Down Expand Up @@ -210,9 +223,9 @@ def lightness(Y, method='CIE 1976', **kwargs):
--------
>>> lightness(10.08) # doctest: +ELLIPSIS
37.9856290...
>>> lightness(10.08, Yn=100) # doctest: +ELLIPSIS
>>> lightness(10.08, Y_n=100) # doctest: +ELLIPSIS
37.9856290...
>>> lightness(10.08, Yn=95) # doctest: +ELLIPSIS
>>> lightness(10.08, Y_n=95) # doctest: +ELLIPSIS
38.9165987...
>>> lightness(10.08, method='Glasser 1958') # doctest: +ELLIPSIS
36.2505626...
Expand Down
12 changes: 6 additions & 6 deletions colour/constants/cie.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
-----
- The original *CIE* value for :math:`\epsilon` is :math:`\epsilon=0.008856`,
**Bruce Lindbloom** has shown that this value is causing a discontinuity
a the junction point of the two functions grafted together to create the
at the junction point of the two functions grafted together to create the
*Lightness* :math:`L^*` function.
That discontinuity can be avoided by using the rational representation as
follows: :math:`\epsilon=216/24389`.
follows: :math:`\epsilon=216\ /\ 24389`.
References
----------
Expand All @@ -45,19 +45,19 @@

CIE_K = 24389 / 27
"""
*CIE* :math:`k` constant.
*CIE* :math:`\kappa` constant.
CIE_K : numeric
Notes
-----
- The original *CIE* value for :math:`k` is :math:`k=903.3`,
- The original *CIE* value for :math:`\kappa` is :math:`\kappa=903.3`,
**Bruce Lindbloom** has shown that this value is causing a discontinuity
a the junction point of the two functions grafted together to create the
at the junction point of the two functions grafted together to create the
*Lightness* :math:`L^*` function.
That discontinuity can be avoided by using the rational representation as
follows: :math:`k=24389/27`.
follows: :math:`k=24389\ /\ 27`.
References
----------
Expand Down

0 comments on commit f3c42c3

Please sign in to comment.