xmcd_projection.color

xmcd_projection.color.get_struct_face_mag_color(struct, magnetisation, cmap_name='seismic')

Gets the colours of the structure faces based on the magnetisation using the given colormap.

Parameters
  • struct (trimesh.Trimesh) – STL file with n faces, m vertices

  • magnetisation ((m,3) array) – per vertex magnetisation

  • cmap_name (str, optional) – Matplotlib colormap specifier. Defaults to ‘seismic’.

Returns

Colours of struct faces

Return type

(n,4) array

xmcd_projection.color.get_xmcd_color(xmcd, vmin=None, vmax=None)

Gets the color of the xmcd vector in grayscale. It scales the colours linearly to the range between vmin and vmax. If vmin(vmax) is None, use min (max) of xmcd.

Parameters
  • xmcd ((n,) array) – xmcd values to be normalized

  • vmin (int, optional) – Min of normalization. Defaults to None.

  • vmax (int, optional) – Max of normalization. Defaults to None.

Returns

xmcd_color ((n, 4) array); background_color ((4,) array)

Return type

tule

xmcd_projection.color.magnetisation_to_color(magnetisation, cmap_name='seismic', direction=[0, 0, 1])

Assigns color to magnetisation component.

Parameters
  • magnetisation ((n,3) array) – Magnetisation values

  • cmap_name (str, optional) – Matplotlib colormap. Defaults to ‘seismic’.

  • direction (list, optional) – Direction along which to project the magnetisation. Defaults to [0, 0, 1].

Returns

Colours corresponding to values of magnetisation along the projection direction.

Return type

(n,4) array