<p dir="ltr">This PR submitted a few months ago adds a substantial new API to numpy, so it'd be great to get more review. No-one's replied yet, though...</p>
<p dir="ltr">Any thoughts, anyone? Is it useful, could it be better...?</p>
<p dir="ltr">-n</p>
<div class="gmail_quote">On 9 Jun 2012 22:47, "Nathaniel Smith" <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
[Manual PR notification]<br>
<br>
---------- Forwarded message ----------<br>
From: timcera<br>
Date: Sat, Jun 9, 2012 at 10:13 PM<br>
Subject: [numpy] ENH: Initial implementation of a 'neighbor' calculation (#303)<br>
To: njsmith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>><br>
<br>
<br>
Each element is assigned the result of a function based on it's neighbors.<br>
Neighbors are selected based on a weight array.<br>
<br>
It uses the new pad routines to pad arrays if neighboring values are<br>
required that would be off the edge of the input array.<br>
<br>
Will be great to have the masked array settled because right now you<br>
can only sort of exclude from the neighborhood using a zero in the<br>
weight array.  Zero or np.IGNORE don't affect np.sum, but functions<br>
like np.mean and np.std would give different answers.  Because of this<br>
my early implementations of neighbor included an optional mask array<br>
along with the weight array, but I decided would be best to wait for<br>
the new masked arrays.<br>
<br>
This in some ways could be considered a generalization of a<br>
convolution, and comparison with existing numpy/scipy convolution<br>
results are included in the tests.  The advantage to neighbor is that<br>
any function that accepts a 1-d array, and returns a single result,<br>
can be used instead of convolution only using summation.  The<br>
convolution functions require the weight array to be flipped to get<br>
the same answer as neighbor.<br>
<br>
You can merge this Pull Request by running:<br>
<br>
 git pull <a href="https://github.com/timcera/numpy" target="_blank">https://github.com/timcera/numpy</a> neighbor<br>
<br>
Or you can view, comment on it, or merge it online at:<br>
<br>
 <a href="https://github.com/numpy/numpy/pull/303" target="_blank">https://github.com/numpy/numpy/pull/303</a><br>
<br>
-- Commit Summary --<br>
<br>
* ENH: Initial implementation of a 'neighbor' calculation where the each<br>
<br>
-- File Changes --<br>
<br>
M numpy/lib/__init__.py (2)<br>
A numpy/lib/neighbor.py (305)<br>
A numpy/lib/tests/test_neighbor.py (278)<br>
<br>
-- Patch Links --<br>
<br>
 <a href="https://github.com/numpy/numpy/pull/303.patch" target="_blank">https://github.com/numpy/numpy/pull/303.patch</a><br>
 <a href="https://github.com/numpy/numpy/pull/303.diff" target="_blank">https://github.com/numpy/numpy/pull/303.diff</a><br>
<br>
---<br>
Reply to this email directly or view it on GitHub:<br>
<a href="https://github.com/numpy/numpy/pull/303" target="_blank">https://github.com/numpy/numpy/pull/303</a><br>
</blockquote></div>