Coverage for characterisation/tests/test_correction.py: 100%

154 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-16 22:49 +1300

1""" 

2Define the unit tests for the :mod:`colour.characterisation.correction` 

3module. 

4""" 

5 

6from __future__ import annotations 

7 

8import contextlib 

9import platform 

10import typing 

11from itertools import product 

12 

13import numpy as np 

14import pytest 

15from numpy.linalg import LinAlgError 

16 

17from colour.characterisation.correction import ( 

18 apply_matrix_colour_correction_Cheung2004, 

19 apply_matrix_colour_correction_Finlayson2015, 

20 apply_matrix_colour_correction_Vandermonde, 

21 colour_correction_Cheung2004, 

22 colour_correction_Finlayson2015, 

23 colour_correction_Vandermonde, 

24 matrix_augmented_Cheung2004, 

25 matrix_colour_correction_Cheung2004, 

26 matrix_colour_correction_Finlayson2015, 

27 matrix_colour_correction_Vandermonde, 

28 polynomial_expansion_Finlayson2015, 

29 polynomial_expansion_Vandermonde, 

30) 

31from colour.constants import TOLERANCE_ABSOLUTE_TESTS 

32 

33if typing.TYPE_CHECKING: 

34 from colour.hints import NDArrayFloat 

35 

36from colour.utilities import ignore_numpy_errors 

37 

38__author__ = "Colour Developers" 

39__copyright__ = "Copyright 2013 Colour Developers" 

40__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 

41__maintainer__ = "Colour Developers" 

42__email__ = "colour-developers@colour-science.org" 

43__status__ = "Production" 

44 

45__all__ = [ 

46 "MATRIX_TEST", 

47 "MATRIX_REFERENCE", 

48 "TestMatrixAugmentedCheung2004", 

49 "TestPolynomialExpansionFinlayson2015", 

50 "TestPolynomialExpansionVandermonde", 

51 "TestMatrixColourCorrectionCheung2004", 

52 "TestMatrixColourCorrectionFinlayson2015", 

53 "TestMatrixColourCorrectionVandermonde", 

54 "TestApplyMatrixColourCorrectionCheung2004", 

55 "TestApplyMatrixColourCorrectionFinlayson2015", 

56 "TestApplyMatrixColourCorrectionVandermonde", 

57 "TestColourCorrectionCheung2004", 

58 "TestColourCorrectionFinlayson2015", 

59 "TestColourCorrectionVandermonde", 

60] 

61 

62MATRIX_TEST: NDArrayFloat = np.array( 

63 [ 

64 [0.17224810, 0.09170660, 0.06416938], 

65 [0.49189645, 0.27802050, 0.21923399], 

66 [0.10999751, 0.18658946, 0.29938611], 

67 [0.11666120, 0.14327905, 0.05713804], 

68 [0.18988879, 0.18227649, 0.36056247], 

69 [0.12501329, 0.42223442, 0.37027445], 

70 [0.64785606, 0.22396782, 0.03365194], 

71 [0.06761093, 0.11076896, 0.39779139], 

72 [0.49101797, 0.09448929, 0.11623839], 

73 [0.11622386, 0.04425753, 0.14469986], 

74 [0.36867946, 0.44545230, 0.06028681], 

75 [0.61632937, 0.32323906, 0.02437089], 

76 [0.03016472, 0.06153243, 0.29014596], 

77 [0.11103655, 0.30553067, 0.08149137], 

78 [0.41162190, 0.05816656, 0.04845934], 

79 [0.73339206, 0.53075188, 0.02475212], 

80 [0.47347718, 0.08834792, 0.30310315], 

81 [0.00000000, 0.25187016, 0.35062450], 

82 [0.76809639, 0.78486240, 0.77808297], 

83 [0.53822392, 0.54307997, 0.54710883], 

84 [0.35458526, 0.35318419, 0.35524431], 

85 [0.17976704, 0.18000531, 0.17991488], 

86 [0.09351417, 0.09510603, 0.09675027], 

87 [0.03405071, 0.03295077, 0.03702047], 

88 ] 

89) 

90 

91MATRIX_REFERENCE: NDArrayFloat = np.array( 

92 [ 

93 [0.15579559, 0.09715755, 0.07514556], 

94 [0.39113140, 0.25943419, 0.21266708], 

95 [0.12824821, 0.18463570, 0.31508023], 

96 [0.12028974, 0.13455659, 0.07408400], 

97 [0.19368988, 0.21158946, 0.37955964], 

98 [0.19957424, 0.36085439, 0.40678123], 

99 [0.48896605, 0.20691688, 0.05816533], 

100 [0.09775522, 0.16710693, 0.47147724], 

101 [0.39358649, 0.12233400, 0.10526425], 

102 [0.10780332, 0.07258529, 0.16151473], 

103 [0.27502671, 0.34705454, 0.09728099], 

104 [0.43980441, 0.26880559, 0.05430533], 

105 [0.05887212, 0.11126272, 0.38552469], 

106 [0.12705825, 0.25787860, 0.13566464], 

107 [0.35612929, 0.07933258, 0.05118732], 

108 [0.48131976, 0.42082843, 0.07120612], 

109 [0.34665585, 0.15170714, 0.24969804], 

110 [0.08261116, 0.24588716, 0.48707733], 

111 [0.66054904, 0.65941137, 0.66376412], 

112 [0.48051509, 0.47870296, 0.48230082], 

113 [0.33045354, 0.32904184, 0.33228886], 

114 [0.18001305, 0.17978567, 0.18004416], 

115 [0.10283975, 0.10424680, 0.10384975], 

116 [0.04742204, 0.04772203, 0.04914226], 

117 ] 

118) 

119 

120 

121class TestMatrixAugmentedCheung2004: 

122 """ 

123 Define :func:`colour.characterisation.correction.\ 

124matrix_augmented_Cheung2004` definition unit tests methods. 

125 """ 

126 

127 def test_matrix_augmented_Cheung2004(self) -> None: 

128 """ 

129 Test :func:`colour.characterisation.correction.\ 

130matrix_augmented_Cheung2004` definition. 

131 """ 

132 

133 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

134 

135 polynomials = [ 

136 np.array([0.17224810, 0.09170660, 0.06416938]), 

137 np.array([0.17224810, 0.09170660, 0.06416938, 1.00000000]), 

138 np.array([0.17224810, 0.09170660, 0.06416938, 0.00101364, 1.00000000]), 

139 np.array( 

140 [ 

141 0.17224810, 

142 0.09170660, 

143 0.06416938, 

144 0.01579629, 

145 0.01105305, 

146 0.00588476, 

147 1.00000000, 

148 ] 

149 ), 

150 np.array( 

151 [ 

152 0.17224810, 

153 0.09170660, 

154 0.06416938, 

155 0.01579629, 

156 0.01105305, 

157 0.00588476, 

158 0.00101364, 

159 1.00000000, 

160 ] 

161 ), 

162 np.array( 

163 [ 

164 0.17224810, 

165 0.09170660, 

166 0.06416938, 

167 0.01579629, 

168 0.01105305, 

169 0.00588476, 

170 0.02966941, 

171 0.00841010, 

172 0.00411771, 

173 1.00000000, 

174 ] 

175 ), 

176 np.array( 

177 [ 

178 0.17224810, 

179 0.09170660, 

180 0.06416938, 

181 0.01579629, 

182 0.01105305, 

183 0.00588476, 

184 0.02966941, 

185 0.00841010, 

186 0.00411771, 

187 0.00101364, 

188 1.00000000, 

189 ] 

190 ), 

191 np.array( 

192 [ 

193 0.17224810, 

194 0.09170660, 

195 0.06416938, 

196 0.01579629, 

197 0.01105305, 

198 0.00588476, 

199 0.02966941, 

200 0.00841010, 

201 0.00411771, 

202 0.00101364, 

203 0.00511050, 

204 0.00077126, 

205 0.00026423, 

206 1.00000000, 

207 ] 

208 ), 

209 np.array( 

210 [ 

211 0.17224810, 

212 0.09170660, 

213 0.06416938, 

214 0.01579629, 

215 0.01105305, 

216 0.00588476, 

217 0.02966941, 

218 0.00841010, 

219 0.00411771, 

220 0.00101364, 

221 0.00272088, 

222 0.00053967, 

223 0.00070927, 

224 0.00511050, 

225 0.00077126, 

226 0.00026423, 

227 ] 

228 ), 

229 np.array( 

230 [ 

231 0.17224810, 

232 0.09170660, 

233 0.06416938, 

234 0.01579629, 

235 0.01105305, 

236 0.00588476, 

237 0.02966941, 

238 0.00841010, 

239 0.00411771, 

240 0.00101364, 

241 0.00272088, 

242 0.00053967, 

243 0.00070927, 

244 0.00511050, 

245 0.00077126, 

246 0.00026423, 

247 1.00000000, 

248 ] 

249 ), 

250 np.array( 

251 [ 

252 0.17224810, 

253 0.09170660, 

254 0.06416938, 

255 0.01579629, 

256 0.01105305, 

257 0.00588476, 

258 0.02966941, 

259 0.00841010, 

260 0.00411771, 

261 0.00101364, 

262 0.00272088, 

263 0.00053967, 

264 0.00070927, 

265 0.00190387, 

266 0.00144862, 

267 0.00037762, 

268 0.00511050, 

269 0.00077126, 

270 0.00026423, 

271 ] 

272 ), 

273 np.array( 

274 [ 

275 0.17224810, 

276 0.09170660, 

277 0.06416938, 

278 0.01579629, 

279 0.01105305, 

280 0.00588476, 

281 0.02966941, 

282 0.00841010, 

283 0.00411771, 

284 0.00101364, 

285 0.00272088, 

286 0.00053967, 

287 0.00070927, 

288 0.00190387, 

289 0.00144862, 

290 0.00037762, 

291 0.00511050, 

292 0.00077126, 

293 0.00026423, 

294 1.00000000, 

295 ] 

296 ), 

297 np.array( 

298 [ 

299 0.17224810, 

300 0.09170660, 

301 0.06416938, 

302 0.01579629, 

303 0.01105305, 

304 0.00588476, 

305 0.02966941, 

306 0.00841010, 

307 0.00411771, 

308 0.00101364, 

309 0.00272088, 

310 0.00053967, 

311 0.00070927, 

312 0.00190387, 

313 0.00144862, 

314 0.00037762, 

315 0.00511050, 

316 0.00077126, 

317 0.00026423, 

318 0.00017460, 

319 0.00009296, 

320 0.00006504, 

321 ] 

322 ), 

323 np.array( 

324 [ 

325 0.17224810, 

326 0.09170660, 

327 0.06416938, 

328 0.01579629, 

329 0.01105305, 

330 0.00588476, 

331 0.02966941, 

332 0.00841010, 

333 0.00411771, 

334 0.00101364, 

335 0.00272088, 

336 0.00053967, 

337 0.00070927, 

338 0.00190387, 

339 0.00144862, 

340 0.00037762, 

341 0.00511050, 

342 0.00077126, 

343 0.00026423, 

344 0.00046867, 

345 0.00032794, 

346 0.00013285, 

347 0.00004949, 

348 0.00004551, 

349 0.00002423, 

350 0.00017460, 

351 0.00009296, 

352 0.00006504, 

353 0.00024952, 

354 0.00012217, 

355 0.00003463, 

356 0.00088027, 

357 0.00007073, 

358 0.00001696, 

359 1.00000000, 

360 ] 

361 ), 

362 ] 

363 

364 for i, terms in enumerate([3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35]): 

365 np.testing.assert_allclose( 

366 matrix_augmented_Cheung2004(RGB, terms), 

367 polynomials[i], 

368 atol=TOLERANCE_ABSOLUTE_TESTS, 

369 ) 

370 

371 def test_raise_exception_matrix_augmented_Cheung2004(self) -> None: 

372 """ 

373 Test :func:`colour.characterisation.correction.\ 

374matrix_augmented_Cheung2004` definition raised exception. 

375 """ 

376 

377 pytest.raises( 

378 ValueError, 

379 matrix_augmented_Cheung2004, 

380 np.array([0.17224810, 0.09170660, 0.06416938]), 

381 6, 

382 ) 

383 

384 @ignore_numpy_errors 

385 def test_nan_matrix_augmented_Cheung2004(self) -> None: 

386 """ 

387 Test :func:`colour.characterisation.correction.\ 

388matrix_augmented_Cheung2004` definition nan support. 

389 """ 

390 

391 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

392 cases = np.array(list(set(product(cases, repeat=3)))) 

393 matrix_augmented_Cheung2004(cases) 

394 

395 

396class TestPolynomialExpansionFinlayson2015: 

397 """ 

398 Define :func:`colour.characterisation.correction.\ 

399polynomial_expansion_Finlayson2015` definition unit tests methods. 

400 """ 

401 

402 def test_polynomial_expansion_Finlayson2015(self) -> None: 

403 """ 

404 Test :func:`colour.characterisation.correction.\ 

405polynomial_expansion_Finlayson2015` definition. 

406 """ 

407 

408 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

409 

410 polynomials = [ 

411 [ 

412 np.array([0.17224810, 0.09170660, 0.06416938]), 

413 np.array([0.17224810, 0.09170660, 0.06416938]), 

414 ], 

415 [ 

416 np.array( 

417 [ 

418 0.17224810, 

419 0.09170660, 

420 0.06416938, 

421 0.02966941, 

422 0.00841010, 

423 0.00411771, 

424 0.01579629, 

425 0.00588476, 

426 0.01105305, 

427 ] 

428 ), 

429 np.array( 

430 [ 

431 0.17224810, 

432 0.09170660, 

433 0.06416938, 

434 0.12568328, 

435 0.07671216, 

436 0.10513350, 

437 ] 

438 ), 

439 ], 

440 [ 

441 np.array( 

442 [ 

443 0.17224810, 

444 0.09170660, 

445 0.06416938, 

446 0.02966941, 

447 0.00841010, 

448 0.00411771, 

449 0.01579629, 

450 0.00588476, 

451 0.01105305, 

452 0.00511050, 

453 0.00077126, 

454 0.00026423, 

455 0.00144862, 

456 0.00037762, 

457 0.00070927, 

458 0.00272088, 

459 0.00053967, 

460 0.00190387, 

461 0.00101364, 

462 ] 

463 ), 

464 np.array( 

465 [ 

466 0.17224810, 

467 0.09170660, 

468 0.06416938, 

469 0.12568328, 

470 0.07671216, 

471 0.10513350, 

472 0.11314930, 

473 0.07228010, 

474 0.08918053, 

475 0.13960570, 

476 0.08141598, 

477 0.12394021, 

478 0.10045255, 

479 ] 

480 ), 

481 ], 

482 [ 

483 np.array( 

484 [ 

485 0.17224810, 

486 0.09170660, 

487 0.06416938, 

488 0.02966941, 

489 0.00841010, 

490 0.00411771, 

491 0.01579629, 

492 0.00588476, 

493 0.01105305, 

494 0.00511050, 

495 0.00077126, 

496 0.00026423, 

497 0.00144862, 

498 0.00037762, 

499 0.00070927, 

500 0.00272088, 

501 0.00053967, 

502 0.00190387, 

503 0.00101364, 

504 0.00088027, 

505 0.00007073, 

506 0.00001696, 

507 0.00046867, 

508 0.00032794, 

509 0.00013285, 

510 0.00004949, 

511 0.00004551, 

512 0.00002423, 

513 0.00024952, 

514 0.00003463, 

515 0.00012217, 

516 0.00017460, 

517 0.00009296, 

518 0.00006504, 

519 ] 

520 ), 

521 np.array( 

522 [ 

523 0.17224810, 

524 0.09170660, 

525 0.06416938, 

526 0.12568328, 

527 0.07671216, 

528 0.10513350, 

529 0.11314930, 

530 0.07228010, 

531 0.08918053, 

532 0.13960570, 

533 0.08141598, 

534 0.12394021, 

535 0.10045255, 

536 0.14713499, 

537 0.13456986, 

538 0.10735915, 

539 0.08387498, 

540 0.08213618, 

541 0.07016104, 

542 0.11495009, 

543 0.09819082, 

544 0.08980545, 

545 ] 

546 ), 

547 ], 

548 ] 

549 

550 for i in range(4): 

551 np.testing.assert_allclose( 

552 polynomial_expansion_Finlayson2015(RGB, i + 1, False), 

553 polynomials[i][0], 

554 atol=TOLERANCE_ABSOLUTE_TESTS, 

555 ) 

556 np.testing.assert_allclose( 

557 polynomial_expansion_Finlayson2015(RGB, i + 1, True), 

558 polynomials[i][1], 

559 atol=TOLERANCE_ABSOLUTE_TESTS, 

560 ) 

561 

562 def test_raise_exception_polynomial_expansion_Finlayson2015(self) -> None: 

563 """ 

564 Test :func:`colour.characterisation.correction.\ 

565polynomial_expansion_Finlayson2015` definition raised exception. 

566 """ 

567 

568 pytest.raises( 

569 ValueError, 

570 polynomial_expansion_Finlayson2015, 

571 np.array([0.17224810, 0.09170660, 0.06416938]), 

572 5, 

573 ) 

574 

575 @ignore_numpy_errors 

576 def test_nan_polynomial_expansion_Finlayson2015(self) -> None: 

577 """ 

578 Test :func:`colour.characterisation.correction.\ 

579polynomial_expansion_Finlayson2015` definition nan support. 

580 """ 

581 

582 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

583 cases = np.array(list(set(product(cases, repeat=3)))) 

584 polynomial_expansion_Finlayson2015(cases) 

585 

586 

587class TestPolynomialExpansionVandermonde: 

588 """ 

589 Define :func:`colour.characterisation.correction.\ 

590polynomial_expansion_Vandermonde` definition unit tests methods. 

591 """ 

592 

593 def test_polynomial_expansion_Vandermonde(self) -> None: 

594 """ 

595 Test :func:`colour.characterisation.correction.\ 

596polynomial_expansion_Vandermonde` definition. 

597 """ 

598 

599 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

600 

601 polynomials = [ 

602 np.array([0.17224810, 0.09170660, 0.06416938, 1.00000000]), 

603 np.array( 

604 [ 

605 0.02966941, 

606 0.00841010, 

607 0.00411771, 

608 0.17224810, 

609 0.09170660, 

610 0.06416938, 

611 1.00000000, 

612 ] 

613 ), 

614 np.array( 

615 [ 

616 0.00511050, 

617 0.00077126, 

618 0.00026423, 

619 0.02966941, 

620 0.00841010, 

621 0.00411771, 

622 0.17224810, 

623 0.09170660, 

624 0.06416938, 

625 1.00000000, 

626 ] 

627 ), 

628 np.array( 

629 [ 

630 0.00088027, 

631 0.00007073, 

632 0.00001696, 

633 0.00511050, 

634 0.00077126, 

635 0.00026423, 

636 0.02966941, 

637 0.00841010, 

638 0.00411771, 

639 0.17224810, 

640 0.09170660, 

641 0.06416938, 

642 1.00000000, 

643 ] 

644 ), 

645 ] 

646 

647 for i in range(4): 

648 np.testing.assert_allclose( 

649 polynomial_expansion_Vandermonde(RGB, i + 1), 

650 polynomials[i], 

651 atol=TOLERANCE_ABSOLUTE_TESTS, 

652 ) 

653 

654 @ignore_numpy_errors 

655 def test_nan_polynomial_expansion_Vandermonde(self) -> None: 

656 """ 

657 Test :func:`colour.characterisation.correction.\ 

658polynomial_expansion_Vandermonde` definition nan support. 

659 """ 

660 

661 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

662 cases = np.array(list(set(product(cases, repeat=3)))) 

663 polynomial_expansion_Vandermonde(cases) 

664 

665 

666class TestMatrixColourCorrectionCheung2004: 

667 """ 

668 Define :func:`colour.characterisation.correction.\ 

669matrix_colour_correction_Cheung2004` definition unit tests methods. 

670 """ 

671 

672 def test_matrix_colour_correction_Cheung2004(self) -> None: 

673 """ 

674 Test :func:`colour.characterisation.correction.\ 

675matrix_colour_correction_Cheung2004` definition. 

676 """ 

677 

678 np.testing.assert_allclose( 

679 matrix_colour_correction_Cheung2004(MATRIX_TEST, MATRIX_REFERENCE), 

680 np.array( 

681 [ 

682 [0.69822661, 0.03071629, 0.16210422], 

683 [0.06893498, 0.67579611, 0.16430385], 

684 [-0.06314956, 0.09212471, 0.97134152], 

685 ] 

686 ), 

687 atol=TOLERANCE_ABSOLUTE_TESTS, 

688 ) 

689 

690 np.testing.assert_allclose( 

691 matrix_colour_correction_Cheung2004(MATRIX_TEST, MATRIX_REFERENCE, terms=7), 

692 np.array( 

693 [ 

694 [ 

695 0.80512769, 

696 0.04001012, 

697 -0.01255261, 

698 -0.41056170, 

699 -0.28052094, 

700 0.68417697, 

701 0.02251728, 

702 ], 

703 [ 

704 0.03270288, 

705 0.71452384, 

706 0.17581905, 

707 -0.00897913, 

708 0.04900199, 

709 -0.17162742, 

710 0.01688472, 

711 ], 

712 [ 

713 -0.03973098, 

714 -0.07164767, 

715 1.16401636, 

716 0.29017859, 

717 -0.88909018, 

718 0.26675507, 

719 0.02345109, 

720 ], 

721 ] 

722 ), 

723 atol=TOLERANCE_ABSOLUTE_TESTS, 

724 ) 

725 

726 @ignore_numpy_errors 

727 @pytest.mark.skipif( 

728 platform.system() in ("Darwin", "Linux"), 

729 reason="Hangs on macOS and Linux", 

730 ) 

731 def test_nan_matrix_colour_correction_Cheung2004(self) -> None: # pragma: no cover 

732 """ 

733 Test :func:`colour.characterisation.correction.\ 

734 matrix_colour_correction_Cheung2004` definition nan support. 

735 """ 

736 

737 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

738 cases = np.array(list(set(product(cases, repeat=3)))) 

739 for case in cases: 

740 with contextlib.suppress(LinAlgError): 

741 matrix_colour_correction_Cheung2004( 

742 np.vstack([case, case, case]), 

743 np.transpose(np.vstack([case, case, case])), 

744 ) 

745 

746 

747class TestMatrixColourCorrectionFinlayson2015: 

748 """ 

749 Define :func:`colour.characterisation.correction.\ 

750matrix_colour_correction_Finlayson2015` definition unit tests methods. 

751 """ 

752 

753 def test_matrix_colour_correction_Finlayson2015(self) -> None: 

754 """ 

755 Test :func:`colour.characterisation.correction.\ 

756matrix_colour_correction_Finlayson2015` definition. 

757 """ 

758 

759 np.testing.assert_allclose( 

760 matrix_colour_correction_Finlayson2015(MATRIX_TEST, MATRIX_REFERENCE), 

761 np.array( 

762 [ 

763 [0.69822661, 0.03071629, 0.16210422], 

764 [0.06893498, 0.67579611, 0.16430385], 

765 [-0.06314956, 0.09212471, 0.97134152], 

766 ] 

767 ), 

768 atol=TOLERANCE_ABSOLUTE_TESTS, 

769 ) 

770 

771 np.testing.assert_allclose( 

772 matrix_colour_correction_Finlayson2015( 

773 MATRIX_TEST, MATRIX_REFERENCE, degree=3 

774 ), 

775 np.array( 

776 [ 

777 [ 

778 2.87796213, 

779 9.85720054, 

780 2.99863978, 

781 76.97227806, 

782 73.73571500, 

783 -49.37563169, 

784 -48.70879206, 

785 -47.53280959, 

786 29.88241815, 

787 -39.82871801, 

788 -37.11388282, 

789 23.30393209, 

790 3.81579802, 

791 ], 

792 [ 

793 -0.78448243, 

794 5.63631335, 

795 0.95306110, 

796 14.19762287, 

797 20.60124427, 

798 -18.05512861, 

799 -14.52994195, 

800 -13.10606336, 

801 10.53666341, 

802 -3.63132534, 

803 -12.49672335, 

804 8.17401039, 

805 3.37995231, 

806 ], 

807 [ 

808 -2.39092600, 

809 10.57193455, 

810 4.16361285, 

811 23.41748866, 

812 58.26902059, 

813 -39.39669827, 

814 -26.63805785, 

815 -35.98397757, 

816 21.25508558, 

817 -4.12726077, 

818 -34.31995017, 

819 18.72796247, 

820 7.33531009, 

821 ], 

822 ] 

823 ), 

824 atol=TOLERANCE_ABSOLUTE_TESTS, 

825 ) 

826 

827 @ignore_numpy_errors 

828 @pytest.mark.skipif( 

829 platform.system() in ("Darwin", "Linux"), 

830 reason="Hangs on macOS and Linux", 

831 ) 

832 def test_nan_matrix_colour_correction_Finlayson2015( 

833 self, 

834 ) -> None: # pragma: no cover 

835 """ 

836 Test :func:`colour.characterisation.correction.\ 

837 matrix_colour_correction_Finlayson2015` definition nan support. 

838 """ 

839 

840 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

841 cases = np.array(list(set(product(cases, repeat=3)))) 

842 for case in cases: 

843 with contextlib.suppress(LinAlgError): 

844 matrix_colour_correction_Finlayson2015( 

845 np.vstack([case, case, case]), 

846 np.transpose(np.vstack([case, case, case])), 

847 ) 

848 

849 

850class TestMatrixColourCorrectionVandermonde: 

851 """ 

852 Define :func:`colour.characterisation.correction.\ 

853matrix_colour_correction_Vandermonde` definition unit tests methods. 

854 """ 

855 

856 def test_matrix_colour_correction_Vandermonde(self) -> None: 

857 """ 

858 Test :func:`colour.characterisation.correction.\ 

859matrix_colour_correction_Vandermonde` definition. 

860 """ 

861 

862 np.testing.assert_allclose( 

863 matrix_colour_correction_Vandermonde(MATRIX_TEST, MATRIX_REFERENCE), 

864 np.array( 

865 [ 

866 [0.66770040, 0.02514036, 0.12745797, 0.02485425], 

867 [0.03155494, 0.66896825, 0.12187874, 0.03043460], 

868 [-0.14502258, 0.07716975, 0.87841836, 0.06666049], 

869 ] 

870 ), 

871 atol=TOLERANCE_ABSOLUTE_TESTS, 

872 ) 

873 

874 np.testing.assert_allclose( 

875 matrix_colour_correction_Vandermonde( 

876 MATRIX_TEST, MATRIX_REFERENCE, degree=3 

877 ), 

878 np.array( 

879 [ 

880 [ 

881 -0.04328223, 

882 -1.87886146, 

883 1.83369170, 

884 -0.10798116, 

885 1.06608177, 

886 -0.87495813, 

887 0.75525839, 

888 -0.08558123, 

889 0.15919076, 

890 0.02404598, 

891 ], 

892 [ 

893 0.00998152, 

894 0.44525275, 

895 -0.53192490, 

896 0.00904507, 

897 -0.41034458, 

898 0.36173334, 

899 0.02904178, 

900 0.78362950, 

901 0.07894900, 

902 0.01986479, 

903 ], 

904 [ 

905 -1.66921744, 

906 3.62954420, 

907 -2.96789849, 

908 2.31451409, 

909 -3.10767297, 

910 1.85975390, 

911 -0.98795093, 

912 0.85962796, 

913 0.63591240, 

914 0.07302317, 

915 ], 

916 ] 

917 ), 

918 atol=TOLERANCE_ABSOLUTE_TESTS, 

919 ) 

920 

921 @ignore_numpy_errors 

922 @pytest.mark.skipif( 

923 platform.system() in ("Darwin", "Linux"), 

924 reason="Hangs on macOS and Linux", 

925 ) 

926 def test_nan_matrix_colour_correction_Vandermonde( 

927 self, 

928 ) -> None: # pragma: no cover 

929 """ 

930 Test :func:`colour.characterisation.correction.\ 

931 matrix_colour_correction_Vandermonde` definition nan support. 

932 """ 

933 

934 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

935 cases = np.array(list(set(product(cases, repeat=3)))) 

936 for case in cases: 

937 with contextlib.suppress(LinAlgError): 

938 matrix_colour_correction_Vandermonde( 

939 np.vstack([case, case, case]), 

940 np.transpose(np.vstack([case, case, case])), 

941 ) 

942 

943 

944class TestApplyMatrixColourCorrectionCheung2004: 

945 """ 

946 Define :func:`colour.characterisation.correction.\ 

947apply_matrix_colour_correction_Cheung2004` definition unit tests methods. 

948 """ 

949 

950 def test_apply_matrix_colour_correction_Cheung2004(self) -> None: 

951 """ 

952 Test :func:`colour.characterisation.correction.\ 

953apply_matrix_colour_correction_Cheung2004` definition. 

954 """ 

955 

956 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

957 

958 np.testing.assert_allclose( 

959 apply_matrix_colour_correction_Cheung2004( 

960 RGB, 

961 np.array( 

962 [ 

963 [0.69822661, 0.03071629, 0.16210422], 

964 [0.06893498, 0.67579611, 0.16430385], 

965 [-0.06314956, 0.09212471, 0.97134152], 

966 ] 

967 ), 

968 ), 

969 np.array([0.13348722, 0.08439216, 0.05990144]), 

970 atol=TOLERANCE_ABSOLUTE_TESTS, 

971 ) 

972 

973 def test_n_dimensional_apply_matrix_colour_correction_Cheung2004(self) -> None: 

974 """ 

975 Test :func:`colour.characterisation.correction.\ 

976apply_matrix_colour_correction_Cheung2004` definition n-dimensional support. 

977 """ 

978 

979 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

980 CCM = np.array( 

981 [ 

982 [0.69822661, 0.03071629, 0.16210422], 

983 [0.06893498, 0.67579611, 0.16430385], 

984 [-0.06314956, 0.09212471, 0.97134152], 

985 ] 

986 ) 

987 RGB_c = apply_matrix_colour_correction_Cheung2004(RGB, CCM) 

988 

989 RGB = np.tile(RGB, (6, 1)) 

990 RGB_c = np.tile(RGB_c, (6, 1)) 

991 np.testing.assert_allclose( 

992 apply_matrix_colour_correction_Cheung2004(RGB, CCM), 

993 RGB_c, 

994 atol=TOLERANCE_ABSOLUTE_TESTS, 

995 ) 

996 

997 RGB = np.reshape(RGB, (2, 3, 3)) 

998 RGB_c = np.reshape(RGB_c, (2, 3, 3)) 

999 np.testing.assert_allclose( 

1000 apply_matrix_colour_correction_Cheung2004(RGB, CCM), 

1001 RGB_c, 

1002 atol=TOLERANCE_ABSOLUTE_TESTS, 

1003 ) 

1004 

1005 @ignore_numpy_errors 

1006 @pytest.mark.skipif( 

1007 platform.system() in ("Darwin", "Linux"), 

1008 reason="Hangs on macOS and Linux", 

1009 ) 

1010 def test_nan_apply_matrix_colour_correction_Cheung2004( 

1011 self, 

1012 ) -> None: # pragma: no cover 

1013 """ 

1014 Test :func:`colour.characterisation.correction.\ 

1015apply_matrix_colour_correction_Cheung2004` definition nan support. 

1016 """ 

1017 

1018 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

1019 cases = np.array(list(set(product(cases, repeat=3)))) 

1020 for case in cases: 

1021 with contextlib.suppress(LinAlgError): 

1022 apply_matrix_colour_correction_Cheung2004( 

1023 case, 

1024 np.vstack([case, case, case]), 

1025 ) 

1026 

1027 

1028class TestApplyMatrixColourCorrectionFinlayson2015: 

1029 """ 

1030 Define :func:`colour.characterisation.correction.\ 

1031apply_matrix_colour_correction_Finlayson2015` definition unit tests methods. 

1032 """ 

1033 

1034 def test_apply_matrix_colour_correction_Finlayson2015(self) -> None: 

1035 """ 

1036 Test :func:`colour.characterisation.correction.\ 

1037apply_matrix_colour_correction_Finlayson2015` definition. 

1038 """ 

1039 

1040 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1041 

1042 np.testing.assert_allclose( 

1043 apply_matrix_colour_correction_Finlayson2015( 

1044 RGB, 

1045 np.array( 

1046 [ 

1047 [0.69822661, 0.03071629, 0.16210422], 

1048 [0.06893498, 0.67579611, 0.16430385], 

1049 [-0.06314956, 0.09212471, 0.97134152], 

1050 ] 

1051 ), 

1052 ), 

1053 np.array([0.13348722, 0.08439216, 0.05990144]), 

1054 atol=TOLERANCE_ABSOLUTE_TESTS, 

1055 ) 

1056 

1057 def test_n_dimensional_apply_matrix_colour_correction_Finlayson2015(self) -> None: 

1058 """ 

1059 Test :func:`colour.characterisation.correction.\ 

1060apply_matrix_colour_correction_Finlayson2015` definition n-dimensional support. 

1061 """ 

1062 

1063 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1064 CCM = np.array( 

1065 [ 

1066 [0.69822661, 0.03071629, 0.16210422], 

1067 [0.06893498, 0.67579611, 0.16430385], 

1068 [-0.06314956, 0.09212471, 0.97134152], 

1069 ] 

1070 ) 

1071 RGB_c = apply_matrix_colour_correction_Finlayson2015(RGB, CCM) 

1072 

1073 RGB = np.tile(RGB, (6, 1)) 

1074 RGB_c = np.tile(RGB_c, (6, 1)) 

1075 np.testing.assert_allclose( 

1076 apply_matrix_colour_correction_Finlayson2015(RGB, CCM), 

1077 RGB_c, 

1078 atol=TOLERANCE_ABSOLUTE_TESTS, 

1079 ) 

1080 

1081 RGB = np.reshape(RGB, (2, 3, 3)) 

1082 RGB_c = np.reshape(RGB_c, (2, 3, 3)) 

1083 np.testing.assert_allclose( 

1084 apply_matrix_colour_correction_Finlayson2015(RGB, CCM), 

1085 RGB_c, 

1086 atol=TOLERANCE_ABSOLUTE_TESTS, 

1087 ) 

1088 

1089 @ignore_numpy_errors 

1090 @pytest.mark.skipif( 

1091 platform.system() in ("Darwin", "Linux"), 

1092 reason="Hangs on macOS and Linux", 

1093 ) 

1094 def test_nan_apply_matrix_colour_correction_Finlayson2015( 

1095 self, 

1096 ) -> None: # pragma: no cover 

1097 """ 

1098 Test :func:`colour.characterisation.correction. 

1099 apply_matrix_colour_correction_Finlayson2015` definition nan support. 

1100 """ 

1101 

1102 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

1103 cases = np.array(list(set(product(cases, repeat=3)))) 

1104 for case in cases: 

1105 with contextlib.suppress(LinAlgError): 

1106 apply_matrix_colour_correction_Finlayson2015( 

1107 case, 

1108 np.vstack([case, case, case]), 

1109 ) 

1110 

1111 

1112class TestApplyMatrixColourCorrectionVandermonde: 

1113 """ 

1114 Define :func:`colour.characterisation.correction.\ 

1115apply_matrix_colour_correction_Vandermonde` definition unit tests methods. 

1116 """ 

1117 

1118 def test_apply_matrix_colour_correction_Vandermonde(self) -> None: 

1119 """ 

1120 Test :func:`colour.characterisation.correction.\ 

1121apply_matrix_colour_correction_Vandermonde` definition. 

1122 """ 

1123 

1124 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1125 

1126 np.testing.assert_allclose( 

1127 apply_matrix_colour_correction_Vandermonde( 

1128 RGB, 

1129 np.array( 

1130 [ 

1131 [0.66770040, 0.02514036, 0.12745797, 0.02485425], 

1132 [0.03155494, 0.66896825, 0.12187874, 0.03043460], 

1133 [-0.14502258, 0.07716975, 0.87841836, 0.06666049], 

1134 ] 

1135 ), 

1136 ), 

1137 np.array([0.15034881, 0.10503956, 0.10512517]), 

1138 atol=TOLERANCE_ABSOLUTE_TESTS, 

1139 ) 

1140 

1141 def test_n_dimensional_apply_matrix_colour_correction_Vandermonde(self) -> None: 

1142 """ 

1143 Test :func:`colour.characterisation.correction.\ 

1144apply_matrix_colour_correction_Vandermonde` definition n-dimensional support. 

1145 """ 

1146 

1147 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1148 CCM = np.array( 

1149 [ 

1150 [0.66770040, 0.02514036, 0.12745797, 0.02485425], 

1151 [0.03155494, 0.66896825, 0.12187874, 0.03043460], 

1152 [-0.14502258, 0.07716975, 0.87841836, 0.06666049], 

1153 ] 

1154 ) 

1155 RGB_c = apply_matrix_colour_correction_Vandermonde(RGB, CCM) 

1156 

1157 RGB = np.tile(RGB, (6, 1)) 

1158 RGB_c = np.tile(RGB_c, (6, 1)) 

1159 np.testing.assert_allclose( 

1160 apply_matrix_colour_correction_Vandermonde(RGB, CCM), 

1161 RGB_c, 

1162 atol=TOLERANCE_ABSOLUTE_TESTS, 

1163 ) 

1164 

1165 RGB = np.reshape(RGB, (2, 3, 3)) 

1166 RGB_c = np.reshape(RGB_c, (2, 3, 3)) 

1167 np.testing.assert_allclose( 

1168 apply_matrix_colour_correction_Vandermonde(RGB, CCM), 

1169 RGB_c, 

1170 atol=TOLERANCE_ABSOLUTE_TESTS, 

1171 ) 

1172 

1173 @ignore_numpy_errors 

1174 @pytest.mark.skipif( 

1175 platform.system() in ("Darwin", "Linux"), 

1176 reason="Hangs on macOS and Linux", 

1177 ) 

1178 def test_nan_apply_matrix_colour_correction_Vandermonde( 

1179 self, 

1180 ) -> None: # pragma: no cover 

1181 """ 

1182 Test :func:`colour.characterisation.correction.\ 

1183apply_matrix_colour_correction_Vandermonde` definition nan support. 

1184 """ 

1185 

1186 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

1187 cases = np.array(list(set(product(cases, repeat=3)))) 

1188 for case in cases: 

1189 with contextlib.suppress(LinAlgError): 

1190 apply_matrix_colour_correction_Vandermonde( 

1191 case, 

1192 np.dstack([case, case, case, case]), 

1193 ) 

1194 

1195 

1196class TestColourCorrectionCheung2004: 

1197 """ 

1198 Define :func:`colour.characterisation.correction.\ 

1199colour_correction_Cheung2004` definition unit tests methods. 

1200 """ 

1201 

1202 def test_colour_correction_Cheung2004(self) -> None: 

1203 """ 

1204 Test :func:`colour.characterisation.correction.\ 

1205colour_correction_Cheung2004` definition. 

1206 """ 

1207 

1208 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1209 

1210 np.testing.assert_allclose( 

1211 colour_correction_Cheung2004(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1212 np.array([0.13348722, 0.08439216, 0.05990144]), 

1213 atol=TOLERANCE_ABSOLUTE_TESTS, 

1214 ) 

1215 

1216 np.testing.assert_allclose( 

1217 colour_correction_Cheung2004(RGB, MATRIX_TEST, MATRIX_REFERENCE, terms=7), 

1218 np.array([0.15850295, 0.09871628, 0.08105752]), 

1219 atol=TOLERANCE_ABSOLUTE_TESTS, 

1220 ) 

1221 

1222 def test_n_dimensional_colour_correction_Cheung2004(self) -> None: 

1223 """ 

1224 Test :func:`colour.characterisation.correction.\ 

1225colour_correction_Cheung2004` definition n-dimensional support. 

1226 """ 

1227 

1228 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1229 RGB_c = colour_correction_Cheung2004(RGB, MATRIX_TEST, MATRIX_REFERENCE) 

1230 

1231 RGB = np.tile(RGB, (6, 1)) 

1232 RGB_c = np.tile(RGB_c, (6, 1)) 

1233 np.testing.assert_allclose( 

1234 colour_correction_Cheung2004(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1235 RGB_c, 

1236 atol=TOLERANCE_ABSOLUTE_TESTS, 

1237 ) 

1238 

1239 RGB = np.reshape(RGB, (2, 3, 3)) 

1240 RGB_c = np.reshape(RGB_c, (2, 3, 3)) 

1241 np.testing.assert_allclose( 

1242 colour_correction_Cheung2004(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1243 RGB_c, 

1244 atol=TOLERANCE_ABSOLUTE_TESTS, 

1245 ) 

1246 

1247 @ignore_numpy_errors 

1248 @pytest.mark.skipif( 

1249 platform.system() in ("Darwin", "Linux"), 

1250 reason="Hangs on macOS and Linux", 

1251 ) 

1252 def test_nan_colour_correction_Cheung2004(self) -> None: # pragma: no cover 

1253 """ 

1254 Test :func:`colour.characterisation.correction.\ 

1255colour_correction_Cheung2004` definition nan support. 

1256 """ 

1257 

1258 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

1259 cases = np.array(list(set(product(cases, repeat=3)))) 

1260 for case in cases: 

1261 with contextlib.suppress(LinAlgError): 

1262 colour_correction_Cheung2004( 

1263 case, 

1264 np.vstack([case, case, case]), 

1265 np.transpose(np.vstack([case, case, case])), 

1266 ) 

1267 

1268 

1269class TestColourCorrectionFinlayson2015: 

1270 """ 

1271 Define :func:`colour.characterisation.correction.\ 

1272colour_correction_Finlayson2015` definition unit tests methods. 

1273 """ 

1274 

1275 def test_colour_correction_Finlayson2015(self) -> None: 

1276 """ 

1277 Test :func:`colour.characterisation.correction.\ 

1278colour_correction_Finlayson2015` definition. 

1279 """ 

1280 

1281 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1282 

1283 np.testing.assert_allclose( 

1284 colour_correction_Finlayson2015(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1285 np.array([0.13348722, 0.08439216, 0.05990144]), 

1286 atol=TOLERANCE_ABSOLUTE_TESTS, 

1287 ) 

1288 

1289 np.testing.assert_allclose( 

1290 colour_correction_Finlayson2015( 

1291 RGB, MATRIX_TEST, MATRIX_REFERENCE, degree=3 

1292 ), 

1293 np.array([0.13914542, 0.08602124, 0.06422973]), 

1294 atol=TOLERANCE_ABSOLUTE_TESTS, 

1295 ) 

1296 

1297 def test_n_dimensional_colour_correction_Finlayson2015(self) -> None: 

1298 """ 

1299 Test :func:`colour.characterisation.correction.\ 

1300colour_correction_Finlayson2015` definition n-dimensional support. 

1301 """ 

1302 

1303 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1304 RGB_c = colour_correction_Finlayson2015(RGB, MATRIX_TEST, MATRIX_REFERENCE) 

1305 

1306 RGB = np.tile(RGB, (6, 1)) 

1307 RGB_c = np.tile(RGB_c, (6, 1)) 

1308 np.testing.assert_allclose( 

1309 colour_correction_Finlayson2015(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1310 RGB_c, 

1311 atol=TOLERANCE_ABSOLUTE_TESTS, 

1312 ) 

1313 

1314 RGB = np.reshape(RGB, (2, 3, 3)) 

1315 RGB_c = np.reshape(RGB_c, (2, 3, 3)) 

1316 np.testing.assert_allclose( 

1317 colour_correction_Finlayson2015(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1318 RGB_c, 

1319 atol=TOLERANCE_ABSOLUTE_TESTS, 

1320 ) 

1321 

1322 @ignore_numpy_errors 

1323 @pytest.mark.skipif( 

1324 platform.system() in ("Darwin", "Linux"), 

1325 reason="Hangs on macOS and Linux", 

1326 ) 

1327 def test_nan_colour_correction_Finlayson2015(self) -> None: # pragma: no cover 

1328 """ 

1329 Test :func:`colour.characterisation.correction. 

1330 colour_correction_Finlayson2015` definition nan support. 

1331 """ 

1332 

1333 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

1334 cases = np.array(list(set(product(cases, repeat=3)))) 

1335 for case in cases: 

1336 with contextlib.suppress(LinAlgError): 

1337 colour_correction_Finlayson2015( 

1338 case, 

1339 np.vstack([case, case, case]), 

1340 np.transpose(np.vstack([case, case, case])), 

1341 ) 

1342 

1343 

1344class TestColourCorrectionVandermonde: 

1345 """ 

1346 Define :func:`colour.characterisation.correction.\ 

1347colour_correction_Vandermonde` definition unit tests methods. 

1348 """ 

1349 

1350 def test_colour_correction_Vandermonde(self) -> None: 

1351 """ 

1352 Test :func:`colour.characterisation.correction.\ 

1353colour_correction_Vandermonde` definition. 

1354 """ 

1355 

1356 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1357 

1358 np.testing.assert_allclose( 

1359 colour_correction_Vandermonde(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1360 np.array([0.15034881, 0.10503956, 0.10512517]), 

1361 atol=TOLERANCE_ABSOLUTE_TESTS, 

1362 ) 

1363 

1364 np.testing.assert_allclose( 

1365 colour_correction_Vandermonde(RGB, MATRIX_TEST, MATRIX_REFERENCE, degree=3), 

1366 np.array([0.15747814, 0.10035799, 0.06616709]), 

1367 atol=TOLERANCE_ABSOLUTE_TESTS, 

1368 ) 

1369 

1370 def test_n_dimensional_colour_correction_Vandermonde(self) -> None: 

1371 """ 

1372 Test :func:`colour.characterisation.correction.\ 

1373colour_correction_Vandermonde` definition n-dimensional support. 

1374 """ 

1375 

1376 RGB = np.array([0.17224810, 0.09170660, 0.06416938]) 

1377 RGB_c = colour_correction_Vandermonde(RGB, MATRIX_TEST, MATRIX_REFERENCE) 

1378 

1379 RGB = np.tile(RGB, (6, 1)) 

1380 RGB_c = np.tile(RGB_c, (6, 1)) 

1381 np.testing.assert_allclose( 

1382 colour_correction_Vandermonde(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1383 RGB_c, 

1384 atol=TOLERANCE_ABSOLUTE_TESTS, 

1385 ) 

1386 

1387 RGB = np.reshape(RGB, (2, 3, 3)) 

1388 RGB_c = np.reshape(RGB_c, (2, 3, 3)) 

1389 np.testing.assert_allclose( 

1390 colour_correction_Vandermonde(RGB, MATRIX_TEST, MATRIX_REFERENCE), 

1391 RGB_c, 

1392 atol=TOLERANCE_ABSOLUTE_TESTS, 

1393 ) 

1394 

1395 @ignore_numpy_errors 

1396 @pytest.mark.skipif( 

1397 platform.system() in ("Darwin", "Linux"), 

1398 reason="Hangs on macOS and Linux", 

1399 ) 

1400 def test_nan_colour_correction_Vandermonde(self) -> None: # pragma: no cover 

1401 """ 

1402 Test :func:`colour.characterisation.correction.\ 

1403colour_correction_Vandermonde` definition nan support. 

1404 """ 

1405 

1406 cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] 

1407 cases = np.array(list(set(product(cases, repeat=3)))) 

1408 for case in cases: 

1409 with contextlib.suppress(LinAlgError): 

1410 colour_correction_Vandermonde( 

1411 case, 

1412 np.vstack([case, case, case]), 

1413 np.transpose(np.vstack([case, case, case])), 

1414 )