@@ -2321,15 +2321,10 @@ def __init__(self, vmin=None, vmax=None, clip=False):
2321
2321
self .callbacks = cbook .CallbackRegistry (signals = ["changed" ])
2322
2322
2323
2323
@property
2324
- def n_input (self ):
2324
+ def n_variables (self ):
2325
2325
# To be overridden by subclasses with multiple inputs
2326
2326
return 1
2327
2327
2328
- @property
2329
- def n_output (self ):
2330
- # To be overridden by subclasses with multiple outputs
2331
- return 1
2332
-
2333
2328
@property
2334
2329
def vmin (self ):
2335
2330
return self ._vmin
@@ -3283,11 +3278,7 @@ def __init__(self, norms, vmin=None, vmax=None, clip=False):
3283
3278
n .callbacks .connect ('changed' , self ._changed )
3284
3279
3285
3280
@property
3286
- def n_input (self ):
3287
- return len (self ._norms )
3288
-
3289
- @property
3290
- def n_output (self ):
3281
+ def n_variables (self ):
3291
3282
return len (self ._norms )
3292
3283
3293
3284
@property
@@ -3300,7 +3291,7 @@ def vmin(self):
3300
3291
3301
3292
@vmin .setter
3302
3293
def vmin (self , value ):
3303
- value = np .broadcast_to (value , self .n_input )
3294
+ value = np .broadcast_to (value , self .n_variables )
3304
3295
with self .callbacks .blocked ():
3305
3296
for i , v in enumerate (value ):
3306
3297
if v is not None :
@@ -3313,7 +3304,7 @@ def vmax(self):
3313
3304
3314
3305
@vmax .setter
3315
3306
def vmax (self , value ):
3316
- value = np .broadcast_to (value , self .n_input )
3307
+ value = np .broadcast_to (value , self .n_variables )
3317
3308
with self .callbacks .blocked ():
3318
3309
for i , v in enumerate (value ):
3319
3310
if v is not None :
@@ -3326,7 +3317,7 @@ def clip(self):
3326
3317
3327
3318
@clip .setter
3328
3319
def clip (self , value ):
3329
- value = np .broadcast_to (value , self .n_input )
3320
+ value = np .broadcast_to (value , self .n_variables )
3330
3321
with self .callbacks .blocked ():
3331
3322
for i , v in enumerate (value ):
3332
3323
if v is not None :
@@ -3349,8 +3340,8 @@ def __call__(self, value, clip=None):
3349
3340
Parameters
3350
3341
----------
3351
3342
value
3352
- Data to normalize. Must be of length `n_input ` or have a data type with
3353
- `n_input ` fields.
3343
+ Data to normalize. Must be of length `n_variables ` or have a data type with
3344
+ `n_variables ` fields.
3354
3345
clip : list of bools or bool, optional
3355
3346
See the description of the parameter *clip* in Normalize.
3356
3347
If ``None``, defaults to ``self.clip`` (which defaults to
@@ -3359,7 +3350,7 @@ def __call__(self, value, clip=None):
3359
3350
Returns
3360
3351
-------
3361
3352
Data
3362
- Normalized input values as a list of length `n_input `
3353
+ Normalized input values as a list of length `n_variables `
3363
3354
3364
3355
Notes
3365
3356
-----
@@ -3369,9 +3360,9 @@ def __call__(self, value, clip=None):
3369
3360
if clip is None :
3370
3361
clip = self .clip
3371
3362
elif not np .iterable (clip ):
3372
- clip = [clip ]* self .n_input
3363
+ clip = [clip ]* self .n_variables
3373
3364
3374
- value = self ._iterable_variates_in_data (value , self .n_input )
3365
+ value = self ._iterable_variates_in_data (value , self .n_variables )
3375
3366
result = [n (v , clip = c ) for n , v , c in zip (self .norms , value , clip )]
3376
3367
return result
3377
3368
@@ -3382,10 +3373,10 @@ def inverse(self, value):
3382
3373
Parameters
3383
3374
----------
3384
3375
value
3385
- Normalized value. Must be of length `n_input ` or have a data type with
3386
- `n_input ` fields.
3376
+ Normalized value. Must be of length `n_variables ` or have a data type with
3377
+ `n_variables ` fields.
3387
3378
"""
3388
- value = self ._iterable_variates_in_data (value , self .n_input )
3379
+ value = self ._iterable_variates_in_data (value , self .n_variables )
3389
3380
result = [n .inverse (v ) for n , v in zip (self .norms , value )]
3390
3381
return result
3391
3382
@@ -3397,7 +3388,7 @@ def autoscale(self, A):
3397
3388
with self .callbacks .blocked ():
3398
3389
# Pause callbacks while we are updating so we only get
3399
3390
# a single update signal at the end
3400
- A = self ._iterable_variates_in_data (A , self .n_input )
3391
+ A = self ._iterable_variates_in_data (A , self .n_variables )
3401
3392
for n , a in zip (self .norms , A ):
3402
3393
n .autoscale (a )
3403
3394
self ._changed ()
@@ -3410,11 +3401,11 @@ def autoscale_None(self, A):
3410
3401
Parameters
3411
3402
----------
3412
3403
A
3413
- Data, must be of length `n_input ` or be an np.ndarray type with
3414
- `n_input ` fields.
3404
+ Data, must be of length `n_variables ` or be an np.ndarray type with
3405
+ `n_variables ` fields.
3415
3406
"""
3416
3407
with self .callbacks .blocked ():
3417
- A = self ._iterable_variates_in_data (A , self .n_input )
3408
+ A = self ._iterable_variates_in_data (A , self .n_variables )
3418
3409
for n , a in zip (self .norms , A ):
3419
3410
n .autoscale_None (a )
3420
3411
self ._changed ()
@@ -3424,18 +3415,18 @@ def scaled(self):
3424
3415
return all ([(n .vmin is not None and n .vmax is not None ) for n in self .norms ])
3425
3416
3426
3417
@staticmethod
3427
- def _iterable_variates_in_data (data , n_input ):
3418
+ def _iterable_variates_in_data (data , n_variables ):
3428
3419
"""
3429
3420
Provides an iterable over the variates contained in the data.
3430
3421
3431
- An input array with n_input fields is returned as a list of length n referencing
3432
- slices of the original array.
3422
+ An input array with `n_variables` fields is returned as a list of length n
3423
+ referencing slices of the original array.
3433
3424
3434
3425
Parameters
3435
3426
----------
3436
3427
data : np.ndarray, tuple or list
3437
- The input array. It must either be an array with n_input fields or have
3438
- a length (n_input )
3428
+ The input array. It must either be an array with n_variables fields or have
3429
+ a length (n_variables )
3439
3430
3440
3431
Returns
3441
3432
-------
@@ -3444,10 +3435,10 @@ def _iterable_variates_in_data(data, n_input):
3444
3435
"""
3445
3436
if isinstance (data , np .ndarray ) and data .dtype .fields is not None :
3446
3437
data = [data [descriptor [0 ]] for descriptor in data .dtype .descr ]
3447
- if len (data ) != n_input :
3438
+ if len (data ) != n_variables :
3448
3439
raise ValueError ("The input to this `MultiNorm` must be of shape "
3449
- f"({ n_input } , ...), or have a data type with { n_input } "
3450
- " fields." )
3440
+ f"({ n_variables } , ...), or have a data type with "
3441
+ f" { n_variables } fields." )
3451
3442
return data
3452
3443
3453
3444
0 commit comments