colorwheel module

Creates RGB images from vector fields.

This module contains several routines for plotting colormaps from input data consisting of 2D images of the vector field. The output image will be stored as a tiff color image. There are options to save it using a custom RGB or standard HSV color-wheel.

Author: Arthur McCray, C. Phatak, ANL, Summer 2019.

colorwheel.color_im(Bx, By, Bz=None, rad=None, hsvwheel=True, background='black')[source]

Make the RGB image from x and y component vector maps.

The color intensity corresponds to the in-plane vector component. If a z-component is given, it will map from black (negative) to white (positive).

Parameters:
  • Bx (2D array) – (M x N) array consisting of the x-component of the vector field.
  • By (2D array) – (M x N) array consisting of the y-component of the vector field.
  • Bz (2D array) – optional (M x N) array consisting of the y-component of the vector field.
  • rad (int) – (optional) Radius of color-wheel in pixels. (default None -> height/16) Set rad = 0 to remove color-wheel.
  • hsvwheel (bool) –
    • True – (default) use a standard HSV color-wheel (3-fold)
    • False – use a four-fold color-wheel
  • background (str) –
    • ‘black’ – (default) magnetization magnitude corresponds to value.
    • ’white’ – magnetization magnitude corresponds to saturation.
Returns:

Numpy array (M x N x 3) containing the color-image.

Return type:

ndarray

colorwheel.colorwheel_HSV(rad, background, z=False, **kwargs)[source]

Creates an HSV color-wheel as a np array to be inserted into the color-image.

Parameters:
  • rad (int) – (optional) Radius of color-wheel in pixels. (default None -> height/16) Set rad = 0 to remove color-wheel.
  • background (str) –
    • ‘black’ – (default) magnetization magnitude corresponds to value.
    • ’white’ – magnetization magnitude corresponds to saturation.
Returns:

Numpy array of shape (2*rad, 2*rad).

Return type:

ndarray

colorwheel.colorwheel_RGB(rad)[source]

Makes a 4-quadrant RGB color-wheel as a np array to be inserted into the color-image

Parameters:rad (int) – (optional) Radius of color-wheel in pixels. (default None -> height/16) Set rad = 0 to remove color-wheel.
Returns:Numpy array of shape (2*rad, 2*rad).
Return type:ndarray
colorwheel.dist(ny, nx, shift=False)[source]

Creates a frequency array for Fourier processing.

Parameters:
  • ny (int) – Height of array
  • nx (int) – Width of array
  • shift (bool) –

    Whether to center the frequency spectrum.

    • False: (default) smallest values are at the corners.
    • True: smallest values at center of array.
Returns:

Numpy array of shape (ny, nx).

Return type:

ndarray