fastplotlib.NDVectorsSlicer#
- class NDVectorsSlicer(data, dims, display_dims, window_funcs=None, window_order=None, spatial_func=None, slider_maps=None)[source]#
NDSlicersubclass for n-dimensional vector data.Produces
[n_vectors, 2, 2 | 3]slices for aVectorsGraphic. 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
0along the positions/directions dim gives the vector positions and index1gives the vector directions.Ex: an electric field sampled over time, an array of shape
[n_timepoints, n_vectors, 2, 2]withdimsof("time", "n_vectors", "pos_dir", "xy")anddisplay_dimsof("n_vectors", "pos_dir", "xy").dims (Sequence[str]) –
names for each dimension in
data. Dimensions not listed indisplay_dimsare treated as slider dimensions and must appear as keys in the parentNDWidget’sref_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_dimsorder, i.e. the array as it is rendered, and must return an array with those same dims.