VectorGrid#

class streamtracer.VectorGrid(
vectors,
grid_spacing=None,
origin_coord=None,
cyclic=None,
*,
grid_coords=None,
)#

Bases: object

A grid of vectors.

Note

If any of cyclic are True, then the grid values on each side of the cyclic dimension must match, e.g. if cyclic=[False, True, False], vectors[:, 0, :, :] must equal vectors[:, -1, :, :].

Parameters:
  • vectors (array-like) – A (nx, ny, nz, 3) shaped array. The three values at (i, j, k, :) specify the (x, y, z) components of the vector at index (i, j, k).

  • grid_spacing (array-like, optional) – A (3,) shaped array, that contains the grid spacings in the (x, y, z) directions. If not specified grid_coords must be specified.

  • origin_coord ([float, float, float], optional) – The coordinate of the vectors[0, 0, 0, :] vector at the corner of the box. Defaults to [0, 0, 0]. This is not used if grid_coords is specified.

  • cyclic ([bool, bool, bool], optional) – Whether to have cyclic boundary conditions in each of the (x, y, z) directions. Defaults to [False, False, False].

  • grid_coords (list[array], optional) – A list of length 3 storing the (x, y, z) coordinates of the grid. If not specified grid_spacing must be specified.

Attributes Summary

coords

The physical coordinates along each axis of the grid.

cyclic

Boolean describing whether to have cyclic boundary conditions in each of the (x, y, z) directions.

grid_spacing

Physical spacing between grid points along each axis.

origin_coord

The physical coordinate corresponding to the index at (0,0,0).

vectors

Three-dimensional vector field through which the streamlines will be traced.

xcoords

Physical coordinates corresponding to grid points in the x-direction.

ycoords

Physical coordinates corresponding to grid points in the y-direction.

zcoords

Physical coordinates corresponding to grid points in the z-direction.

Attributes Documentation

coords#

The physical coordinates along each axis of the grid.

cyclic#

Boolean describing whether to have cyclic boundary conditions in each of the (x, y, z) directions.

grid_spacing#

Physical spacing between grid points along each axis.

origin_coord#

The physical coordinate corresponding to the index at (0,0,0).

vectors#

Three-dimensional vector field through which the streamlines will be traced.

xcoords#

Physical coordinates corresponding to grid points in the x-direction.

ycoords#

Physical coordinates corresponding to grid points in the y-direction.

zcoords#

Physical coordinates corresponding to grid points in the z-direction.