From 059a7fe5cacf7cdce7f281f1733478089cceaa83 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Fri, 7 Oct 2022 10:27:06 +0200 Subject: [PATCH] Replace getmask with getmaskarray --- lib/matplotlib/colors.py | 13 +++++-------- lib/matplotlib/transforms.py | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 5441b0d617b5..16e13e69d53f 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -1302,9 +1302,8 @@ def process_value(value): dtype = np.promote_types(dtype, np.float32) # ensure data passed in as an ndarray subclass are interpreted as # an ndarray. See issue #6622. - mask = np.ma.getmask(value) - data = np.asarray(value) - result = np.ma.array(data, mask=mask, dtype=dtype, copy=True) + result = np.ma.array(np.asarray(value), mask=np.ma.getmaskarray(value), + dtype=dtype, copy=True) return result, is_scalar def __call__(self, value, clip=None): @@ -1341,9 +1340,8 @@ def __call__(self, value, clip=None): raise ValueError("minvalue must be less than or equal to maxvalue") else: if clip: - mask = np.ma.getmask(result) result = np.ma.array(np.clip(result.filled(vmax), vmin, vmax), - mask=mask) + mask=np.ma.getmaskarray(result)) # ma division is very slow; we can take a shortcut resdat = result.data resdat -= vmin @@ -1459,7 +1457,7 @@ def __call__(self, value, clip=None): result = np.ma.masked_array( np.interp(result, [self.vmin, self.vcenter, self.vmax], [0, 0.5, 1], left=-np.inf, right=np.inf), - mask=np.ma.getmask(result)) + mask=np.ma.getmaskarray(result)) if is_scalar: result = np.atleast_1d(result)[0] return result @@ -1873,9 +1871,8 @@ def __call__(self, value, clip=None): result.fill(0) else: if clip: - mask = np.ma.getmask(result) result = np.ma.array(np.clip(result.filled(vmax), vmin, vmax), - mask=mask) + mask=np.ma.getmaskarray(result)) resdat = result.data resdat -= vmin resdat[resdat < 0] = 0 diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 1471d4fe672d..62d460a9833c 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -1849,7 +1849,7 @@ def transform_affine(self, points): mtx = self.get_matrix() if isinstance(points, np.ma.MaskedArray): tpoints = affine_transform(points.data, mtx) - return np.ma.MaskedArray(tpoints, mask=np.ma.getmask(points)) + return np.ma.MaskedArray(tpoints, mask=np.ma.getmaskarray(points)) return affine_transform(points, mtx) if DEBUG: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy