class tensorstore_demo.IndexDomain[source]

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.

Constructors

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

Constructs an index domain from component vectors.

IndexDomain(dimensions: collections.abc.Sequence[Dim])

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

IndexDomain(*, json: Any)

Constructs an index domain from its JSON representation.

Sequence accessors

__getitem__(identifier: int | str) Dim

Returns the single dimension specified by identifier.

Indexing

__getitem__(selection: Any) 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: Any) IndexDomain

Transforms the domain using an explicit index transform.

Accessors

to_json() Any[source]

Returns the JSON representation.

property exclusive_max : tuple[int, ...]

Exclusive upper bound of the domain.

property inclusive_min : tuple[int, ...]

Inclusive lower bound of the domain, alias of origin.

property labels : tuple[str, ...]

Dimension labels for each dimension.

property origin : tuple[int, ...]

Inclusive lower bound of the domain.

property rank : int

Number of dimensions in the index space.

property shape : tuple[int, ...]

Shape of the domain.

property size : int

Total number of elements in the domain.


Last update: Apr 16, 2024