It’s nice that this is pure Python / NumPy vectorized, whereas generic_filter requires some compilation to get good performance. (Tim, although your implementation is nice and readable, it would have been very slow for any significant volumes.)

However, my feeling is that this function is too specialized for a foundational package like NumPy. As Sebastian Berg pointed out on one of the PRs, it can cause confusion when there are many ways of achieving the same outcome. imho, the One Way to do this kind of operation is using generic_filter together with LowLevelCallable. My two blog posts on the topic: https://ilovesymposia.com/2017/03/12/scipys-new-lowlevelcallable-is-a-game-changer/ https://ilovesymposia.com/2017/03/15/prettier-lowlevelcallables-with-numba-jit-and-decorators/ This has the advantage that it’s even more general. (In fact, it avoids the repeated-applications-vs-diagonal-application argument altogether. These are simply two different kernels.) Perhaps ndimage lacks discoverability to other fields… But I think that can be better solved with documentation, rather than duplicating functionality and cluttering the NumPy API. Sorry! Juan. On 6 Aug 2017, 6:02 AM +0200, Tim Cera <t...@cerazone.net>, wrote: > It you're into reading ancient history here is the link to the discussion > where Zachary Pincus makes the same observation and my response was to close > the PR because I could use scipy.ndimage.generic_filter, even though at least > through my eyes, my implementation was nicer. > http://numpy-discussion.10968.n7.nabble.com/Fwd-numpy-ENH-Initial-implementation-of-a-neighbor-calculation-303-td27508.html > > > On Sat, Aug 5, 2017 at 7:56 PM Stefan van der Walt <stef...@berkeley.edu> > > wrote: > > > On Fri, Aug 4, 2017, at 19:54, Tim Cera wrote: > > > > As noted https://github.com/numpy/numpy/pull/303 a large part of this > > > > functionality has been implemented before for numpy and didn't go > > > > anywhere because it is already present in scipy.ndimage. > > > > > > > > IMHO it is better suited in numpy with a better name so that people > > > > don't miss it. > > > > > > Is this essentially `scipy.ndimage.generic_filter`? > > > > > > Stéfan > > > > > > _______________________________________________ > > > NumPy-Discussion mailing list > > > NumPy-Discussion@python.org > > > https://mail.python.org/mailman/listinfo/numpy-discussion > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@python.org > https://mail.python.org/mailman/listinfo/numpy-discussion

_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion