-
-
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.
Drop vendored compatibility code (#54)
* Bump Dask requirement to 0.16.1+ The Dask 0.13.0 requirement was in place before as that was a pretty stable and somewhat old Dask version at the time and Python 3.4 packages existed for it on conda-forge. Also it was believed this should make it easier for other projects to use this Dask-based image processing code. However many changes were pushed upstream to Dask when this was being developed, which were largely vendored or worked around in this library through compatibility code. In some cases the upstream implementations have seen notable performance improvements. In other cases, functionality (like Dask Arrays of unknown shape) have just become easier to work with generally with fewer hacks. Of course there is also the maintenance that this extra code entails, which is not really worth the effort given upstream often has superior implementations.Generally having this compatibility code is becoming a bit of a hindrance. Also Python 3.4 is not being supported by Dask further or many of the projects downstream of it. Further some of these projects already require substantially newer versions of Dask to function. As we may have similar implementations of things that differ as noted above, this can be costly in terms of interoperability. So supporting such old versions of Dask is really not helpful for others wanting to use this library. Given all of this, it makes sense to bump the Dask minimum version for better performance, a simpler code base, and nicer interoperability with other libraries. The minimum version of Dask that would help us eliminate all compatibility code would be 0.16.1. While a newer version could be used for other new features, none of these are needed yet. As 0.16.1 came out early this year, it has been around for a while. It is also the last patch release of the 0.16 series. Plus 0.16.0 introduces the Dask Collections interface to the public API, which makes it easier to construct custom graphs should they be needed. Thus go ahead and bump the minimum Dask version to 0.16.1. * Drop all `_compat` modules As the `_compat` modules were added to provide Dask Array functionality not yet included in the Dask version we were using, they are now unneeded given our minimum version of Dask has been bumped up to a version that includes all of this functionality. So just remove the `_compat` modules from the codebase. * Drop tests of compatibility code As the compatibility modules have been removed, there is no need to hang on to tests of their functionality. Instead simply drop them as well. * Replace compatibility functions with Dask ones As all of the compatibility functions are now in Dask in some form, replace them all with their Dask Array equivalent. * Use `meshgrid` in `_get_freq_grid` Instead of rolling our own version of `meshgrid` in `_get_freq_grid` to construct the frequency grid, simply pass the results from `fftfreq` onto `meshgrid`. This drastically cuts down on the amount of code here and benefits from all of the optimizations upstream has implemented in `meshgrid`, which we did not have here with our `repeat`-based implementation. * Use Dask Array's `where` directly We had wrapped Dask Array's `where` to perform a quick optimization if the condition was a simple scalar (e.g. `True` or `False`). In this special case, we merely selected the correct result and returned it instead of performing a lengthy computation, whose result was already known during graph computation. This optimization has long since made its way into Dask Array. So there is no value in us holding onto this wrapper code any longer. Hence it is dropped. * Drop tests for the `ndmorph._ops` module The only test of `ndmorph._ops` was for the `_where` function, which we no longer need. The other functionality in there is a wrapper that is already effectively tested by the construction of all `ndmorph` functions and their tests. Having an explicit test of the wrapper makes no sense since it already occurs through the functions it is used to make. Given this, just drop this test module since it is no longer needed. * Remove map_overlap 0-depth workaround Upstream has since incorporated a change to ensure setting the depth to `0` in `map_overlap` does not cause an error (for cases other than `reflect`). As we are bumping the Dask version, we no longer need this workaround. Hence this drops it to cleanup some code and simplify maintenance. Also updates the corresponding test to stop checking that this this workaround is used.
- Loading branch information
Showing
23 changed files
with
24 additions
and
286 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
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
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
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.