Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Do not warn when invalid values are masked in a MaskedArray #4959

Copy link
Copy link
Open
@gerritholl

Description

@gerritholl
Issue body actions

When doing a mathematical operation on a masked array, and some elements are invalid for the particular mathematical operation, numpy should not issue a warning if all invalid elements are masked.

This cannot be handled by numpy.seterr: I want numpy to warn or raise when performing an invalid operation on any non-masked value, but to be silent when performing an invalid operation on a masked value.

In [1]: A = arange(-2, 5)/2

In [2]: Am = numpy.ma.masked_less_equal(A, 0)

In [3]: numpy.log10(Am)
/export/data/home/gholl/venv/gerrit/bin/ipython3:1: RuntimeWarning: divide by zero encountered in log10
  #!/export/data/home/gholl/venv/gerrit/bin/python3.4
/export/data/home/gholl/venv/gerrit/bin/ipython3:1: RuntimeWarning: invalid value encountered in log10
  #!/export/data/home/gholl/venv/gerrit/bin/python3.4
Out[3]: 
masked_array(data = [-- -- -- -0.3010299956639812 0.0 0.17609125905568124 0.3010299956639812],
             mask = [ True  True  True False False False False],
       fill_value = 1e+20)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.