Skip to content

Commit 2511ae4

Browse files
committed
Update threshold approach and rename files to not use _jmh
1 parent b9749f2 commit 2511ae4

31 files changed

+951
-926
lines changed

coloraide/everything.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
from .spaces.acescg import ACEScg
2727
from .spaces.acescc import ACEScc
2828
from .spaces.acescct import ACEScct
29-
from .spaces.cam02_jmh import CAM02JMh
29+
from .spaces.cam02 import CAM02JMh
3030
from .spaces.cam02_ucs import CAM02UCS, CAM02LCD, CAM02SCD
31-
from .spaces.cam16_jmh import CAM16JMh
31+
from .spaces.cam16 import CAM16JMh
3232
from .spaces.cam16_ucs import CAM16UCS, CAM16LCD, CAM16SCD
33-
from .spaces.hellwig_jmh import HellwigJMh, HellwigHKJMh
34-
from .spaces.zcam_jmh import ZCAMJMh
33+
from .spaces.hellwig import HellwigJMh, HellwigHKJMh
34+
from .spaces.zcam import ZCAMJMh
3535
from .spaces.hct import HCT
3636
from .spaces.ucs import UCS
3737
from .spaces.rec709 import Rec709
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@
1010
import math
1111
from .. import util
1212
from .. import algebra as alg
13-
from ..spaces import Space, LChish
13+
from .lch import LCh
1414
from ..cat import WHITES, CAT02
1515
from ..channels import Channel, FLG_ANGLE
16-
from .lch import ACHROMATIC_THRESHOLD
1716
from ..types import Vector
18-
from .cam16_jmh import (
17+
from .cam16 import (
1918
M1,
2019
hue_quadrature,
2120
inv_hue_quadrature,
2221
eccentricity,
2322
adapt,
2423
unadapt
2524
)
26-
from .cam16_jmh import Environment as _Environment
25+
from .cam16 import Environment as _Environment
2726

2827
# CAT02
2928
M02 = CAT02.MATRIX
@@ -247,7 +246,7 @@ def cam_jmh_to_xyz(jmh: Vector, env: Environment) -> Vector:
247246
return cam_to_xyz(J=J, M=M, h=h, env=env)
248247

249248

250-
class CAM02JMh(LChish, Space):
249+
class CAM02JMh(LCh):
251250
"""CAM02 class (JMh)."""
252251

253252
BASE = "xyz-d65"
@@ -291,7 +290,7 @@ def is_achromatic(self, coords: Vector) -> bool | None:
291290
"""Check if color is achromatic."""
292291

293292
# Account for both positive and negative chroma
294-
return coords[0] == 0 or abs(coords[1]) < ACHROMATIC_THRESHOLD
293+
return coords[0] == 0 or abs(coords[1]) < self.achromatic_threshold
295294

296295
def to_base(self, coords: Vector) -> Vector:
297296
"""From CAM02 JMh to XYZ."""

coloraide/spaces/cam02_ucs.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
"""CAM02 UCS."""
22
from __future__ import annotations
3-
from .cam02_jmh import xyz_to_cam, cam_to_xyz, CAM02JMh
3+
from .cam02 import xyz_to_cam, cam_to_xyz, CAM02JMh
44
from .cam16_ucs import cam_jmh_to_cam_ucs, cam_ucs_to_cam_jmh
5-
from ..spaces import Space, Labish
6-
from .lch import ACHROMATIC_THRESHOLD
5+
from .lab import Lab
76
from ..cat import WHITES
87
from ..channels import Channel, FLG_MIRROR_PERCENT
98
from ..types import Vector
109

1110

12-
class CAM02UCS(Labish, Space):
11+
class CAM02UCS(Lab):
1312
"""CAM02 UCS (Jab) class."""
1413

1514
BASE = "cam02-jmh"
@@ -32,7 +31,7 @@ def is_achromatic(self, coords: Vector) -> bool:
3231
"""Check if color is achromatic."""
3332

3433
j, m = cam_ucs_to_cam_jmh(coords, self.MODEL)[:-1]
35-
return j == 0 or abs(m) < ACHROMATIC_THRESHOLD
34+
return j == 0 or abs(m) < self.achromatic_threshold
3635

3736
def to_base(self, coords: Vector) -> Vector:
3837
"""To base from UCS."""

0 commit comments

Comments
 (0)