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

BUG: Polynomial classes in np.polynomial silently discard the mask of masked arrays. #15807

Copy link
Copy link
Open
@WarrenWeckesser

Description

@WarrenWeckesser
Issue body actions

When the array of coefficients is a masked array, the polynomial classes such as np.polynomial.Polynomial and np.polynomial.Hermite silently discard the mask.

For example,

In [2]: np.__version__
Out[2]: '1.19.0.dev0+5b126f8'

c is a masked array, with c[1] masked:

In [3]: c = np.ma.masked_array([1.0, -1.0, 3.0], mask=[0, 1, 0])

In [4]: c
Out[4]: 
masked_array(data=[1.0, --, 3.0],
             mask=[False,  True, False],
       fill_value=1e+20)

Use c as the coefficients of a Polynomial. The mask is ignored, resulting in the value -1 appearing in the coefficients:

In [5]: p = np.polynomial.Polynomial(c)

In [6]: p
Out[6]: Polynomial([ 1., -1.,  3.], domain=[-1,  1], window=[-1,  1])

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.