dask 2021.10.0

BackRef
take(outname, inname, chunks, index, itemsize, axis=0)

Handles a single index by a single list

Mimics np.take

>>> from pprint import pprint
>>> chunks, dsk = take('y', 'x', [(20, 20, 20, 20)], [5, 1, 47, 3], 8, axis=0)
>>> chunks
((2, 1, 1),)
>>> pprint(dsk)   # doctest: +ELLIPSIS
{('y', 0): (<function getitem at ...>, ('x', 0), (array([5, 1]),)),
 ('y', 1): (<function getitem at ...>, ('x', 2), (array([7]),)),
 ('y', 2): (<function getitem at ...>, ('x', 0), (array([3]),))}

When list is sorted we retain original block structure

>>> chunks, dsk = take('y', 'x', [(20, 20, 20, 20)], [1, 3, 5, 47], 8, axis=0)
>>> chunks
((3, 1),)
>>> pprint(dsk)     # doctest: +ELLIPSIS
{('y', 0): (<function getitem at ...>,
            ('x', 0),
            (array([1, 3, 5]),)),
 ('y', 1): (<function getitem at ...>, ('x', 2), (array([7]),))}

When any indexed blocks would otherwise grow larger than dask.config.array.chunk-size, we might split them, depending on the value of dask.config.slicing.split-large-chunks .

>>> import dask
>>> with dask.config.set({"array.slicing.split-large-chunks": True}):
...      chunks, dsk = take('y', 'x', [(1, 1, 1), (1000, 1000), (1000, 1000)],
...                        [0] + [1] * 6 + [2], axis=0, itemsize=8)
>>> chunks
((1, 3, 3, 1), (1000, 1000), (1000, 1000))

Index array with an iterable of index

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.slicing.slice_wrap_lists

Local connectivity graph

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


File: /dask/array/slicing.py#585
type: <class 'function'>
Commit: