summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2015-06-19 18:58:59 -0400
committerAllan Haldane <allan.haldane@gmail.com>2017-09-07 16:47:36 -0400
commit7412b85a1b4920e5b72ab694e51b11e4cb615866 (patch)
tree8daf3914cedfb671869982daa04bac027864bc2b /numpy/ma/core.py
parent2afa142ae6ee121f6c75f28403526e35473ee6d5 (diff)
downloadnumpy-7412b85a1b4920e5b72ab694e51b11e4cb615866.tar.gz
MAINT: improve struct assignment, allow multi fields views
This commit attempts to make structure assignment more consistent, and then changes multi-field indices to return a view instead of a copy. Assignment between structures now works "by field position" rather than "by field name". Fixes #2353, fixes #6085, fixes #3351, fixes #6085, fixes #6314, fixes #2346, fixes #7058, fixes #3641, fixes #5994, fixes #7262, fixes #7493
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 8efe45eed..78e7b27a7 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -1613,6 +1613,11 @@ def make_mask(m, copy=False, shrink=True, dtype=MaskType):
# Make sure the input dtype is valid.
dtype = make_mask_descr(dtype)
+
+ # legacy boolean special case: "existence of fields implies true"
+ if isinstance(m, ndarray) and m.dtype.fields and dtype == np.bool_:
+ return np.ones(m.shape, dtype=dtype)
+
# Fill the mask in case there are missing data; turn it into an ndarray.
result = np.array(filled(m, True), copy=copy, dtype=dtype, subok=True)
# Bas les masques !