Skip to content

DOC: updated docstrings in numpy/ma/core.py - #13241

Closed
ay11111111111 wants to merge 8 commits into
numpy:masterfrom
ay11111111111:master
Closed

ay11111111111 wants to merge 8 commits into
numpy:masterfrom
ay11111111111:master

Conversation

@ay11111111111

@ay11111111111 ay11111111111 commented Apr 2, 2019 •

Copy link
Copy Markdown
Contributor

This PR updates docstrings in numpy/ma/core.py for 'filled' and 'MaskedArray' functions. More specifically, it specifies that fill_value attribute can be of any shape.

@ay11111111111 ay11111111111 changed the title Fixes issue #4363: updated docstrings in numpy/ma/core.py DOC: issue #4363 - updated docstrings in numpy/ma/core.py Apr 2, 2019
@mattip

mattip commented Apr 2, 2019

Copy link
Copy Markdown
Member

The shape cannot be "any", it must be able to be broadcast to x. Also needs expanded examples showing how it can be used.

@mattip

mattip commented Apr 2, 2019

Copy link
Copy Markdown
Member

Sorry, issue #4363 requested deprecation instead.

@ay11111111111

Copy link
Copy Markdown
Contributor Author

@mattip I am so sorry, I have commited the solution for another issue to this branch. How can I discard this commit?

@mattip

mattip commented Apr 2, 2019

Copy link
Copy Markdown
Member

You can do something like git rebase -i HEAD~2 which should open an editor with your three commits, with pick in the first column. Change that to drop on the commits you wish to revert, then write the file and exit.

@ay11111111111 ay11111111111 changed the title DOC: issue #4363 - updated docstrings in numpy/ma/core.py DOC: updated docstrings in numpy/ma/core.py Apr 2, 2019
@ay11111111111

Copy link
Copy Markdown
Contributor Author

@mattip I have updated docstrings, added several examples and deprecation warnings.
Now, trying to figure out how to write warning tests. Can you check if I added deprecation warning right?
And is it ok if I am doing often commits to the branch? I am a newbie in git, that's why there is a little mess :)

@mattip

mattip commented Apr 2, 2019

Copy link
Copy Markdown
Member

is it ok if I am doing often commits to the branch

You might want to investigate git rebase -i ..., it allows you to squash and drop changesets. Then you will need to use -f when you push since you have modified history

@mattip

mattip commented Apr 2, 2019

Copy link
Copy Markdown
Member

added deprecation warning

In the issue @eric-wieser commented "I think we should compromise on allowing filled(...) to take a broadcasting value, and writing tests for it (it's easy to get right), but deprecating using a non-scalar fill value for fill_value (because getting that right is hard)." Please be sure your code and tests answer to that spec or if you disagree discuss it here.

Also, you should add a comment before the warning with the date and version (currently 1.17.0), and the relevant github issue. See the other DeprecationWarnings in the file.

Since this changes user-facing behaviour, you also need to add a comment in doc/release/1.17.0-notes.rst.

@ay11111111111

Copy link
Copy Markdown
Contributor Author

@mattip thanks for navigating me. I'll do my best 👍

@charris

charris commented Apr 3, 2019

Copy link
Copy Markdown
Member

close/reopen.

@charris charris closed this Apr 3, 2019
@charris charris reopened this Apr 3, 2019
@ay11111111111

ay11111111111 commented Apr 3, 2019 •

Copy link
Copy Markdown
Contributor Author

Hi @mattip ! To be honest, I am confused a little bit because the deprecation warnings in core.py are different in structure, and not all of them has a deprecation test. Can I ask 2 more questions?

  1. Did I understand right that fill_value must be only scalar broadcastable over 'a' (however, the type of fill_value broadcasts over 'a' automatically), and non-scalar values are deprecated?
  2. Am I writing test right?
class TestMaFilled(object):
    """gh-4363"""
    x = np.ma.array(np.arange(4).reshape(2, 2), mask=[[1, 0],[0, 1]])
    def test_base(self):
        assert_warns(DeprecationWarning, x.filled,fill_value=0)

Also, can I suggest reorder functions in alphabetical order in order to ease analysis for new-comer contributors?

@mattip

mattip commented Jun 7, 2019 •

Copy link
Copy Markdown
Member

Duplicate of #13698 which was merged. Closing.

@mattip mattip closed this Jun 7, 2019
@eric-wieser

Copy link
Copy Markdown
Member

Wrong PR?

@eric-wieser

Copy link
Copy Markdown
Member

Not sure why I considered this not a duplicate, sorry @mattip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants