Skip to content

ENH: Initial implementation of a 'neighbor' calculation #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

ENH: Initial implementation of a 'neighbor' calculation #303

wants to merge 1 commit into from

Conversation

timcera
Copy link
Contributor

@timcera timcera commented Jun 9, 2012

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.

element is assigned the result of a function based on it's neighbors.
Neighbors are selected based on a weight array.
@teoliphant
Copy link
Member

I'm not sure what to make of no comments on this PR. This seems like a useful addition. @timcera are you still interested in having this PR merged?

@ewmoore
Copy link
Contributor

ewmoore commented Oct 10, 2012

This seems to be trying to solve a very similar problem to #31

@timcera
Copy link
Contributor Author

timcera commented Oct 16, 2012

Closing. scipy.ndimage.generic_filter has identical functionality.

@timcera timcera closed this Oct 16, 2012
luyahan pushed a commit to plctlab/numpy that referenced this pull request Apr 25, 2024
feat: Add vqrdmlsh[q]_[|lane]_[s16|s32]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants