Skip to content

Commit ffa6f01

Browse files
Jackchou00KelSolaar
authored andcommitted
Fix an incorrect formula for Q in the sCAM model.
Replace the exponent with recommended 0.1 instead of 0.46 and update test cases. Closes #1360
1 parent 7744d66 commit ffa6f01

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

colour/appearance/scam.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def XYZ_to_sCAM(
264264
>>> surround = VIEWING_CONDITIONS_sCAM["Average"]
265265
>>> XYZ_to_sCAM(XYZ, XYZ_w, L_A, Y_b, surround) # doctest: +ELLIPSIS
266266
CAM_Specification_sCAM(J=49.9795668..., C=0.0140531..., h=328.2724924..., \
267-
Q=206.4275827..., M=0.0050244..., H=363.6013437..., HC=None, V=49.9795727..., \
267+
Q=195.23024234..., M=0.0050244..., H=363.6013437..., HC=None, V=49.9795727..., \
268268
K=50.0204272..., W=34.9734327..., D=65.0265672...)
269269
"""
270270

@@ -302,7 +302,10 @@ def XYZ_to_sCAM(
302302

303303
with sdiv_mode():
304304
M = (C * spow(F_L, 0.1) * sdiv(1, spow(I_a, 0.27)) * e_t) * surround.F
305-
Q = sdiv(2, surround.c) * I_a * spow(F_L, 0.46)
305+
# The original paper contained two inconsistent formulas for calculating Q:
306+
# Equation (15) on page 6 uses an exponent of 0.1, while page 10 uses 0.46.
307+
# After confirmation with the author, 0.1 is the recommended value.
308+
Q = sdiv(2, surround.c) * I_a * spow(F_L, 0.1)
306309

307310
H = hue_quadrature(h)
308311

colour/appearance/tests/test_scam.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_XYZ_to_sCAM(self) -> None:
5656
49.97956680,
5757
0.01405311,
5858
328.27249244,
59-
206.42758274,
59+
195.23024234,
6060
0.00502448,
6161
363.60134377,
6262
np.nan,
@@ -78,7 +78,7 @@ def test_XYZ_to_sCAM(self) -> None:
7878
71.63079886,
7979
37.33838127,
8080
18.75135858,
81-
207.84501305,
81+
259.13174065,
8282
10.66713872,
8383
4.20415978,
8484
np.nan,
@@ -101,7 +101,7 @@ def test_XYZ_to_sCAM(self) -> None:
101101
29.61821869,
102102
25.97461207,
103103
178.56952253,
104-
122.33033780,
104+
115.69472052,
105105
10.76901611,
106106
227.46922207,
107107
np.nan,

0 commit comments

Comments
 (0)