-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor out
_unravel_index
function (#60)
* Add a function unravel indices in Dask Arrays Provides a utility function in `ndmeasure` to handle unraveling a Dask Array of 1-D indices into multiple dimensions. Uses a simple kernel function to perform the unraveling on 1-D NumPy Array chunks and coerce them into a format that Dask can handle. This kernel function is then used in a Dask Array `map_blocks` call to handle conversion of the full Dask Array of 1-D indices into N-D indices. * Test the unravel indices utility function Make sure that our unravel indices utility function behaves roughly like NumPy's. They are not a 1-to-1 match as we prefer to return a single Dask Array instead of a `tuple` of Dask Arrays, which is better suited for our use case. * Use the unravel indices utility function Instead of handling the unraveling of a Dask Array of indices through mathematical operations in Dask (which creates a more complex graph), Simply use the utility function, which simply uses `map_blocks` on each chunk to get the N-D indices simply. This makes it easier for Dask to potentially fuse this task with other tasks. Also keeps the Dask graph pretty clean.
- Loading branch information
Showing
3 changed files
with
51 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters