"""
Color maps and color conversion utilities for BCDI visualisation.
This module provides custom colormaps and utilities for converting complex-valued
arrays to RGB(A) representations, particularly useful for visualising phase
information in BCDI reconstructions.
"""
import colorcet # noqa: F401
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import colormaps
from matplotlib.colors import BivarColormapFromImage, LinearSegmentedColormap
AVAILABLE_2D_CMAPS = ["abyss", "peak", "barrel", "jch_max", "jch_const"]
# module-level cache for 2D LUTs (loaded on demand)
_LUTS = {}
def _load_lut(cmap_name: str) -> np.ndarray:
"""
Lazy-load 2D LUT from disk.
LUTs are cached after first load to avoid repeated file I/O.
Args:
cmap_name: Name of colormap ('max' or 'const').
Returns:
2D LUT array of shape (256, 256, 3).
"""
if cmap_name not in _LUTS:
from pathlib import Path
lut_path = Path(__file__).parent / f"lut_{cmap_name}.npz"
if lut_path.exists():
with np.load(lut_path) as data:
_LUTS[cmap_name] = data["lut"]
else:
raise FileNotFoundError(f"Could not find LUT file: {lut_path}")
return _LUTS[cmap_name]
[docs]
def complex_to_rgb(
complex_array: np.ndarray,
cmap: str = "abyss",
) -> np.ndarray:
"""
Map complex array to RGB using perceptually uniform JCh colormap.
This function encodes complex data into RGB colors using the JCh (CAM02-UCS)
perceptually uniform color space. Phase is mapped to hue, and magnitude is
encoded as lightness in the RGB values.
Args:
complex_array: Complex-valued array of any shape.
cmap: 2D colormap to use. Options:
- 'abyss': Perceptually uniform colormap (dark to light)
- 'peak': High-contrast colormap (emphasizes peaks)
- 'barrel': Cylindrical colormap (smooth transitions)
- 'jch_max': Maximum chroma colormap (vivid, saturated colors)
- 'jch_const': Constant chroma colormap (uniform brightness across hues)
Default is 'jch_const'.
output_type: Output data type. Options:
- 'float': Values in [0, 1] range (default)
- 'uint8': Values in [0, 255] range (for saving images)
Returns:
Array of shape (..., 3) containing RGB values.
RGB channels encode both phase (as hue) and magnitude (as lightness)
via the JCh colorspace.
Examples:
>>> # Basic usage with default max chroma colormap
>>> rgb = complex_to_rgb(complex_array)
>>> plt.imshow(rgb)
>>> # Use constant chroma for uniform appearance
>>> rgb = complex_to_rgb(complex_array, cmap='jch_const')
>>> # Save as uint8 image
>>> rgb = complex_to_rgb(complex_array, output_type='uint8')
>>> plt.imsave('complex_data.png', rgb)
Notes:
Unlike HSV-based approaches, this uses the CAM02-UCS (JCh) color space,
ensuring equal perceptual differences for equal phase differences.
Magnitude is fully encoded in RGB lightness - no alpha channel needed.
References:
- https://colorstamps.readthedocs.io/en/latest/index.html
- https://github.com/endolith/complex_colormap
"""
# load appropriate 2D LUT (lazy-loaded and cached)
if cmap not in AVAILABLE_2D_CMAPS:
raise ValueError(
f"cmap must be 'abyss', 'peak', 'barrel', 'jch_max', 'jch_const', got '{cmap}'"
)
lut_2d = _load_lut(cmap)
# get phase and magnitude
phase = np.angle(complex_array) # [-pi, pi]
magnitude = np.abs(complex_array)
# normalise magnitude to [0, 1]
magnitude = (magnitude - magnitude.min()) / (np.ptp(magnitude) + 1e-12)
# convert phase [-pi, pi] to hue [0, 1]
h_degrees = (phase + np.pi) / (2 * np.pi)
bivar_cmap = BivarColormapFromImage(lut_2d, shape="circle")
rgb = bivar_cmap((magnitude, h_degrees))
return rgb
# # convert normalised magnitude to lightness [0, 100]
# J_lightness = 100 * magnitude
# # map to LUT indices
# J_lutsize, h_lutsize = lut_2d.shape[:2]
# J_indices = (
# (J_lightness * (J_lutsize - 1) / 100)
# .astype(int)
# .clip(0, J_lutsize - 1)
# )
# h_indices = (
# (h_degrees * (h_lutsize - 1) / 360).astype(int).clip(0, h_lutsize - 1)
# )
# # lookup RGB values from LUT
# rgb = lut_2d[J_indices, h_indices]
# # convert to requested type
# if output_type == "uint8":
# rgb = (rgb * 255).astype(np.uint8)
# elif output_type != "float":
# raise ValueError(
# f"output_type must be 'float' or 'uint8', got '{output_type}'"
# )
# return rgb
[docs]
def save_json_cmap(colormap_name: str, output_path: str) -> None:
cmap = plt.get_cmap(colormap_name)
pace = 0.015
array = np.arange(0, 1 + pace, pace)
with open(output_path, "w") as file:
file.write(
"""
[
{
"ColorSpace" : "Lab",
"Creator" : "Matplotlib",
"DefaultMap" : true,
"""
)
file.write(f'"Name" : "{colormap_name}",')
file.write(
"""
"NanColor" :
[
0,
0,
0
],
"RGBPoints" :
[
"""
)
for i, e in enumerate(array):
file.write(f"{e} ,\n{cmap(e)[0]},\n{cmap(e)[1]},\n{cmap(e)[2]}")
if i != array.shape[0] - 1:
file.write(",\n")
file.write(
"""
]
}
]
"""
)
PARULA = LinearSegmentedColormap.from_list(
"parula",
[
[0.2081, 0.1663, 0.5292],
[0.2116238095, 0.1897809524, 0.5776761905],
[0.212252381, 0.2137714286, 0.6269714286],
[0.2081, 0.2386, 0.6770857143],
[0.1959047619, 0.2644571429, 0.7279],
[0.1707285714, 0.2919380952, 0.779247619],
[0.1252714286, 0.3242428571, 0.8302714286],
[0.0591333333, 0.3598333333, 0.8683333333],
[0.0116952381, 0.3875095238, 0.8819571429],
[0.0059571429, 0.4086142857, 0.8828428571],
[0.0165142857, 0.4266, 0.8786333333],
[0.032852381, 0.4430428571, 0.8719571429],
[0.0498142857, 0.4585714286, 0.8640571429],
[0.0629333333, 0.4736904762, 0.8554380952],
[0.0722666667, 0.4886666667, 0.8467],
[0.0779428571, 0.5039857143, 0.8383714286],
[0.079347619, 0.5200238095, 0.8311809524],
[0.0749428571, 0.5375428571, 0.8262714286],
[0.0640571429, 0.5569857143, 0.8239571429],
[0.0487714286, 0.5772238095, 0.8228285714],
[0.0343428571, 0.5965809524, 0.819852381],
[0.0265, 0.6137, 0.8135],
[0.0238904762, 0.6286619048, 0.8037619048],
[0.0230904762, 0.6417857143, 0.7912666667],
[0.0227714286, 0.6534857143, 0.7767571429],
[0.0266619048, 0.6641952381, 0.7607190476],
[0.0383714286, 0.6742714286, 0.743552381],
[0.0589714286, 0.6837571429, 0.7253857143],
[0.0843, 0.6928333333, 0.7061666667],
[0.1132952381, 0.7015, 0.6858571429],
[0.1452714286, 0.7097571429, 0.6646285714],
[0.1801333333, 0.7176571429, 0.6424333333],
[0.2178285714, 0.7250428571, 0.6192619048],
[0.2586428571, 0.7317142857, 0.5954285714],
[0.3021714286, 0.7376047619, 0.5711857143],
[0.3481666667, 0.7424333333, 0.5472666667],
[0.3952571429, 0.7459, 0.5244428571],
[0.4420095238, 0.7480809524, 0.5033142857],
[0.4871238095, 0.7490619048, 0.4839761905],
[0.5300285714, 0.7491142857, 0.4661142857],
[0.5708571429, 0.7485190476, 0.4493904762],
[0.609852381, 0.7473142857, 0.4336857143],
[0.6473, 0.7456, 0.4188],
[0.6834190476, 0.7434761905, 0.4044333333],
[0.7184095238, 0.7411333333, 0.3904761905],
[0.7524857143, 0.7384, 0.3768142857],
[0.7858428571, 0.7355666667, 0.3632714286],
[0.8185047619, 0.7327333333, 0.3497904762],
[0.8506571429, 0.7299, 0.3360285714],
[0.8824333333, 0.7274333333, 0.3217],
[0.9139333333, 0.7257857143, 0.3062761905],
[0.9449571429, 0.7261142857, 0.2886428571],
[0.9738952381, 0.7313952381, 0.266647619],
[0.9937714286, 0.7454571429, 0.240347619],
[0.9990428571, 0.7653142857, 0.2164142857],
[0.9955333333, 0.7860571429, 0.196652381],
[0.988, 0.8066, 0.1793666667],
[0.9788571429, 0.8271428571, 0.1633142857],
[0.9697, 0.8481380952, 0.147452381],
[0.9625857143, 0.8705142857, 0.1309],
[0.9588714286, 0.8949, 0.1132428571],
[0.9598238095, 0.9218333333, 0.0948380952],
[0.9661, 0.9514428571, 0.0755333333],
[0.9763, 0.9831, 0.0538],
],
)
RED_TO_TEAL = LinearSegmentedColormap.from_list(
"red_to_teal",
[
"#f84650",
"#fb4358",
"#fb455b",
"#fc475d",
"#fc495e",
"#fc4b60",
"#fd4d62",
"#fd4f64",
"#fd5165",
"#fd5367",
"#fe5568",
"#fe576a",
"#fe596b",
"#fe5b6d",
"#fe5d6e",
"#ff5f70",
"#ff6171",
"#ff6373",
"#ff6574",
"#ff6776",
"#ff6977",
"#ff6a79",
"#ff6c7a",
"#ff6e7c",
"#ff707d",
"#ff727e",
"#ff7380",
"#ff7581",
"#ff7783",
"#ff7984",
"#ff7a85",
"#ff7c87",
"#ff7e88",
"#ff7f8a",
"#ff818b",
"#ff838c",
"#ff848e",
"#ff868f",
"#ff8890",
"#ff8992",
"#ff8b93",
"#ff8d95",
"#fe8e96",
"#fe9097",
"#fe9199",
"#fe939a",
"#fe959b",
"#fe969d",
"#fd989e",
"#fd99a0",
"#fd9ba1",
"#fd9da2",
"#fd9ea4",
"#fca0a5",
"#fca1a6",
"#fca3a8",
"#fca4a9",
"#fba6ab",
"#fba7ac",
"#fba9ad",
"#fbabaf",
"#faacb0",
"#faaeb1",
"#faafb3",
"#f9b1b4",
"#f9b2b6",
"#f9b4b7",
"#f8b5b8",
"#f8b7ba",
"#f8b8bb",
"#f7babc",
"#f7bbbe",
"#f6bdbf",
"#f6bec1",
"#f6c0c2",
"#f5c1c3",
"#f5c3c5",
"#f4c4c6",
"#f4c6c7",
"#f3c7c9",
"#f3c9ca",
"#f2cacc",
"#f2cccd",
"#f1cdce",
"#f1cfd0",
"#f0d0d1",
"#efd2d3",
"#efd3d4",
"#eed4d5",
"#eed6d7",
"#edd7d8",
"#ecd9d9",
"#ecdadb",
"#ebdcdc",
"#eaddde",
"#eadfdf",
"#e9e0e0",
"#e8e2e2",
"#e8e3e3",
"#e7e5e5",
"#e3e5e5",
"#e1e5e4",
"#dfe4e4",
"#dce4e3",
"#dae3e2",
"#d7e3e1",
"#d5e2e0",
"#d3e1e0",
"#d0e1df",
"#cee0de",
"#ccdfdd",
"#c9dfdd",
"#c7dedc",
"#c5dddb",
"#c3ddda",
"#c0dcda",
"#bedbd9",
"#bcdbd8",
"#badad7",
"#b8d9d7",
"#b6d8d6",
"#b4d8d5",
"#b2d7d5",
"#afd6d4",
"#add6d3",
"#abd5d2",
"#a9d4d2",
"#a7d3d1",
"#a5d3d0",
"#a3d2d0",
"#a1d1cf",
"#9fd0ce",
"#9dcfcd",
"#9bcfcd",
"#99cecc",
"#97cdcb",
"#95cccb",
"#93ccca",
"#91cbc9",
"#90cac9",
"#8ec9c8",
"#8cc8c7",
"#8ac7c7",
"#88c7c6",
"#86c6c5",
"#84c5c5",
"#82c4c4",
"#80c3c3",
"#7ec3c2",
"#7dc2c2",
"#7bc1c1",
"#79c0c1",
"#77bfc0",
"#75bebf",
"#73bebf",
"#71bdbe",
"#70bcbd",
"#6ebbbd",
"#6cbabc",
"#6ab9bb",
"#68b8bb",
"#66b8ba",
"#64b7b9",
"#62b6b9",
"#61b5b8",
"#5fb4b7",
"#5db3b7",
"#5bb3b6",
"#59b2b5",
"#57b1b5",
"#55b0b4",
"#53afb4",
"#51aeb3",
"#4fadb2",
"#4dacb2",
"#4bacb1",
"#49abb0",
"#47aab0",
"#45a9af",
"#43a8af",
"#41a7ae",
"#3fa6ad",
"#3da5ad",
"#3aa5ac",
"#38a4ab",
"#36a3ab",
"#33a2aa",
"#31a1aa",
"#2ea0a9",
"#2c9fa8",
"#299ea8",
"#269ea7",
"#239da6",
"#209ca6",
"#1c9ba5",
"#189aa5",
"#1499a4",
"#0e98a3",
"#0797a3",
"#0097a2",
],
)
TURBO_FIRST_HALF = LinearSegmentedColormap.from_list(
"turbo_first_half",
[
"#30123b",
"#31133d",
"#31143e",
"#321540",
"#321641",
"#331743",
"#331744",
"#341846",
"#341947",
"#351a49",
"#351b4b",
"#361c4c",
"#361d4e",
"#371e4f",
"#371f51",
"#382052",
"#382154",
"#382256",
"#392357",
"#392359",
"#3a245a",
"#3a255c",
"#3b265d",
"#3b275f",
"#3b2861",
"#3c2962",
"#3c2a64",
"#3d2b65",
"#3d2c67",
"#3d2d68",
"#3e2e6a",
"#3e2f6b",
"#3e306d",
"#3f316f",
"#3f3270",
"#3f3372",
"#403473",
"#403575",
"#403676",
"#413778",
"#413879",
"#41397b",
"#413a7c",
"#423b7e",
"#423c80",
"#423d81",
"#433e83",
"#433f84",
"#434086",
"#434187",
"#444289",
"#44438a",
"#44448c",
"#44458d",
"#44468f",
"#454790",
"#454892",
"#454993",
"#454a95",
"#454c96",
"#464d98",
"#464e99",
"#464f9a",
"#46509c",
"#46519d",
"#46529f",
"#4753a0",
"#4754a2",
"#4755a3",
"#4756a4",
"#4757a6",
"#4759a7",
"#475aa9",
"#475baa",
"#475cab",
"#475dad",
"#485eae",
"#485faf",
"#4860b1",
"#4862b2",
"#4863b3",
"#4864b5",
"#4865b6",
"#4866b7",
"#4867b9",
"#4868ba",
"#486abb",
"#486bbc",
"#486cbe",
"#486dbf",
"#486ec0",
"#486fc1",
"#4871c3",
"#4872c4",
"#4873c5",
"#4774c6",
"#4775c7",
"#4777c8",
"#4778ca",
"#4779cb",
"#477acc",
"#477bcd",
"#477dce",
"#467ecf",
"#467fd0",
"#4680d1",
"#4681d2",
"#4683d3",
"#4684d4",
"#4585d5",
"#4586d6",
"#4588d7",
"#4589d8",
"#448ad9",
"#448bda",
"#448ddb",
"#438edc",
"#438fdd",
"#4391de",
"#4292de",
"#4293df",
"#4194e0",
"#4196e1",
"#4097e2",
"#4098e2",
"#409ae3",
"#3f9be4",
"#3e9ce4",
"#3e9ee5",
"#3d9fe6",
"#3da0e6",
"#3ca2e7",
"#3ba3e7",
"#3aa4e8",
"#3aa6e9",
"#39a7e9",
"#38a8ea",
"#37aaea",
"#36abea",
"#35adeb",
"#34aeeb",
"#33afeb",
"#32b1ec",
"#30b2ec",
"#2fb4ec",
"#2eb5ed",
"#2cb6ed",
"#2ab8ed",
"#2ab9ed",
"#2dbbea",
"#30bce8",
"#33bee6",
"#36bfe4",
"#38c1e1",
"#3bc2df",
"#3dc4dd",
"#3fc5da",
"#41c7d8",
"#43c8d6",
"#45c9d3",
"#47cbd1",
"#49ccce",
"#4bcecc",
"#4dcfc9",
"#4ed1c7",
"#50d2c4",
"#52d4c2",
"#54d5bf",
"#55d6bc",
"#57d8ba",
"#59d9b7",
"#5adbb4",
"#5cdcb1",
"#5eddaf",
"#60dfac",
"#61e0a9",
"#63e1a6",
"#65e3a3",
"#67e4a0",
"#69e59d",
"#6be799",
"#6de896",
"#6fe993",
"#71eb8f",
"#73ec8c",
"#75ed88",
"#77ee84",
"#7af080",
"#7cf17c",
"#7ff278",
"#82f374",
"#85f46f",
"#88f56a",
"#8bf765",
"#8ef860",
"#92f95a",
"#96fa54",
"#9afa4d",
"#9efb45",
"#a3fc3c",
],
)
TURBO_SECOND_HALF = LinearSegmentedColormap.from_list(
"turbo_second_half",
[
"#a3fc3c",
"#a7fa3c",
"#abf83c",
"#aff63c",
"#b3f43b",
"#b6f33b",
"#b9f13b",
"#bcef3b",
"#bfed3a",
"#c2eb3a",
"#c4ea3a",
"#c6e83a",
"#c9e639",
"#cbe439",
"#cde339",
"#cfe138",
"#d1df38",
"#d3dd38",
"#d4dc37",
"#d6da37",
"#d8d837",
"#d9d736",
"#dbd536",
"#dcd336",
"#ddd135",
"#dfd035",
"#e0ce35",
"#e1cc34",
"#e3cb34",
"#e4c933",
"#e5c733",
"#e6c633",
"#e7c432",
"#e8c232",
"#e9c132",
"#eabf31",
"#ebbd31",
"#ebbc30",
"#ecba30",
"#edb830",
"#eeb72f",
"#eeb52f",
"#efb32e",
"#f0b22e",
"#f0b02d",
"#f1ae2d",
"#f2ad2d",
"#f2ab2c",
"#f3aa2c",
"#f3a82b",
"#f4a62b",
"#f4a52b",
"#f5a32a",
"#f5a12a",
"#f6a029",
"#f69e29",
"#f79c28",
"#f79a28",
"#f79928",
"#f89727",
"#f89527",
"#f89426",
"#f99226",
"#f99025",
"#f98f25",
"#f98d25",
"#fa8b24",
"#fa8a24",
"#fa8823",
"#fa8623",
"#fa8423",
"#fb8222",
"#fb8122",
"#fb7f21",
"#fb7e21",
"#fa7c20",
"#f97b20",
"#f97a1f",
"#f8791f",
"#f7781e",
"#f7761e",
"#f6751d",
"#f5741d",
"#f4731c",
"#f4721c",
"#f3711c",
"#f26f1b",
"#f16e1b",
"#f16d1a",
"#f06c1a",
"#ef6b19",
"#ee6a19",
"#ed6919",
"#ed6818",
"#ec6618",
"#eb6517",
"#ea6417",
"#e96317",
"#e86216",
"#e76116",
"#e76016",
"#e65f15",
"#e55e15",
"#e45d15",
"#e35b14",
"#e25a14",
"#e15913",
"#e05813",
"#df5713",
"#de5613",
"#de5512",
"#dd5412",
"#dc5312",
"#db5211",
"#da5111",
"#d95011",
"#d84f10",
"#d74e10",
"#d64d10",
"#d54c10",
"#d44b0f",
"#d34a0f",
"#d2490f",
"#d1480f",
"#d0470e",
"#cf460e",
"#ce450e",
"#cd440e",
"#cc430d",
"#cb420d",
"#ca410d",
"#c9400d",
"#c83f0c",
"#c73e0c",
"#c53d0c",
"#c43c0c",
"#c33b0c",
"#c23a0b",
"#c1390b",
"#c0380b",
"#bf370b",
"#be370b",
"#bd360b",
"#bc350a",
"#bb340a",
"#ba330a",
"#b8320a",
"#b7310a",
"#b6300a",
"#b52f09",
"#b42e09",
"#b32d09",
"#b22d09",
"#b12c09",
"#af2b09",
"#ae2a09",
"#ad2909",
"#ac2808",
"#ab2708",
"#aa2608",
"#a92508",
"#a72508",
"#a62408",
"#a52308",
"#a42208",
"#a32108",
"#a22008",
"#a01f08",
"#9f1f07",
"#9e1e07",
"#9d1d07",
"#9c1c07",
"#9b1b07",
"#991a07",
"#981907",
"#971907",
"#961807",
"#951707",
"#931607",
"#921506",
"#911406",
"#901306",
"#8f1306",
"#8d1206",
"#8c1106",
"#8b1006",
"#8a0f06",
"#890e05",
"#870d05",
"#860c05",
"#850b05",
"#840b05",
"#830a04",
"#810904",
"#800804",
"#7f0704",
"#7e0604",
"#7c0503",
"#7b0503",
"#7a0403",
],
)
JCH_MAX_ARRAY = np.array(
[
[1.0000000000, 0.1220006161, 0.5583278540],
[1.0000000000, 0.1322379002, 0.5407820884],
[1.0000000000, 0.1413660049, 0.5234136709],
[1.0000000000, 0.1495810942, 0.5061991846],
[1.0000000000, 0.1570464169, 0.4891155545],
[1.0000000000, 0.1638854831, 0.4721397299],
[1.0000000000, 0.1701852871, 0.4552473946],
[1.0000000000, 0.1760155089, 0.4384132431],
[1.0000000000, 0.1814332279, 0.4216107555],
[1.0000000000, 0.1864861429, 0.4048119030],
[1.0000000000, 0.1912148428, 0.3879867602],
[1.0000000000, 0.1956544509, 0.3711029904],
[1.0000000000, 0.1998358438, 0.3541251568],
[1.0000000000, 0.2037719980, 0.3370093010],
[1.0000000000, 0.2074962531, 0.3197120723],
[1.0000000000, 0.2110183169, 0.3021759097],
[1.0000000000, 0.2143544527, 0.2843348849],
[1.0000000000, 0.2175267043, 0.2661116024],
[1.0000000000, 0.2205433589, 0.2474028431],
[1.0000000000, 0.2234131681, 0.2280747879],
[1.0000000000, 0.2261454370, 0.2079470543],
[1.0000000000, 0.2287501094, 0.1867644672],
[1.0000000000, 0.2312434999, 0.1641472530],
[1.0000000000, 0.2336201058, 0.1394547362],
[1.0000000000, 0.2358931201, 0.1115226724],
[1.0000000000, 0.2380661818, 0.0776959461],
[1.0000000000, 0.2401449888, 0.0292304822],
[0.9935469174, 0.2547336562, 0.0000000000],
[0.9806629062, 0.2792976570, 0.0000000000],
[0.9683978630, 0.3002489131, 0.0000000000],
[0.9566898277, 0.3185039991, 0.0000000000],
[0.9454825262, 0.3346654269, 0.0000000000],
[0.9347268530, 0.3491516363, 0.0000000000],
[0.9243794712, 0.3622668000, 0.0000000000],
[0.9144038188, 0.3742377352, 0.0000000000],
[0.9047627043, 0.3852445351, 0.0000000000],
[0.8954270786, 0.3954251659, 0.0000000000],
[0.8863711058, 0.4048904909, 0.0000000000],
[0.8775641808, 0.4137376001, 0.0000000000],
[0.8689906967, 0.4220362368, 0.0000000000],
[0.8606224819, 0.4298565781, 0.0000000000],
[0.8524468536, 0.4372473016, 0.0000000000],
[0.8444417016, 0.4442581954, 0.0000000000],
[0.8365923445, 0.4509276795, 0.0000000000],
[0.8288832777, 0.4572904595, 0.0000000000],
[0.8213010289, 0.4633761348, 0.0000000000],
[0.8138287720, 0.4692134937, 0.0000000000],
[0.8064572823, 0.4748235876, 0.0000000000],
[0.7991714001, 0.4802292112, 0.0000000000],
[0.7919634879, 0.4854465225, 0.0000000000],
[0.7848201210, 0.4904936924, 0.0000000000],
[0.7777301293, 0.4953860253, 0.0000000000],
[0.7706844750, 0.5001363865, 0.0000000000],
[0.7636712021, 0.5047581696, 0.0000000000],
[0.7566828966, 0.5092613527, 0.0000000000],
[0.7497068779, 0.5136578018, 0.0000000000],
[0.7427348876, 0.5179562998, 0.0000000000],
[0.7357581203, 0.5221652646, 0.0000000000],
[0.7287650857, 0.5262937103, 0.0000000000],
[0.7217461146, 0.5303491625, 0.0000000000],
[0.7146930360, 0.5343379920, 0.0000000000],
[0.7075930203, 0.5382680072, 0.0000000000],
[0.7004348855, 0.5421457404, 0.0000000000],
[0.6932104845, 0.5459761394, 0.0000000000],
[0.6859071207, 0.5497654616, 0.0000000000],
[0.6785115459, 0.5535196354, 0.0000000000],
[0.6710129427, 0.5572433691, 0.0000000000],
[0.6633963296, 0.5609422958, 0.0000000000],
[0.6556473648, 0.5646213876, 0.0000000000],
[0.6477517882, 0.5682852485, 0.0000000000],
[0.6396926055, 0.5719388195, 0.0000000000],
[0.6314524604, 0.5755867716, 0.0000000000],
[0.6230103165, 0.5792340757, 0.0000000000],
[0.6143461993, 0.5828852212, 0.0000000000],
[0.6054366838, 0.5865449899, 0.0000000000],
[0.5962551996, 0.5902181669, 0.0000000000],
[0.5867734593, 0.5939096163, 0.0000000000],
[0.5769587806, 0.5976241194, 0.0000000000],
[0.5667754020, 0.6013669423, 0.0000000000],
[0.5561819519, 0.6051432356, 0.0000000000],
[0.5451314275, 0.6089584688, 0.0000000000],
[0.5335700981, 0.6128179301, 0.0000000000],
[0.5214352933, 0.6167277058, 0.0000000000],
[0.5086540280, 0.6206937591, 0.0000000000],
[0.4951386155, 0.6247231811, 0.0000000000],
[0.4807869842, 0.6288218899, 0.0000000000],
[0.4654715338, 0.6329980619, 0.0000000000],
[0.4490375659, 0.6372591904, 0.0000000000],
[0.4312919589, 0.6416129754, 0.0000000000],
[0.4119815562, 0.6460694218, 0.0000000000],
[0.3907772936, 0.6506376709, 0.0000000000],
[0.3672285505, 0.6553279270, 0.0000000000],
[0.3406861112, 0.6601524299, 0.0000000000],
[0.3101695253, 0.6651232200, 0.0000000000],
[0.2740522887, 0.6702536927, 0.0000000000],
[0.2292441572, 0.6755587313, 0.0000000000],
[0.1682021496, 0.6810567255, 0.0000000000],
[0.0532381054, 0.6867631428, 0.0000000000],
[0.0000000000, 0.6870776415, 0.0919246594],
[0.0000000000, 0.6859822633, 0.1515301683],
[0.0000000000, 0.6849274102, 0.1932678954],
[0.0000000000, 0.6839090650, 0.2266312964],
[0.0000000000, 0.6829285581, 0.2548282373],
[0.0000000000, 0.6819803095, 0.2794385100],
[0.0000000000, 0.6810635900, 0.3013600030],
[0.0000000000, 0.6801754616, 0.3211766229],
[0.0000000000, 0.6793160228, 0.3392840800],
[0.0000000000, 0.6784800052, 0.3559836826],
[0.0000000000, 0.6776687025, 0.3714886445],
[0.0000000000, 0.6768773237, 0.3859782776],
[0.0000000000, 0.6761068925, 0.3995845574],
[0.0000000000, 0.6753536662, 0.4124238347],
[0.0000000000, 0.6746179519, 0.4245857212],
[0.0000000000, 0.6738960759, 0.4361516561],
[0.0000000000, 0.6731894716, 0.4471836520],
[0.0000000000, 0.6724962170, 0.4577397105],
[0.0000000000, 0.6718147499, 0.4678695600],
[0.0000000000, 0.6711422268, 0.4776178030],
[0.0000000000, 0.6704822783, 0.4870176245],
[0.0000000000, 0.6698281362, 0.4961077630],
[0.0000000000, 0.6691836557, 0.5049139835],
[0.0000000000, 0.6685442801, 0.5134656806],
[0.0000000000, 0.6679125986, 0.5217848194],
[0.0000000000, 0.6672847530, 0.5298949498],
[0.0000000000, 0.6666622973, 0.5378149501],
[0.0000000000, 0.6660423576, 0.5455638681],
[0.0000000000, 0.6654256398, 0.5531581013],
[0.0000000000, 0.6648104742, 0.5606134491],
[0.0000000000, 0.6641948389, 0.5679443288],
[0.0000000000, 0.6635824691, 0.5751644189],
[0.0000000000, 0.6629687185, 0.5822865023],
[0.0000000000, 0.6623527143, 0.5893224121],
[0.0000000000, 0.6617353561, 0.5962839764],
[0.0000000000, 0.6611152780, 0.6031820943],
[0.0000000000, 0.6604929004, 0.6100279787],
[0.0000000000, 0.6598644007, 0.6168303823],
[0.0000000000, 0.6592317733, 0.6236007524],
[0.0000000000, 0.6585947699, 0.6303495830],
[0.0000000000, 0.6579489740, 0.6370839248],
[0.0000000000, 0.6572957251, 0.6438149600],
[0.0000000000, 0.6566322103, 0.6505504200],
[0.0000000000, 0.6559612454, 0.6573037498],
[0.0000000000, 0.6552776616, 0.6640803066],
[0.0000000000, 0.6545837761, 0.6708939312],
[0.0000000000, 0.6538740562, 0.6777491027],
[0.0000000000, 0.6531521502, 0.6846628072],
[0.0000000000, 0.6524120962, 0.6916390937],
[0.0000000000, 0.6516568781, 0.6986960630],
[0.0000000000, 0.6508800786, 0.7058373088],
[0.0000000000, 0.6500839583, 0.7130820132],
[0.0000000000, 0.6492650370, 0.7204403924],
[0.0000000000, 0.6484195542, 0.7279224919],
[0.0000000000, 0.6475484045, 0.7355497535],
[0.0000000000, 0.6466469303, 0.7433332490],
[0.0000000000, 0.6457117125, 0.7512880300],
[0.0000000000, 0.6447419046, 0.7594382102],
[0.0000000000, 0.6437328055, 0.7678006163],
[0.0000000000, 0.6426791175, 0.7763925039],
[0.0000000000, 0.6415791383, 0.7852459024],
[0.0000000000, 0.6404271932, 0.7943852715],
[0.0000000000, 0.6392153164, 0.8038310606],
[0.0000000000, 0.6379410145, 0.8136304477],
[0.0000000000, 0.6365937319, 0.8238072320],
[0.0000000000, 0.6351664418, 0.8344080492],
[0.0000000000, 0.6336499701, 0.8454827233],
[0.0000000000, 0.6320317108, 0.8570784876],
[0.0000000000, 0.6302985703, 0.8692575032],
[0.0000000000, 0.6284359615, 0.8820987371],
[0.0000000000, 0.6264241404, 0.8956807279],
[0.0000000000, 0.6242394527, 0.9100942928],
[0.0000000000, 0.6218558133, 0.9254710812],
[0.0000000000, 0.6192369270, 0.9419331602],
[0.0000000000, 0.6163413253, 0.9596702059],
[0.0000000000, 0.6131130558, 0.9788825324],
[0.0000000000, 0.6094810350, 0.9998433471],
[0.1183679952, 0.6049880568, 1.0000000000],
[0.1757192783, 0.6005507863, 1.0000000000],
[0.2171205563, 0.5961671681, 1.0000000000],
[0.2505830396, 0.5918305928, 1.0000000000],
[0.2790740444, 0.5875345847, 1.0000000000],
[0.3041180717, 0.5832731332, 1.0000000000],
[0.3265972143, 0.5790402910, 1.0000000000],
[0.3470873469, 0.5748306688, 1.0000000000],
[0.3659722872, 0.5706377638, 1.0000000000],
[0.3835483793, 0.5664570042, 1.0000000000],
[0.4000232814, 0.5622818495, 1.0000000000],
[0.4155690494, 0.5581076337, 1.0000000000],
[0.4303162492, 0.5539284593, 1.0000000000],
[0.4443715666, 0.5497382702, 1.0000000000],
[0.4578274708, 0.5455330358, 1.0000000000],
[0.4707553974, 0.5413057911, 1.0000000000],
[0.4832198872, 0.5370516178, 1.0000000000],
[0.4952737770, 0.5327630927, 1.0000000000],
[0.5069663245, 0.5284367213, 1.0000000000],
[0.5183370358, 0.5240633501, 1.0000000000],
[0.5294231827, 0.5196362687, 1.0000000000],
[0.5402580644, 0.5151504387, 1.0000000000],
[0.5508709506, 0.5105973189, 1.0000000000],
[0.5612886456, 0.5059698320, 1.0000000000],
[0.5715358571, 0.5012586524, 1.0000000000],
[0.5816350292, 0.4964561147, 1.0000000000],
[0.5916073802, 0.4915520599, 1.0000000000],
[0.6014729163, 0.4865357129, 1.0000000000],
[0.6112505422, 0.4813956513, 1.0000000000],
[0.6209581477, 0.4761197677, 1.0000000000],
[0.6306126753, 0.4706952272, 1.0000000000],
[0.6402301706, 0.4651084162, 1.0000000000],
[0.6498275695, 0.4593417716, 1.0000000000],
[0.6594214891, 0.4533762628, 1.0000000000],
[0.6690261867, 0.4471946525, 1.0000000000],
[0.6786571665, 0.4407749963, 1.0000000000],
[0.6883317484, 0.4340897262, 1.0000000000],
[0.6980672116, 0.4271084649, 1.0000000000],
[0.7078757879, 0.4198057347, 1.0000000000],
[0.7177788431, 0.4121369925, 1.0000000000],
[0.7277902469, 0.4040653012, 1.0000000000],
[0.7379284707, 0.3955403524, 1.0000000000],
[0.7482145423, 0.3865002802, 1.0000000000],
[0.7586664716, 0.3768792043, 1.0000000000],
[0.7693105369, 0.3665850252, 1.0000000000],
[0.7801608445, 0.3555318771, 1.0000000000],
[0.7912518853, 0.3435762652, 1.0000000000],
[0.8026024582, 0.3305749934, 1.0000000000],
[0.8142428097, 0.3163233319, 1.0000000000],
[0.8262055484, 0.3005521947, 1.0000000000],
[0.8385253889, 0.2828970908, 1.0000000000],
[0.8512388034, 0.2628435056, 1.0000000000],
[0.8643869699, 0.2396123278, 1.0000000000],
[0.8780187890, 0.2119145799, 1.0000000000],
[0.8921835001, 0.1773628468, 1.0000000000],
[0.9069435813, 0.1302858042, 1.0000000000],
[0.9223599862, 0.0457136471, 1.0000000000],
[0.9303589225, 0.0000000000, 0.9877073807],
[0.9350577490, 0.0000000000, 0.9703839987],
[0.9396475648, 0.0000000000, 0.9530238265],
[0.9441313769, 0.0000000000, 0.9356244753],
[0.9485084127, 0.0000000000, 0.9181793467],
[0.9527878948, 0.0000000000, 0.9006948047],
[0.9569649867, 0.0000000000, 0.8831603667],
[0.9610414508, 0.0000000000, 0.8655745616],
[0.9650221634, 0.0000000000, 0.8479392826],
[0.9689049176, 0.0000000000, 0.8302495141],
[0.9726940352, 0.0000000000, 0.8125069152],
[0.9763901799, 0.0000000000, 0.7947097787],
[0.9799937736, 0.0000000000, 0.7768565473],
[0.9835050055, 0.0000000000, 0.7589458192],
[0.9869238418, 0.0000000000, 0.7409763481],
[0.9902566157, 0.0000000000, 0.7229504363],
[0.9934962184, 0.0000000000, 0.7048628832],
[0.9966485007, 0.0000000000, 0.6867154365],
[0.9997124975, 0.0000000000, 0.6685061637],
[1.0000000000, 0.0305495897, 0.6495115978],
[1.0000000000, 0.0596901011, 0.6307372162],
[1.0000000000, 0.0804316079, 0.6122550018],
[1.0000000000, 0.0967611952, 0.5940413738],
[1.0000000000, 0.1103381772, 0.5760733720],
]
)
JCH_MAX = LinearSegmentedColormap.from_list("JCH_MAX", JCH_MAX_ARRAY)
JCH_CONST_ARRAY = np.array(
[
[0.8159566997, 0.4262287241, 0.5625514019],
[0.8176685114, 0.4259897056, 0.5541114763],
[0.8192697666, 0.4258319757, 0.5456234080],
[0.8207592907, 0.4257563118, 0.5370924735],
[0.8221359067, 0.4257634372, 0.5285240150],
[0.8233984369, 0.4258540175, 0.5199234334],
[0.8245457050, 0.4260286578, 0.5112961808],
[0.8255765380, 0.4262878988, 0.5026477535],
[0.8264897685, 0.4266322135, 0.4939836846],
[0.8272842362, 0.4270620039, 0.4853095364],
[0.8279587912, 0.4275775972, 0.4766308938],
[0.8285122950, 0.4281792422, 0.4679533564],
[0.8289436239, 0.4288671060, 0.4592825324],
[0.8292516708, 0.4296412701, 0.4506240313],
[0.8294353474, 0.4305017276, 0.4419834584],
[0.8294935873, 0.4314483798, 0.4333664087],
[0.8294253480, 0.4324810328, 0.4247784620],
[0.8292296132, 0.4335993950, 0.4162251787],
[0.8289053956, 0.4348030744, 0.4077120964],
[0.8284517391, 0.4360915762, 0.3992447271],
[0.8278677217, 0.4374643012, 0.3908285564],
[0.8271524569, 0.4389205432, 0.3824690430],
[0.8263050971, 0.4404594886, 0.3741716203],
[0.8253248354, 0.4420802152, 0.3659416993],
[0.8242109077, 0.4437816912, 0.3577846734],
[0.8229625952, 0.4455627759, 0.3497059247],
[0.8215792264, 0.4474222193, 0.3417108327],
[0.8200601787, 0.4493586636, 0.3338047854],
[0.8184048809, 0.4513706436, 0.3259931921],
[0.8166128146, 0.4534565891, 0.3182814994],
[0.8146835159, 0.4556148268, 0.3106752092],
[0.8126165770, 0.4578435825, 0.3031798996],
[0.8104116476, 0.4601409847, 0.2958012490],
[0.8080684361, 0.4625050675, 0.2885450621],
[0.8055867106, 0.4649337743, 0.2814172989],
[0.8029663002, 0.4674249622, 0.2744241069],
[0.8002070953, 0.4699764064, 0.2675718541],
[0.7973090488, 0.4725858045, 0.2608671653],
[0.7942721762, 0.4752507819, 0.2543169589],
[0.7910965560, 0.4779688968, 0.2479284849],
[0.7877823298, 0.4807376457, 0.2417093615],
[0.7843297023, 0.4835544687, 0.2356676115],
[0.7807389414, 0.4864167554, 0.2298116945],
[0.7770103774, 0.4893218505, 0.2241505349],
[0.7731444027, 0.4922670596, 0.2186935423],
[0.7691414711, 0.4952496553, 0.2134506228],
[0.7650020971, 0.4982668824, 0.2084321775],
[0.7607268548, 0.5013159643, 0.2036490856],
[0.7563163767, 0.5043941083, 0.1991126690],
[0.7517713528, 0.5074985110, 0.1948346351],
[0.7470925286, 0.5106263643, 0.1908269946],
[0.7422807043, 0.5137748603, 0.1871019524],
[0.7373367324, 0.5169411963, 0.1836717699],
[0.7322615167, 0.5201225803, 0.1805485995],
[0.7270560100, 0.5233162351, 0.1777442913],
[0.7217212119, 0.5265194033, 0.1752701773],
[0.7162581674, 0.5297293513, 0.1731368384],
[0.7106679642, 0.5329433736, 0.1713538621],
[0.7049517309, 0.5361587963, 0.1699296023],
[0.6991106344, 0.5393729814, 0.1688709507],
[0.6931458774, 0.5425833292, 0.1681831352],
[0.6870586967, 0.5457872821, 0.1678695535],
[0.6808503599, 0.5489823273, 0.1679316552],
[0.6745221633, 0.5521659993, 0.1683688783],
[0.6680754296, 0.5553358824, 0.1691786447],
[0.6615115046, 0.5584896128, 0.1703564148],
[0.6548317552, 0.5616248808, 0.1718957970],
[0.6480375668, 0.5647394319, 0.1737887062],
[0.6411303401, 0.5678310691, 0.1760255590],
[0.6341114887, 0.5708976538, 0.1785954962],
[0.6269824366, 0.5739371067, 0.1814866199],
[0.6197446154, 0.5769474092, 0.1846862328],
[0.6123994613, 0.5799266039, 0.1881810716],
[0.6049484127, 0.5828727953, 0.1919575238],
[0.5973929072, 0.5857841501, 0.1960018253],
[0.5897343790, 0.5886588976, 0.2003002309],
[0.5819742563, 0.5914953299, 0.2048391601],
[0.5741139582, 0.5942918017, 0.2096053150],
[0.5661548919, 0.5970467304, 0.2145857725],
[0.5580984502, 0.5997585959, 0.2197680537],
[0.5499460085, 0.6024259401, 0.2251401718],
[0.5416989219, 0.6050473665, 0.2306906619],
[0.5333585222, 0.6076215398, 0.2364085957],
[0.5249261153, 0.6101471854, 0.2422835846],
[0.5164029778, 0.6126230883, 0.2483057716],
[0.5077903542, 0.6150480929, 0.2544658176],
[0.4990894539, 0.6174211016, 0.2607548807],
[0.4903014475, 0.6197410746, 0.2671645927],
[0.4814274640, 0.6220070283, 0.2736870329],
[0.4724685872, 0.6242180349, 0.2803147007],
[0.4634258520, 0.6263732208, 0.2870404877],
[0.4543002409, 0.6284717663, 0.2938576501],
[0.4450926799, 0.6305129038, 0.3007597821],
[0.4358040345, 0.6324959170, 0.3077407900],
[0.4264351053, 0.6344201399, 0.3147948678],
[0.4169866232, 0.6362849554, 0.3219164745],
[0.4074592445, 0.6380897942, 0.3291003130],
[0.3978535456, 0.6398341336, 0.3363413099],
[0.3881700169, 0.6415174966, 0.3436345978],
[0.3784090565, 0.6431394500, 0.3509754984],
[0.3685709635, 0.6446996041, 0.3583595078],
[0.3586559295, 0.6461976107, 0.3657822822],
[0.3486640312, 0.6476331623, 0.3732396258],
[0.3385952197, 0.6490059910, 0.3807274795],
[0.3284493107, 0.6503158670, 0.3882419105],
[0.3182259721, 0.6515625975, 0.3957791033],
[0.3079247105, 0.6527460259, 0.4033353513],
[0.2975448555, 0.6538660299, 0.4109070497],
[0.2870855426, 0.6549225213, 0.4184906884],
[0.2765456921, 0.6559154440, 0.4260828462],
[0.2659239859, 0.6568447735, 0.4336801852],
[0.2552188401, 0.6577105155, 0.4412794465],
[0.2444283724, 0.6585127050, 0.4488774451],
[0.2335503639, 0.6592514052, 0.4564710665],
[0.2225822145, 0.6599267065, 0.4640572627],
[0.2115208875, 0.6605387255, 0.4716330493],
[0.2003628448, 0.6610876040, 0.4791955024],
[0.1891039660, 0.6615735083, 0.4867417562],
[0.1777394495, 0.6619966278, 0.4942689999],
[0.1662636895, 0.6623571747, 0.5017744762],
[0.1546701198, 0.6626553826, 0.5092554787],
[0.1429510145, 0.6628915064, 0.5167093504],
[0.1310972286, 0.6630658206, 0.5241334815],
[0.1190978553, 0.6631786192, 0.5315253081],
[0.1069397619, 0.6632302147, 0.5388823103],
[0.0946069496, 0.6632209377, 0.5462020111],
[0.0820796422, 0.6631511357, 0.5534819746],
[0.0693329478, 0.6630211730, 0.5607198051],
[0.0563348118, 0.6628314297, 0.5679131453],
[0.0430427268, 0.6625823013, 0.5750596757],
[0.0301061333, 0.6622741982, 0.5821571129],
[0.0194259648, 0.6619075450, 0.5892032087],
[0.0110864753, 0.6614827804, 0.5961957488],
[0.0050762957, 0.6610003561, 0.6031325522],
[0.0013830976, 0.6604607371, 0.6100114695],
[0.0000000000, 0.6598644007, 0.6168303823],
[0.0008937359, 0.6592118366, 0.6235872021],
[0.0040684160, 0.6585035461, 0.6302798694],
[0.0095018278, 0.6577400424, 0.6369063525],
[0.0171773313, 0.6569218496, 0.6434646468],
[0.0270775148, 0.6560495031, 0.6499527737],
[0.0391842231, 0.6551235490, 0.6563687800],
[0.0522263130, 0.6541445440, 0.6627107364],
[0.0649125879, 0.6531130552, 0.6689767375],
[0.0772993626, 0.6520296601, 0.6751649001],
[0.0894217898, 0.6508949461, 0.6812733630],
[0.1013072289, 0.6497095112, 0.6873002858],
[0.1129775192, 0.6484739628, 0.6932438482],
[0.1244504541, 0.6471889187, 0.6991022496],
[0.1357407767, 0.6458550065, 0.7048737077],
[0.1468608772, 0.6444728638, 0.7105564583],
[0.1578212937, 0.6430431380, 0.7161487545],
[0.1686310826, 0.6415664868, 0.7216488659],
[0.1792980972, 0.6400435778, 0.7270550780],
[0.1898292006, 0.6384750888, 0.7323656916],
[0.2002304331, 0.6368617079, 0.7375790226],
[0.2105071429, 0.6352041336, 0.7426934006],
[0.2206640915, 0.6335030750, 0.7477071692],
[0.2307055392, 0.6317592518, 0.7526186852],
[0.2406353140, 0.6299733946, 0.7574263182],
[0.2504568694, 0.6281462453, 0.7621284499],
[0.2601733321, 0.6262785567, 0.7667234743],
[0.2697875418, 0.6243710934, 0.7712097970],
[0.2793020847, 0.6224246315, 0.7755858349],
[0.2887193228, 0.6204399592, 0.7798500160],
[0.2980414179, 0.6184178771, 0.7840007795],
[0.3072703523, 0.6163591978, 0.7880365751],
[0.3164079476, 0.6142647472, 0.7919558633],
[0.3254558801, 0.6121353639, 0.7957571152],
[0.3344156942, 0.6099718999, 0.7994388127],
[0.3432888149, 0.6077752208, 0.8029994481],
[0.3520765578, 0.6055462062, 0.8064375246],
[0.3607801387, 0.6032857499, 0.8097515563],
[0.3694006815, 0.6009947600, 0.8129400686],
[0.3779392257, 0.5986741596, 0.8160015980],
[0.3863967325, 0.5963248869, 0.8189346931],
[0.3947740910, 0.5939478953, 0.8217379142],
[0.4030721227, 0.5915441541, 0.8244098347],
[0.4112915868, 0.5891146484, 0.8269490406],
[0.4194331837, 0.5866603796, 0.8293541321],
[0.4274975591, 0.5841823656, 0.8316237232],
[0.4354853071, 0.5816816410, 0.8337564435],
[0.4433969733, 0.5791592575, 0.8357509381],
[0.4512330576, 0.5766162837, 0.8376058689],
[0.4589940166, 0.5740538060, 0.8393199156],
[0.4666802658, 0.5714729282, 0.8408917765],
[0.4742921818, 0.5688747719, 0.8423201695],
[0.4818301037, 0.5662604767, 0.8436038337],
[0.4892943353, 0.5636312001, 0.8447415301],
[0.4966851466, 0.5609881179, 0.8457320434],
[0.5040027748, 0.5583324241, 0.8465741830],
[0.5112474256, 0.5556653308, 0.8472667848],
[0.5184192751, 0.5529880686, 0.8478087125],
[0.5255184697, 0.5503018861, 0.8481988595],
[0.5325451280, 0.5476080501, 0.8484361504],
[0.5394993413, 0.5449078458, 0.8485195428],
[0.5463811744, 0.5422025759, 0.8484480293],
[0.5531906664, 0.5394935611, 0.8482206397],
[0.5599278312, 0.5367821396, 0.8478364424],
[0.5665926583, 0.5340696670, 0.8472945472],
[0.5731851134, 0.5313575156, 0.8465941071],
[0.5797051383, 0.5286470747, 0.8457343208],
[0.5861526523, 0.5259397496, 0.8447144347],
[0.5925275516, 0.5232369615, 0.8435337460],
[0.5988297105, 0.5205401468, 0.8421916047],
[0.6050589811, 0.5178507567, 0.8406874161],
[0.6112151938, 0.5151702567, 0.8390206439],
[0.6172981575, 0.5125001258, 0.8371908126],
[0.6233076599, 0.5098418559, 0.8351975105],
[0.6292434674, 0.5071969510, 0.8330403921],
[0.6351053256, 0.5045669267, 0.8307191815],
[0.6408929592, 0.5019533089, 0.8282336752],
[0.6466060719, 0.4993576336, 0.8255837447],
[0.6522443469, 0.4967814453, 0.8227693402],
[0.6578074466, 0.4942262967, 0.8197904930],
[0.6632950126, 0.4916937474, 0.8166473188],
[0.6687066660, 0.4891853631, 0.8133400212],
[0.6740420071, 0.4867027143, 0.8098688942],
[0.6793006152, 0.4842473755, 0.8062343255],
[0.6844820492, 0.4818209241, 0.8024367996],
[0.6895858467, 0.4794249395, 0.7984769013],
[0.6946115246, 0.4770610015, 0.7943553179],
[0.6995585787, 0.4747306896, 0.7900728430],
[0.7044264833, 0.4724355820, 0.7856303790],
[0.7092146920, 0.4701772542, 0.7810289402],
[0.7139226365, 0.4679572778, 0.7762696555],
[0.7185497274, 0.4657772200, 0.7713537714],
[0.7230953534, 0.4636386417, 0.7662826543],
[0.7275588818, 0.4615430972, 0.7610577933],
[0.7319396580, 0.4594921327, 0.7556808025],
[0.7362370056, 0.4574872851, 0.7501534232],
[0.7404502261, 0.4555300817, 0.7444775261],
[0.7445785992, 0.4536220382, 0.7386551134],
[0.7486213826, 0.4517646586, 0.7326883202],
[0.7525778118, 0.4499594337, 0.7265794162],
[0.7564471006, 0.4482078404, 0.7203308074],
[0.7602284405, 0.4465113406, 0.7139450363],
[0.7639210014, 0.4448713805, 0.7074247839],
[0.7675239314, 0.4432893894, 0.7007728694],
[0.7710363569, 0.4417667790, 0.6939922508],
[0.7744573829, 0.4403049421, 0.6870860251],
[0.7777860936, 0.4389052524, 0.6800574277],
[0.7810215519, 0.4375690625, 0.6729098322],
[0.7841628006, 0.4362977040, 0.6656467490],
[0.7872088624, 0.4350924855, 0.6582718241],
[0.7901587405, 0.4339546919, 0.6507888379],
[0.7930114189, 0.4328855833, 0.6432017027],
[0.7957658637, 0.4318863935, 0.6355144604],
[0.7984210231, 0.4309583290, 0.6277312802],
[0.8009758284, 0.4301025670, 0.6198564546],
[0.8034291951, 0.4293202544, 0.6118943969],
[0.8057800238, 0.4286125056, 0.6038496365],
[0.8080272008, 0.4279804011, 0.5957268149],
[0.8101695999, 0.4274249851, 0.5875306812],
[0.8122060831, 0.4269472637, 0.5792660869],
[0.8141355021, 0.4265482025, 0.5709379805],
]
)
JCH_CONST = LinearSegmentedColormap.from_list("JCH_CONST", JCH_CONST_ARRAY)
# register colormaps with matplotlib for string-based access
# this allows users to use cmap='cdiutils_jch_max' in matplotlib functions
def _register_colormaps():
"""Register cdiutils colormaps with matplotlib."""
# also register without prefix for convenience (lowercase to avoid conflicts)
colormaps.register(name="jch_max", cmap=JCH_MAX)
colormaps.register(name="jch_const", cmap=JCH_CONST)
colormaps.register(name="parula", cmap=PARULA)
colormaps.register(name="red_to_teal", cmap=RED_TO_TEAL)
colormaps.register(name="turbo_first_half", cmap=TURBO_FIRST_HALF)
colormaps.register(name="turbo_second_half", cmap=TURBO_SECOND_HALF)
# register colormaps automatically when module is imported
_register_colormaps()
if __name__ == "__main__":
import sys
if len(sys.argv) < 3:
print(f"usage: {sys.argv[0]}, cmap_name, output_path")
sys.exit()
save_json_cmap(sys.argv[1], sys.argv[2])