tensorstore_demo.IndexDomain.__getitem__(
    
selfselection: Any-> IndexDomain

Returns a new domain with a subset of the dimensions.

Parameters:
selection: Any

Specifies the dimensions to include, either by index or label. May be any value or sequence of values convertible to a dimension selection.

Raises:

ValueError – If any dimension is specified more than once.

Examples

>>> a = ts.IndexDomain(inclusive_min=[1, 2, 3],
...                    exclusive_max=[4, 5, 6],
...                    labels=['x', 'y', 'z'])
>>> a[:2]
{ "x": [1, 4), "y": [2, 5) }
>>> a[0, -1]
{ "x": [1, 4), "z": [3, 6) }
>>> a['y', 'x']
{ "y": [2, 5), "x": [1, 4) }
>>> a['y', 1]
Traceback (most recent call last):
    ...
ValueError: Input dimensions {1} specified more than once

Last update: Nov 16, 2024