s3dlib.surface.Vector3DCollection

Contents

Geometry Properties

name Descriptive identifier for the vector geometry.
bounds Dictionary of vector geometric and value ranges.
alr Arrow head to length ratio.

Color Properties/Methods

cname Descriptive identifier for values indicated by color.
vlim Range of values associated with color

The following methods will return the calling object (self).
map_color_from_op(operation[, rgb, cname]) Assignment of vector color from a function.
map_cmap_from_op(operation[, cmap, cname]) Functional assignment of a vector color from a color map.
map_cmap_from_direction([cmap, direction, cname]) Vector color assignment using vector direction relative to direction argument.
map_cmap_from_magnitude([cmap, cname]) Vector color assignment using vector magnitude.

Code Documentation

class s3dlib.surface.Vector3DCollection(location, vect, alr=None, name=None, **kwargs)[source]

Bases: mpl_toolkits.mplot3d.art3d.Line3DCollection

Collection of 3D vectors represented as arrows.

Create a collection of 3D vectors.

Parameters:
  • location (N x 3 float array) – Cartesian coordinate location (tails) for N number of vectors.
  • vect (N x 3 float array) – N number of vectors in Cartesian coordinates.
  • alr (scalar, optional, default: 0.25) – Axis length ratio, head size to vector magnitude.
  • name (string identifier) –
Other Parameters:
 

**kwargs – All other parameters are passed on to mpl_toolkits.mplot3d.art3d.Line3DCollection. Valid keywords include: colors, linewidths.

alr

Arrow head to length ratio.

bounds

Dictionary of vector geometric and value ranges.

Each dictionary value is a 2 float array of minimum and maximum values of the vector location. Keys are:

‘xlim’ : x-coordinate

‘ylim’ : y-coordinate

‘zlim’ : z-coordinate

‘r_xy’ : radial distance from the z axis

‘rorg’ : radial distance from the origin

‘vlim’ : value functional assignments.

‘vertvlim: magnitude

Values are assigned from the geometry and color mapping methods.

cname

Descriptive identifier for values indicated by color.

map_cmap_from_direction(cmap=None, direction=[1, 1, 1], cname=None)[source]

Vector color assignment using vector direction relative to direction argument.

The dot product of vector direction with the argument direction is used to assign vector colors from a colormap.

Parameters:
  • cmap (str or Colormap, optional, default: 'viridis') – A Colormap instance or registered colormap name. If not assigned, the surface Colormap is used. The colormap maps the dot product values to colors.
  • direction (list of size 3, optional, default: [1,1,1]) – A 3D vector in xyz Cartesian coordinates designating the reference direction.
  • refCoor (string, optional, default: "XYZ") – Direction coordinate system for the evaluation. (Not implimented)
Returns:

self (Vector3DCollection object)

map_cmap_from_magnitude(cmap=None, cname=None)[source]

Vector color assignment using vector magnitude.

Parameters:cmap (str or Colormap, optional, default: 'viridis') – A Colormap instance or registered colormap name. If not assigned, the surface Colormap is used. The colormap maps the dot product values to colors.
Returns:self (Vector3DCollection object)
map_cmap_from_op(operation, cmap=None, cname=None)[source]

Functional assignment of a vector color from a color map.

Location and direction coordinates are used to calculate a scalar which is then used to assign face colors from a colormap.

Parameters:
  • operation (function object) – Function that takes two arguments, both a 3xN Numpy array of xyz coordinates. The first and second arguments are the location and direction, respectively. The function returns a Numpy array of scalar values.
  • cmap (str or Colormap, optional) – A Colormap instance or registered colormap name. If not assigned, the surface Colormap is used. The colormap maps the function return values to colors.
Returns:

self (Vector3DCollection object)

map_color_from_op(operation, rgb=True, cname=None)[source]

Assignment of vector color from a function.

Vector colors are assigned from a function of direction and location coordinates.

Parameters:
  • operation (function object) – Function that takes two arguments, both a 3xN Numpy array of xyz coordinates. The first and second arguments are the location and direction, respectively. The function returns a 3xN color value.
  • rgb (bool {True, False}, optional, default: True) – By default, RGB color values are returned by the operation function. If set False, the operation returns HSV color values.
Returns:

self (Vector3DCollection object)

name

Descriptive identifier for the vector geometry.

vlim

Range of values associated with color