_slice_1d(dim_shape, lengths, index)
This function figures out where each slice should start in each block for a single dimension. If the slice won't return any elements in the block, that block will not be in the output.
This should be a positive, non-zero integer
This should be a positive, non-zero integer
This might be an integer, a slice(), or an Ellipsis
should be sliced and the values are the slices
Returns a dict of {blocknum: slice}
Trivial slicing
This example is valid syntax, but we were not able to check execution>>> _slice_1d(100, [60, 40], slice(None, None, None)) {0: slice(None, None, None), 1: slice(None, None, None)}
100 length array cut into length 20 pieces, slice 0:35
This example is valid syntax, but we were not able to check execution>>> _slice_1d(100, [20, 20, 20, 20, 20], slice(0, 35)) {0: slice(None, None, None), 1: slice(0, 15, 1)}
Support irregular blocks and various slices
This example is valid syntax, but we were not able to check execution>>> _slice_1d(100, [20, 10, 10, 10, 25, 25], slice(10, 35)) {0: slice(10, 20, 1), 1: slice(None, None, None), 2: slice(0, 5, 1)}
Support step sizes
This example is valid syntax, but we were not able to check execution>>> _slice_1d(100, [15, 14, 13], slice(10, 41, 3)) {0: slice(10, 15, 3), 1: slice(1, 14, 3), 2: slice(2, 12, 3)}This example is valid syntax, but we were not able to check execution
>>> _slice_1d(100, [20, 20, 20, 20, 20], slice(0, 100, 40)) # step > blocksize {0: slice(0, 20, 40), 2: slice(0, 20, 40), 4: slice(0, 20, 40)}
Also support indexing single elements
This example is valid syntax, but we were not able to check execution>>> _slice_1d(100, [20, 20, 20, 20, 20], 25) {1: 5}
And negative slicing
This example is valid syntax, but we were not able to check execution>>> _slice_1d(100, [20, 20, 20, 20, 20], slice(100, 0, -3)) # doctest: +NORMALIZE_WHITESPACE {4: slice(-1, -21, -3), 3: slice(-2, -21, -3), 2: slice(-3, -21, -3), 1: slice(-1, -21, -3), 0: slice(-2, -20, -3)}This example is valid syntax, but we were not able to check execution
>>> _slice_1d(100, [20, 20, 20, 20, 20], slice(100, 12, -3)) # doctest: +NORMALIZE_WHITESPACE {4: slice(-1, -21, -3), 3: slice(-2, -21, -3), 2: slice(-3, -21, -3), 1: slice(-1, -21, -3), 0: slice(-2, -8, -3)}This example is valid syntax, but we were not able to check execution
>>> _slice_1d(100, [20, 20, 20, 20, 20], slice(100, -12, -3)) {4: slice(-1, -12, -3)}See :
The following pages refer to to this document either explicitly or contain code examples using this.
dask.array.slicing.slice_slices_and_integers
dask.array.slicing._slice_1d
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them