8000 PR: Implement support for slugs to "colour.utilities.CaseInsensitiveMapping" class. by KelSolaar · Pull Request #993 · colour-science/colour · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PR: Implement support for slugs to "colour.utilities.CaseInsensitiveMapping" class. #993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions BIBLIOGRAPHY.bib
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,11 @@ @misc{DigitalCinemaInitiatives2007b
author = {{Digital Cinema Initiatives}},
year = 2007,
}
@misc{DjangoSoftwareFoundation2022,
title = {Slugify},
author = {{Django Software Foundation}},
year = 2022,
}
@misc{Dolby2016a,
title = {{{WHAT IS ICTCP}}? - {{INTRODUCTION}}},
author = {{Dolby}},
Expand Down Expand Up @@ -2780,10 +2785,6 @@ @misc{REDDigitalCinema2017
author = {{RED Digital Cinema}},
year = 2017,
}
@misc{Reitza,
title = {{{CaseInsensitiveDict}}},
author = {Reitz, Kenneth},
}
@misc{RenewableResourceDataCenter2003a,
title = {Reference {{Solar Spectral Irradiance}}: {{ASTM
G-173}}},
Expand Down
2 changes: 1 addition & 1 deletion colour/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,5 +939,5 @@ def __getattr__(self, attribute) -> Any:
__disable_lazy_load__ = colour.__disable_lazy_load__ # type: ignore[attr-defined]
"""
Ensures that the lazy loaded datasets are not transformed during import.
See :class:`colour.utilities.LazyCaseInsensitiveMapping` for more information.
See :class:`colour.utilities.LazyCanonicalMapping` for more information.
"""
4 changes: 2 additions & 2 deletions colour/adaptation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from colour.hints import Any, ArrayLike, Literal, NDArray, Union
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
filter_kwargs,
get_domain_range_scale,
as_float_array,
Expand Down Expand Up @@ -101,7 +101,7 @@
"chromatic_adaptation_Zhai2018",
]

CHROMATIC_ADAPTATION_METHODS: CaseInsensitiveMapping = CaseInsensitiveMapping(
CHROMATIC_ADAPTATION_METHODS: CanonicalMapping = CanonicalMapping(
{
"CIE 1994": chromatic_adaptation_CIE1994,
"CMCCAT2000": chromatic_adaptation_CMCCAT2000,
Expand Down
4 changes: 2 additions & 2 deletions colour/adaptation/cmccat2000.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Union,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
as_float_array,
from_range_100,
to_domain_100,
Expand Down Expand Up @@ -84,7 +84,7 @@ class InductionFactors_CMCCAT2000(NamedTuple):
F: Floating


VIEWING_CONDITIONS_CMCCAT2000: CaseInsensitiveMapping = CaseInsensitiveMapping(
VIEWING_CONDITIONS_CMCCAT2000: CanonicalMapping = CanonicalMapping(
{
"Average": InductionFactors_CMCCAT2000(1),
"Dim": InductionFactors_CMCCAT2000(0.8),
Expand Down
34 changes: 16 additions & 18 deletions colour/adaptation/datasets/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
import numpy as np

from colour.hints import NDArray
from colour.utilities import CaseInsensitiveMapping
from colour.utilities import CanonicalMapping

__author__ = "Colour Developers"
__copyright__ = "Copyright 2013 Colour Developers"
Expand Down Expand Up @@ -281,23 +281,21 @@
- This chromatic adaptation transform has no negative lobes.
"""

CHROMATIC_ADAPTATION_TRANSFORMS: CaseInsensitiveMapping = (
CaseInsensitiveMapping(
{
"XYZ Scaling": CAT_XYZ_SCALING,
"Von Kries": CAT_VON_KRIES,
"Bradford": CAT_BRADFORD,
"Sharp": CAT_SHARP,
"Fairchild": CAT_FAIRCHILD,
"CMCCAT97": CAT_CMCCAT97,
"CMCCAT2000": CAT_CMCCAT2000,
"CAT02": CAT_CAT02,
"CAT02 Brill 2008": CAT_CAT02_BRILL2008,
"CAT16": CAT_CAT16,
"Bianco 2010": CAT_BIANCO2010,
"Bianco PC 2010": CAT_PC_BIANCO2010,
}
)
CHROMATIC_ADAPTATION_TRANSFORMS: CanonicalMapping = CanonicalMapping(
{
"XYZ Scaling": CAT_XYZ_SCALING,
"Von Kries": CAT_VON_KRIES,
"Bradford": CAT_BRADFORD,
"Sharp": CAT_SHARP,
"Fairchild": CAT_FAIRCHILD,
"CMCCAT97": CAT_CMCCAT97,
"CMCCAT2000": CAT_CMCCAT2000,
"CAT02": CAT_CAT02,
"CAT02 Brill 2008": CAT_CAT02_BRILL2008,
"CAT16": CAT_CAT16,
"Bianco 2010": CAT_BIANCO2010,
"Bianco PC 2010": CAT_PC_BIANCO2010,
}
)
CHROMATIC_ADAPTATION_TRANSFORMS.__doc__ = """
Chromatic adaptation transforms.
Expand Down
4 changes: 2 additions & 2 deletions colour/algebra/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
cast,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
as_float,
3D11 as_float_array,
ones,
Expand Down Expand Up @@ -603,7 +603,7 @@ def ellipse_fitting_Halir1998(a: ArrayLike) -> NDArray:
return A


ELLIPSE_FITTING_METHODS: CaseInsensitiveMapping = CaseInsensitiveMapping(
ELLIPSE_FITTING_METHODS: CanonicalMapping = CanonicalMapping(
{"Halir 1998": ellipse_fitting_Halir1998}
)
ELLIPSE_FITTING_METHODS.__doc__ = """
Expand Down
4 changes: 2 additions & 2 deletions colour/algebra/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
cast,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
as_array,
as_float_array,
as_float,
Expand Down Expand Up @@ -1948,7 +1948,7 @@ def table_interpolation_tetrahedral(
return xyz_o


TABLE_INTERPOLATION_METHODS = CaseInsensitiveMapping(
TABLE_INTERPOLATION_METHODS = CanonicalMapping(
{
"Trilinear": table_interpolation_trilinear,
"Tetrahedral": table_interpolation_tetrahedral,
Expand Down
4 changes: 2 additions & 2 deletions colour/appearance/cam16.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
Union,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
MixinDataclassArithmetic,
as_float,
as_float_array,
Expand Down Expand Up @@ -122,7 +122,7 @@ class InductionFactors_CAM16(
"""


VIEWING_CONDITIONS_CAM16: CaseInsensitiveMapping = CaseInsensitiveMapping(
VIEWING_CONDITIONS_CAM16: CanonicalMapping = CanonicalMapping(
VIEWING_CONDITIONS_CIECAM02
)
VIEWING_CONDITIONS_CAM16.__doc__ = """
Expand Down
4 changes: 2 additions & 2 deletions colour/appearance/ciecam02.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
)
from colour.models import xy_to_XYZ
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
MixinDataclassArithmetic,
as_float,
as_float_array,
Expand Down Expand Up @@ -148,7 +148,7 @@ class InductionFactors_CIECAM02(
"""


VIEWING_CONDITIONS_CIECAM02: CaseInsensitiveMapping = CaseInsensitiveMapping(
VIEWING_CONDITIONS_CIECAM02: CanonicalMapping = CanonicalMapping(
{
"Average": InductionFactors_CIECAM02(1, 0.69, 1),
"Dim": InductionFactors_CIECAM02(0.9, 0.59, 0.9),
Expand Down
6 changes: 3 additions & 3 deletions colour/appearance/hellwig2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
Union,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
MixinDataclassArithmetic,
as_float,
as_float_array,
Expand Down Expand Up @@ -109,8 +109,8 @@ class InductionFactors_Hellwig2022(
"""


VIEWING_CONDITIONS_HELLWIG2022: CaseInsensitiveMapping = (
CaseInsensitiveMapping(VIEWING_CONDITIONS_CIECAM02)
VIEWING_CONDITIONS_HELLWIG2022: CanonicalMapping = CanonicalMapping(
VIEWING_CONDITIONS_CIECAM02
)
VIEWING_CONDITIONS_HELLWIG2022.__doc__ = """
Reference *Hellwig and Fairchild (2022)* colour appearance model viewing
Expand Down
4 changes: 2 additions & 2 deletions colour/appearance/hke.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Union,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
as_float_array,
tsplit,
validate_method,
Expand All @@ -57,7 +57,7 @@
"coefficient_K_Br_Nayatani1997",
]

HKE_NAYATANI1997_METHODS = CaseInsensitiveMapping(
HKE_NAYATANI1997_METHODS = CanonicalMapping(
{
"VAC": -0.1340,
"VCC": -0.8660,
Expand Down
4 changes: 2 additions & 2 deletions colour/appearance/hunt.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
cast,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
MixinDataclassArithmetic,
as_float,
as_float_array,
Expand Down Expand Up @@ -122,7 +122,7 @@ def __new__(cls, N_c, N_b, N_cb=None, N_bb=None):
return super().__new__(cls, N_c, N_b, N_cb, N_bb)


VIEWING_CONDITIONS_HUNT: CaseInsensitiveMapping = CaseInsensitiveMapping(
VIEWING_CONDITIONS_HUNT: CanonicalMapping = CanonicalMapping(
{
"Small Areas, Uniform Background & Surrounds": InductionFactors_Hunt(
1, 300
Expand Down
6 changes: 3 additions & 3 deletions colour/appearance/kim2009.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
Optional,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
MixinDataclassArithmetic,
as_float,
as_float_array,
Expand Down Expand Up @@ -110,7 +110,7 @@ class InductionFactors_Kim2009(
"""


VIEWING_CONDITIONS_KIM2009: CaseInsensitiveMapping = CaseInsensitiveMapping(
VIEWING_CONDITIONS_KIM2009: CanonicalMapping = CanonicalMapping(
VIEWING_CONDITIONS_CIECAM02
)
VIEWING_CONDITIONS_KIM2009.__doc__ = """
Expand Down Expand Up @@ -146,7 +146,7 @@ def __new__(cls, E):
return super().__new__(cls, E)


MEDIA_PARAMETERS_KIM2009: CaseInsensitiveMapping = CaseInsensitiveMapping(
MEDIA_PARAMETERS_KIM2009: CanonicalMapping = CanonicalMapping(
{
"High-luminance LCD Display": MediaParameters_Kim2009(1),
"Transparent Advertising Media": MediaParameters_Kim2009(1.2175),
Expand Down
4 changes: 2 additions & 2 deletions colour/appearance/llab.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
Optional,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
MixinDataclassArithmetic,
as_float,
as_float_array,
Expand Down Expand Up @@ -104,7 +104,7 @@ class InductionFactors_LLAB(
"""


VIEWING_CONDITIONS_LLAB: CaseInsensitiveMapping = CaseInsensitiveMapping(
VIEWING_CONDITIONS_LLAB: CanonicalMapping = CanonicalMapping(
{
"Reference Samples & Images, Average Surround, Subtending > 4": (
InductionFactors_LLAB(1, 3, 0, 1)
Expand Down
6 changes: 3 additions & 3 deletions colour/appearance/rlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
Optional,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
MixinDataclassArray,
as_float,
as_float_array,
Expand Down Expand Up @@ -68,7 +68,7 @@
)
"""*RLAB* colour appearance model precomputed helper matrix."""

VIEWING_CONDITIONS_RLAB: CaseInsensitiveMapping = CaseInsensitiveMapping(
VIEWING_CONDITIONS_RLAB: CanonicalMapping = CanonicalMapping(
{"Average": 1 / 2.3, "Dim": 1 / 2.9, "Dark": 1 / 3.5}
)
VIEWING_CONDITIONS_RLAB.__doc__ = """
Expand All @@ -79,7 +79,7 @@
:cite:`Fairchild1996a`, :cite:`Fairchild2013w`
"""

D_FACTOR_RLAB: CaseInsensitiveMapping = CaseInsensitiveMapping(
D_FACTOR_RLAB: CanonicalMapping = CanonicalMapping(
{
"Hard Copy Images": 1,
"Soft Copy Images": 0,
Expand Down
4 changes: 2 additions & 2 deletions colour/appearance/zcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
)
from colour.models import Izazbz_to_XYZ, XYZ_to_Izazbz, xy_to_XYZ
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
MixinDataclassArithmetic,
as_float,
as_float_array,
Expand Down Expand Up @@ -109,7 +109,7 @@ class InductionFactors_ZCAM(
"""


VIEWING_CONDITIONS_ZCAM: CaseInsensitiveMapping = CaseInsensitiveMapping(
VIEWING_CONDITIONS_ZCAM: CanonicalMapping = CanonicalMapping(
{
"Average": InductionFactors_ZCAM(
0.69, *VIEWING_CONDITIONS_CIECAM02["Average"]
Expand Down
18 changes: 8 additions & 10 deletions colour/biochemistry/michaelis_menten.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Union,
)
from colour.utilities import (
CaseInsensitiveMapping,
CanonicalMapping,
as_float,
as_float_array,
filter_kwargs,
Expand Down Expand Up @@ -157,13 +157,11 @@ def reaction_rate_MichaelisMenten_Abebe2017(
return as_float(v)


REACTION_RATE_MICHAELISMENTEN_METHODS: CaseInsensitiveMapping = (
CaseInsensitiveMapping(
{
"Michaelis 1913": reaction_rate_MichaelisMenten_Michaelis1913,
"Abebe 2017": reaction_rate_MichaelisMenten_Abebe2017,
}
)
REACTION_RATE_MICHAELISMENTEN_METHODS: CanonicalMapping = CanonicalMapping(
{
"Michaelis 1913": reaction_rate_MichaelisMenten_Michaelis1913,
"Abebe 2017": reaction_rate_MichaelisMenten_Abebe2017,
}
)
REACTION_RATE_MICHAELISMENTEN_METHODS.__doc__ = """
Supported *Michaelis-Menten* kinetics reaction rate equation computation
Expand Down Expand Up @@ -330,8 +328,8 @@ def substrate_concentration_MichaelisMenten_Abebe2017(


SUBSTRATE_CONCENTRATION_MICHAELISMENTEN_METHODS: (
CaseInsensitiveMapping
) = CaseInsensitiveMapping(
CanonicalMapping
) = CanonicalMapping(
{
"Michaelis 1913": substrate_concentration_MichaelisMenten_Michaelis1913,
"Abebe 2017": substrate_concentration_MichaelisMenten_Abebe2017,
Expand Down
4 changes: 2 additions & 2 deletions colour/blindness/datasets/machado2010.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import numpy as np

from colour.utilities import CaseInsensitiveMapping
from colour.utilities import CanonicalMapping

__author__ = "Colour Developers"
__copyright__ = "Copyright 2013 Colour Developers 65AC "
Expand All @@ -28,7 +28,7 @@
"CVD_MATRICES_MACHADO2010",
]

CVD_MATRICES_MACHADO2010: CaseInsensitiveMapping = CaseInsensitiveMapping(
CVD_MATRICES_MACHADO2010: CanonicalMapping = CanonicalMapping(
{
"Protanomaly": {
0.0: np.array(
Expand Down
Loading
0