Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion colour/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

from __future__ import absolute_import

import numpy as np
import colour.ndarray as np
import sys

from .utilities.deprecation import ModuleAPI, build_API_changes
Expand Down
2 changes: 1 addition & 1 deletion colour/adaptation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def chromatic_adaptation(XYZ, XYZ_w, XYZ_wr, method='Von Kries', **kwargs):

*Von Kries* chromatic adaptation:

>>> import numpy as np
>>> import colour.ndarray as np
>>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
>>> XYZ_w = np.array([0.95045593, 1.00000000, 1.08905775])
>>> XYZ_wr = np.array([0.96429568, 1.00000000, 0.82510460])
Expand Down
2 changes: 1 addition & 1 deletion colour/adaptation/cie1994.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from __future__ import division, unicode_literals

import numpy as np
import colour.ndarray as np

from colour.algebra import spow
from colour.adaptation import CAT_VON_KRIES
Expand Down
2 changes: 1 addition & 1 deletion colour/adaptation/cmccat2000.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from __future__ import division, unicode_literals

import numpy as np
import colour.ndarray as np
from collections import namedtuple

from colour.adaptation import CAT_CMCCAT2000
Expand Down
2 changes: 1 addition & 1 deletion colour/adaptation/datasets/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

from __future__ import division, unicode_literals

import numpy as np
import colour.ndarray as np

from colour.utilities import CaseInsensitiveMapping

Expand Down
2 changes: 1 addition & 1 deletion colour/adaptation/fairchild1990.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from __future__ import division, unicode_literals

import numpy as np
import colour.ndarray as np

from colour.algebra import spow
from colour.adaptation import CAT_VON_KRIES
Expand Down
12 changes: 6 additions & 6 deletions colour/adaptation/tests/test__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import division, unicode_literals

import numpy as np
import colour.ndarray as np
import unittest
from six.moves import zip

Expand Down Expand Up @@ -37,14 +37,14 @@ def test_chromatic_adaptation(self):
XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
XYZ_w = np.array([0.95045593, 1.00000000, 1.08905775])
XYZ_wr = np.array([0.96429568, 1.00000000, 0.82510460])
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation(XYZ, XYZ_w, XYZ_wr),
np.array([0.21638819, 0.12570000, 0.03847494]),
decimal=7)

Y_o = 0.2
E_o = 1000
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation(
XYZ,
XYZ_w,
Expand All @@ -57,14 +57,14 @@ def test_chromatic_adaptation(self):
decimal=7)

L_A = 200
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation(
XYZ, XYZ_w, XYZ_wr, method='CMCCAT2000', L_A1=L_A, L_A2=L_A),
np.array([0.21498829, 0.12474711, 0.03910138]),
decimal=7)

Y_n = 200
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation(
XYZ, XYZ_w, XYZ_wr, method='Fairchild 1990', Y_n=Y_n),
np.array([0.21394049, 0.12262315, 0.03891917]),
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_domain_range_scale_chromatic_adaptation(self):
for method, value in zip(m, v):
for scale, factor in d_r:
with domain_range_scale(scale):
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation(
XYZ * factor,
XYZ_w * factor,
Expand Down
16 changes: 8 additions & 8 deletions colour/adaptation/tests/test_cie1994.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import division, unicode_literals

import numpy as np
import colour.ndarray as np
import unittest
from itertools import permutations

Expand Down Expand Up @@ -35,7 +35,7 @@ def test_chromatic_adaptation_CIE1994(self):
definition.
"""

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_CIE1994(
XYZ_1=np.array([28.00, 21.26, 5.27]),
xy_o1=np.array([0.44760, 0.40740]),
Expand All @@ -46,7 +46,7 @@ def test_chromatic_adaptation_CIE1994(self):
np.array([24.03379521, 21.15621214, 17.64301199]),
decimal=7)

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_CIE1994(
XYZ_1=np.array([21.77, 19.18, 16.73]),
xy_o1=np.array([0.31270, 0.32900]),
Expand All @@ -57,7 +57,7 @@ def test_chromatic_adaptation_CIE1994(self):
np.array([21.12891746, 19.42980532, 19.49577765]),
decimal=7)

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_CIE1994(
XYZ_1=np.array([0.07818780, 0.06157201, 0.28099326]) * 100,
xy_o1=np.array([0.31270, 0.32900]),
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_n_dimensional_chromatic_adaptation_CIE1994(self):

XYZ_1 = np.tile(XYZ_1, (6, 1))
XYZ_2 = np.tile(XYZ_2, (6, 1))
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_CIE1994(XYZ_1, xy_o1, xy_o2, Y_o, E_o1, E_o2),
XYZ_2,
decimal=7)
Expand All @@ -95,7 +95,7 @@ def test_n_dimensional_chromatic_adaptation_CIE1994(self):
Y_o = np.tile(Y_o, 6)
E_o1 = np.tile(E_o1, 6)
E_o2 = np.tile(E_o2, 6)
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_CIE1994(XYZ_1, xy_o1, xy_o2, Y_o, E_o1, E_o2),
XYZ_2,
decimal=7)
Expand All @@ -107,7 +107,7 @@ def test_n_dimensional_chromatic_adaptation_CIE1994(self):
E_o1 = np.reshape(E_o1, (2, 3))
E_o2 = np.reshape(E_o2, (2, 3))
XYZ_2 = np.reshape(XYZ_2, (2, 3, 3))
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_CIE1994(XYZ_1, xy_o1, xy_o2, Y_o, E_o1, E_o2),
XYZ_2,
decimal=7)
Expand All @@ -130,7 +130,7 @@ def test_domain_range_scale_chromatic_adaptation_CIE1994(self):
d_r = (('reference', 1), (1, 0.01), (100, 1))
for scale, factor in d_r:
with domain_range_scale(scale):
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_CIE1994(XYZ_1 * factor, xy_o1, xy_o2,
Y_o * factor, E_o1, E_o2),
XYZ_2 * factor,
Expand Down
30 changes: 15 additions & 15 deletions colour/adaptation/tests/test_cmccat2000.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import division, unicode_literals

import numpy as np
import colour.ndarray as np
import unittest
from itertools import permutations

Expand Down Expand Up @@ -41,15 +41,15 @@ def test_chromatic_adaptation_forward_CMCCAT2000(self):
chromatic_adaptation_forward_CMCCAT2000` definition.
"""

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_forward_CMCCAT2000(
np.array([22.48, 22.74, 8.54]),
np.array([111.15, 100.00, 35.20]),
np.array([94.81, 100.00, 107.30]), 200, 200),
np.array([19.52698326, 23.06833960, 24.97175229]),
decimal=7)

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_forward_CMCCAT2000(
np.array([0.14222010, 0.23042768, 0.10495772]) * 100,
np.array([0.95045593, 1.00000000, 1.08905775]) * 100,
Expand All @@ -58,7 +58,7 @@ def test_chromatic_adaptation_forward_CMCCAT2000(self):
np.array([17.90511171, 22.75299363, 3.79837384]),
decimal=7)

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_forward_CMCCAT2000(
np.array([0.07818780, 0.06157201, 0.28099326]) * 100,
np.array([0.95045593, 1.00000000, 1.08905775]) * 100,
Expand All @@ -84,7 +84,7 @@ def test_n_dimensional_chromatic_adaptation_forward_CMCCAT2000(self):

XYZ = np.tile(XYZ, (6, 1))
XYZ_c = np.tile(XYZ_c, (6, 1))
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_forward_CMCCAT2000(XYZ, XYZ_w, XYZ_wr, L_A1,
L_A2),
XYZ_c,
Expand All @@ -94,7 +94,7 @@ def test_n_dimensional_chromatic_adaptation_forward_CMCCAT2000(self):
XYZ_wr = np.tile(XYZ_wr, (6, 1))
L_A1 = np.tile(L_A1, 6)
L_A2 = np.tile(L_A2, 6)
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_forward_CMCCAT2000(XYZ, XYZ_w, XYZ_wr, L_A1,
L_A2),
XYZ_c,
Expand All @@ -106,7 +106,7 @@ def test_n_dimensional_chromatic_adaptation_forward_CMCCAT2000(self):
L_A1 = np.reshape(L_A1, (2, 3))
L_A2 = np.reshape(L_A2, (2, 3))
XYZ_c = np.reshape(XYZ_c, (2, 3, 3))
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_forward_CMCCAT2000(XYZ, XYZ_w, XYZ_wr, L_A1,
L_A2),
XYZ_c,
Expand All @@ -130,7 +130,7 @@ def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self):
d_r = (('reference', 1), (1, 0.01), (100, 1))
for scale, factor in d_r:
with domain_range_scale(scale):
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_forward_CMCCAT2000(
XYZ * factor, XYZ_w * factor, XYZ_wr * factor, L_A1,
L_A2),
Expand Down Expand Up @@ -168,15 +168,15 @@ def test_chromatic_adaptation_inverse_CMCCAT2000(self):
chromatic_adaptation_inverse_CMCCAT2000` definition.
"""

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_inverse_CMCCAT2000(
np.array([19.52698326, 23.06833960, 24.97175229]),
np.array([111.15, 100.00, 35.20]),
np.array([94.81, 100.00, 107.30]), 200, 200),
np.array([22.48, 22.74, 8.54]),
decimal=7)

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_inverse_CMCCAT2000(
np.array([17.90511171, 22.75299363, 3.79837384]),
np.array([0.95045593, 1.00000000, 1.08905775]) * 100,
Expand All @@ -185,7 +185,7 @@ def test_chromatic_adaptation_inverse_CMCCAT2000(self):
np.array([0.14222010, 0.23042768, 0.10495772]) * 100,
decimal=7)

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_inverse_CMCCAT2000(
np.array([6.76564344, 5.86585763, 18.40577315]),
np.array([0.95045593, 1.00000000, 1.08905775]) * 100,
Expand All @@ -211,7 +211,7 @@ def test_n_dimensional_chromatic_adaptation_inverse_CMCCAT2000(self):

XYZ_c = np.tile(XYZ_c, (6, 1))
XYZ = np.tile(XYZ, (6, 1))
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1,
L_A2),
XYZ,
Expand All @@ -221,7 +221,7 @@ def test_n_dimensional_chromatic_adaptation_inverse_CMCCAT2000(self):
XYZ_wr = np.tile(XYZ_wr, (6, 1))
L_A1 = np.tile(L_A1, 6)
L_A2 = np.tile(L_A2, 6)
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1,
L_A2),
XYZ,
Expand All @@ -233,7 +233,7 @@ def test_n_dimensional_chromatic_adaptation_inverse_CMCCAT2000(self):
L_A1 = np.reshape(L_A1, (2, 3))
L_A2 = np.reshape(L_A2, (2, 3))
XYZ = np.reshape(XYZ, (2, 3, 3))
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1,
L_A2),
XYZ,
Expand All @@ -257,7 +257,7 @@ def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self):
d_r = (('reference', 1), (1, 0.01), (100, 1))
for scale, factor in d_r:
with domain_range_scale(scale):
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_inverse_CMCCAT2000(
XYZ_c * factor, XYZ_w * factor, XYZ_wr * factor, L_A1,
L_A2),
Expand Down
16 changes: 8 additions & 8 deletions colour/adaptation/tests/test_fairchild1990.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import division, unicode_literals

import numpy as np
import colour.ndarray as np
import unittest
from itertools import permutations

Expand Down Expand Up @@ -35,23 +35,23 @@ def test_chromatic_adaptation_Fairchild1990(self):
chromatic_adaptation_Fairchild1990` definition.
"""

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_Fairchild1990(
np.array([19.53, 23.07, 24.97]),
np.array([111.15, 100.00, 35.20]),
np.array([94.81, 100.00, 107.30]), 200),
np.array([23.32526349, 23.32455819, 76.11593750]),
decimal=7)

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_Fairchild1990(
np.array([0.14222010, 0.23042768, 0.10495772]) * 100,
np.array([0.95045593, 1.00000000, 1.08905775]) * 100,
np.array([1.09846607, 1.00000000, 0.35582280]) * 100, 200),
np.array([19.28089326, 22.91583715, 3.42923503]),
decimal=7)

np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_Fairchild1990(
np.array([0.07818780, 0.06157201, 0.28099326]) * 100,
np.array([0.95045593, 1.00000000, 1.08905775]) * 100,
Expand All @@ -73,15 +73,15 @@ def test_n_dimensional_chromatic_adaptation_Fairchild1990(self):

XYZ_1 = np.tile(XYZ_1, (6, 1))
XYZ_c = np.tile(XYZ_c, (6, 1))
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_n, XYZ_r, Y_n),
XYZ_c,
decimal=7)

XYZ_n = np.tile(XYZ_n, (6, 1))
XYZ_r = np.tile(XYZ_r, (6, 1))
Y_n = np.tile(Y_n, 6)
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_n, XYZ_r, Y_n),
XYZ_c,
decimal=7)
Expand All @@ -91,7 +91,7 @@ def test_n_dimensional_chromatic_adaptation_Fairchild1990(self):
XYZ_r = np.reshape(XYZ_r, (2, 3, 3))
Y_n = np.reshape(Y_n, (2, 3))
XYZ_c = np.reshape(XYZ_c, (2, 3, 3))
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_n, XYZ_r, Y_n),
XYZ_c,
decimal=7)
Expand All @@ -111,7 +111,7 @@ def test_domain_range_scale_chromatic_adaptation_Fairchild1990(self):
d_r = (('reference', 1), (1, 0.01), (100, 1))
for scale, factor in d_r:
with domain_range_scale(scale):
np.testing.assert_almost_equal(
np.testing.assert_array_almost_equal(
chromatic_adaptation_Fairchild1990(
XYZ_1 * factor, XYZ_n * factor, XYZ_r * factor, Y_n),
XYZ_c * factor,
Expand Down
Loading