napari_track_edit.data_views.lazy_array_wrapper

Classes

LazyArrayWrapper

Wrapper around lazy/read-only arrays that materializes fancy indexing.

Functions

_is_fancy_index(index)

Return True if index is a fancy index (tuple containing array-likes).

Module Contents

napari_track_edit.data_views.lazy_array_wrapper._is_fancy_index(index)

Return True if index is a fancy index (tuple containing array-likes).

class napari_track_edit.data_views.lazy_array_wrapper.LazyArrayWrapper(data)

Wrapper around lazy/read-only arrays that materializes fancy indexing.

Lazy array backends like tracksdata’s GraphArrayView return view objects from __getitem__ rather than numpy values. This breaks napari code that does fancy indexing (e.g. data[tuple_of_arrays] == value).

This wrapper intercepts fancy indexing and materializes one first-dimension slice at a time, returning numpy values. All other indexing patterns and attribute access are delegated to the underlying array.

The wrapper intentionally does not implement __setitem__, preserving the read-only nature of the underlying array for detection via hasattr(data, "__setitem__").

_data
property wrapped

The underlying array object.

property shape
property dtype
property ndim
property size
__len__()
__array__(dtype=None, copy=None)
__getitem__(index)
_materialize_fancy(index)

Materialize fancy indexing by reading individual coordinates.

Each coordinate tuple is looked up via scalar indexing on the underlying array, which is fast when the array has an internal cache (e.g. GraphArrayView’s NDChunkCache).

__getattr__(name)
__repr__()