[Numpy-discussion] [numpy] ENH: Initial implementation of a 'neighbor' calculation (#303)

Zachary Pincus zachary.pincus at yale.edu
Mon Oct 15 14:26:43 EDT 2012

Hi Tim,

It's tricky to find functionality sometimes because as you've seen numpy and especially scipy are spread over very diverse domains with very diverse terminology! Usually someone on one or the other of the lists can help folks find some functionality, if not by name than by description...

In any case, though, I hope you'll keep your code around and accessible to people in standalone form. Despite being a bit slower than the ndimage stuff, it seems like you've got a better set of boundary conditions, and some other niceties that may appeal to others too.


> On Sun, Oct 14, 2012 at 8:24 PM, Zachary Pincus <zachary.pincus at yale.edu> wrote:
>> It would be useful for the author of the PR to post a detailed comparison of this functionality with scipy.ndimage.generic_filter, which appears to have very similar functionality.
> I'll be durned.   I created neighbor because I didn't find what I wanted, and to find now that I just didn't look in the right place is well ...  Let's just say that I went for a long run last night.
> Searching for ndimage, I found that is has been around a long, long time.  First in numarray, then moved to scipy.
> Really I could only nitpick about minor differences - kinda like a primary political campaign.  On the face of it though, generic_filter looks better.  First off it is written in C so likely will be faster and more efficient memory use.  I didn't look at optimizing neighbor at all and at least my part of it is pure Python.  Of course for all of the small differences, I like my choices better.  :-)
> I would like to make a mild suggestion.  Emphasis on mild.  Maybe ndimage, in all or in part, should be brought into (back into?) Numpy and renamed.  
> About the PR.  Given that the neighbor functionality exists already, I will close the PR later today.  Move along, nothing to see here...
> Side note:  I wrote arraypad with the future idea that it would become easyish to include that functionality in other places, for example in neighbor.  A Don't Repeat Yourself idea.  Previously I had only seen Fortran pad capabilities in some of the Fast Fourier Transform functions. The generic_filter function includes several padding functions - written in C.  This means that if arraypad needs be more efficient we have C code to base a better arraypad.
> Another side node:  The measurements functions in ndimage are called zonal functions in the GIS field.
> Kindest regards,
> Tim
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list