Skip to content

Commit 8098fbc

Browse files
committed
Merge branch 'feature/v0.4.5' into develop
2 parents 5adf88b + 2f8a709 commit 8098fbc

File tree

12 files changed

+111
-112
lines changed

12 files changed

+111
-112
lines changed

.github/workflows/continuous-integration-documentation.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ jobs:
3030
sudo apt-get update
3131
sudo apt-get --yes install graphviz graphviz-dev latexmk texlive-full
3232
- name: Install Poetry
33-
env:
34-
POETRY_VERSION: 1.4.0
3533
run: |
3634
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
3735
echo "$HOME/.poetry/bin" >> $GITHUB_PATH

.github/workflows/continuous-integration-quality-unit-tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ jobs:
3535
sudo apt-get update
3636
sudo apt-get --yes install graphviz graphviz-dev libboost-all-dev libilmbase-dev libopenexr-dev libpng-dev libtiff5-dev
3737
- name: Install Poetry
38-
env:
39-
POETRY_VERSION: 1.4.0
4038
run: |
4139
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
4240
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
@@ -75,7 +73,7 @@ jobs:
7573
poetry run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
7674
shell: bash
7775
- name: Upload Coverage to coveralls.io
78-
if: matrix.os == 'macOS-latest' && matrix.python-version == '3.11'
76+
if: matrix.os == 'macOS-latest' && matrix.python-version == '3.12'
7977
run: |
8078
if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else poetry run coveralls; fi
8179
shell: bash

colour/characterisation/tests/test_aces_it.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,39 +116,34 @@ def test_sd_to_aces_relative_exposure_values(self):
116116
atol=TOLERANCE_ABSOLUTE_TESTS,
117117
)
118118

119-
# NOTE: Reduced precision for random unit tests failure.
120119
dark_skin = SDS_COLOURCHECKERS["ColorChecker N Ohta"]["dark skin"]
121120
np.testing.assert_allclose(
122121
sd_to_aces_relative_exposure_values(dark_skin),
123122
np.array([0.11807796, 0.08690312, 0.05891252]),
124-
atol=1e-5,
123+
atol=TOLERANCE_ABSOLUTE_TESTS,
125124
)
126125

127-
# NOTE: Reduced precision for random unit tests failure.
128-
dark_skin = SDS_COLOURCHECKERS["ColorChecker N Ohta"]["dark skin"]
129126
np.testing.assert_allclose(
130127
sd_to_aces_relative_exposure_values(
131128
dark_skin, SDS_ILLUMINANTS["A"]
132129
),
133130
np.array([0.12937082, 0.09120875, 0.06110636]),
134-
atol=1e-4,
131+
atol=TOLERANCE_ABSOLUTE_TESTS,
135132
)
136133

137-
dark_skin = SDS_COLOURCHECKERS["ColorChecker N Ohta"]["dark skin"]
138134
np.testing.assert_allclose(
139135
sd_to_aces_relative_exposure_values(dark_skin),
140136
np.array([0.11807796, 0.08690312, 0.05891252]),
141-
atol=1e-5,
137+
atol=TOLERANCE_ABSOLUTE_TESTS,
142138
)
143139

144-
dark_skin = SDS_COLOURCHECKERS["ColorChecker N Ohta"]["dark skin"]
145140
np.testing.assert_allclose(
146141
sd_to_aces_relative_exposure_values(
147142
dark_skin,
148143
chromatic_adaptation_transform="Bradford",
149144
),
150145
np.array([0.11805993, 0.08689013, 0.05900396]),
151-
atol=1e-5,
146+
atol=TOLERANCE_ABSOLUTE_TESTS,
152147
)
153148

154149
def test_domain_range_scale_spectral_to_aces_relative_exposure_values(
@@ -833,7 +828,6 @@ def test_training_data_sds_to_XYZ(self):
833828
SDS_COLOURCHECKERS["BabelColor Average"].values()
834829
)
835830

836-
# NOTE: Reduced precision for random unit tests failure.
837831
np.testing.assert_allclose(
838832
training_data_sds_to_XYZ(
839833
training_data,
@@ -868,10 +862,9 @@ def test_training_data_sds_to_XYZ(self):
868862
[0.03058273, 0.03200953, 0.03277947],
869863
]
870864
),
871-
atol=1e-6,
865+
atol=TOLERANCE_ABSOLUTE_TESTS,
872866
)
873867

874-
# NOTE: Reduced precision for random unit tests failure.
875868
np.testing.assert_allclose(
876869
training_data_sds_to_XYZ(
877870
training_data,
@@ -907,7 +900,7 @@ def test_training_data_sds_to_XYZ(self):
907900
[0.03058222, 0.03200864, 0.03278183],
908901
]
909902
),
910-
atol=1e-6,
903+
atol=TOLERANCE_ABSOLUTE_TESTS,
911904
)
912905

913906

colour/colorimetry/spectrum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3074,7 +3074,7 @@ def sds_and_msds_to_msds(
30743074
display_labels = []
30753075
for sd in sds_converted:
30763076
if sd.shape != shape:
3077-
sd = sd.align(shape) # noqa: PLW2901
3077+
sd = sd.copy().align(shape) # noqa: PLW2901
30783078

30793079
values.append(sd.values)
30803080
labels.append(

colour/graph/tests/test_conversion.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class TestConvert(unittest.TestCase):
6060
def test_convert(self):
6161
"""Test :func:`colour.graph.conversion.convert` definition."""
6262

63-
# NOTE: Reduced precision for random unit tests failure.
6463
RGB_a = convert(
6564
SDS_COLOURCHECKERS["ColorChecker N Ohta"]["dark skin"],
6665
"Spectral Distribution",
@@ -69,15 +68,14 @@ def test_convert(self):
6968
np.testing.assert_allclose(
7069
RGB_a,
7170
np.array([0.49034776, 0.30185875, 0.23587685]),
72-
atol=5e-5,
71+
atol=TOLERANCE_ABSOLUTE_TESTS,
7372
)
7473

75-
# NOTE: Reduced precision for random unit tests failure.
7674
Jpapbp = convert(RGB_a, "Output-Referred RGB", "CAM16UCS")
7775
np.testing.assert_allclose(
7876
Jpapbp,
7977
np.array([0.40738741, 0.12046560, 0.09284385]),
80-
atol=5e-4,
78+
atol=TOLERANCE_ABSOLUTE_TESTS,
8179
)
8280

8381
RGB_b = convert(
@@ -114,7 +112,6 @@ def test_convert(self):
114112
atol=TOLERANCE_ABSOLUTE_TESTS,
115113
)
116114

117-
# NOTE: Reduced precision for random unit tests failure.
118115
np.testing.assert_allclose(
119116
convert(
120117
RGB_a,
@@ -123,7 +120,7 @@ def test_convert(self):
123120
RGB_to_RGB={"output_colourspace": RGB_COLOURSPACE_ACES2065_1},
124121
),
125122
np.array([0.37308227, 0.31241444, 0.24746366]),
126-
atol=5e-5,
123+
atol=TOLERANCE_ABSOLUTE_TESTS,
127124
)
128125

129126
# Consistency check to verify that all the colour models are properly

colour/plotting/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,9 @@ def plot_multi_colour_swatches(
13261326
colour_swatches_converted = []
13271327
if not isinstance(first_item(colour_swatches), ColourSwatch):
13281328
for _i, colour_swatch in enumerate(
1329-
as_float_array(cast(ArrayLike, colour_swatches)).reshape([-1, 3])
1329+
as_float_array(cast(ArrayLike, colour_swatches))[..., :3].reshape(
1330+
[-1, 3]
1331+
)
13301332
):
13311333
colour_swatches_converted.append(ColourSwatch(colour_swatch))
13321334
else:

colour/plotting/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ def plot_RGB_chromaticities_in_chromaticity_diagram(
10141014
:alt: plot_RGB_chromaticities_in_chromaticity_diagram
10151015
"""
10161016

1017-
RGB = np.reshape(as_float_array(RGB), (-1, 3))
1017+
RGB = np.reshape(as_float_array(RGB)[..., :3], (-1, 3))
10181018
method = validate_method(
10191019
method, ("CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS")
10201020
)

colour/plotting/volume.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ def plot_RGB_scatter(
758758
:alt: plot_RGB_scatter
759759
"""
760760

761+
RGB = np.reshape(as_float_array(RGB)[..., :3], (-1, 3))
762+
761763
colourspace = cast(
762764
RGB_Colourspace,
763765
first_item(filter_RGB_colourspaces(colourspace).values()),

colour/quality/tests/test_cqs.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,35 @@ def test_colour_quality_scale(self):
3737
np.testing.assert_allclose(
3838
colour_quality_scale(SDS_ILLUMINANTS["FL1"]),
3939
74.982585798279914,
40-
atol=5e-5,
40+
atol=TOLERANCE_ABSOLUTE_TESTS,
4141
)
4242

4343
np.testing.assert_allclose(
4444
colour_quality_scale(
4545
SDS_ILLUMINANTS["FL1"], method="NIST CQS 7.4"
4646
),
4747
75.377089740493361,
48-
atol=5e-5,
48+
atol=TOLERANCE_ABSOLUTE_TESTS,
4949
)
5050

5151
np.testing.assert_allclose(
5252
colour_quality_scale(SDS_ILLUMINANTS["FL2"]),
5353
64.111822015662852,
54-
atol=5e-5,
54+
atol=TOLERANCE_ABSOLUTE_TESTS,
5555
)
5656

5757
np.testing.assert_allclose(
5858
colour_quality_scale(
5959
SDS_ILLUMINANTS["FL2"], method="NIST CQS 7.4"
6060
),
6161
64.774586908581369,
62-
atol=5e-5,
62+
atol=TOLERANCE_ABSOLUTE_TESTS,
6363
)
6464

6565
np.testing.assert_allclose(
6666
colour_quality_scale(SDS_LIGHT_SOURCES["Neodimium Incandescent"]),
6767
89.737456186836681,
68-
atol=5e-5,
68+
atol=TOLERANCE_ABSOLUTE_TESTS,
6969
)
7070

7171
np.testing.assert_allclose(
@@ -74,15 +74,15 @@ def test_colour_quality_scale(self):
7474
method="NIST CQS 7.4",
7575
),
7676
87.700300087538821,
77-
atol=5e-5,
77+
atol=TOLERANCE_ABSOLUTE_TESTS,
7878
)
7979

8080
np.testing.assert_allclose(
8181
colour_quality_scale(
8282
SDS_LIGHT_SOURCES["F32T8/TL841 (Triphosphor)"]
8383
),
8484
84.934928463428903,
85-
atol=5e-5,
85+
atol=TOLERANCE_ABSOLUTE_TESTS,
8686
)
8787

8888
np.testing.assert_allclose(
@@ -91,7 +91,7 @@ def test_colour_quality_scale(self):
9191
method="NIST CQS 7.4",
9292
),
9393
83.255457439460713,
94-
atol=5e-5,
94+
atol=TOLERANCE_ABSOLUTE_TESTS,
9595
)
9696

9797
specification_r = ColourRendering_Specification_CQS(

colour/utilities/array.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ def set_default_int_dtype(
854854
--------
855855
>>> as_int_array(np.ones(3)).dtype # doctest: +SKIP
856856
dtype('int64')
857-
>>> set_default_int_dtype(np.int32)
857+
>>> set_default_int_dtype(np.int32) # doctest: +SKIP
858858
>>> as_int_array(np.ones(3)).dtype # doctest: +SKIP
859859
dtype('int32')
860860
>>> set_default_int_dtype(np.int64)
@@ -870,6 +870,8 @@ def set_default_int_dtype(
870870

871871
module.DTYPE_INT_DEFAULT = dtype # pyright: ignore
872872

873+
CACHE_REGISTRY.clear_all_caches()
874+
873875

874876
def set_default_float_dtype(
875877
dtype: Type[DTypeFloat] = DTYPE_FLOAT_DEFAULT,
@@ -903,8 +905,8 @@ def set_default_float_dtype(
903905
--------
904906
>>> as_float_array(np.ones(3)).dtype
905907
dtype('float64')
906-
>>> set_default_float_dtype(np.float16)
907-
>>> as_float_array(np.ones(3)).dtype
908+
>>> set_default_float_dtype(np.float16) # doctest: +SKIP
909+
>>> as_float_array(np.ones(3)).dtype # doctest: +SKIP
908910
dtype('float16')
909911
>>> set_default_float_dtype(np.float64)
910912
>>> as_float_array(np.ones(3)).dtype
@@ -918,6 +920,8 @@ def set_default_float_dtype(
918920

919921
module.DTYPE_FLOAT_DEFAULT = dtype # pyright: ignore
920922

923+
CACHE_REGISTRY.clear_all_caches()
924+
921925

922926
# TODO: Annotate with "Union[Literal['ignore', 'reference', '1', '100'], str]"
923927
# when Python 3.7 is dropped.

0 commit comments

Comments
 (0)