10000 ENH: Add ma.convolve and ma.correlate for #6458 by eric-wieser · Pull Request #7922 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Add ma.convolve and ma.correlate for #6458 #7922

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

Merged
merged 4 commits into from
Oct 20, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DOC: correct ma.convolve docstrings, and add the feature to the relea…
…se notes
  • Loading branch information
eric-wieser committed Oct 19, 2016
commit bf3fb267a3b014adbf6a980684877374636234b3
7 changes: 7 additions & 0 deletions doc/release/1.12.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ context manager will work as expected. Additionally, it is possible
to use the context manager as a decorator which can be useful when
multiple tests give need to hide the same warning.

New masked array functions ``ma.convolve`` and ``ma.correlate`` added
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These functions wrapped the non-masked versions, but propagate through masked
values. There are two different propagation modes. The default causes masked
values to contaminate the result with masks, but the other mode only outputs
masks if there is no alternative.


Improvements
============
Expand Down
7 changes: 5 additions & 2 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7367,6 +7367,9 @@ def outer(a, b):


def _convolve_or_correlate(f, a, v, mode, propagate_mask):
"""
Helper function for ma.correlate and ma.convolve
"""
if propagate_mask:
# results which are contributed to by either item in any pair being invalid
mask = (
Expand Down Expand Up @@ -7400,7 +7403,7 @@ def correlate(a, v, mode='valid', propagate_mask=True):

Returns
-------
out : ndarray
out : MaskedArray
Discrete cross-correlation of `a` and `v`.

See Also
Expand Down Expand Up @@ -7428,7 +7431,7 @@ def convolve(a, v, mode='full', propagate_mask=True):

Returns
-------
out : ndarray
out : MaskedArray
Discrete, linear convolution of `a` and `v`.

See Also
Expand Down
0