<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">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.)
<div><br /></div>
<div>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:</div>
<div><br /></div>
<div>https://ilovesymposia.com/2017/03/12/scipys-new-lowlevelcallable-is-a-game-changer/<br /></div>
<div>https://ilovesymposia.com/2017/03/15/prettier-lowlevelcallables-with-numba-jit-and-decorators/<br /></div>
<div><br /></div>
<div>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.)</div>
<div><br /></div>
<div>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.</div>
<div><br /></div>
<div>Sorry!</div>
<div><br /></div>
<div>Juan.</div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On 6 Aug 2017, 6:02 AM +0200, Tim Cera <tim@cerazone.net>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">
<div dir="ltr">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.
<div><a href="http://numpy-discussion.10968.n7.nabble.com/Fwd-numpy-ENH-Initial-implementation-of-a-neighbor-calculation-303-td27508.html">http://numpy-discussion.10968.n7.nabble.com/Fwd-numpy-ENH-Initial-implementation-of-a-neighbor-calculation-303-td27508.html</a><br /></div>
</div>
<br />
<div class="gmail_quote">
<div dir="ltr">On Sat, Aug 5, 2017 at 7:56 PM Stefan van der Walt <<a href="mailto:stefanv@berkeley.edu">stefanv@berkeley.edu</a>> wrote:<br /></div>
<blockquote class="gmail_quote" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">
<div>
<div>On Fri, Aug 4, 2017, at 19:54, Tim Cera wrote:<br /></div>
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #3498db;">
<div dir="ltr">
<div>As noted <a href="https://github.com/numpy/numpy/pull/303" target="_blank">https://github.com/numpy/numpy/pull/303</a> 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.<br /></div>
<div><br /></div>
<div>IMHO it is better suited in numpy with a better name so that people don't miss it.<br /></div>
</div>
</blockquote>
<div><br /></div>
</div>
<div>
<div>Is this essentially `scipy.ndimage.generic_filter`?<br /></div>
<div><br /></div>
<div>Stéfan<br /></div>
<div><br /></div>
</div>
_______________________________________________<br />
NumPy-Discussion mailing list<br />
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br />
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br /></blockquote>
</div>
_______________________________________________<br />
NumPy-Discussion mailing list<br />
NumPy-Discussion@python.org<br />
https://mail.python.org/mailman/listinfo/numpy-discussion<br /></blockquote>
</div>
</body>
</html>