ImageD11.rgb_colors: IPF colours#

ubi_to_rgb(ubis, group, view, key, axis) gives MTEX 7.2 TSL / HSV IPF colours from ubi and a sym_u point group only (no B, no orix). key_image / plot_key draw the legend, plot_ipf the inverse pole figure. spacegroup_group names the point group of a space group (unitcell.ipf_group).

path

what

ipf.py

the code; __init__.py exports the public functions

ipf_keys.py

the keys: integer hkl/uvw, generated by tools/make_shipped.py

ipf_colour_math.md

the maths

test/

tests and ipf_oracle.json (check colours, from tools/make_shipped.py); test/test_rgb_colors.py at the repository root imports them

tools/

MATLAB dump, key table, reference implementation and comparisons; not needed at run time

Folds with integer ops, angles use the symmetrised metric g_s (warns above 5e-3 strain). The hue integral (Gauss on arcs, one table per key: the sector is the same figure in every metric the group allows) and the 4-corner centre are exact: MTEX differs by 5.5e-5, and 4.7e-3 for TSL m-3/23. The HSV hue correction starts at 0 (MTEX 1.7e-3, a jump on one half circle): HSV is up to 9.5e-3 from MTEX. 1e6 ubi in 2-8 s on one core (numpy 2.5.4).

unitcell, grain, nb_utils and TensorMap colours and IPF plots go through it by default; backend="orix" gives the previous orix TSL colours and plots.

orix and pymtex are not references: orix uses other keys for -1, monoclinic, 3, -3, 321, 312, 3m1, -3m1, 6, -6, 6/m and is 0.005-0.009 off elsewhere; pymtex differs for monoclinic HSV/TSL (see tools/ipf_keys.md).