Skip to content

Commit

Permalink
Code formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Sep 3, 2014
1 parent 23bf4e3 commit d834b78
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
39 changes: 21 additions & 18 deletions colour/models/ipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,22 @@

"""
IPT Colourspace
===================
===============
Defines the *IPT* colourspace transformations:
- :func:`XYZ_to_IPT`
- :func:`IPT_to_XYZ`
and computation of correlates:
And computation of correlates:
- :func:`IPT_hue_angle`
References
----------
.. [1] **Mark D. Fairchild**, *Color Appearance Models, 3nd Edition*,
The Wiley-IS&T Series in Imaging Science and Technology,
published June 2013, ASIN: B00DAYO8E2, locations 5094-5556,
pages 271-272.
published June 2013, ASIN: B00DAYO8E2, locations 8492-8567
"""

from __future__ import division, unicode_literals
Expand All @@ -35,7 +32,11 @@
__email__ = 'colour-science@googlegroups.com'
__status__ = 'Production'

__all__ = ['XYZ_to_IPT',
__all__ = ['IPT_XYZ_TO_LMS_MATRIX',
'IPT_LMS_TO_XYZ_MATRIX',
'IPT_LMS_TO_IPT_MATRIX',
'IPT_IPT_TO_LMS_MATRIX',
'XYZ_to_IPT',
'IPT_to_XYZ',
'IPT_hue_angle']

Expand All @@ -57,8 +58,8 @@
Notes
-----
- This matrix has been rounded on purpose to 4 decimals so in order to keep available
precision consistent between transformations.
- This matrix has been rounded on purpose to 4 decimals so in order to keep
available precision consistent between transformations.
IPT_LMS_TO_XYZ_MATRIX : array_like, (3, 3)
"""
Expand All @@ -81,16 +82,16 @@
Notes
-----
- This matrix has been rounded on purpose to 4 decimals so in order to keep available
precision consistent between transformations.
- This matrix has been rounded on purpose to 4 decimals so in order to keep
available precision consistent between transformations.
IPT_IPT_TO_LMS_MATRIX : array_like, (3, 3)
"""


def XYZ_to_IPT(XYZ):
"""
Converts from *CIE XYZ* colourspace to *IPT* colourspace (see [1]_).
Converts from *CIE XYZ* colourspace to *IPT* colourspace. [1]_
Parameters
----------
Expand All @@ -104,7 +105,8 @@ def XYZ_to_IPT(XYZ):
Notes
-----
- Input *CIE XYZ* needs to be adapted for CIE illuminant D65.
- Input *CIE XYZ* colourspace matrix needs to be adapted for
*CIE Standard Illuminant D Series* *D65*.
Examples
--------
Expand All @@ -121,7 +123,7 @@ def XYZ_to_IPT(XYZ):

def IPT_to_XYZ(IPT):
"""
Converts from *IPT* colourspace to *CIE XYZ* colourspace (see [1]_).
Converts from *IPT* colourspace to *CIE XYZ* colourspace. [1]_
Parameters
----------
Expand All @@ -131,7 +133,7 @@ def IPT_to_XYZ(IPT):
Returns
-------
ndarray, (3,)
*XYZ* colourspace matrix.
*CIE XYZ* colourspace matrix.
Examples
--------
Expand All @@ -148,7 +150,7 @@ def IPT_to_XYZ(IPT):

def IPT_hue_angle(IPT):
"""
Computes the hue angle from *IPT* colourspace (see [1]_).
Computes the hue angle from *IPT* colourspace. [1]_
Parameters
----------
Expand All @@ -157,12 +159,13 @@ def IPT_hue_angle(IPT):
Returns
-------
numeric,
hue angle.
numeric
Hue angle.
Examples
--------
>>> IPT_hue_angle(([0.5, 0.5, 0.5])) # doctest: +ELLIPSIS
0.7853981...
"""

return np.arctan2(IPT[2], IPT[1])
6 changes: 3 additions & 3 deletions colour/models/tests/tests_ipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

__all__ = ['TestXYZ_to_IPT',
'TestIPT_to_XYZ',
'TestIPT_hue_angle']
'TestIPTHueAngle']


class TestXYZ_to_IPT(unittest.TestCase):
Expand Down Expand Up @@ -63,7 +63,7 @@ def test_IPT_to_XYZ(self):
decimal=7)


class TestIPT_hue_angle(unittest.TestCase):
class TestIPTHueAngle(unittest.TestCase):
"""
Defines :func:`colour.models.ipt.IPT_hue_angle` definition unit tests
methods.
Expand All @@ -77,4 +77,4 @@ def test_IPT_hue_angle(self):
np.testing.assert_almost_equal(
IPT_hue_angle(np.array([0.5, 0.5, 0.5])),
0.78539812,
decimal=7)
decimal=7)

0 comments on commit d834b78

Please sign in to comment.