@@ -223,9 +223,9 @@ def _set_cmap(self, cmap):
223
223
in_init = self ._cmap is None
224
224
cmap_obj = _ensure_cmap (cmap , accept_multivariate = True )
225
225
if not in_init :
226
- if self .norm .n_output != cmap_obj .n_variates :
226
+ if self .norm .n_variables != cmap_obj .n_variates :
227
227
raise ValueError (f"The colormap { cmap } does not support "
228
- f"{ self .norm .n_output } variates as required by "
228
+ f"{ self .norm .n_variables } variates as required by "
229
229
f"the { type (self .norm )} on this Colorizer" )
230
230
self ._cmap = cmap_obj
231
231
if not in_init :
@@ -253,7 +253,7 @@ def set_clim(self, vmin=None, vmax=None):
253
253
254
254
.. ACCEPTS: (vmin: float, vmax: float)
255
255
"""
256
- if self .norm .n_input == 1 :
256
+ if self .norm .n_variables == 1 :
257
257
if vmax is None :
258
258
try :
259
259
vmin , vmax = vmin
@@ -580,7 +580,7 @@ def set_array(self, A):
580
580
self ._A = None
581
581
return
582
582
583
- A = _ensure_multivariate_data (A , self .norm .n_input )
583
+ A = _ensure_multivariate_data (A , self .norm .n_variables )
584
584
585
585
A = cbook .safe_masked_invalid (A , copy = True )
586
586
if not np .can_cast (A .dtype , float , "same_kind" ):
@@ -784,7 +784,7 @@ def _ensure_norm(norm, n_variates=1):
784
784
norm = colors .MultiNorm ([norm ]* n_variates )
785
785
else : # multiple string or objects
786
786
norm = colors .MultiNorm (norm )
787
- if isinstance (norm , colors .Normalize ) and norm .n_output == n_variates :
787
+ if isinstance (norm , colors .Normalize ) and norm .n_variables == n_variates :
788
788
return norm
789
789
raise ValueError (
790
790
"Invalid norm for multivariate colormap with "
@@ -857,20 +857,20 @@ def _ensure_cmap(cmap, accept_multivariate=False):
857
857
return cm .colormaps [cmap_name ]
858
858
859
859
860
- def _ensure_multivariate_data (data , n_input ):
860
+ def _ensure_multivariate_data (data , n_variables ):
861
861
"""
862
- Ensure that the data has dtype with n_input .
863
- Input data of shape (n_input , n, m) is converted to an array of shape
864
- (n, m) with data type np.dtype(f'{data.dtype}, ' * n_input )
862
+ Ensure that the data has dtype with n_variables .
863
+ Input data of shape (n_variables , n, m) is converted to an array of shape
864
+ (n, m) with data type np.dtype(f'{data.dtype}, ' * n_variables )
865
865
Complex data is returned as a view with dtype np.dtype('float64, float64')
866
866
or np.dtype('float32, float32')
867
- If n_input is 1 and data is not of type np.ndarray (i.e. PIL.Image),
867
+ If n_variables is 1 and data is not of type np.ndarray (i.e. PIL.Image),
868
868
the data is returned unchanged.
869
869
If data is None, the function returns None
870
870
871
871
Parameters
872
872
----------
873
- n_input : int
873
+ n_variables : int
874
874
- number of variates in the data
875
875
data : np.ndarray, PIL.Image or None
876
876
@@ -880,7 +880,7 @@ def _ensure_multivariate_data(data, n_input):
880
880
"""
881
881
882
882
if isinstance (data , np .ndarray ):
883
- if len (data .dtype .descr ) == n_input :
883
+ if len (data .dtype .descr ) == n_variables :
884
884
# pass scalar data
885
885
# and already formatted data
886
886
return data
@@ -896,8 +896,8 @@ def _ensure_multivariate_data(data, n_input):
896
896
reconstructed [descriptor [0 ]][data .mask ] = np .ma .masked
897
897
return reconstructed
898
898
899
- if n_input > 1 and len (data ) == n_input :
900
- # convert data from shape (n_input , n, m)
899
+ if n_variables > 1 and len (data ) == n_variables :
900
+ # convert data from shape (n_variables , n, m)
901
901
# to (n,m) with a new dtype
902
902
data = [np .ma .array (part , copy = False ) for part in data ]
903
903
dt = np .dtype (', ' .join ([f'{ part .dtype } ' for part in data ]))
@@ -915,15 +915,15 @@ def _ensure_multivariate_data(data, n_input):
915
915
if data is None :
916
916
return data
917
917
918
- if n_input == 1 :
918
+ if n_variables == 1 :
919
919
# PIL.Image also gets passed here
920
920
return data
921
921
922
- elif n_input == 2 :
922
+ elif n_variables == 2 :
923
923
raise ValueError ("Invalid data entry for multivariate data. The data"
924
924
" must contain complex numbers, or have a first dimension 2,"
925
925
" or be of a dtype with 2 fields" )
926
926
else :
927
927
raise ValueError ("Invalid data entry for multivariate data. The shape"
928
- f" of the data must have a first dimension { n_input } "
929
- f" or be of a dtype with { n_input } fields" )
928
+ f" of the data must have a first dimension { n_variables } "
929
+ f" or be of a dtype with { n_variables } fields" )
0 commit comments