Skip to content

MNT: Simplify code related to masked arrays #24758

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 2 commits into from
Dec 21, 2022
Merged

Conversation

oscargus
Copy link
Member

@oscargus oscargus commented Dec 17, 2022

PR Summary

Simplified a bit of code related to masked arrays.

  • basic_units: already converted to non-masked a few lines up
  • ticker: may just as well use the MaskedConstant class (clearer, only a single check)
  • MaskedArray is a subclass of nparray

(Was about to change many isinstance(.., MaskedArray) to is_masked, but the time for is_masked is much higher compared to isinstance(), so while it probably will be beneficial in the few cases where a MaskedArray object does not have any masked content, this seems a bit too exotic. One may consider the opposite though, replace is_masked with isinstance.)

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@tacaswell tacaswell added this to the v3.8.0 milestone Dec 18, 2022
Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
@rcomer
Copy link
Member

rcomer commented Dec 21, 2022

I assume it’s OK to merge this with doc failures since the change does not affect the docs.

@rcomer rcomer merged commit fde35d4 into matplotlib:main Dec 21, 2022
@rcomer rcomer modified the milestones: v3.8.0, v3.7.0 Dec 21, 2022
@oscargus oscargus deleted the masked branch December 21, 2022 23:23
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