From f18ebf68cfdf7aa816e42b1d358ad416b31a0ec1 Mon Sep 17 00:00:00 2001 From: Marten van Kerkwijk Date: Thu, 26 Apr 2018 17:39:58 -0400 Subject: MAINT: move all masked array matrix tests to matrixlib. Further progress in isolating matrix in preparation of its deprecation. There is one place left with an explicit reference to matrix (in MaskedArray.count), which is to be solved later. --- numpy/ma/extras.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'numpy/ma/extras.py') diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index 8272dced9..da35217d1 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -1465,9 +1465,14 @@ class MAxisConcatenator(AxisConcatenator): """ concatenate = staticmethod(concatenate) - @staticmethod - def makemat(arr): - return array(arr.data.view(np.matrix), mask=arr.mask) + @classmethod + def makemat(cls, arr): + # There used to be a view as np.matrix here, but we may eventually + # deprecate that class. In preparation, we use the unmasked version + # to construct the matrix (with copy=False for backwards compatibility + # with the .view) + data = super(MAxisConcatenator, cls).makemat(arr.data, copy=False) + return array(data, mask=arr.mask) def __getitem__(self, key): # matrix builder syntax, like 'a, b; c, d' -- cgit v1.2.1