Make the filternorm prop of Images a boolean rather than a {0,1} scalar. by anntzer · Pull Request #10442 · matplotlib/matplotlib · GitHub
Skip to content

Make the filternorm prop of Images a boolean rather than a {0,1} scalar. - #10442

Merged
QuLogic merged 1 commit into
matplotlib:masterfrom
anntzer:filternorm
Apr 11, 2018
Merged

QuLogic merged 1 commit into
matplotlib:masterfrom
anntzer:filternorm

Conversation

@anntzer

@anntzer anntzer commented Feb 13, 2018

Copy link
Copy Markdown
Contributor

This seems a bit more pythonic and the C-API handles bools just as well.
Also filternorm and filterrad are always defined (as bool and float,
respectively, so no need to add ... or 0.0 when passing them to the
C-API.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.0 milestone Feb 13, 2018
@QuLogic

QuLogic commented Feb 13, 2018

Copy link
Copy Markdown
Member

@anntzer

anntzer commented Feb 13, 2018

Copy link
Copy Markdown
Contributor Author

seems easy to rebase in either direction

This seems a bit more pythonic and the C-API handles bools just as well.
Also filternorm and filterrad are always defined (as bool and float,
respectively, so no need to add `... or 0.0` when passing them to the
C-API.
filternorm : scalar, optional, default: 1
A parameter for the antigrain image resize filter. From the
antigrain documentation, if `filternorm` = 1, the filter
filternorm : bool, optional, default: True

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so filternorm was either 1 or zero?

The rest of this docstring doesn't make a lick of sense to me. I think they are trying to say the sum of the filter should be one, but???

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to propose a better wording :-) (it doesn't make sense to me either)
At least since #10383 matplotlib._image.resample also documents norm as a bool.

@timhoffm

timhoffm commented Apr 8, 2018

Copy link
Copy Markdown
Member

Concerning removal of ... or 0.0:

What if users have used filterrad=False or filterrad=0? Until now, the or has silently cast them to float. Do it still work? At least the second one should.

@anntzer

anntzer commented Apr 8, 2018

Copy link
Copy Markdown
Contributor Author

@QuLogic
QuLogic merged commit e18af55 into matplotlib:master Apr 11, 2018
@anntzer
anntzer deleted the filternorm branch April 11, 2018 02:24
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.

4 participants