-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide entrypoint for specifying alternate versions of map_coordinates
#282
Comments
Do we think it's possible to use the correct function depending on the input? That is, for example if the input is a dask array we could use the dask-image function, and so on? Otherwise I agree being able to customize this would be good, I'll have a think about how to do this best. @Cadair, any thoughts too? |
Possibly, with something like Annoyingly, it doesn't seem like |
I shall have a think about this but this seems relevant: https://discuss.scientific-python.org/t/spec-2-api-dispatch/173 |
@wtbarnes just to check, do you think this is the only function that needs this kind of treatment or are there other parts of reproject that would need to be adjusted to work optimally with cupy or dask? |
Hmm that's a fair question. In the context of The only other place that I could see being a potential bottleneck would be the pixel-to-pixel mapping in the case of a really nontrivial WCS but I don't think any of my proposed solutions above would help with that. |
reproject_interp
relies onscipy.ndimage.map_coordinates
for interpolating the image to the new pixel array. This is potentially quite slow for large images/complicated WCSs. However, there are several alternate implementations ofmap_coordinates
that could provide potential speedups, e.g.cupy
implementation ofmap_coordinates
when your array is on a GPU: https://docs.cupy.dev/en/stable/reference/generated/cupyx.scipy.ndimage.map_coordinates.htmldask-image
implementation ofmap_coordinates
: Implement support for ndimage.map_coordinates dask/dask-image#237I see that
map_coordinates
is already abstracted away fromscipy.ndimage.map_coordinates
in some sense by placing it in its own function inarray_utils
. Is there a sensible way for providing an entrypoint for swapping out the underlyingmap_coordinates
function? One possibility of course would be just passing in a function as an argument from the high-levelreproject_interp
interface all the way down tomap_coordinates
. Is there a cleaner way?The text was updated successfully, but these errors were encountered: