From 3edf1a43987be276459e01c4afa7bbc6c74e7144 Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Tue, 20 Oct 2015 20:35:43 -0500 Subject: BUG: scalar argument to ma.atleast_* return arrays The np.ma.atleast_1d, np.ma.atleast_2d, np.ma.atleast_3d and np.ma.diagflat function return arrays when given a scalar in the same manner as their non-ma counterparts. Previously these function would return None. Additionally, the np.ma vstack, row_stack, hstack, column_stack, dstack, and hsplit functions now raise an expection when given a scalar argument. closes #3367 --- numpy/ma/extras.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'numpy/ma/extras.py') diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index b4021df63..ae4e0cee5 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -270,6 +270,10 @@ class _fromnxfunction: _d = func(tuple([np.asarray(a) for a in x]), **params) _m = func(tuple([getmaskarray(a) for a in x]), **params) return masked_array(_d, mask=_m) + else: + _d = func(np.asarray(x), **params) + _m = func(getmaskarray(x), **params) + return masked_array(_d, mask=_m) else: arrays = [] args = list(args) -- cgit v1.2.1