Coverage for colour/notation/tests/test_munsell.py: 100%

430 statements  

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

1"""Define the unit tests for the :mod:`colour.notation.munsell` module.""" 

2 

3from __future__ import annotations 

4 

5import contextlib 

6import typing 

7from itertools import product 

8 

9import numpy as np 

10import pytest 

11 

12from colour.constants import TOLERANCE_ABSOLUTE_TESTS 

13 

14if typing.TYPE_CHECKING: 

15 from colour.hints import NDArrayFloat 

16 

17from colour.notation import ( 

18 munsell_value_ASTMD1535, 

19 munsell_value_Ladd1955, 

20 munsell_value_McCamy1987, 

21 munsell_value_Moon1943, 

22 munsell_value_Munsell1933, 

23 munsell_value_Priest1920, 

24 munsell_value_Saunderson1944, 

25) 

26from colour.notation.munsell import ( 

27 CCS_ILLUMINANT_MUNSELL, 

28 LCHab_to_munsell_specification, 

29 bounding_hues_from_renotation, 

30 hue_angle_to_hue, 

31 hue_to_ASTM_hue, 

32 hue_to_hue_angle, 

33 interpolation_method_from_renotation_ovoid, 

34 is_grey_munsell_colour, 

35 is_specification_in_renotation, 

36 maximum_chroma_from_renotation, 

37 munsell_colour_to_munsell_specification, 

38 munsell_colour_to_xyY, 

39 munsell_specification_to_munsell_colour, 

40 munsell_specification_to_xy, 

41 munsell_specification_to_xyY, 

42 normalise_munsell_specification, 

43 parse_munsell_colour, 

44 xy_from_renotation_ovoid, 

45 xyY_from_renotation, 

46 xyY_to_munsell_colour, 

47 xyY_to_munsell_specification, 

48) 

49from colour.utilities import ( 

50 as_array, 

51 as_float_array, 

52 domain_range_scale, 

53 ignore_numpy_errors, 

54 is_scipy_installed, 

55 tstack, 

56) 

57 

58__author__ = "Colour Developers" 

59__copyright__ = "Copyright 2013 Colour Developers" 

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

61__maintainer__ = "Colour Developers" 

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

63__status__ = "Production" 

64 

65__all__ = [ 

66 "MUNSELL_SPECIFICATIONS", 

67 "MUNSELL_GREYS_SPECIFICATIONS", 

68 "MUNSELL_EVEN_SPECIFICATIONS", 

69 "MUNSELL_BOUNDING_HUES", 

70 "MUNSELL_HUE_TO_ANGLE", 

71 "MUNSELL_HUE_TO_ASTM_HUE", 

72 "MUNSELL_INTERPOLATION_METHODS", 

73 "MUNSELL_XY_FROM_RENOTATION_OVOID", 

74 "TestMunsellValuePriest1920", 

75 "TestMunsellValueMunsell1933", 

76 "TestMunsellValueMoon1943", 

77 "TestMunsellValueSaunderson1944", 

78 "TestMunsellValueLadd1955", 

79 "TestMunsellValueMcCamy1992", 

80 "TestMunsellValueASTMD1535", 

81 "TestMunsellSpecification_to_xyY", 

82 "TestMunsellColour_to_xyY", 

83 "TestxyY_to_munsell_specification", 

84 "TestxyY_to_munsell_colour", 

85 "TestParseMunsellColour", 

86 "TestIsGreyMunsellColour", 

87 "TestNormaliseMunsellSpecification", 

88 "TestMunsellColourToMunsellSpecification", 

89 "TestMunsellSpecificationToMunsellColour", 

90 "Test_xyY_fromRenotation", 

91 "TestIsSpecificationInRenotation", 

92 "TestBoundingHuesFromRenotation", 

93 "TestHueToHueAngle", 

94 "TestHueAngleToHue", 

95 "TestHueTo_ASTM_hue", 

96 "TestInterpolationMethodFromRenotationOvoid", 

97 "Test_xy_fromRenotationOvoid", 

98 "TestLCHabToMunsellSpecification", 

99 "TestMaximumChromaFromRenotation", 

100 "TestMunsellSpecification_to_xy", 

101] 

102 

103 

104def _generate_unit_tests_specifications() -> tuple: # pragma: no cover 

105 """ 

106 Generate the unit tests specifications. 

107 

108 Returns 

109 ------- 

110 :class:`tuple` 

111 Tuples of unit tests specifications. The first tuple represents even 

112 specifications and their corresponding *CIE xyY* colourspace values. 

113 The tuple represents random specifications and their corresponding 

114 *CIE xyY* colourspace values. 

115 """ 

116 

117 from colour.notation import MUNSELL_COLOURS # noqa: PLC0415 

118 

119 np.random.seed(16) 

120 

121 indexes = np.arange(len(MUNSELL_COLOURS["real"])) 

122 np.random.shuffle(indexes) 

123 

124 specifications, specifications_r = [], [] 

125 for i in indexes: 

126 munsell_colour = "{} {}/{}".format(*MUNSELL_COLOURS["real"][i][0]) 

127 

128 try: 

129 specification = munsell_colour_to_munsell_specification(munsell_colour) 

130 specification_r = specification + np.hstack( 

131 [np.random.uniform(-1, 1, 3), [0]] 

132 ) 

133 

134 xyY = munsell_specification_to_xyY(specification) 

135 xyY_r = munsell_specification_to_xyY(specification_r) 

136 

137 _munsell_colour = xyY_to_munsell_colour(xyY) 

138 _munsell_colour_r = xyY_to_munsell_colour(xyY_r) 

139 

140 specifications.append([specification, xyY]) 

141 specifications_r.append([specification_r, xyY_r]) 

142 

143 if len(specifications) == 100: 

144 break 

145 except (AssertionError, RuntimeError, ValueError) as error: 

146 print(specification) # noqa: T201 

147 print(error) # noqa: T201 

148 

149 return specifications, specifications_r 

150 

151 

152MUNSELL_SPECIFICATIONS: NDArrayFloat = as_array( 

153 [ 

154 [ 

155 [7.18927191, 5.34025196, 16.05861170, 3.00000000], 

156 [0.16623068, 0.45684550, 0.22399519], 

157 ], 

158 [ 

159 [6.75749691, 9.44255422, 11.79641069, 3.00000000], 

160 [0.27297006, 0.36631948, 0.86427673], 

161 ], 

162 [ 

163 [8.44964118, 7.42750072, 3.22576700, 7.00000000], 

164 [0.35016714, 0.32764928, 0.48285006], 

165 ], 

166 [ 

167 [2.27432787, 1.59581362, 8.78434161, 2.00000000], 

168 [0.08494989, 0.35448667, 0.02152067], 

169 ], 

170 [ 

171 [9.82364034, 5.10755230, 3.23527358, 6.00000000], 

172 [0.38135277, 0.37024591, 0.20229405], 

173 ], 

174 [ 

175 [9.43158071, 6.93268985, 23.81322134, 9.00000000], 

176 [0.33551832, 0.17578313, 0.41043153], 

177 ], 

178 [ 

179 [7.48132776, 2.89467904, 8.47029950, 7.00000000], 

180 [0.53871366, 0.32437859, 0.05953010], 

181 ], 

182 [ 

183 [7.19717582, 1.79579794, 3.60295782, 2.00000000], 

184 [0.21606607, 0.29770875, 0.02567493], 

185 ], 

186 [ 

187 [7.77779715, 1.83619425, 6.42105231, 1.00000000], 

188 [0.15191376, 0.18640506, 0.02657869], 

189 ], 

190 [ 

191 [7.05646374, 8.15113870, 2.63767438, 10.00000000], 

192 [0.29508705, 0.29769267, 0.60266436], 

193 ], 

194 [ 

195 [3.03969874, 8.41779328, 5.82455544, 10.00000000], 

196 [0.25900977, 0.27198272, 0.65133417], 

197 ], 

198 [ 

199 [7.12616461, 4.61877951, 3.25823453, 9.00000000], 

200 [0.30806367, 0.27715003, 0.16105305], 

201 ], 

202 [ 

203 [9.75994064, 5.00164995, 13.80804118, 3.00000000], 

204 [0.16988405, 0.41104446, 0.19286318], 

205 ], 

206 [ 

207 [6.97677165, 8.25846010, 6.75337147, 2.00000000], 

208 [0.24767890, 0.32314418, 0.62194498], 

209 ], 

210 [ 

211 [3.30599914, 6.13663591, 6.17907561, 1.00000000], 

212 [0.23048205, 0.28607980, 0.30872546], 

213 ], 

214 [ 

215 [9.18340797, 7.81066836, 4.15020349, 7.00000000], 

216 [0.36349464, 0.33324537, 0.54413876], 

217 ], 

218 [ 

219 [8.10631072, 3.26448077, 9.90156782, 1.00000000], 

220 [0.14334034, 0.18086971, 0.07589385], 

221 ], 

222 [ 

223 [5.69603430, 5.94554581, 26.45021730, 3.00000000], 

224 [0.10047143, 0.54485967, 0.28688700], 

225 ], 

226 [ 

227 [7.52941160, 3.10193862, 2.03837398, 2.00000000], 

228 [0.26959492, 0.31200708, 0.06836215], 

229 ], 

230 [ 

231 [9.01080996, 8.59514291, 5.06552338, 2.00000000], 

232 [0.26018550, 0.31561977, 0.68515300], 

233 ], 

234 [ 

235 [9.93350418, 6.92619502, 2.76022400, 3.00000000], 

236 [0.28894781, 0.33443098, 0.40952934], 

237 ], 

238 [ 

239 [9.96785141, 1.11835600, 3.99853550, 9.00000000], 

240 [0.31352711, 0.20634513, 0.01346611], 

241 ], 

242 [ 

243 [9.99840409, 3.19309711, 5.82065904, 10.00000000], 

244 [0.25414765, 0.20939962, 0.07251951], 

245 ], 

246 [ 

247 [9.27080064, 2.36096768, 2.35873176, 9.00000000], 

248 [0.31412335, 0.26537265, 0.04053697], 

249 ], 

250 [ 

251 [9.85478063, 4.04717472, 2.09829596, 5.00000000], 

252 [0.34970053, 0.37571825, 0.12005323], 

253 ], 

254 [ 

255 [8.02558980, 6.36819633, 4.60141462, 5.00000000], 

256 [0.37965729, 0.40977154, 0.33650122], 

257 ], 

258 [ 

259 [7.19056185, 7.66646120, 10.23200084, 3.00000000], 

260 [0.24865695, 0.39205285, 0.52051894], 

261 ], 

262 [ 

263 [9.27459121, 8.93329764, 2.82639874, 3.00000000], 

264 [0.29214864, 0.33503056, 0.75302151], 

265 ], 

266 [ 

267 [6.56514645, 4.20156404, 5.64991156, 9.00000000], 

268 [0.30195484, 0.24513718, 0.13037695], 

269 ], 

270 [ 

271 [9.90928732, 9.28999046, 17.40567009, 4.00000000], 

272 [0.30741363, 0.49906135, 0.82974391], 

273 ], 

274 [ 

275 [6.66033139, 7.82125559, 2.83656023, 10.00000000], 

276 [0.29234640, 0.29513484, 0.54589974], 

277 ], 

278 [ 

279 [7.09563810, 9.27179818, 3.41469395, 6.00000000], 

280 [0.34662788, 0.34241664, 0.82569659], 

281 ], 

282 [ 

283 [8.06308980, 7.35943482, 4.42642439, 8.00000000], 

284 [0.34290892, 0.30832480, 0.47244825], 

285 ], 

286 [ 

287 [6.73937163, 4.45035611, 17.29157077, 2.00000000], 

288 [0.09315578, 0.28811552, 0.14817605], 

289 ], 

290 [ 

291 [4.46091279, 4.97623184, 8.27347386, 3.00000000], 

292 [0.25257308, 0.42043736, 0.19064074], 

293 ], 

294 [ 

295 [9.59823267, 4.43380834, 4.49782459, 3.00000000], 

296 [0.26156547, 0.35357051, 0.14694714], 

297 ], 

298 [ 

299 [5.68236594, 5.20647917, 7.98231240, 4.00000000], 

300 [0.36926047, 0.50258483, 0.21135463], 

301 ], 

302 [ 

303 [6.75749120, 9.13825880, 5.79055270, 3.00000000], 

304 [0.28340044, 0.35597801, 0.79643638], 

305 ], 

306 [ 

307 [3.45818284, 2.10857125, 4.85791418, 8.00000000], 

308 [0.34999194, 0.24490799, 0.03328770], 

309 ], 

310 [ 

311 [2.88591190, 3.36970167, 10.21423066, 7.00000000], 

312 [0.51380217, 0.28835519, 0.08106070], 

313 ], 

314 [ 

315 [1.71270774, 1.53669828, 3.39403462, 9.00000000], 

316 [0.26997438, 0.21369276, 0.02038916], 

317 ], 

318 [ 

319 [4.90655199, 3.23724997, 18.85327042, 2.00000000], 

320 [0.05681430, 0.29884718, 0.07459423], 

321 ], 

322 [ 

323 [2.60942297, 4.07393682, 4.85686834, 8.00000000], 

324 [0.33889111, 0.27070427, 0.12180360], 

325 ], 

326 [ 

327 [7.80566706, 4.07902945, 30.88921341, 9.00000000], 

328 [0.30271734, 0.09713576, 0.12213854], 

329 ], 

330 [ 

331 [9.83519352, 8.12251250, 10.73221172, 5.00000000], 

332 [0.42441612, 0.48582983, 0.59759029], 

333 ], 

334 [ 

335 [7.35317886, 7.08150026, 4.62737592, 5.00000000], 

336 [0.37586606, 0.40232896, 0.43144075], 

337 ], 

338 [ 

339 [7.77389803, 6.90019200, 8.10157277, 9.00000000], 

340 [0.31242681, 0.25756495, 0.40592957], 

341 ], 

342 [ 

343 [4.87250279, 4.19552668, 18.70870067, 9.00000000], 

344 [0.26755998, 0.13995403, 0.12996294], 

345 ], 

346 [ 

347 [7.38366474, 3.35764668, 12.11239914, 9.00000000], 

348 [0.30031035, 0.16953394, 0.08045698], 

349 ], 

350 [ 

351 [5.11434827, 6.25840324, 18.46717586, 9.00000000], 

352 [0.27423716, 0.17360892, 0.32315057], 

353 ], 

354 [ 

355 [6.50234711, 7.39248581, 8.42947132, 8.00000000], 

356 [0.36895615, 0.29211972, 0.47748118], 

357 ], 

358 [ 

359 [5.12057785, 6.74131875, 9.90906687, 9.00000000], 

360 [0.28824634, 0.23317117, 0.38435902], 

361 ], 

362 [ 

363 [7.97767039, 3.80398969, 4.31555212, 7.00000000], 

364 [0.41347359, 0.33271080, 0.10489086], 

365 ], 

366 [ 

367 [8.28257058, 4.99288145, 4.13426077, 10.00000000], 

368 [0.27534267, 0.26445867, 0.19209471], 

369 ], 

370 [ 

371 [2.27833490, 3.13652250, 12.74644014, 9.00000000], 

372 [0.24604475, 0.14443079, 0.06991948], 

373 ], 

374 [ 

375 [4.17788614, 4.56875266, 4.69980113, 8.00000000], 

376 [0.34608761, 0.28369563, 0.15715775], 

377 ], 

378 [ 

379 [5.52166738, 2.72767471, 10.73842907, 8.00000000], 

380 [0.41659713, 0.21166956, 0.05302211], 

381 ], 

382 [ 

383 [1.96964226, 5.83362103, 28.30224843, 3.00000000], 

384 [0.11730240, 0.75674218, 0.27454364], 

385 ], 

386 [ 

387 [4.22034979, 7.29875716, 8.00238058, 7.00000000], 

388 [0.40163259, 0.32283516, 0.46329585], 

389 ], 

390 [ 

391 [8.10122939, 7.84099254, 13.76355873, 4.00000000], 

392 [0.34218201, 0.54357248, 0.54919251], 

393 ], 

394 [ 

395 [6.93175327, 3.88633728, 4.19698393, 4.00000000], 

396 [0.33428973, 0.42675447, 0.10987617], 

397 ], 

398 [ 

399 [7.17972997, 7.76394588, 5.52955464, 5.00000000], 

400 [0.38311308, 0.41154624, 0.53641155], 

401 ], 

402 [ 

403 [7.44539380, 2.45826571, 18.17553552, 8.00000000], 

404 [0.49593109, 0.16155048, 0.04361652], 

405 ], 

406 [ 

407 [6.57942671, 5.70954742, 4.21109407, 7.00000000], 

408 [0.37391946, 0.32682537, 0.26124266], 

409 ], 

410 [ 

411 [7.07918723, 3.60945090, 5.18867792, 10.00000000], 

412 [0.24565114, 0.22732867, 0.09371006], 

413 ], 

414 [ 

415 [9.19704045, 7.64270856, 20.12511878, 4.00000000], 

416 [0.31036980, 0.63853638, 0.51669329], 

417 ], 

418 [ 

419 [7.38744649, 2.69345468, 6.96087944, 8.00000000], 

420 [0.40651600, 0.25385677, 0.05175378], 

421 ], 

422 [ 

423 [5.71814887, 1.35726940, 4.25987210, 6.00000000], 

424 [0.55344553, 0.38963438, 0.01720090], 

425 ], 

426 [ 

427 [7.65193815, 5.15801515, 17.63637606, 8.00000000], 

428 [0.47344711, 0.24662331, 0.20688549], 

429 ], 

430 [ 

431 [5.80035357, 8.46843486, 3.91395266, 7.00000000], 

432 [0.35101966, 0.32394467, 0.66087042], 

433 ], 

434 [ 

435 [2.64017362, 6.58022725, 25.27474395, 3.00000000], 

436 [0.15857410, 0.65244571, 0.36322040], 

437 ], 

438 [ 

439 [6.81904597, 7.52735613, 14.14454379, 5.00000000], 

440 [0.46547138, 0.50598542, 0.49837113], 

441 ], 

442 [ 

443 [1.72002655, 2.00166767, 15.17756223, 3.00000000], 

444 [0.06593801, 0.78772140, 0.03052292], 

445 ], 

446 [ 

447 [7.17387426, 7.40686142, 4.67300544, 6.00000000], 

448 [0.38508722, 0.36570863, 0.47968081], 

449 ], 

450 [ 

451 [5.66354474, 8.29189799, 7.88289254, 2.00000000], 

452 [0.24153734, 0.33167097, 0.62803620], 

453 ], 

454 [ 

455 [4.96369167, 6.11709577, 2.83010340, 9.00000000], 

456 [0.30299188, 0.28933160, 0.30644773], 

457 ], 

458 [ 

459 [9.86666880, 3.53860824, 3.76283439, 4.00000000], 

460 [0.30878925, 0.40194660, 0.08984394], 

461 ], 

462 [ 

463 [2.54469570, 1.94205063, 6.51472847, 8.00000000], 

464 [0.34838418, 0.21610764, 0.02905603], 

465 ], 

466 [ 

467 [7.41841874, 7.28061720, 7.52688380, 5.00000000], 

468 [0.41055673, 0.44673738, 0.46058155], 

469 ], 

470 [ 

471 [1.75980807, 3.96245086, 15.45788733, 3.00000000], 

472 [0.19389711, 0.63957903, 0.11461936], 

473 ], 

474 [ 

475 [4.71729705, 3.34696841, 7.66988506, 6.00000000], 

476 [0.52645405, 0.39761412, 0.07992475], 

477 ], 

478 [ 

479 [2.08610570, 6.73042407, 7.05471426, 1.00000000], 

480 [0.22763195, 0.29145327, 0.38290628], 

481 ], 

482 [ 

483 [2.27268990, 3.26447649, 7.69468499, 6.00000000], 

484 [0.53002779, 0.37341819, 0.07589364], 

485 ], 

486 [ 

487 [7.23049017, 4.12309620, 15.10943786, 8.00000000], 

488 [0.46585026, 0.23748776, 0.12506155], 

489 ], 

490 [ 

491 [6.64140481, 2.17555713, 5.41523047, 7.00000000], 

492 [0.46318547, 0.31027036, 0.03511077], 

493 ], 

494 [ 

495 [7.37490620, 1.75480377, 16.97212717, 9.00000000], 

496 [0.28825940, 0.09568892, 0.02478061], 

497 ], 

498 [ 

499 [4.33290089, 2.10328054, 2.19891461, 10.00000000], 

500 [0.25933572, 0.26024656, 0.03314673], 

501 ], 

502 [ 

503 [9.12491352, 3.86980063, 15.33312818, 3.00000000], 

504 [0.12639463, 0.43809589, 0.10886288], 

505 ], 

506 [ 

507 [3.39633194, 4.88689265, 23.54167471, 3.00000000], 

508 [0.10976610, 0.64434470, 0.18295497], 

509 ], 

510 [ 

511 [2.61214646, 1.14977763, 7.81503339, 2.00000000], 

512 [0.06586815, 0.34294740, 0.01392758], 

513 ], 

514 [ 

515 [3.29714039, 2.54520254, 13.61325521, 8.00000000], 

516 [0.39022459, 0.16803475, 0.04650827], 

517 ], 

518 [ 

519 [2.78196233, 4.33925419, 16.17790238, 3.00000000], 

520 [0.17272546, 0.59343082, 0.14004876], 

521 ], 

522 [ 

523 [7.51260170, 3.39633095, 9.42584908, 2.00000000], 

524 [0.14825319, 0.28502763, 0.08240516], 

525 ], 

526 [ 

527 [4.46597913, 8.02986601, 3.85801792, 1.00000000], 

528 [0.26863443, 0.30193859, 0.58136398], 

529 ], 

530 [ 

531 [2.29263540, 4.86650662, 7.08151101, 8.00000000], 

532 [0.34377887, 0.26102802, 0.18122849], 

533 ], 

534 [ 

535 [6.82015249, 5.14066765, 21.13348572, 9.00000000], 

536 [0.29448492, 0.15338239, 0.20529997], 

537 ], 

538 [ 

539 [4.31245640, 4.85614027, 11.50803662, 6.00000000], 

540 [0.54231929, 0.40629376, 0.18035446], 

541 ], 

542 [ 

543 [8.22108412, 5.80818951, 3.94579416, 8.00000000], 

544 [0.34702328, 0.30674052, 0.27178470], 

545 ], 

546 [ 

547 [8.31388115, 4.66785495, 3.69434623, 5.00000000], 

548 [0.38078540, 0.41116296, 0.16493242], 

549 ], 

550 [ 

551 [3.40490668, 6.59689139, 9.20874115, 7.00000000], 

552 [0.41967010, 0.31821655, 0.36537324], 

553 ], 

554 ], 

555 dtype=object, # pyright: ignore 

556) 

557 

558MUNSELL_GREYS_SPECIFICATIONS: NDArrayFloat = as_array( 

559 list( 

560 zip( 

561 np.linspace(0, 10, 25)[:, None], 

562 ( 

563 [0.31006, 0.31616, 0.00000000], 

564 [0.31006, 0.31616, 0.00473582], 

565 [0.31006, 0.31616, 0.00961944], 

566 [0.31006, 0.31616, 0.01545756], 

567 [0.31006, 0.31616, 0.02293343], 

568 [0.31006, 0.31616, 0.03261914], 

569 [0.31006, 0.31616, 0.04498800], 

570 [0.31006, 0.31616, 0.06042690], 

571 [0.31006, 0.31616, 0.07924864], 

572 [0.31006, 0.31616, 0.10170428], 

573 [0.31006, 0.31616, 0.12799549], 

574 [0.31006, 0.31616, 0.15828689], 

575 [0.31006, 0.31616, 0.19271844], 

576 [0.31006, 0.31616, 0.23141772], 

577 [0.31006, 0.31616, 0.27451233], 

578 [0.31006, 0.31616, 0.32214224], 

579 [0.31006, 0.31616, 0.37447210], 

580 [0.31006, 0.31616, 0.43170362], 

581 [0.31006, 0.31616, 0.49408790], 

582 [0.31006, 0.31616, 0.56193781], 

583 [0.31006, 0.31616, 0.63564030], 

584 [0.31006, 0.31616, 0.71566876], 

585 [0.31006, 0.31616, 0.80259539], 

586 [0.31006, 0.31616, 0.89710353], 

587 [0.31006, 0.31616, 1.00000000], 

588 ), 

589 strict=True, 

590 ) 

591 ), 

592 dtype=object, # pyright: ignore 

593) 

594 

595MUNSELL_EVEN_SPECIFICATIONS: NDArrayFloat = as_array( 

596 [ 

597 [(7.5, 6.0, 16.0, 3), [0.18320000, 0.44140000, 0.29301153]], 

598 [(7.5, 9.0, 12.0, 3), [0.24190000, 0.39850000, 0.76695586]], 

599 [(7.5, 8.0, 4.0, 7), [0.35640000, 0.32790000, 0.57619628]], 

600 [(2.5, 2.0, 8.0, 2), [0.15570000, 0.35170000, 0.03048116]], 

601 [(10.0, 6.0, 4.0, 6), [0.38610000, 0.37670000, 0.29301153]], 

602 [(10.0, 6.0, 24.0, 9), [0.34410000, 0.16980000, 0.29301153]], 

603 [(7.5, 2.0, 8.0, 7), [0.54330000, 0.30270000, 0.03048116]], 

604 [(7.5, 1.0, 4.0, 2), [0.17020000, 0.27680000, 0.01179925]], 

605 [(7.5, 1.0, 6.0, 1), [0.13030000, 0.16390000, 0.01179925]], 

606 [(7.5, 9.0, 2.0, 10), [0.30150000, 0.30520000, 0.76695586]], 

607 [(2.5, 8.0, 6.0, 10), [0.25620000, 0.27090000, 0.57619628]], 

608 [(7.5, 5.0, 4.0, 9), [0.31000000, 0.27500000, 0.19271844]], 

609 [(10.0, 5.0, 14.0, 3), [0.16710000, 0.40890000, 0.19271844]], 

610 [(7.5, 9.0, 6.0, 2), [0.25430000, 0.32200000, 0.76695586]], 

611 [(2.5, 6.0, 6.0, 1), [0.23120000, 0.28990000, 0.29301153]], 

612 [(10.0, 8.0, 4.0, 7), [0.36210000, 0.33490000, 0.57619628]], 

613 [(7.5, 4.0, 10.0, 1), [0.16010000, 0.20280000, 0.11700751]], 

614 [(5.0, 5.0, 26.0, 3), [0.07840000, 0.57610000, 0.19271844]], 

615 [(7.5, 3.0, 2.0, 2), [0.26990000, 0.31200000, 0.06391178]], 

616 [(10.0, 9.0, 6.0, 2), [0.25010000, 0.31180000, 0.76695586]], 

617 [(10.0, 6.0, 2.0, 3), [0.29290000, 0.33030000, 0.29301153]], 

618 [(10.0, 1.0, 4.0, 9), [0.31320000, 0.20320000, 0.01179925]], 

619 [(10.0, 3.0, 6.0, 10), [0.25110000, 0.20310000, 0.06391178]], 

620 [(10.0, 2.0, 2.0, 9), [0.31610000, 0.26910000, 0.03048116]], 

621 [(10.0, 5.0, 2.0, 5), [0.34220000, 0.36480000, 0.19271844]], 

622 [(7.5, 6.0, 4.0, 5), [0.37450000, 0.40040000, 0.29301153]], 

623 [(7.5, 7.0, 10.0, 3), [0.24450000, 0.39140000, 0.41985394]], 

624 [(10.0, 9.0, 2.0, 3), [0.29650000, 0.32930000, 0.76695586]], 

625 [(7.5, 4.0, 6.0, 9), [0.30760000, 0.24160000, 0.11700751]], 

626 [(10.0, 9.0, 18.0, 4), [0.30320000, 0.57480000, 0.76695586]], 

627 [(7.5, 7.0, 2.0, 10), [0.29820000, 0.30030000, 0.41985394]], 

628 [(7.5, 9.0, 4.0, 6), [0.36790000, 0.35850000, 0.76695586]], 

629 [(7.5, 7.0, 4.0, 8), [0.33890000, 0.30790000, 0.41985394]], 

630 [(7.5, 5.0, 18.0, 2), [0.09820000, 0.28280000, 0.19271844]], 

631 [(5.0, 5.0, 8.0, 3), [0.25110000, 0.41070000, 0.19271844]], 

632 [(10.0, 5.0, 4.0, 3), [0.27110000, 0.34550000, 0.19271844]], 

633 [(5.0, 5.0, 8.0, 4), [0.38150000, 0.50930000, 0.19271844]], 

634 [(7.5, 9.0, 6.0, 3), [0.27630000, 0.36070000, 0.76695586]], 

635 [(2.5, 2.0, 4.0, 8), [0.33820000, 0.24960000, 0.03048116]], 

636 [(2.5, 4.0, 10.0, 7), [0.47740000, 0.29690000, 0.11700751]], 

637 [(2.5, 2.0, 4.0, 9), [0.27580000, 0.22080000, 0.03048116]], 

638 [(5.0, 4.0, 18.0, 2), [0.08280000, 0.31080000, 0.11700751]], 

639 [(2.5, 5.0, 4.0, 8), [0.32980000, 0.28690000, 0.19271844]], 

640 [(7.5, 4.0, 30.0, 9), [0.29690000, 0.09790000, 0.11700751]], 

641 [(10.0, 8.0, 10.0, 5), [0.41900000, 0.47910000, 0.57619628]], 

642 [(7.5, 8.0, 4.0, 5), [0.36220000, 0.38610000, 0.57619628]], 

643 [(7.5, 6.0, 8.0, 9), [0.30990000, 0.25020000, 0.29301153]], 

644 [(5.0, 5.0, 18.0, 9), [0.27180000, 0.16040000, 0.19271844]], 

645 [(7.5, 4.0, 12.0, 9), [0.30450000, 0.19050000, 0.11700751]], 

646 [(5.0, 6.0, 18.0, 9), [0.27310000, 0.17380000, 0.29301153]], 

647 [(7.5, 8.0, 8.0, 8), [0.36820000, 0.29830000, 0.57619628]], 

648 [(5.0, 6.0, 10.0, 9), [0.28620000, 0.22600000, 0.29301153]], 

649 [(7.5, 3.0, 4.0, 7), [0.42400000, 0.33020000, 0.06391178]], 

650 [(7.5, 4.0, 4.0, 10), [0.26570000, 0.25280000, 0.11700751]], 

651 [(2.5, 4.0, 12.0, 9), [0.25590000, 0.17300000, 0.11700751]], 

652 [(5.0, 4.0, 4.0, 8), [0.34910000, 0.28720000, 0.11700751]], 

653 [(5.0, 3.0, 10.0, 8), [0.40730000, 0.22350000, 0.06391178]], 

654 [(2.5, 5.0, 28.0, 3), [0.07940000, 0.73850000, 0.19271844]], 

655 [(5.0, 8.0, 8.0, 7), [0.40010000, 0.32630000, 0.57619628]], 

656 [(7.5, 8.0, 14.0, 4), [0.35460000, 0.54900000, 0.57619628]], 

657 [(7.5, 3.0, 4.0, 4), [0.32700000, 0.42880000, 0.06391178]], 

658 [(7.5, 7.0, 6.0, 5), [0.39430000, 0.42640000, 0.41985394]], 

659 [(7.5, 3.0, 18.0, 8), [0.51300000, 0.18930000, 0.06391178]], 

660 [(7.5, 5.0, 4.0, 7), [0.38060000, 0.32940000, 0.19271844]], 

661 [(7.5, 3.0, 6.0, 10), [0.23110000, 0.20100000, 0.06391178]], 

662 [(10.0, 7.0, 20.0, 4), [0.28160000, 0.65630000, 0.41985394]], 

663 [(7.5, 3.0, 6.0, 8), [0.39900000, 0.27080000, 0.06391178]], 

664 [(5.0, 1.0, 4.0, 6), [0.56600000, 0.37950000, 0.01179925]], 

665 [(7.5, 6.0, 18.0, 8), [0.45810000, 0.25490000, 0.29301153]], 

666 [(5.0, 9.0, 4.0, 7), [0.34950000, 0.32260000, 0.76695586]], 

667 [(2.5, 6.0, 26.0, 3), [0.13400000, 0.68710000, 0.29301153]], 

668 [(7.5, 8.0, 14.0, 5), [0.45740000, 0.50620000, 0.57619628]], 

669 [(2.5, 2.0, 16.0, 3), [0.03290000, 0.73580000, 0.03048116]], 

670 [(7.5, 8.0, 4.0, 6), [0.36990000, 0.35860000, 0.57619628]], 

671 [(5.0, 8.0, 8.0, 2), [0.24190000, 0.33520000, 0.57619628]], 

672 [(5.0, 6.0, 2.0, 9), [0.30500000, 0.29670000, 0.29301153]], 

673 [(10.0, 4.0, 4.0, 4), [0.31000000, 0.40180000, 0.11700751]], 

674 [(2.5, 2.0, 6.0, 8), [0.34700000, 0.22590000, 0.03048116]], 

675 [(7.5, 7.0, 8.0, 5), [0.41840000, 0.45680000, 0.41985394]], 

676 [(2.5, 3.0, 16.0, 3), [0.13410000, 0.64200000, 0.06391178]], 

677 [(5.0, 3.0, 8.0, 6), [0.54560000, 0.40400000, 0.06391178]], 

678 [(2.5, 6.0, 8.0, 1), [0.20800000, 0.27890000, 0.29301153]], 

679 [(2.5, 4.0, 8.0, 6), [0.50710000, 0.37770000, 0.11700751]], 

680 [(7.5, 5.0, 16.0, 8), [0.46170000, 0.25060000, 0.19271844]], 

681 [(7.5, 2.0, 6.0, 7), [0.48750000, 0.31230000, 0.03048116]], 

682 [(7.5, 2.0, 16.0, 9), [0.29220000, 0.11060000, 0.03048116]], 

683 [(5.0, 2.0, 2.0, 10), [0.26380000, 0.26240000, 0.03048116]], 

684 [(10.0, 3.0, 16.0, 3), [0.09250000, 0.42750000, 0.06391178]], 

685 [(2.5, 5.0, 24.0, 3), [0.11880000, 0.69180000, 0.19271844]], 

686 [(2.5, 1.0, 8.0, 2), [0.04760000, 0.34580000, 0.01179925]], 

687 [(2.5, 2.0, 14.0, 8), [0.37110000, 0.14490000, 0.03048116]], 

688 [(2.5, 5.0, 16.0, 3), [0.20050000, 0.57590000, 0.19271844]], 

689 [(7.5, 3.0, 10.0, 2), [0.13260000, 0.27840000, 0.06391178]], 

690 [(5.0, 8.0, 4.0, 1), [0.26710000, 0.29980000, 0.57619628]], 

691 [(2.5, 5.0, 8.0, 8), [0.34900000, 0.25700000, 0.19271844]], 

692 [(7.5, 5.0, 22.0, 9), [0.30380000, 0.15000000, 0.19271844]], 

693 [(5.0, 5.0, 12.0, 6), [0.54220000, 0.41410000, 0.19271844]], 

694 [(7.5, 5.0, 4.0, 8), [0.35150000, 0.30240000, 0.19271844]], 

695 [(7.5, 5.0, 4.0, 5), [0.38500000, 0.41200000, 0.19271844]], 

696 [(2.5, 6.0, 10.0, 7), [0.43200000, 0.31180000, 0.29301153]], 

697 [(8.0, 2, 14.0, 1), [0.07257382, 0.10413956, 0.03048116]], 

698 ], 

699 dtype=object, # pyright: ignore 

700) 

701 

702MUNSELL_BOUNDING_HUES: NDArrayFloat = as_float_array( 

703 [ 

704 ((5.0, 3.0), (7.5, 3.0)), 

705 ((5.0, 3.0), (7.5, 3.0)), 

706 ((7.5, 7.0), (10, 7.0)), 

707 ((10, 3.0), (2.5, 2.0)), 

708 ((7.5, 6.0), (10, 6.0)), 

709 ((7.5, 9.0), (10, 9.0)), 

710 ((5.0, 7.0), (7.5, 7.0)), 

711 ((5.0, 2.0), (7.5, 2.0)), 

712 ((7.5, 1.0), (10, 1.0)), 

713 ((5.0, 10.0), (7.5, 10.0)), 

714 ((2.5, 10.0), (5.0, 10.0)), 

715 ((5.0, 9.0), (7.5, 9.0)), 

716 ((7.5, 3.0), (10, 3.0)), 

717 ((5.0, 2.0), (7.5, 2.0)), 

718 ((2.5, 1.0), (5.0, 1.0)), 

719 ((7.5, 7.0), (10, 7.0)), 

720 ((7.5, 1.0), (10, 1.0)), 

721 ((5.0, 3.0), (7.5, 3.0)), 

722 ((7.5, 2.0), (10, 2.0)), 

723 ((7.5, 2.0), (10, 2.0)), 

724 ((7.5, 3.0), (10, 3.0)), 

725 ((7.5, 9.0), (10, 9.0)), 

726 ((7.5, 10.0), (10, 10.0)), 

727 ((7.5, 9.0), (10, 9.0)), 

728 ((7.5, 5.0), (10, 5.0)), 

729 ((7.5, 5.0), (10, 5.0)), 

730 ((5.0, 3.0), (7.5, 3.0)), 

731 ((7.5, 3.0), (10, 3.0)), 

732 ((5.0, 9.0), (7.5, 9.0)), 

733 ((7.5, 4.0), (10, 4.0)), 

734 ((5.0, 10.0), (7.5, 10.0)), 

735 ((5.0, 6.0), (7.5, 6.0)), 

736 ((7.5, 8.0), (10, 8.0)), 

737 ((5.0, 2.0), (7.5, 2.0)), 

738 ((2.5, 3.0), (5.0, 3.0)), 

739 ((7.5, 3.0), (10, 3.0)), 

740 ((5.0, 4.0), (7.5, 4.0)), 

741 ((5.0, 3.0), (7.5, 3.0)), 

742 ((2.5, 8.0), (5.0, 8.0)), 

743 ((2.5, 7.0), (5.0, 7.0)), 

744 ((10, 10), (2.5, 9.0)), 

745 ((2.5, 2.0), (5.0, 2.0)), 

746 ((2.5, 8.0), (5.0, 8.0)), 

747 ((7.5, 9.0), (10, 9.0)), 

748 ((7.5, 5.0), (10, 5.0)), 

749 ((5.0, 5.0), (7.5, 5.0)), 

750 ((7.5, 9.0), (10, 9.0)), 

751 ((2.5, 9.0), (5.0, 9.0)), 

752 ((5.0, 9.0), (7.5, 9.0)), 

753 ((5.0, 9.0), (7.5, 9.0)), 

754 ((5.0, 8.0), (7.5, 8.0)), 

755 ((5.0, 9.0), (7.5, 9.0)), 

756 ((7.5, 7.0), (10, 7.0)), 

757 ((7.5, 10.0), (10, 10.0)), 

758 ((10, 10), (2.5, 9.0)), 

759 ((2.5, 8.0), (5.0, 8.0)), 

760 ((5.0, 8.0), (7.5, 8.0)), 

761 ((10, 4.0), (2.5, 3.0)), 

762 ((2.5, 7.0), (5.0, 7.0)), 

763 ((7.5, 4.0), (10, 4.0)), 

764 ((5.0, 4.0), (7.5, 4.0)), 

765 ((5.0, 5.0), (7.5, 5.0)), 

766 ((5.0, 8.0), (7.5, 8.0)), 

767 ((5.0, 7.0), (7.5, 7.0)), 

768 ((5.0, 10.0), (7.5, 10.0)), 

769 ((7.5, 4.0), (10, 4.0)), 

770 ((5.0, 8.0), (7.5, 8.0)), 

771 ((5.0, 6.0), (7.5, 6.0)), 

772 ((7.5, 8.0), (10, 8.0)), 

773 ((5.0, 7.0), (7.5, 7.0)), 

774 ((2.5, 3.0), (5.0, 3.0)), 

775 ((5.0, 5.0), (7.5, 5.0)), 

776 ((10, 4.0), (2.5, 3.0)), 

777 ((5.0, 6.0), (7.5, 6.0)), 

778 ((5.0, 2.0), (7.5, 2.0)), 

779 ((2.5, 9.0), (5.0, 9.0)), 

780 ((7.5, 4.0), (10, 4.0)), 

781 ((2.5, 8.0), (5.0, 8.0)), 

782 ((5.0, 5.0), (7.5, 5.0)), 

783 ((10, 4.0), (2.5, 3.0)), 

784 ((2.5, 6.0), (5.0, 6.0)), 

785 ((10, 2.0), (2.5, 1.0)), 

786 ((10, 7.0), (2.5, 6.0)), 

787 ((5.0, 8.0), (7.5, 8.0)), 

788 ((5.0, 7.0), (7.5, 7.0)), 

789 ((5.0, 9.0), (7.5, 9.0)), 

790 ((2.5, 10.0), (5.0, 10.0)), 

791 ((7.5, 3.0), (10, 3.0)), 

792 ((2.5, 3.0), (5.0, 3.0)), 

793 ((2.5, 2.0), (5.0, 2.0)), 

794 ((2.5, 8.0), (5.0, 8.0)), 

795 ((2.5, 3.0), (5.0, 3.0)), 

796 ((7.5, 2.0), (10, 2.0)), 

797 ((2.5, 1.0), (5.0, 1.0)), 

798 ((10, 9.0), (2.5, 8.0)), 

799 ((5.0, 9.0), (7.5, 9.0)), 

800 ((2.5, 6.0), (5.0, 6.0)), 

801 ((7.5, 8.0), (10, 8.0)), 

802 ((7.5, 5.0), (10, 5.0)), 

803 ((2.5, 7.0), (5.0, 7.0)), 

804 ] 

805) 

806 

807MUNSELL_HUE_TO_ANGLE: NDArrayFloat = np.array( 

808 [ 

809 [2.5, 1, 208.750], 

810 [2.5, 2, 153.750], 

811 [2.5, 3, 118.750], 

812 [2.5, 4, 63.750], 

813 [2.5, 5, 39.375], 

814 [2.5, 6, 16.875], 

815 [2.5, 7, 348.750], 

816 [2.5, 8, 300.000], 

817 [2.5, 9, 251.250], 

818 [2.5, 10, 236.250], 

819 [5.0, 1, 225.000], 

820 [5.0, 2, 160.000], 

821 [5.0, 3, 135.000], 

822 [5.0, 4, 70.000], 

823 [5.0, 5, 45.000], 

824 [5.0, 6, 22.500], 

825 [5.0, 7, 0.000], 

826 [5.0, 8, 315.000], 

827 [5.0, 9, 255.000], 

828 [5.0, 10, 240.000], 

829 [7.5, 1, 228.750], 

830 [7.5, 2, 176.250], 

831 [7.5, 3, 141.250], 

832 [7.5, 4, 86.250], 

833 [7.5, 5, 51.250], 

834 [7.5, 6, 28.125], 

835 [7.5, 7, 5.625], 

836 [7.5, 8, 326.250], 

837 [7.5, 9, 270.000], 

838 [7.5, 10, 243.750], 

839 [10.0, 1, 232.500], 

840 [10.0, 2, 192.500], 

841 [10.0, 3, 147.500], 

842 [10.0, 4, 102.500], 

843 [10.0, 5, 57.500], 

844 [10.0, 6, 33.750], 

845 [10.0, 7, 11.250], 

846 [10.0, 8, 337.500], 

847 [10.0, 9, 285.000], 

848 [10.0, 10, 247.500], 

849 ] 

850) 

851 

852MUNSELL_HUE_TO_ASTM_HUE: NDArrayFloat = np.array( 

853 [ 

854 [2.5, 0, 72.5], 

855 [2.5, 1, 62.5], 

856 [2.5, 2, 52.5], 

857 [2.5, 3, 42.5], 

858 [2.5, 4, 32.5], 

859 [2.5, 5, 22.5], 

860 [2.5, 6, 12.5], 

861 [2.5, 7, 2.5], 

862 [2.5, 8, 92.5], 

863 [2.5, 9, 82.5], 

864 [2.5, 10, 72.5], 

865 [5.0, 0, 75.0], 

866 [5.0, 1, 65.0], 

867 [5.0, 2, 55.0], 

868 [5.0, 3, 45.0], 

869 [5.0, 4, 35.0], 

870 [5.0, 5, 25.0], 

871 [5.0, 6, 15.0], 

872 [5.0, 7, 5.0], 

873 [5.0, 8, 95.0], 

874 [5.0, 9, 85.0], 

875 [5.0, 10, 75.0], 

876 [7.5, 0, 77.5], 

877 [7.5, 1, 67.5], 

878 [7.5, 2, 57.5], 

879 [7.5, 3, 47.5], 

880 [7.5, 4, 37.5], 

881 [7.5, 5, 27.5], 

882 [7.5, 6, 17.5], 

883 [7.5, 7, 7.5], 

884 [7.5, 8, 97.5], 

885 [7.5, 9, 87.5], 

886 [7.5, 10, 77.5], 

887 [10.0, 0, 80.0], 

888 [10.0, 1, 70.0], 

889 [10.0, 2, 60.0], 

890 [10.0, 3, 50.0], 

891 [10.0, 4, 40.0], 

892 [10.0, 5, 30.0], 

893 [10.0, 6, 20.0], 

894 [10.0, 7, 10.0], 

895 [10.0, 8, 100.0], 

896 [10.0, 9, 90.0], 

897 [10.0, 10, 80.0], 

898 ] 

899) 

900 

901MUNSELL_INTERPOLATION_METHODS: list = [ 

902 "Linear", 

903 "Linear", 

904 "Radial", 

905 "Linear", 

906 "Radial", 

907 "Linear", 

908 "Linear", 

909 "Linear", 

910 "Radial", 

911 "Radial", 

912 "Radial", 

913 "Linear", 

914 "Linear", 

915 "Linear", 

916 "Radial", 

917 "Radial", 

918 "Radial", 

919 "Linear", 

920 "Linear", 

921 "Linear", 

922 "Linear", 

923 "Linear", 

924 "Radial", 

925 "Linear", 

926 "Radial", 

927 "Radial", 

928 "Linear", 

929 "Linear", 

930 "Linear", 

931 "Radial", 

932 "Radial", 

933 "Radial", 

934 "Linear", 

935 "Radial", 

936 "Linear", 

937 "Linear", 

938 "Radial", 

939 "Linear", 

940 "Linear", 

941 "Linear", 

942 "Linear", 

943 "Linear", 

944 "Linear", 

945 "Linear", 

946 "Radial", 

947 "Radial", 

948 "Linear", 

949 "Linear", 

950 "Linear", 

951 "Linear", 

952 "Linear", 

953 "Linear", 

954 "Radial", 

955 "Radial", 

956 "Linear", 

957 "Linear", 

958 "Linear", 

959 "Linear", 

960 "Linear", 

961 "Radial", 

962 "Linear", 

963 "Radial", 

964 "Linear", 

965 "Radial", 

966 "Radial", 

967 "Linear", 

968 "Linear", 

969 "Radial", 

970 "Linear", 

971 "Linear", 

972 "Linear", 

973 "Linear", 

974 "Linear", 

975 "Radial", 

976 "Linear", 

977 "Radial", 

978 "Radial", 

979 "Linear", 

980 "Radial", 

981 "Linear", 

982 "Radial", 

983 "Radial", 

984 "Radial", 

985 "Linear", 

986 "Linear", 

987 "Linear", 

988 "Linear", 

989 "Linear", 

990 "Linear", 

991 "Linear", 

992 "Linear", 

993 "Linear", 

994 "Linear", 

995 "Radial", 

996 "Linear", 

997 "Linear", 

998 "Radial", 

999 "Linear", 

1000 "Radial", 

1001 "Linear", 

1002 "Radial", 

1003] 

1004 

1005MUNSELL_XY_FROM_RENOTATION_OVOID: list = [ 

1006 [0.1832, 0.4414], 

1007 [0.2419, 0.3985], 

1008 [0.3564, 0.3279], 

1009 [0.1557, 0.3517], 

1010 [0.3861, 0.3767], 

1011 [0.3441, 0.1698], 

1012 [0.5433, 0.3027], 

1013 [0.1702, 0.2768], 

1014 [0.1303, 0.1639], 

1015 [0.3015, 0.3052], 

1016 [0.2562, 0.2709], 

1017 [0.3100, 0.2750], 

1018 [0.1671, 0.4089], 

1019 [0.2543, 0.3220], 

1020 [0.2312, 0.2899], 

1021 [0.3621, 0.3349], 

1022 [0.1601, 0.2028], 

1023 [0.0784, 0.5761], 

1024 [0.2699, 0.3120], 

1025 [0.2501, 0.3118], 

1026 [0.2929, 0.3303], 

1027 [0.3132, 0.2032], 

1028 [0.2511, 0.2031], 

1029 [0.3161, 0.2691], 

1030 [0.3422, 0.3648], 

1031 [0.3745, 0.4004], 

1032 [0.2445, 0.3914], 

1033 [0.2965, 0.3293], 

1034 [0.3076, 0.2416], 

1035 [0.3032, 0.5748], 

1036 [0.2982, 0.3003], 

1037 [0.3679, 0.3585], 

1038 [0.3389, 0.3079], 

1039 [0.0982, 0.2828], 

1040 [0.2511, 0.4107], 

1041 [0.2711, 0.3455], 

1042 [0.3815, 0.5093], 

1043 [0.2763, 0.3607], 

1044 [0.3382, 0.2496], 

1045 [0.4774, 0.2969], 

1046 [0.2758, 0.2208], 

1047 [0.0828, 0.3108], 

1048 [0.3298, 0.2869], 

1049 [0.2969, 0.0979], 

1050 [0.4190, 0.4791], 

1051 [0.3622, 0.3861], 

1052 [0.3099, 0.2502], 

1053 [0.2718, 0.1604], 

1054 [0.3045, 0.1905], 

1055 [0.2731, 0.1738], 

1056 [0.3682, 0.2983], 

1057 [0.2862, 0.2260], 

1058 [0.4240, 0.3302], 

1059 [0.2657, 0.2528], 

1060 [0.2559, 0.1730], 

1061 [0.3491, 0.2872], 

1062 [0.4073, 0.2235], 

1063 [0.0794, 0.7385], 

1064 [0.4001, 0.3263], 

1065 [0.3546, 0.5490], 

1066 [0.3270, 0.4288], 

1067 [0.3943, 0.4264], 

1068 [0.5130, 0.1893], 

1069 [0.3806, 0.3294], 

1070 [0.2311, 0.2010], 

1071 [0.2816, 0.6563], 

1072 [0.3990, 0.2708], 

1073 [0.5660, 0.3795], 

1074 [0.4581, 0.2549], 

1075 [0.3495, 0.3226], 

1076 [0.1340, 0.6871], 

1077 [0.4574, 0.5062], 

1078 [0.0329, 0.7358], 

1079 [0.3699, 0.3586], 

1080 [0.2419, 0.3352], 

1081 [0.3050, 0.2967], 

1082 [0.3100, 0.4018], 

1083 [0.3470, 0.2259], 

1084 [0.4184, 0.4568], 

1085 [0.1341, 0.6420], 

1086 [0.5456, 0.4040], 

1087 [0.2080, 0.2789], 

1088 [0.5071, 0.3777], 

1089 [0.4617, 0.2506], 

1090 [0.4875, 0.3123], 

1091 [0.2922, 0.1106], 

1092 [0.2638, 0.2624], 

1093 [0.0925, 0.4275], 

1094 [0.1188, 0.6918], 

1095 [0.0476, 0.3458], 

1096 [0.3711, 0.1449], 

1097 [0.2005, 0.5759], 

1098 [0.1326, 0.2784], 

1099 [0.2671, 0.2998], 

1100 [0.3490, 0.2570], 

1101 [0.3038, 0.1500], 

1102 [0.5422, 0.4141], 

1103 [0.3515, 0.3024], 

1104 [0.3850, 0.4120], 

1105 [0.4320, 0.3118], 

1106] 

1107 

1108 

1109class TestMunsellValuePriest1920: 

1110 """ 

1111 Define :func:`colour.notation.munsell.munsell_value_Priest1920` definition 

1112 unit tests methods. 

1113 """ 

1114 

1115 def test_munsell_value_Priest1920(self) -> None: 

1116 """ 

1117 Test :func:`colour.notation.munsell.munsell_value_Priest1920` 

1118 definition. 

1119 """ 

1120 

1121 np.testing.assert_allclose( 

1122 munsell_value_Priest1920(12.23634268), 

1123 3.498048410185314, 

1124 atol=TOLERANCE_ABSOLUTE_TESTS, 

1125 ) 

1126 

1127 np.testing.assert_allclose( 

1128 munsell_value_Priest1920(22.89399987), 

1129 4.7847674833788947, 

1130 atol=TOLERANCE_ABSOLUTE_TESTS, 

1131 ) 

1132 

1133 np.testing.assert_allclose( 

1134 munsell_value_Priest1920(6.29022535), 

1135 2.5080321668591092, 

1136 atol=TOLERANCE_ABSOLUTE_TESTS, 

1137 ) 

1138 

1139 def test_n_dimensional_munsell_value_Priest1920(self) -> None: 

1140 """ 

1141 Test :func:`colour.notation.munsell.munsell_value_Priest1920` 

1142 definition n-dimensional arrays support. 

1143 """ 

1144 

1145 Y = 12.23634268 

1146 V = munsell_value_Priest1920(Y) 

1147 

1148 V = np.tile(V, 6) 

1149 Y = np.tile(Y, 6) 

1150 np.testing.assert_allclose( 

1151 munsell_value_Priest1920(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1152 ) 

1153 

1154 V = np.reshape(V, (2, 3)) 

1155 Y = np.reshape(Y, (2, 3)) 

1156 np.testing.assert_allclose( 

1157 munsell_value_Priest1920(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1158 ) 

1159 

1160 V = np.reshape(V, (2, 3, 1)) 

1161 Y = np.reshape(Y, (2, 3, 1)) 

1162 np.testing.assert_allclose( 

1163 munsell_value_Priest1920(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1164 ) 

1165 

1166 def test_domain_range_scale_munsell_value_Priest1920(self) -> None: 

1167 """ 

1168 Test :func:`colour.notation.munsell.munsell_value_Priest1920` 

1169 definition domain and range scale support. 

1170 """ 

1171 

1172 Y = 12.23634268 

1173 V = munsell_value_Priest1920(Y) 

1174 

1175 d_r = (("reference", 1, 1), ("1", 0.01, 0.1), ("100", 1, 10)) 

1176 for scale, factor_a, factor_b in d_r: 

1177 with domain_range_scale(scale): 

1178 np.testing.assert_allclose( 

1179 munsell_value_Priest1920(Y * factor_a), 

1180 V * factor_b, 

1181 atol=TOLERANCE_ABSOLUTE_TESTS, 

1182 ) 

1183 

1184 @ignore_numpy_errors 

1185 def test_nan_munsell_value_Priest1920(self) -> None: 

1186 """ 

1187 Test :func:`colour.notation.munsell.munsell_value_Priest1920` 

1188 definition nan support. 

1189 """ 

1190 

1191 munsell_value_Priest1920(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) 

1192 

1193 

1194class TestMunsellValueMunsell1933: 

1195 """ 

1196 Define :func:`colour.notation.munsell.munsell_value_Munsell1933` 

1197 definition unit tests methods. 

1198 """ 

1199 

1200 def test_munsell_value_Munsell1933(self) -> None: 

1201 """ 

1202 Test :func:`colour.notation.munsell.munsell_value_Munsell1933` 

1203 definition. 

1204 """ 

1205 

1206 np.testing.assert_allclose( 

1207 munsell_value_Munsell1933(12.23634268), 

1208 4.1627702416858083, 

1209 atol=TOLERANCE_ABSOLUTE_TESTS, 

1210 ) 

1211 

1212 np.testing.assert_allclose( 

1213 munsell_value_Munsell1933(22.89399987), 

1214 5.5914543020790592, 

1215 atol=TOLERANCE_ABSOLUTE_TESTS, 

1216 ) 

1217 

1218 np.testing.assert_allclose( 

1219 munsell_value_Munsell1933(6.29022535), 

1220 3.0141971134091761, 

1221 atol=TOLERANCE_ABSOLUTE_TESTS, 

1222 ) 

1223 

1224 def test_n_dimensional_munsell_value_Munsell1933(self) -> None: 

1225 """ 

1226 Test :func:`colour.notation.munsell.munsell_value_Munsell1933` 

1227 definition n-dimensional arrays support. 

1228 """ 

1229 

1230 Y = 12.23634268 

1231 V = munsell_value_Munsell1933(Y) 

1232 

1233 V = np.tile(V, 6) 

1234 Y = np.tile(Y, 6) 

1235 np.testing.assert_allclose( 

1236 munsell_value_Munsell1933(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1237 ) 

1238 

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

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

1241 np.testing.assert_allclose( 

1242 munsell_value_Munsell1933(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1243 ) 

1244 

1245 V = np.reshape(V, (2, 3, 1)) 

1246 Y = np.reshape(Y, (2, 3, 1)) 

1247 np.testing.assert_allclose( 

1248 munsell_value_Munsell1933(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1249 ) 

1250 

1251 def test_domain_range_scale_munsell_value_Munsell1933(self) -> None: 

1252 """ 

1253 Test :func:`colour.notation.munsell.munsell_value_Munsell1933` 

1254 definition domain and range scale support. 

1255 """ 

1256 

1257 Y = 12.23634268 

1258 V = munsell_value_Munsell1933(Y) 

1259 

1260 d_r = (("reference", 1, 1), ("1", 0.01, 0.1), ("100", 1, 10)) 

1261 for scale, factor_a, factor_b in d_r: 

1262 with domain_range_scale(scale): 

1263 np.testing.assert_allclose( 

1264 munsell_value_Munsell1933(Y * factor_a), 

1265 V * factor_b, 

1266 atol=TOLERANCE_ABSOLUTE_TESTS, 

1267 ) 

1268 

1269 @ignore_numpy_errors 

1270 def test_nan_munsell_value_Munsell1933(self) -> None: 

1271 """ 

1272 Test :func:`colour.notation.munsell.munsell_value_Munsell1933` 

1273 definition nan support. 

1274 """ 

1275 

1276 munsell_value_Munsell1933(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) 

1277 

1278 

1279class TestMunsellValueMoon1943: 

1280 """ 

1281 Define :func:`colour.notation.munsell.munsell_value_Moon1943` definition 

1282 unit tests methods. 

1283 """ 

1284 

1285 def test_munsell_value_Moon1943(self) -> None: 

1286 """ 

1287 Test :func:`colour.notation.munsell.munsell_value_Moon1943` 

1288 definition. 

1289 """ 

1290 

1291 np.testing.assert_allclose( 

1292 munsell_value_Moon1943(12.23634268), 

1293 4.0688120634976421, 

1294 atol=TOLERANCE_ABSOLUTE_TESTS, 

1295 ) 

1296 

1297 np.testing.assert_allclose( 

1298 munsell_value_Moon1943(22.89399987), 

1299 5.3133627855494412, 

1300 atol=TOLERANCE_ABSOLUTE_TESTS, 

1301 ) 

1302 

1303 np.testing.assert_allclose( 

1304 munsell_value_Moon1943(6.29022535), 

1305 3.0645015037679695, 

1306 atol=TOLERANCE_ABSOLUTE_TESTS, 

1307 ) 

1308 

1309 def test_n_dimensional_munsell_value_Moon1943(self) -> None: 

1310 """ 

1311 Test :func:`colour.notation.munsell.munsell_value_Moon1943` 

1312 definition n-dimensional arrays support. 

1313 """ 

1314 

1315 Y = 12.23634268 

1316 V = munsell_value_Moon1943(Y) 

1317 

1318 V = np.tile(V, 6) 

1319 Y = np.tile(Y, 6) 

1320 np.testing.assert_allclose( 

1321 munsell_value_Moon1943(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1322 ) 

1323 

1324 V = np.reshape(V, (2, 3)) 

1325 Y = np.reshape(Y, (2, 3)) 

1326 np.testing.assert_allclose( 

1327 munsell_value_Moon1943(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1328 ) 

1329 

1330 V = np.reshape(V, (2, 3, 1)) 

1331 Y = np.reshape(Y, (2, 3, 1)) 

1332 np.testing.assert_allclose( 

1333 munsell_value_Moon1943(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1334 ) 

1335 

1336 def test_domain_range_scale_munsell_value_Moon1943(self) -> None: 

1337 """ 

1338 Test :func:`colour.notation.munsell.munsell_value_Moon1943` 

1339 definition domain and range scale support. 

1340 """ 

1341 

1342 Y = 12.23634268 

1343 V = munsell_value_Moon1943(Y) 

1344 

1345 d_r = (("reference", 1, 1), ("1", 0.01, 0.1), ("100", 1, 10)) 

1346 for scale, factor_a, factor_b in d_r: 

1347 with domain_range_scale(scale): 

1348 np.testing.assert_allclose( 

1349 munsell_value_Moon1943(Y * factor_a), 

1350 V * factor_b, 

1351 atol=TOLERANCE_ABSOLUTE_TESTS, 

1352 ) 

1353 

1354 @ignore_numpy_errors 

1355 def test_nan_munsell_value_Moon1943(self) -> None: 

1356 """ 

1357 Test :func:`colour.notation.munsell.munsell_value_Moon1943` 

1358 definition nan support. 

1359 """ 

1360 

1361 munsell_value_Moon1943(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) 

1362 

1363 

1364class TestMunsellValueSaunderson1944: 

1365 """ 

1366 Define :func:`colour.notation.munsell.munsell_value_Saunderson1944` 

1367 definition unit tests methods. 

1368 """ 

1369 

1370 def test_munsell_value_Saunderson1944(self) -> None: 

1371 """ 

1372 Test :func:`colour.notation.munsell.munsell_value_Saunderson1944` 

1373 definition. 

1374 """ 

1375 

1376 np.testing.assert_allclose( 

1377 munsell_value_Saunderson1944(12.23634268), 

1378 4.0444736723175119, 

1379 atol=TOLERANCE_ABSOLUTE_TESTS, 

1380 ) 

1381 

1382 np.testing.assert_allclose( 

1383 munsell_value_Saunderson1944(22.89399987), 

1384 5.3783324022305923, 

1385 atol=TOLERANCE_ABSOLUTE_TESTS, 

1386 ) 

1387 

1388 np.testing.assert_allclose( 

1389 munsell_value_Saunderson1944(6.29022535), 

1390 2.9089633927316823, 

1391 atol=TOLERANCE_ABSOLUTE_TESTS, 

1392 ) 

1393 

1394 def test_n_dimensional_munsell_value_Saunderson1944(self) -> None: 

1395 """ 

1396 Test :func:`colour.notation.munsell.munsell_value_Saunderson1944` 

1397 definition n-dimensional arrays support. 

1398 """ 

1399 

1400 Y = 12.23634268 

1401 V = munsell_value_Saunderson1944(Y) 

1402 

1403 V = np.tile(V, 6) 

1404 Y = np.tile(Y, 6) 

1405 np.testing.assert_allclose( 

1406 munsell_value_Saunderson1944(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1407 ) 

1408 

1409 V = np.reshape(V, (2, 3)) 

1410 Y = np.reshape(Y, (2, 3)) 

1411 np.testing.assert_allclose( 

1412 munsell_value_Saunderson1944(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1413 ) 

1414 

1415 V = np.reshape(V, (2, 3, 1)) 

1416 Y = np.reshape(Y, (2, 3, 1)) 

1417 np.testing.assert_allclose( 

1418 munsell_value_Saunderson1944(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1419 ) 

1420 

1421 def test_domain_range_scale_munsell_value_Saunderson1944(self) -> None: 

1422 """ 

1423 Test :func:`colour.notation.munsell.munsell_value_Saunderson1944` 

1424 definition domain and range scale support. 

1425 """ 

1426 

1427 Y = 12.23634268 

1428 V = munsell_value_Saunderson1944(Y) 

1429 

1430 d_r = (("reference", 1, 1), ("1", 0.01, 0.1), ("100", 1, 10)) 

1431 for scale, factor_a, factor_b in d_r: 

1432 with domain_range_scale(scale): 

1433 np.testing.assert_allclose( 

1434 munsell_value_Saunderson1944(Y * factor_a), 

1435 V * factor_b, 

1436 atol=TOLERANCE_ABSOLUTE_TESTS, 

1437 ) 

1438 

1439 @ignore_numpy_errors 

1440 def test_nan_munsell_value_Saunderson1944(self) -> None: 

1441 """ 

1442 Test :func:`colour.notation.munsell.munsell_value_Saunderson1944` 

1443 definition nan support. 

1444 """ 

1445 

1446 munsell_value_Saunderson1944( 

1447 np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]) 

1448 ) 

1449 

1450 

1451class TestMunsellValueLadd1955: 

1452 """ 

1453 Define :func:`colour.notation.munsell.munsell_value_Ladd1955` definition 

1454 unit tests methods. 

1455 """ 

1456 

1457 def test_munsell_value_Ladd1955(self) -> None: 

1458 """ 

1459 Test :func:`colour.notation.munsell.munsell_value_Ladd1955` 

1460 definition. 

1461 """ 

1462 

1463 np.testing.assert_allclose( 

1464 munsell_value_Ladd1955(12.23634268), 

1465 4.0511633044287088, 

1466 atol=TOLERANCE_ABSOLUTE_TESTS, 

1467 ) 

1468 

1469 np.testing.assert_allclose( 

1470 munsell_value_Ladd1955(22.89399987), 

1471 5.3718647913936772, 

1472 atol=TOLERANCE_ABSOLUTE_TESTS, 

1473 ) 

1474 

1475 np.testing.assert_allclose( 

1476 munsell_value_Ladd1955(6.29022535), 

1477 2.9198269939751613, 

1478 atol=TOLERANCE_ABSOLUTE_TESTS, 

1479 ) 

1480 

1481 def test_n_dimensional_munsell_value_Ladd1955(self) -> None: 

1482 """ 

1483 Test :func:`colour.notation.munsell.munsell_value_Ladd1955` 

1484 definition n-dimensional arrays support. 

1485 """ 

1486 

1487 Y = 12.23634268 

1488 V = munsell_value_Ladd1955(Y) 

1489 

1490 V = np.tile(V, 6) 

1491 Y = np.tile(Y, 6) 

1492 np.testing.assert_allclose( 

1493 munsell_value_Ladd1955(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1494 ) 

1495 

1496 V = np.reshape(V, (2, 3)) 

1497 Y = np.reshape(Y, (2, 3)) 

1498 np.testing.assert_allclose( 

1499 munsell_value_Ladd1955(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1500 ) 

1501 

1502 V = np.reshape(V, (2, 3, 1)) 

1503 Y = np.reshape(Y, (2, 3, 1)) 

1504 np.testing.assert_allclose( 

1505 munsell_value_Ladd1955(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1506 ) 

1507 

1508 def test_domain_range_scale_munsell_value_Ladd1955(self) -> None: 

1509 """ 

1510 Test :func:`colour.notation.munsell.munsell_value_Ladd1955` 

1511 definition domain and range scale support. 

1512 """ 

1513 

1514 Y = 12.23634268 

1515 V = munsell_value_Ladd1955(Y) 

1516 

1517 d_r = (("reference", 1, 1), ("1", 0.01, 0.1), ("100", 1, 10)) 

1518 for scale, factor_a, factor_b in d_r: 

1519 with domain_range_scale(scale): 

1520 np.testing.assert_allclose( 

1521 munsell_value_Ladd1955(Y * factor_a), 

1522 V * factor_b, 

1523 atol=TOLERANCE_ABSOLUTE_TESTS, 

1524 ) 

1525 

1526 @ignore_numpy_errors 

1527 def test_nan_munsell_value_Ladd1955(self) -> None: 

1528 """ 

1529 Test :func:`colour.notation.munsell.munsell_value_Ladd1955` 

1530 definition nan support. 

1531 """ 

1532 

1533 munsell_value_Ladd1955(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) 

1534 

1535 

1536class TestMunsellValueMcCamy1992: 

1537 """ 

1538 Define :func:`colour.notation.munsell.munsell_value_McCamy1987` definition 

1539 unit tests methods. 

1540 """ 

1541 

1542 def test_munsell_value_McCamy1987(self) -> None: 

1543 """ 

1544 Test :func:`colour.notation.munsell.munsell_value_McCamy1987` 

1545 definition. 

1546 """ 

1547 

1548 np.testing.assert_allclose( 

1549 munsell_value_McCamy1987(12.23634268), 

1550 4.081434853194113, 

1551 atol=TOLERANCE_ABSOLUTE_TESTS, 

1552 ) 

1553 

1554 np.testing.assert_allclose( 

1555 munsell_value_McCamy1987(22.89399987), 

1556 5.394083970919982, 

1557 atol=TOLERANCE_ABSOLUTE_TESTS, 

1558 ) 

1559 

1560 np.testing.assert_allclose( 

1561 munsell_value_McCamy1987(6.29022535), 

1562 2.9750160800320096, 

1563 atol=TOLERANCE_ABSOLUTE_TESTS, 

1564 ) 

1565 

1566 def test_n_dimensional_munsell_value_McCamy1987(self) -> None: 

1567 """ 

1568 Test :func:`colour.notation.munsell.munsell_value_McCamy1987` 

1569 definition n-dimensional arrays support. 

1570 """ 

1571 

1572 Y = 12.23634268 

1573 V = munsell_value_McCamy1987(Y) 

1574 

1575 V = np.tile(V, 6) 

1576 Y = np.tile(Y, 6) 

1577 np.testing.assert_allclose( 

1578 munsell_value_McCamy1987(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1579 ) 

1580 

1581 V = np.reshape(V, (2, 3)) 

1582 Y = np.reshape(Y, (2, 3)) 

1583 np.testing.assert_allclose( 

1584 munsell_value_McCamy1987(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1585 ) 

1586 

1587 V = np.reshape(V, (2, 3, 1)) 

1588 Y = np.reshape(Y, (2, 3, 1)) 

1589 np.testing.assert_allclose( 

1590 munsell_value_McCamy1987(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1591 ) 

1592 

1593 def test_domain_range_scale_munsell_value_McCamy1987(self) -> None: 

1594 """ 

1595 Test :func:`colour.notation.munsell.munsell_value_McCamy1987` 

1596 definition domain and range scale support. 

1597 """ 

1598 

1599 Y = 12.23634268 

1600 V = munsell_value_McCamy1987(Y) 

1601 

1602 d_r = (("reference", 1, 1), ("1", 0.01, 0.1), ("100", 1, 10)) 

1603 for scale, factor_a, factor_b in d_r: 

1604 with domain_range_scale(scale): 

1605 np.testing.assert_allclose( 

1606 munsell_value_McCamy1987(Y * factor_a), 

1607 V * factor_b, 

1608 atol=TOLERANCE_ABSOLUTE_TESTS, 

1609 ) 

1610 

1611 @ignore_numpy_errors 

1612 def test_nan_munsell_value_McCamy1987(self) -> None: 

1613 """ 

1614 Test :func:`colour.notation.munsell.munsell_value_McCamy1987` 

1615 definition nan support. 

1616 """ 

1617 

1618 munsell_value_McCamy1987(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) 

1619 

1620 

1621class TestMunsellValueASTMD1535: 

1622 """ 

1623 Define :func:`colour.notation.munsell.munsell_value_ASTMD1535` 

1624 definition unit tests methods. 

1625 """ 

1626 

1627 def test_munsell_value_ASTMD1535(self) -> None: 

1628 """ 

1629 Test :func:`colour.notation.munsell.munsell_value_ASTMD1535` 

1630 definition. 

1631 """ 

1632 

1633 np.testing.assert_allclose( 

1634 munsell_value_ASTMD1535(12.23634268), 

1635 4.0824437076525664, 

1636 atol=TOLERANCE_ABSOLUTE_TESTS, 

1637 ) 

1638 

1639 np.testing.assert_allclose( 

1640 munsell_value_ASTMD1535(22.89399987), 

1641 5.3913268228155395, 

1642 atol=TOLERANCE_ABSOLUTE_TESTS, 

1643 ) 

1644 

1645 np.testing.assert_allclose( 

1646 munsell_value_ASTMD1535(6.29022535), 

1647 2.9761930839606454, 

1648 atol=TOLERANCE_ABSOLUTE_TESTS, 

1649 ) 

1650 

1651 def test_n_dimensional_munsell_value_ASTMD1535(self) -> None: 

1652 """ 

1653 Test :func:`colour.notation.munsell.munsell_value_ASTMD1535` 

1654 definition n-dimensional arrays support. 

1655 """ 

1656 

1657 Y = 12.23634268 

1658 V = munsell_value_ASTMD1535(Y) 

1659 

1660 V = np.tile(V, 6) 

1661 Y = np.tile(Y, 6) 

1662 np.testing.assert_allclose( 

1663 munsell_value_ASTMD1535(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1664 ) 

1665 

1666 V = np.reshape(V, (2, 3)) 

1667 Y = np.reshape(Y, (2, 3)) 

1668 np.testing.assert_allclose( 

1669 munsell_value_ASTMD1535(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1670 ) 

1671 

1672 V = np.reshape(V, (2, 3, 1)) 

1673 Y = np.reshape(Y, (2, 3, 1)) 

1674 np.testing.assert_allclose( 

1675 munsell_value_ASTMD1535(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS 

1676 ) 

1677 

1678 def test_domain_range_scale_munsell_value_ASTMD1535(self) -> None: 

1679 """ 

1680 Test :func:`colour.notation.munsell.munsell_value_ASTMD1535` 

1681 definition domain and range scale support. 

1682 """ 

1683 

1684 Y = 12.23634268 

1685 V = munsell_value_ASTMD1535(Y) 

1686 

1687 d_r = (("reference", 1, 1), ("1", 0.01, 0.1), ("100", 1, 10)) 

1688 for scale, factor_a, factor_b in d_r: 

1689 with domain_range_scale(scale): 

1690 np.testing.assert_allclose( 

1691 munsell_value_ASTMD1535(Y * factor_a), 

1692 V * factor_b, 

1693 atol=TOLERANCE_ABSOLUTE_TESTS, 

1694 ) 

1695 

1696 @ignore_numpy_errors 

1697 def test_nan_munsell_value_ASTMD1535(self) -> None: 

1698 """ 

1699 Test :func:`colour.notation.munsell.munsell_value_ASTMD1535` 

1700 definition nan support. 

1701 """ 

1702 

1703 munsell_value_ASTMD1535(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) 

1704 

1705 

1706class TestMunsellSpecification_to_xyY: 

1707 """ 

1708 Define :func:`colour.notation.munsell.munsell_specification_to_xyY` 

1709 definition unit tests methods. 

1710 """ 

1711 

1712 def test_munsell_specification_to_xyY(self) -> None: 

1713 """ 

1714 Test :func:`colour.notation.munsell.munsell_specification_to_xyY` 

1715 definition. 

1716 """ 

1717 

1718 specification, xyY = ( 

1719 as_float_array(list(MUNSELL_SPECIFICATIONS[..., 0])), 

1720 as_float_array(list(MUNSELL_SPECIFICATIONS[..., 1])), 

1721 ) 

1722 np.testing.assert_allclose( 

1723 munsell_specification_to_xyY(specification), 

1724 xyY, 

1725 atol=TOLERANCE_ABSOLUTE_TESTS, 

1726 ) 

1727 

1728 specification, xyY = ( 

1729 as_float_array(list(MUNSELL_GREYS_SPECIFICATIONS[..., 0])), 

1730 as_float_array(list(MUNSELL_GREYS_SPECIFICATIONS[..., 1])), 

1731 ) 

1732 specification = np.squeeze(specification) 

1733 nan_array = np.full(specification.shape, np.nan) 

1734 specification = tstack([nan_array, specification, nan_array, nan_array]) 

1735 

1736 np.testing.assert_allclose( 

1737 munsell_specification_to_xyY(specification), 

1738 xyY, 

1739 atol=TOLERANCE_ABSOLUTE_TESTS, 

1740 ) 

1741 

1742 def test_n_dimensional_munsell_specification_to_xyY(self) -> None: 

1743 """ 

1744 Test :func:`colour.notation.munsell.munsell_specification_to_xyY` 

1745 definition n-dimensional arrays support. 

1746 """ 

1747 

1748 specification = np.array([7.18927191, 5.34025196, 16.05861170, 3.00000000]) 

1749 xyY = munsell_specification_to_xyY(specification) 

1750 

1751 specification = np.tile(specification, (6, 1)) 

1752 xyY = np.tile(xyY, (6, 1)) 

1753 np.testing.assert_allclose( 

1754 munsell_specification_to_xyY(specification), 

1755 xyY, 

1756 atol=TOLERANCE_ABSOLUTE_TESTS, 

1757 ) 

1758 

1759 specification = np.reshape(specification, (2, 3, 4)) 

1760 xyY = np.reshape(xyY, (2, 3, 3)) 

1761 np.testing.assert_allclose( 

1762 munsell_specification_to_xyY(specification), 

1763 xyY, 

1764 atol=TOLERANCE_ABSOLUTE_TESTS, 

1765 ) 

1766 

1767 specification = np.array([np.nan, 8.9, np.nan, np.nan]) 

1768 xyY = munsell_specification_to_xyY(specification) 

1769 

1770 specification = np.tile(specification, (6, 1)) 

1771 xyY = np.tile(xyY, (6, 1)) 

1772 np.testing.assert_allclose( 

1773 munsell_specification_to_xyY(specification), 

1774 xyY, 

1775 atol=TOLERANCE_ABSOLUTE_TESTS, 

1776 ) 

1777 

1778 specification = np.reshape(specification, (2, 3, 4)) 

1779 xyY = np.reshape(xyY, (2, 3, 3)) 

1780 np.testing.assert_allclose( 

1781 munsell_specification_to_xyY(specification), 

1782 xyY, 

1783 atol=TOLERANCE_ABSOLUTE_TESTS, 

1784 ) 

1785 

1786 def test_domain_range_scale_munsell_specification_to_xyY(self) -> None: 

1787 """ 

1788 Test :func:`colour.notation.munsell.munsell_specification_to_xyY` 

1789 definition domain and range scale support. 

1790 """ 

1791 

1792 specification = np.array([7.18927191, 5.34025196, 16.05861170, 3.00000000]) 

1793 xyY = munsell_specification_to_xyY(specification) 

1794 

1795 d_r = ( 

1796 ("reference", 1, 1), 

1797 ("1", np.array([0.1, 0.1, 1 / 50, 0.1]), 1), 

1798 ("100", np.array([10, 10, 2, 10]), np.array([1, 1, 100])), 

1799 ) 

1800 for scale, factor_a, factor_b in d_r: 

1801 with domain_range_scale(scale): 

1802 np.testing.assert_allclose( 

1803 munsell_specification_to_xyY(specification * factor_a), 

1804 xyY * factor_b, 

1805 atol=TOLERANCE_ABSOLUTE_TESTS, 

1806 ) 

1807 

1808 @ignore_numpy_errors 

1809 def test_nan_munsell_specification_to_xyY(self) -> None: 

1810 """ 

1811 Test :func:`colour.notation.munsell.munsell_specification_to_xyY` 

1812 definition nan support. 

1813 """ 

1814 

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

1816 cases = np.array(list(set(product(cases, repeat=4)))) 

1817 for case in cases: 

1818 with contextlib.suppress(AssertionError, TypeError, ValueError): 

1819 munsell_specification_to_xyY(case) 

1820 

1821 

1822class TestMunsellColour_to_xyY: 

1823 """ 

1824 Define :func:`colour.notation.munsell.munsell_colour_to_xyY` definition 

1825 unit tests methods. 

1826 """ 

1827 

1828 def test_domain_range_scale_munsell_colour_to_xyY(self) -> None: 

1829 """ 

1830 Test :func:`colour.notation.munsell.munsell_colour_to_xyY` definition 

1831 domain and range scale support. 

1832 """ 

1833 

1834 munsell_colour = "4.2YR 8.1/5.3" 

1835 xyY = munsell_colour_to_xyY(munsell_colour) 

1836 

1837 d_r = ( 

1838 ("reference", 1), 

1839 ("1", 1), 

1840 ("100", np.array([1, 1, 100])), 

1841 ) 

1842 for scale, factor in d_r: 

1843 with domain_range_scale(scale): 

1844 np.testing.assert_allclose( 

1845 munsell_colour_to_xyY(munsell_colour), 

1846 xyY * factor, 

1847 atol=TOLERANCE_ABSOLUTE_TESTS, 

1848 ) 

1849 

1850 def test_n_dimensional_munsell_colour_to_xyY(self) -> None: 

1851 """ 

1852 Test :func:`colour.notation.munsell.munsell_colour_to_xyY` definition 

1853 n-dimensional arrays support. 

1854 """ 

1855 

1856 munsell_colour = "4.2YR 8.1/5.3" 

1857 xyY = munsell_colour_to_xyY(munsell_colour) 

1858 

1859 munsell_colour = np.tile(munsell_colour, 6) 

1860 xyY = np.tile(xyY, (6, 1)) 

1861 np.testing.assert_allclose( 

1862 munsell_colour_to_xyY(munsell_colour), 

1863 xyY, 

1864 atol=TOLERANCE_ABSOLUTE_TESTS, 

1865 ) 

1866 

1867 munsell_colour = np.reshape(munsell_colour, (2, 3)) 

1868 xyY = np.reshape(xyY, (2, 3, 3)) 

1869 np.testing.assert_allclose( 

1870 munsell_colour_to_xyY(munsell_colour), 

1871 xyY, 

1872 atol=TOLERANCE_ABSOLUTE_TESTS, 

1873 ) 

1874 

1875 munsell_colour = "N8.9" 

1876 xyY = munsell_colour_to_xyY(munsell_colour) 

1877 

1878 munsell_colour = np.tile(munsell_colour, 6) 

1879 xyY = np.tile(xyY, (6, 1)) 

1880 np.testing.assert_allclose( 

1881 munsell_colour_to_xyY(munsell_colour), 

1882 xyY, 

1883 atol=TOLERANCE_ABSOLUTE_TESTS, 

1884 ) 

1885 

1886 munsell_colour = np.reshape(munsell_colour, (2, 3)) 

1887 xyY = np.reshape(xyY, (2, 3, 3)) 

1888 np.testing.assert_allclose( 

1889 munsell_colour_to_xyY(munsell_colour), 

1890 xyY, 

1891 atol=TOLERANCE_ABSOLUTE_TESTS, 

1892 ) 

1893 

1894 

1895class TestxyY_to_munsell_specification: 

1896 """ 

1897 Define :func:`colour.notation.munsell.xyY_to_munsell_specification` 

1898 definition unit tests methods. 

1899 """ 

1900 

1901 def test_xyY_to_munsell_specification(self) -> None: 

1902 """ 

1903 Test :func:`colour.notation.munsell.xyY_to_munsell_specification` 

1904 definition. 

1905 """ 

1906 

1907 if not is_scipy_installed(): # pragma: no cover 

1908 return 

1909 

1910 specification, xyY = ( 

1911 as_float_array(list(MUNSELL_SPECIFICATIONS[..., 0])), 

1912 as_float_array(list(MUNSELL_SPECIFICATIONS[..., 1])), 

1913 ) 

1914 

1915 np.testing.assert_allclose( 

1916 xyY_to_munsell_specification(xyY), 

1917 specification, 

1918 atol=5e-5, 

1919 ) 

1920 

1921 specification, xyY = ( 

1922 as_float_array(list(MUNSELL_GREYS_SPECIFICATIONS[..., 0])), 

1923 as_float_array(list(MUNSELL_GREYS_SPECIFICATIONS[..., 1])), 

1924 ) 

1925 specification = np.squeeze(specification) 

1926 nan_array = np.full(specification.shape, np.nan) 

1927 specification = tstack([nan_array, specification, nan_array, nan_array]) 

1928 

1929 np.testing.assert_allclose( 

1930 xyY_to_munsell_specification(xyY), 

1931 specification, 

1932 atol=0.00001, 

1933 ) 

1934 

1935 def test_n_dimensional_xyY_to_munsell_specification(self) -> None: 

1936 """ 

1937 Test :func:`colour.notation.munsell.xyY_to_munsell_specification` 

1938 definition n-dimensional arrays support. 

1939 """ 

1940 

1941 if not is_scipy_installed(): # pragma: no cover 

1942 return 

1943 

1944 xyY = [0.16623068, 0.45684550, 0.22399519] 

1945 specification = xyY_to_munsell_specification(xyY) 

1946 

1947 xyY = np.tile(xyY, (6, 1)) 

1948 specification = np.tile(specification, (6, 1)) 

1949 np.testing.assert_allclose( 

1950 xyY_to_munsell_specification(xyY), 

1951 specification, 

1952 atol=TOLERANCE_ABSOLUTE_TESTS, 

1953 ) 

1954 

1955 xyY = np.reshape(xyY, (2, 3, 3)) 

1956 specification = np.reshape(specification, (2, 3, 4)) 

1957 np.testing.assert_allclose( 

1958 xyY_to_munsell_specification(xyY), 

1959 specification, 

1960 atol=TOLERANCE_ABSOLUTE_TESTS, 

1961 ) 

1962 

1963 def test_raise_exception_xyY_to_munsell_specification(self) -> None: 

1964 """ 

1965 Test :func:`colour.notation.munsell.xyY_to_munsell_specification` 

1966 definition raised exception. 

1967 """ 

1968 

1969 if not is_scipy_installed(): # pragma: no cover 

1970 return 

1971 

1972 pytest.raises( 

1973 RuntimeError, 

1974 xyY_to_munsell_specification, 

1975 np.array([0.90615118, 0.57945103, 0.91984064]), 

1976 ) 

1977 

1978 def test_domain_range_scale_xyY_to_munsell_specification(self) -> None: 

1979 """ 

1980 Test :func:`colour.notation.munsell.xyY_to_munsell_specification` 

1981 definition domain and range scale support. 

1982 """ 

1983 

1984 if not is_scipy_installed(): # pragma: no cover 

1985 return 

1986 

1987 xyY = [0.16623068, 0.45684550, 0.22399519] 

1988 specification = xyY_to_munsell_specification(xyY) 

1989 

1990 d_r = ( 

1991 ("reference", 1, 1), 

1992 ("1", 1, np.array([0.1, 0.1, 1 / 50, 0.1])), 

1993 ("100", np.array([1, 1, 100]), np.array([10, 10, 2, 10])), 

1994 ) 

1995 for scale, factor_a, factor_b in d_r: 

1996 with domain_range_scale(scale): 

1997 np.testing.assert_allclose( 

1998 xyY_to_munsell_specification(xyY * factor_a), 

1999 specification * factor_b, 

2000 atol=2e-5, 

2001 ) 

2002 

2003 @ignore_numpy_errors 

2004 def test_nan_xyY_to_munsell_specification(self) -> None: 

2005 """ 

2006 Test :func:`colour.notation.munsell.xyY_to_munsell_specification` 

2007 definition nan support. 

2008 """ 

2009 

2010 if not is_scipy_installed(): # pragma: no cover 

2011 return 

2012 

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

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

2015 for case in cases: 

2016 with contextlib.suppress(AssertionError, TypeError, ValueError): 

2017 xyY_to_munsell_specification(case) 

2018 

2019 

2020class TestxyY_to_munsell_colour: 

2021 """ 

2022 Define :func:`colour.notation.munsell.xyY_to_munsell_colour` definition 

2023 unit tests methods. 

2024 """ 

2025 

2026 def test_domain_range_scale_xyY_to_munsell_colour(self) -> None: 

2027 """ 

2028 Test :func:`colour.notation.munsell.xyY_to_munsell_colour` definition 

2029 domain and range scale support. 

2030 """ 

2031 

2032 if not is_scipy_installed(): # pragma: no cover 

2033 return 

2034 

2035 xyY = np.array([0.38736945, 0.35751656, 0.59362000]) 

2036 munsell_colour = xyY_to_munsell_colour(xyY) 

2037 

2038 d_r = ( 

2039 ("reference", 1), 

2040 ("1", 1), 

2041 ("100", np.array([1, 1, 100])), 

2042 ) 

2043 for scale, factor in d_r: 

2044 with domain_range_scale(scale): 

2045 assert xyY_to_munsell_colour(xyY * factor) == munsell_colour 

2046 

2047 def test_n_dimensional_xyY_to_munsell_colour(self) -> None: 

2048 """ 

2049 Test :func:`colour.notation.munsell.xyY_to_munsell_colour` definition 

2050 n-dimensional arrays support. 

2051 """ 

2052 

2053 if not is_scipy_installed(): # pragma: no cover 

2054 return 

2055 

2056 xyY = [0.16623068, 0.45684550, 0.22399519] 

2057 munsell_colour = xyY_to_munsell_colour(xyY) 

2058 

2059 xyY = np.tile(xyY, (6, 1)) 

2060 munsell_colour = np.tile(munsell_colour, 6) 

2061 np.testing.assert_equal(xyY_to_munsell_colour(xyY), munsell_colour) 

2062 

2063 xyY = np.reshape(xyY, (2, 3, 3)) 

2064 munsell_colour = np.reshape(munsell_colour, (2, 3)) 

2065 np.testing.assert_equal(xyY_to_munsell_colour(xyY), munsell_colour) 

2066 

2067 xyY = [*list(CCS_ILLUMINANT_MUNSELL), 1.0] 

2068 munsell_colour = xyY_to_munsell_colour(xyY) 

2069 

2070 xyY = np.tile(xyY, (6, 1)) 

2071 munsell_colour = np.tile(munsell_colour, 6) 

2072 np.testing.assert_equal(xyY_to_munsell_colour(xyY), munsell_colour) 

2073 

2074 xyY = np.reshape(xyY, (2, 3, 3)) 

2075 munsell_colour = np.reshape(munsell_colour, (2, 3)) 

2076 np.testing.assert_equal(xyY_to_munsell_colour(xyY), munsell_colour) 

2077 

2078 

2079class TestParseMunsellColour: 

2080 """ 

2081 Define :func:`colour.notation.munsell.parse_munsell_colour` definition 

2082 unit tests methods. 

2083 """ 

2084 

2085 def test_parse_munsell_colour(self) -> None: 

2086 """ 

2087 Test :func:`colour.notation.munsell.is_grey_munsell_colour` 

2088 definition. 

2089 """ 

2090 

2091 np.testing.assert_allclose( 

2092 parse_munsell_colour("N5.2"), 

2093 np.array([np.nan, 5.2, np.nan, np.nan]), 

2094 atol=TOLERANCE_ABSOLUTE_TESTS, 

2095 ) 

2096 

2097 np.testing.assert_allclose( 

2098 parse_munsell_colour("0YR 2.0/4.0"), 

2099 np.array([0.0, 2.0, 4.0, 6]), 

2100 atol=TOLERANCE_ABSOLUTE_TESTS, 

2101 ) 

2102 

2103 np.testing.assert_allclose( 

2104 parse_munsell_colour("4.2YR 8.1/5.3"), 

2105 np.array([4.2, 8.1, 5.3, 6]), 

2106 atol=TOLERANCE_ABSOLUTE_TESTS, 

2107 ) 

2108 

2109 def test_raise_exception_parse_munsell_colour(self) -> None: 

2110 """ 

2111 Test :func:`colour.notation.munsell.is_grey_munsell_colour` 

2112 definition raised exception. 

2113 """ 

2114 

2115 pytest.raises(ValueError, parse_munsell_colour, "4.2YQ 8.1/5.3") 

2116 

2117 

2118class TestIsGreyMunsellColour: 

2119 """ 

2120 Define :func:`colour.notation.munsell.is_grey_munsell_colour` definition 

2121 unit tests methods. 

2122 """ 

2123 

2124 def test_is_grey_munsell_colour(self) -> None: 

2125 """ 

2126 Test :func:`colour.notation.munsell.is_grey_munsell_colour` 

2127 definition. 

2128 """ 

2129 

2130 assert is_grey_munsell_colour(5.2) 

2131 

2132 assert not is_grey_munsell_colour(np.array([0.0, 2.0, 4.0, 6])) 

2133 

2134 assert not is_grey_munsell_colour(np.array([4.2, 8.1, 5.3, 6])) 

2135 

2136 assert is_grey_munsell_colour(np.array([np.nan, 0.5, np.nan, np.nan])) 

2137 

2138 

2139class TestNormaliseMunsellSpecification: 

2140 """ 

2141 Define :func:`colour.notation.munsell.normalise_munsell_specification` 

2142 definition unit tests methods. 

2143 """ 

2144 

2145 def test_normalise_munsell_specification(self) -> None: 

2146 """ 

2147 Test :func:`colour.notation.munsell.normalise_munsell_specification` 

2148 definition. 

2149 """ 

2150 

2151 np.testing.assert_allclose( 

2152 normalise_munsell_specification((0.0, 2.0, 4.0, 6)), 

2153 np.array([10.0, 2.0, 4.0, 7]), 

2154 atol=TOLERANCE_ABSOLUTE_TESTS, 

2155 ) 

2156 

2157 np.testing.assert_allclose( 

2158 normalise_munsell_specification((0.0, 2.0, 4.0, 8)), 

2159 np.array([10.0, 2.0, 4.0, 9]), 

2160 atol=TOLERANCE_ABSOLUTE_TESTS, 

2161 ) 

2162 

2163 np.testing.assert_allclose( 

2164 normalise_munsell_specification((0, 2.0, 4.0, 10)), 

2165 np.array([10.0, 2.0, 4.0, 1]), 

2166 atol=TOLERANCE_ABSOLUTE_TESTS, 

2167 ) 

2168 

2169 np.testing.assert_allclose( 

2170 normalise_munsell_specification(0.5), 

2171 np.array([np.nan, 0.5, np.nan, np.nan]), 

2172 atol=TOLERANCE_ABSOLUTE_TESTS, 

2173 ) 

2174 

2175 

2176class TestMunsellColourToMunsellSpecification: 

2177 """ 

2178 Define :func:`colour.notation.munsell.\ 

2179munsell_colour_to_munsell_specification` definition unit tests methods. 

2180 """ 

2181 

2182 def test_munsell_colour_to_munsell_specification(self) -> None: 

2183 """ 

2184 Test :func:`colour.notation.munsell.\ 

2185munsell_colour_to_munsell_specification` definition. 

2186 """ 

2187 

2188 np.testing.assert_allclose( 

2189 munsell_colour_to_munsell_specification("0.0YR 2.0/4.0"), 

2190 np.array([10.0, 2.0, 4.0, 7]), 

2191 atol=TOLERANCE_ABSOLUTE_TESTS, 

2192 ) 

2193 

2194 np.testing.assert_allclose( 

2195 munsell_colour_to_munsell_specification("0.0RP 2.0/4.0"), 

2196 np.array([10.0, 2.0, 4.0, 9]), 

2197 atol=TOLERANCE_ABSOLUTE_TESTS, 

2198 ) 

2199 

2200 np.testing.assert_allclose( 

2201 munsell_colour_to_munsell_specification("10.0B 2.0/4.0"), 

2202 np.array([10.0, 2.0, 4.0, 1]), 

2203 atol=TOLERANCE_ABSOLUTE_TESTS, 

2204 ) 

2205 

2206 np.testing.assert_allclose( 

2207 munsell_colour_to_munsell_specification("N5.2"), 

2208 np.array([np.nan, 5.2, np.nan, np.nan]), 

2209 atol=TOLERANCE_ABSOLUTE_TESTS, 

2210 ) 

2211 

2212 np.testing.assert_allclose( 

2213 munsell_colour_to_munsell_specification("0.0YR 2.0/0.0"), 

2214 np.array([np.nan, 2.0, np.nan, np.nan]), 

2215 atol=TOLERANCE_ABSOLUTE_TESTS, 

2216 ) 

2217 

2218 

2219class TestMunsellSpecificationToMunsellColour: 

2220 """ 

2221 Define :func:`colour.notation.munsell.\ 

2222munsell_specification_to_munsell_colour` definition unit tests methods. 

2223 """ 

2224 

2225 def test_munsell_specification_to_munsell_colour(self) -> None: 

2226 """ 

2227 Test :func:`colour.notation.munsell.\ 

2228munsell_specification_to_munsell_colour` definition. 

2229 """ 

2230 

2231 assert ( 

2232 munsell_specification_to_munsell_colour(np.array([10.0, 2.0, 4.0, 7])) 

2233 == "10.0R 2.0/4.0" 

2234 ) 

2235 

2236 assert ( 

2237 munsell_specification_to_munsell_colour(np.array([10.0, 2.0, 4.0, 9])) 

2238 == "10.0P 2.0/4.0" 

2239 ) 

2240 

2241 assert ( 

2242 munsell_specification_to_munsell_colour(np.array([10.0, 2.0, 4.0, 1])) 

2243 == "10.0B 2.0/4.0" 

2244 ) 

2245 

2246 assert ( 

2247 munsell_specification_to_munsell_colour( 

2248 np.array([np.nan, 5.2, np.nan, np.nan]) 

2249 ) 

2250 == "N5.2" 

2251 ) 

2252 

2253 assert ( 

2254 munsell_specification_to_munsell_colour(np.array([0.0, 2.0, 4.0, 7])) 

2255 == "10.0RP 2.0/4.0" 

2256 ) 

2257 

2258 assert ( 

2259 munsell_specification_to_munsell_colour(np.array([10.0, 0.0, 4.0, 7])) 

2260 == "N0.0" 

2261 ) 

2262 

2263 

2264class Test_xyY_fromRenotation: 

2265 """ 

2266 Define :func:`colour.notation.munsell.xyY_from_renotation` definition 

2267 unit tests methods. 

2268 """ 

2269 

2270 def test_xyY_from_renotation(self) -> None: 

2271 """ 

2272 Test :func:`colour.notation.munsell.xyY_from_renotation` 

2273 definition. 

2274 """ 

2275 

2276 np.testing.assert_array_equal( 

2277 xyY_from_renotation([2.5, 0.2, 2.0, 4]), 

2278 np.array([0.713, 1.414, 0.237]), 

2279 ) 

2280 

2281 np.testing.assert_array_equal( 

2282 xyY_from_renotation([5.0, 0.2, 2.0, 4]), 

2283 np.array([0.449, 1.145, 0.237]), 

2284 ) 

2285 

2286 np.testing.assert_array_equal( 

2287 xyY_from_renotation([7.5, 0.2, 2.0, 4]), 

2288 np.array([0.262, 0.837, 0.237]), 

2289 ) 

2290 

2291 

2292class TestIsSpecificationInRenotation: 

2293 """ 

2294 Define :func:`colour.notation.munsell.is_specification_in_renotation` 

2295 definition unit tests methods. 

2296 """ 

2297 

2298 def test_is_specification_in_renotation(self) -> None: 

2299 """ 

2300 Test :func:`colour.notation.munsell.is_specification_in_renotation` 

2301 definition. 

2302 """ 

2303 

2304 assert is_specification_in_renotation(np.array([2.5, 0.2, 2.0, 4])) 

2305 

2306 assert is_specification_in_renotation(np.array([5.0, 0.2, 2.0, 4])) 

2307 

2308 assert not is_specification_in_renotation(np.array([25.0, 0.2, 2.0, 4])) 

2309 

2310 

2311class TestBoundingHuesFromRenotation: 

2312 """ 

2313 Define :func:`colour.notation.munsell.bounding_hues_from_renotation` 

2314 definition unit tests methods. 

2315 """ 

2316 

2317 def test_bounding_hues_from_renotation(self) -> None: 

2318 """ 

2319 Test :func:`colour.notation.munsell.bounding_hues_from_renotation` 

2320 definition. 

2321 """ 

2322 

2323 for i, (specification, _xyY) in enumerate(MUNSELL_SPECIFICATIONS): 

2324 hue, _value, _chroma, code = specification 

2325 np.testing.assert_array_equal( 

2326 bounding_hues_from_renotation([hue, code]), 

2327 MUNSELL_BOUNDING_HUES[i], 

2328 ) 

2329 

2330 # Test hue == 0 case 

2331 np.testing.assert_array_equal( 

2332 bounding_hues_from_renotation([0.0, 1]), 

2333 np.array([[10.0, 2.0], [10.0, 2.0]]), 

2334 ) 

2335 

2336 

2337class TestHueToHueAngle: 

2338 """ 

2339 Define :func:`colour.notation.munsell.hue_to_hue_angle` definition unit 

2340 tests methods. 

2341 """ 

2342 

2343 def test_hue_to_hue_angle(self) -> None: 

2344 """Test :func:`colour.notation.munsell.hue_to_hue_angle` definition.""" 

2345 

2346 for hue, code, angle in MUNSELL_HUE_TO_ANGLE: 

2347 assert hue_to_hue_angle([hue, code]) == angle 

2348 

2349 

2350class TestHueAngleToHue: 

2351 """ 

2352 Define :func:`colour.notation.munsell.hue_angle_to_hue` definition unit 

2353 tests methods. 

2354 """ 

2355 

2356 def test_hue_angle_to_hue(self) -> None: 

2357 """Test :func:`colour.notation.munsell.hue_angle_to_hue` definition.""" 

2358 

2359 for hue, code, angle in MUNSELL_HUE_TO_ANGLE: 

2360 np.testing.assert_array_equal(hue_angle_to_hue(angle), (hue, code)) 

2361 

2362 

2363class TestHueTo_ASTM_hue: 

2364 """ 

2365 Define :func:`colour.notation.munsell.hue_to_ASTM_hue` definition unit 

2366 tests methods. 

2367 """ 

2368 

2369 def test_hue_to_ASTM_hue(self) -> None: 

2370 """Test :func:`colour.notation.munsell.hue_to_ASTM_hue` definition.""" 

2371 

2372 for hue, code, angle in MUNSELL_HUE_TO_ASTM_HUE: 

2373 assert hue_to_ASTM_hue([hue, code]) == angle 

2374 

2375 

2376class TestInterpolationMethodFromRenotationOvoid: 

2377 """ 

2378 Define :func:`colour.notation.munsell.\ 

2379interpolation_method_from_renotation_ovoid` definition unit tests methods. 

2380 """ 

2381 

2382 def test_interpolation_method_from_renotation_ovoid(self) -> None: 

2383 """ 

2384 Test :func:`colour.notation.munsell.\ 

2385interpolation_method_from_renotation_ovoid` definition. 

2386 """ 

2387 

2388 for i, (specification, _xyY) in enumerate(MUNSELL_EVEN_SPECIFICATIONS): 

2389 assert ( 

2390 interpolation_method_from_renotation_ovoid(specification) 

2391 == MUNSELL_INTERPOLATION_METHODS[i] 

2392 ) 

2393 

2394 assert ( 

2395 interpolation_method_from_renotation_ovoid( 

2396 np.array([np.nan, 5.2, np.nan, np.nan]) 

2397 ) 

2398 is None 

2399 ) 

2400 

2401 assert ( 

2402 interpolation_method_from_renotation_ovoid(np.array([2.5, 10.0, 2.0, 4])) 

2403 is None 

2404 ) 

2405 

2406 

2407class Test_xy_fromRenotationOvoid: 

2408 """ 

2409 Define :func:`colour.notation.munsell.xy_from_renotation_ovoid` definition 

2410 unit tests methods. 

2411 """ 

2412 

2413 def test_xy_from_renotation_ovoid(self) -> None: 

2414 """ 

2415 Test :func:`colour.notation.munsell.xy_from_renotation_ovoid` 

2416 definition. 

2417 """ 

2418 

2419 for i, (specification, _xyY) in enumerate(MUNSELL_EVEN_SPECIFICATIONS): 

2420 if is_specification_in_renotation(specification): 

2421 np.testing.assert_allclose( 

2422 xy_from_renotation_ovoid(specification), 

2423 MUNSELL_XY_FROM_RENOTATION_OVOID[i], 

2424 atol=TOLERANCE_ABSOLUTE_TESTS, 

2425 ) 

2426 

2427 # Test grey Munsell colour case (coverage for line 2347) 

2428 np.testing.assert_allclose( 

2429 xy_from_renotation_ovoid([np.nan, 8, np.nan, np.nan]), 

2430 np.array([0.31006, 0.31616]), 

2431 atol=0.00001, 

2432 ) 

2433 

2434 

2435class TestLCHabToMunsellSpecification: 

2436 """ 

2437 Define :func:`colour.notation.munsell.LCHab_to_munsell_specification` 

2438 definition unit tests methods. 

2439 """ 

2440 

2441 def test_LCHab_to_munsell_specification(self) -> None: 

2442 """ 

2443 Test :func:`colour.notation.munsell.LCHab_to_munsell_specification` 

2444 definition. 

2445 """ 

2446 

2447 np.testing.assert_allclose( 

2448 LCHab_to_munsell_specification( 

2449 np.array([100.00000000, 21.57210357, 272.22819350]) 

2450 ), 

2451 np.array([5.618942638888882, 10.0, 4.314420714000000, 10]), 

2452 atol=TOLERANCE_ABSOLUTE_TESTS, 

2453 ) 

2454 

2455 np.testing.assert_allclose( 

2456 LCHab_to_munsell_specification( 

2457 np.array([100.00000000, 426.67945353, 72.39590835]) 

2458 ), 

2459 np.array([0.109974541666666, 10.0, 85.335890706000001, 5]), 

2460 atol=TOLERANCE_ABSOLUTE_TESTS, 

2461 ) 

2462 

2463 np.testing.assert_allclose( 

2464 LCHab_to_munsell_specification( 

2465 np.array([100.00000000, 74.05216981, 276.45318193]) 

2466 ), 

2467 np.array([6.792550536111119, 10.0, 14.810433961999999, 10]), 

2468 atol=TOLERANCE_ABSOLUTE_TESTS, 

2469 ) 

2470 

2471 np.testing.assert_allclose( 

2472 LCHab_to_munsell_specification( 

2473 np.array([100.00000000, 21.57210357, 0.00000000]) 

2474 ), 

2475 np.array([10.000000000000000, 10.0, 4.314420714000000, 8]), 

2476 atol=TOLERANCE_ABSOLUTE_TESTS, 

2477 ) 

2478 

2479 np.testing.assert_allclose( 

2480 LCHab_to_munsell_specification( 

2481 np.array([100.00000000, 21.57210357, 36.00000000]) 

2482 ), 

2483 np.array([10.000000000000000, 10.0, 4.314420714000000, 7]), 

2484 atol=TOLERANCE_ABSOLUTE_TESTS, 

2485 ) 

2486 

2487 

2488class TestMaximumChromaFromRenotation: 

2489 """ 

2490 Define :func:`colour.notation.munsell.maximum_chroma_from_renotation` 

2491 definition unit tests methods. 

2492 """ 

2493 

2494 def test_maximum_chroma_from_renotation(self) -> None: 

2495 """ 

2496 Test :func:`colour.notation.munsell.maximum_chroma_from_renotation` 

2497 definition. 

2498 """ 

2499 

2500 assert maximum_chroma_from_renotation([2.5, 5, 5]) == 14.0 

2501 

2502 assert maximum_chroma_from_renotation([8.675, 1.225, 10]) == 48.0 

2503 

2504 assert maximum_chroma_from_renotation([6.875, 3.425, 1]) == 16.0 

2505 

2506 

2507class TestMunsellSpecification_to_xy: 

2508 """ 

2509 Define :func:`colour.notation.munsell.munsell_specification_to_xy` 

2510 definition unit tests methods. 

2511 """ 

2512 

2513 def test_munsell_specification_to_xy(self) -> None: 

2514 """ 

2515 Test :func:`colour.notation.munsell.munsell_specification_to_xy` 

2516 definition. 

2517 """ 

2518 

2519 for specification, xyY in MUNSELL_EVEN_SPECIFICATIONS: 

2520 np.testing.assert_allclose( 

2521 munsell_specification_to_xy(specification), 

2522 xyY[0:2], 

2523 atol=TOLERANCE_ABSOLUTE_TESTS, 

2524 ) 

2525 

2526 for specification, xyY in MUNSELL_GREYS_SPECIFICATIONS: 

2527 np.testing.assert_allclose( 

2528 munsell_specification_to_xy(specification[0]), 

2529 xyY[0:2], 

2530 atol=TOLERANCE_ABSOLUTE_TESTS, 

2531 )