-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use 1-D structured array fields for position-based kernels in `ndmeas…
…ure` (#79) * Use N-D structured array field in `center_of_mass` Instead of using multiple structured array fields to pass back the different coordinate components of the center of mass, use one 1-D field with the size being the number of components. This simplifies the array handling a bit and avoids the need to split apart and restack the array. * Use N-D structured array in `maximum_position` Rewrite `maximum_position` to use a structured `dtype` with a 1-D field. This allows the unraveled position to be determined in the `maximum_position` kernel function and returned. With this change there is no need to handle unraveling of the position in the Dask graph. Only the structured field need be selected, which is a constant time operation. Thus simplifying the Dask graph generated by `maximum_position` and improving the computation performance as well. * Use N-D structured array in `minimum_position` Rewrite `minimum_position` to use a structured `dtype` with a 1-D field. This allows the unraveled position to be determined in the `minimum_position` kernel function and returned. With this change there is no need to handle unraveling of the position in the Dask graph. Only the structured field need be selected, which is a constant time operation. Thus simplifying the Dask graph generated by `minimum_position` and improving the computation performance as well. * Use N-D structured array fields in `extrema` Make use of N-D structured array fields in `extrema`'s kernel function to pass back N-D coordinate positions. Avoids having an explicit unraveling step added to the Dask graph after the `extrema`'s kernel function. * Drop `_unravel_index` from `ndmeasure._utils` This function is no longer needed as unraveling of indices now occurs within kernel functions that are returning position. Hence it is dropped along with its tests.
- Loading branch information
Showing
3 changed files
with
56 additions
and
96 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