fastplotlib.NDVectorsSlicer#

class NDVectorsSlicer(data, dims, display_dims, window_funcs=None, window_order=None, spatial_func=None, slider_maps=None)[source]#

NDSlicer subclass for n-dimensional vector data.

Produces [n_vectors, 2, 2 | 3] slices for a VectorsGraphic. The last two dims describe the position/direction and the 2D/3D spatial coordinate, respectively.

Parameters:
  • data (ArrayProtocol) –

    n-dimensional vector data, must have 3 or more dims. Index 0 along the positions/directions dim gives the vector positions and index 1 gives the vector directions.

    Ex: an electric field sampled over time, an array of shape [n_timepoints, n_vectors, 2, 2] with dims of ("time", "n_vectors", "pos_dir", "xy") and display_dims of ("n_vectors", "pos_dir", "xy").

  • dims (Sequence[str]) –

    names for each dimension in data. Dimensions not listed in display_dims are treated as slider dimensions and must appear as keys in the parent NDWidget’s ref_ranges.

    dims in the array do not need to be in the order that you want to display them, the data slice is transposed into the order given by display_dims.

  • display_dims (tuple[str, str, str]) – The 3 spatial dims in display order: (n_vectors, positions & directions, xy(z)). The positions/directions dim must be of size 2 and the coordinate dim of size 2 or 3.

  • slider_maps (dict[str, Callable[[Any], int] | ArrayLike], optional) – Per-slider-dim mapping from reference-space values to local array indices, see NDSlicer.

  • window_funcs (dict[str, tuple[WindowFuncCallable | None, int | float | None]], optional) – Per-slider-dim window functions applied around the current slider position, see NDSlicer.

  • window_order (tuple[str, ...], optional) – Order in which the window functions are applied across dims. Only dims listed here have their window function applied, see NDSlicer.

  • spatial_func (Callable[[ArrayProtocol], ArrayProtocol], optional) – A function applied to the spatial slice after the window funcs, right before rendering. It is given the slice in display_dims order, i.e. the array as it is rendered, and must return an array with those same dims.

See also

NDSlicer

Base class with full parameter documentation.

NDVectors

The NDGraphic that uses this processor by default.