- tensorstore.IndexDomain.__getitem__(self, expr: DimExpression) IndexDomain
Transforms the domain by a dimension expression.
- Parameters:¶
- expr: DimExpression¶
Dimension expression to apply.
Examples
>>> domain = ts.IndexDomain(inclusive_min=[1, 2, 3], ... exclusive_max=[6, 7, 8], ... labels=['x', 'y', 'z']) >>> domain[ts.d[:].translate_by[5]] { "x": [6, 11), "y": [7, 12), "z": [8, 13) } >>> domain[ts.d['y'][3:5]] { "x": [1, 6), "y": [3, 5), "z": [3, 8) } >>> domain[ts.d['z'][5]] { "x": [1, 6), "y": [2, 7) }
Note
For the purpose of applying a dimension expression, an
IndexDomain
behaves like anIndexTransform
with an output rank of 0. Consequently, operations that primarily affect the output index mappings, like integer array indexing, are not very useful, though they are still permitted.>>> domain = ts.IndexDomain(inclusive_min=[1, 2, 3], ... exclusive_max=[6, 7, 8], ... labels=['x', 'y', 'z']) >>> domain[ts.d['z'][[3, 5, 7]]] { "x": [1, 6), "y": [2, 7), [0, 3) }