ThreeDViewer.image.vector_color#

vector_color(data, saturation=1, mode=4, axial=False, oop=1)#

Converts a 3D or 2D array of 3 components into a complex number, which can then be plotted using complex domain coloring.

The input should be an array with [x, y, z] vector components. Each component can have 2 or 3 spatial dimensions thus the input array should have the shape (3, nx, ny).

The mapping of the out of plane component can be done linearly or with some other function to improve contrast. The available modes are:

  1. Linear: \(l = y\)

  2. Root: \(l = \sqrt{y}\)

  3. Tangential: \(l = \frac {2}{\pi} \tan{y}\)

  4. Cubic: \(l = y^3\)

Parameters:
datanp.ndarray

Input vector field numpy array shaped (3, x, y) or (3, x, y, z).

saturationfloat (optional)

0…1 for color saturation or 0 to colour according to magnitude.

modeint (optional)

Choice (0 - 4) for lightness maps described above.

axialbool (optional)

Apply degenerate coloring for orientation fields.

oopint (optional)

Index of out-of-plane direction.

Returns:
np.ndarray

RBG array (x, y, z, 3) for plotting.