Skip to content

Commit

Permalink
Fix issue with undersized SPDs
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdcs committed Apr 26, 2023
1 parent bdbb4ba commit 5bb3f6b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions colour/quality/cfi2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ def colour_fidelity_index_CIE2017(
70.1208254...
"""

if sd_test.shape.interval > 5:
raise ValueError(
"Test spectral distribution interval is greater than"
"5nm which is the maximum recommended value "
'for computing the "CIE 2017 Colour Fidelity Index"!'
)

shape = SpectralShape(
SPECTRAL_SHAPE_CIE2017.start,
SPECTRAL_SHAPE_CIE2017.end,
sd_test.shape.interval,
)

if sd_test.shape.start > 380 or sd_test.shape.end < 780:
usage_warning(
"Test spectral distribution shape does not span the "
Expand All @@ -183,19 +196,7 @@ def colour_fidelity_index_CIE2017(
"left": 0,
"right": 0,
}

if sd_test.shape.interval > 5:
raise ValueError(
"Test spectral distribution interval is greater than"
"5nm which is the maximum recommended value "
'for computing the "CIE 2017 Colour Fidelity Index"!'
)

shape = SpectralShape(
SPECTRAL_SHAPE_CIE2017.start,
SPECTRAL_SHAPE_CIE2017.end,
sd_test.shape.interval,
)
sd_test.align(shape=shape)

CCT, D_uv = tsplit(CCT_reference_illuminant(sd_test))
sd_reference = sd_reference_illuminant(CCT, shape)
Expand Down

0 comments on commit 5bb3f6b

Please sign in to comment.