Skip to content

Simplify/fix save_diff_image. #23659

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 1 commit into from
Aug 18, 2022
Merged

Simplify/fix save_diff_image. #23659

merged 1 commit into from
Aug 18, 2022

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Aug 18, 2022

  • The previous *255*10 factor was necessary when using the old _png
    module to read images, which read them as 0-1 floats, the 255 factor
    was needed prior to conversion to uint8. Now we use pillow everywhere
    in matplotlib.testing.compare and work with uint8 throughout, so the
    extra 255 is incorrect (it basically caused any slight difference to
    be fully saturated).
  • We don't use _png to write the diffs anymore, and pillow handles RGB
    just fine, so we don't need to add an alpha channel if it's not there.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@tacaswell
Copy link
Member

(it basically caused any slight difference to be fully saturated.

I had noticed this but it had not bothered me enough to chase down....

@tacaswell
Copy link
Member

This might allow us to reduce the tolerances on some of the known-bad tests.

Do we have a test that still fail on slightly different images? I guess the night-mare risk here is we put a bug in this code and start passing wrong images and effectively invalidate a most of our test suite.

@tacaswell tacaswell added this to the v3.7.0 milestone Aug 18, 2022
- The previous `*255*10` factor was necessary when using the old _png
  module to read images, which read them as 0-1 floats, the 255 factor
  was needed prior to conversion to uint8.  Now we use pillow everywhere
  in matplotlib.testing.compare and work with uint8 throughout, so the
  extra 255 is incorrect (it basically caused any slight difference to
  be fully saturated).
- We don't use _png to write the diffs anymore, and pillow handles RGB
  just fine, so we don't need to add an alpha channel if it's not there.
@tacaswell
Copy link
Member

tacaswell commented Aug 18, 2022

Given the number of tests that go through this lets hold off merging this until we have 3.6.x branched.

@anntzer
Copy link
Contributor Author

anntzer commented Aug 18, 2022

The tolerance is compared with the value computed in calculate_rms, independently of save_diff_image, so this shouldn't matter.

@tacaswell
Copy link
Member

Given @anntzer 's comment I rectract my request we hold this for 3.7.

@tacaswell tacaswell modified the milestones: v3.7.0, v3.6.0 Aug 18, 2022
@QuLogic QuLogic merged commit 69cf385 into matplotlib:main Aug 18, 2022
@anntzer anntzer deleted the sdi branch August 18, 2022 19:13
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.

3 participants