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...
Any thoughts, anyone? Is it useful, could it be better...? -n On 9 Jun 2012 22:47, "Nathaniel Smith" <n...@pobox.com> wrote: > [Manual PR notification] > > ---------- Forwarded message ---------- > From: timcera > Date: Sat, Jun 9, 2012 at 10:13 PM > Subject: [numpy] ENH: Initial implementation of a 'neighbor' calculation > (#303) > To: njsmith <n...@pobox.com> > > > Each element is assigned the result of a function based on it's neighbors. > Neighbors are selected based on a weight array. > > It uses the new pad routines to pad arrays if neighboring values are > required that would be off the edge of the input array. > > Will be great to have the masked array settled because right now you > can only sort of exclude from the neighborhood using a zero in the > weight array. Zero or np.IGNORE don't affect np.sum, but functions > like np.mean and np.std would give different answers. Because of this > my early implementations of neighbor included an optional mask array > along with the weight array, but I decided would be best to wait for > the new masked arrays. > > This in some ways could be considered a generalization of a > convolution, and comparison with existing numpy/scipy convolution > results are included in the tests. The advantage to neighbor is that > any function that accepts a 1-d array, and returns a single result, > can be used instead of convolution only using summation. The > convolution functions require the weight array to be flipped to get > the same answer as neighbor. > > You can merge this Pull Request by running: > > git pull https://github.com/timcera/numpy neighbor > > Or you can view, comment on it, or merge it online at: > > https://github.com/numpy/numpy/pull/303 > > -- Commit Summary -- > > * ENH: Initial implementation of a 'neighbor' calculation where the each > > -- File Changes -- > > M numpy/lib/__init__.py (2) > A numpy/lib/neighbor.py (305) > A numpy/lib/tests/test_neighbor.py (278) > > -- Patch Links -- > > https://github.com/numpy/numpy/pull/303.patch > https://github.com/numpy/numpy/pull/303.diff > > --- > Reply to this email directly or view it on GitHub: > https://github.com/numpy/numpy/pull/303 >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion