@@ -6055,7 +6055,7 @@ def _normalize_input(inp, ename='input'):
6055
6055
if (isinstance (x , np .ndarray ) or
6056
6056
not iterable (cbook .safe_first_element (inp ))):
6057
6057
6058
- inp = np . asarray (inp )
6058
+ inp = cbook . safe_masked_invalid (inp )
6059
6059
if inp .ndim == 2 :
6060
6060
# 2-D input with columns as datasets; switch to rows
6061
6061
inp = inp .T
@@ -6077,7 +6077,7 @@ def _normalize_input(inp, ename='input'):
6077
6077
"{ename} must be 1D or 2D" .format (ename = ename ))
6078
6078
else :
6079
6079
# Change to a list of arrays
6080
- inp = [np . asarray (arr ) for arr in inp ]
6080
+ inp = [cbook . safe_masked_invalid (arr ) for arr in inp ]
6081
6081
6082
6082
return inp
6083
6083
@@ -6138,6 +6138,7 @@ def _normalize_input(inp, ename='input'):
6138
6138
else :
6139
6139
w = _normalize_input (weights , 'weights' )
6140
6140
6141
+ # Comparing shape of weights vs. x
6141
6142
if len (w ) != nx :
6142
6143
raise ValueError ('weights should have the same shape as x' )
6143
6144
@@ -6146,6 +6147,16 @@ def _normalize_input(inp, ename='input'):
6146
6147
raise ValueError (
6147
6148
'weights should have the same shape as x' )
6148
6149
6150
+ # Combine the masks from x[i] and w[i] (if applicable) into a single
6151
+ # mask and apply it to both.
6152
+ if not input_empty :
6153
+ for i in range (len (x )):
6154
+ mask_i = x [i ].mask
6155
+ if w [i ] is not None :
6156
+ mask_i = mask_i | w [i ].mask
6157
+ w [i ] = np .ma .masked_array (w [i ], mask = mask_i ).compressed ()
6158
+ x [i ] = np .ma .masked_array (x [i ], mask = mask_i ).compressed ()
6159
+
6149
6160
if color is None :
6150
6161
color = [self ._get_lines .get_next_color () for i in xrange (nx )]
6151
6162
else :
0 commit comments