11"""
22:math:`M_{t}` - Metamerism Index
3- ====================================================
3+ ================================
44
55Define the :math:`M_{t}` metamerism computation objects.
66
7- - :func:`colour.difference.metamerism_index_from_Lab `
8- - :func:`colour.difference.metamerism_index_from_XYZ `
7+ - :func:`colour.difference.Lab_to_metamerism_index `
8+ - :func:`colour.difference.XYZ_to_metamerism_index `
99
1010References
1111----------
3030from colour .utilities import (
3131 as_array ,
3232 filter_kwargs ,
33+ validate_method ,
3334)
3435
3536__author__ = "Colour Developers"
4041__status__ = "Production"
4142
4243__all__ = [
43- "metamerism_index_from_Lab " ,
44- "metamerism_index_from_XYZ " ,
44+ "Lab_to_metamerism_index " ,
45+ "XYZ_to_metamerism_index " ,
4546]
4647
4748
48- def metamerism_index_from_Lab (
49+ def Lab_to_metamerism_index (
4950 Lab_spl_t : Domain100 ,
5051 Lab_std_t : Domain100 ,
5152 Lab_spl_r : Domain100 ,
5253 Lab_std_r : Domain100 ,
53- correction : Literal ["additive " , "multiplicative " ] | str = "additive " ,
54+ correction : Literal ["Additive " , "Multiplicative " ] | str = "Additive " ,
5455 method : LiteralDeltaEMethod | str = "CIE 2000" ,
5556 ** kwargs : Any ,
5657) -> NDArrayFloat :
@@ -79,7 +80,7 @@ def metamerism_index_from_Lab(
7980 *CIE L\\ *a\\ *b\\ ** colourspace array of colour standard under
8081 reference illuminant.
8182 correction
82- Correction method to apply, either 'additive ' or 'multiplicative '.
83+ Correction method to apply, either 'Additive ' or 'Multiplicative '.
8384 metric
8485 Colour difference metric to use.
8586
@@ -130,26 +131,28 @@ def metamerism_index_from_Lab(
130131 >>> Lab_std_t = np.array([38.17781, -17.4939, 21.0618])
131132 >>> Lab_spl_r = np.array([38.83253, -19.8787, 20.0453])
132133 >>> Lab_spl_t = np.array([37.9013, -19.56327, 16.9346])
133- >>> metamerism_index_from_Lab (
134+ >>> Lab_to_metamerism_index (
134135 ... Lab_spl_t,
135136 ... Lab_std_t,
136137 ... Lab_spl_r,
137138 ... Lab_std_r,
138- ... correction="additive ",
139+ ... correction="Additive ",
139140 ... method="CIE 1976",
140141 ... ) # doctest: +ELLIPSIS
141142 3.8267581...
142- >>> metamerism_index_from_Lab (
143+ >>> Lab_to_metamerism_index (
143144 ... Lab_spl_t,
144145 ... Lab_std_t,
145146 ... Lab_spl_r,
146147 ... Lab_std_r,
147- ... correction="multiplicative ",
148+ ... correction="Multiplicative ",
148149 ... method="CIE 1976",
149150 ... ) # doctest: +ELLIPSIS
150151 3.9842216...
151152 """
152153
154+ correction = validate_method (correction , ("Additive" , "Multiplicative" ))
155+
153156 if correction == "additive" :
154157 Lab_corr_t = as_array (Lab_spl_t ) - (as_array (Lab_spl_r ) - as_array (Lab_std_r ))
155158
@@ -164,12 +167,12 @@ def metamerism_index_from_Lab(
164167 )
165168
166169
167- def metamerism_index_from_XYZ (
170+ def XYZ_to_metamerism_index (
168171 XYZ_spl_t : Domain1 ,
169172 XYZ_std_t : Domain1 ,
170173 XYZ_spl_r : Domain1 ,
171174 XYZ_std_r : Domain1 ,
172- correction : Literal ["additive " , "multiplicative " ] | str = "multiplicative " ,
175+ correction : Literal ["Additive " , "Multiplicative " ] | str = "Multiplicative " ,
173176 method : LiteralDeltaEMethod | str = "CIE 2000" ,
174177 ** kwargs : Any ,
175178) -> NDArrayFloat :
@@ -200,8 +203,8 @@ def metamerism_index_from_XYZ(
200203 *CIE XYZ* tristimulus array of the standard under reference
201204 illuminant.
202205 correction
203- Correction method to apply, either 'additive ' or
204- 'multiplicative '.
206+ Correction method to apply, either 'Additive ' or
207+ 'Multiplicative '.
205208 method
206209 Colour-difference method.
207210
@@ -257,7 +260,7 @@ def metamerism_index_from_XYZ(
257260 >>> XYZ_std_t = np.array([8.96442, 10.1878, 1.6663]) / 100
258261 >>> XYZ_spl_r = np.array([7.6933, 10.5616, 5.54474]) / 100
259262 >>> XYZ_spl_t = np.array([8.56438, 10.0324, 1.9315]) / 100
260- >>> metamerism_index_from_XYZ (
263+ >>> XYZ_to_metamerism_index (
261264 ... XYZ_spl_t,
262265 ... XYZ_std_t,
263266 ... XYZ_spl_r,
@@ -267,7 +270,7 @@ def metamerism_index_from_XYZ(
267270 ... illuminant=CCS_ILLUMINANTS["CIE 1964 10 Degree Standard Observer"]["A"],
268271 ... ) # doctest: +ELLIPSIS
269272 3.7906989...
270- >>> metamerism_index_from_XYZ (
273+ >>> XYZ_to_metamerism_index (
271274 ... XYZ_spl_t,
272275 ... XYZ_std_t,
273276 ... XYZ_spl_r,
@@ -279,6 +282,8 @@ def metamerism_index_from_XYZ(
279282 4.6910648...
280283 """
281284
285+ correction = validate_method (correction , ("Additive" , "Multiplicative" ))
286+
282287 if correction == "additive" :
283288 XYZ_corr_t = as_array (XYZ_spl_t ) - (as_array (XYZ_spl_r ) - as_array (XYZ_std_r ))
284289
0 commit comments