8000 Slightly clarify the implementation of safe_masked_invalid. by anntzer · Pull Request #15786 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Slightly clarify the implementation of safe_masked_invalid. #15786

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
Nov 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/matplotlib/cbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,12 +746,9 @@ def safezip(*args):
def safe_masked_invalid(x, copy=False):
x = np.array(x, subok=True, copy=copy)
if not x.dtype.isnative:
# Note that the argument to `byteswap` is 'inplace',
# thus if we have already made a copy, do the byteswap in
# place, else make a copy with the byte order swapped.
# Be explicit that we are swapping the byte order of the dtype
x = x.byteswap(copy).newbyteorder('S')

# If we have already made a copy, do the byteswap in place, else make a
# copy with the byte order swapped.
x = x.byteswap(inplace=copy).newbyteorder('N') # Swap to native order.
try:
xm = np.ma.masked_invalid(x, copy=False)
xm.shrink_mask()
Expand Down
0