Description
Is your feature request related to a problem?
I'm trying to think of an example that would demonstrate the "functional index" pattern discussed in #3620.
I think a 2D rotation is the simplest example of an analytically-expressible, non-trivial, domain-agnostic case where you might want to back a set of multiple coordinates with a single functional index. It's also nice because there is additional information that must be passed and stored (the angle of the rotation), but that part is very simple, and domain-agnostic. I'm proposing we make this example work and put it in the custom index docs.
I had a go at making that example (notebook here) @benbovy, but I'm confused about a couple of things:
- How do I implement
.sel
in such a way that it supports indexing with slices (i.e. to crop my image) - How can I make this lazy?
- Should the implementation be a "MetaIndex" (i.e. wrapping some pandas indexes)?
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
This example is inspired by @jni's use case in napari, where (IIUC) they want to do a lazy functional affine transformation from pixel to physical coordinates, where the simplest example of such a transform might be a linear shear (caused by the imaging focal plane being at an angle to the physical sample).