class tensorstore.IndexDomain

Domain (including bounds and optional dimension labels) of an N-dimensional index space.

Logically, an IndexDomain is the cartesian product of a sequence of Dim objects.

Note

Index domains are immutable, but dimension expressions may be applied using __getitem__(expr) to obtain a modified domain.

See also

Constructors

IndexDomain(rank: int | None = None, *, ...)

Constructs an index domain from component vectors.

IndexDomain(dimensions: Sequence[Dim])

Constructs an index domain from a :py:class`.Dim` sequence.

IndexDomain(*, json: Any)

Constructs an index domain from its JSON representation.

Accessors

rank : int

Number of dimensions in the index space.

ndim : int

Alias for rank.

origin : tuple[int, ...]

Inclusive lower bound of the domain.

inclusive_min : tuple[int, ...]

Inclusive lower bound of the domain, alias of origin.

shape : tuple[int, ...]

Shape of the domain.

exclusive_max : tuple[int, ...]

Exclusive upper bound of the domain.

inclusive_max : tuple[int, ...]

Inclusive upper bound of the domain.

labels : tuple[str, ...]

Dimension labels for each dimension.

implicit_lower_bounds : tuple[bool, ...]

Indicates whether the lower bound of each dimension is implicit or explicit.

implicit_upper_bounds : tuple[bool, ...]

Indicates whether the upper bound of each dimension is implicit or explicit.

size : int

Total number of elements in the domain.

index_exp : tuple[slice, ...]

Equivalent NumPy-compatible index expression.

to_json() Any

Returns the JSON representation.

Sequence accessors

__len__() int

Returns the number of dimensions (rank).

__getitem__(identifier: int | str) Dim

Returns the single dimension specified by identifier.

Indexing

__getitem__(selection: DimSelectionLike) IndexDomain

Returns a new domain with a subset of the dimensions.

__getitem__(other: IndexDomain) IndexDomain

Slices this domain by another domain.

__getitem__(expr: DimExpression) IndexDomain

Transforms the domain by a dimension expression.

__getitem__(transform: IndexTransform) IndexDomain

Transforms the domain using an explicit index transform.

T : IndexDomain

View with the dimension order reversed (transposed).

translate_to[origins] IndexDomain

Returns a new view with origin translated to the specified origin.

translate_by[offsets] IndexDomain

Returns a new view with the origin translated by the specified offsets.

translate_backward_by[offsets] IndexDomain

Returns a new view with the origin translated backward by the specified offsets.

label[labels: str | Sequence[str]] IndexDomain

Returns a new view with the dimension labels changed.

mark_bounds_implicit[implicit: bool | None | slice] IndexDomain

Returns a new view with the lower/upper bounds changed to implicit/explicit.

transpose(axes: DimSelectionLike | None = None) IndexDomain

Returns a view with a transposed domain.

Geometric operations

intersect(other: IndexDomain) IndexDomain

Intersects with another domain.

hull(other: IndexDomain) IndexDomain

Computes the hull (minimum containing box) with another domain.

String representation

__repr__() str

Returns the string representation.