@@ -41,9 +41,7 @@ def test_shape_zeros_dtype(self):
41
41
self .assertEqual ((tf .values == 0 ).all (), v_dict ["empty" ])
42
42
43
43
def test_frequency (self ):
44
- self .assertEqual (
45
- (self .tf .frequency == 1.0 / np .arange (1 , 3 , 1 )).all (), True
46
- )
44
+ self .assertEqual ((self .tf .frequency == 1.0 / np .arange (1 , 3 , 1 )).all (), True )
47
45
48
46
def test_period (self ):
49
47
self .assertEqual ((self .tf .period == np .arange (1 , 3 , 1 )).all (), True )
@@ -55,9 +53,7 @@ def test_equal(self):
55
53
class TestTFBaseTFErrorInput (unittest .TestCase ):
56
54
@classmethod
57
55
def setUpClass (self ):
58
- self .tf = TFBase (
59
- tf_error = np .array ([[[0 , 1 ], [1 , 0 ]], [[1 , 0 ], [0 , 1 ]]])
60
- )
56
+ self .tf = TFBase (tf_error = np .array ([[[0 , 1 ], [1 , 0 ]], [[1 , 0 ], [0 , 1 ]]]))
61
57
self .expected_shape = (2 , 2 , 2 )
62
58
self .expected = {
63
59
"transfer_function" : {"dtype" : complex , "empty" : True },
@@ -78,9 +74,7 @@ def test_shape_zeros_dtype(self):
78
74
self .assertEqual ((tf .values == 0 ).all (), v_dict ["empty" ])
79
75
80
76
def test_frequency (self ):
81
- self .assertEqual (
82
- (self .tf .frequency == 1.0 / np .arange (1 , 3 , 1 )).all (), True
83
- )
77
+ self .assertEqual ((self .tf .frequency == 1.0 / np .arange (1 , 3 , 1 )).all (), True )
84
78
85
79
def test_period (self ):
86
80
self .assertEqual ((self .tf .period == np .arange (1 , 3 , 1 )).all (), True )
@@ -89,9 +83,7 @@ def test_period(self):
89
83
class TestTFBaseTFModelErrorInput (unittest .TestCase ):
90
84
@classmethod
91
85
def setUpClass (self ):
92
- self .tf = TFBase (
93
- tf_model_error = np .array ([[[0 , 1 ], [1 , 0 ]], [[1 , 0 ], [0 , 1 ]]])
94
- )
86
+ self .tf = TFBase (tf_model_error = np .array ([[[0 , 1 ], [1 , 0 ]], [[1 , 0 ], [0 , 1 ]]]))
95
87
self .expected_shape = (2 , 1 , 1 )
96
88
self .expected = {
97
89
"transfer_function" : {"dtype" : complex , "empty" : True },
@@ -112,9 +104,7 @@ def test_shape_zeros_dtype(self):
112
104
self .assertEqual ((tf .values == 0 ).all (), v_dict ["empty" ])
113
105
114
106
def test_frequency (self ):
115
- self .assertEqual (
116
- (self .tf .frequency == 1.0 / np .arange (1 , 3 , 1 )).all (), True
117
- )
107
+ self .assertEqual ((self .tf .frequency == 1.0 / np .arange (1 , 3 , 1 )).all (), True )
118
108
119
109
def test_period (self ):
120
110
self .assertEqual ((self .tf .period == np .arange (1 , 3 , 1 )).all (), True )
@@ -320,9 +310,7 @@ def setUpClass(self):
320
310
self .new_periods = np .logspace (- 3 , 3 , 12 )
321
311
322
312
def interpolate (self , interp_type , bounds_error = False ):
323
- interp_tf = spi .interp1d (
324
- self .period , self .tf , axis = 0 , kind = interp_type
325
- )
313
+ interp_tf = spi .interp1d (self .period , self .tf , axis = 0 , kind = interp_type )
326
314
interp_tf_error = spi .interp1d (
327
315
self .period , self .tf_error , axis = 0 , kind = interp_type
328
316
)
@@ -437,9 +425,7 @@ def setUpClass(self):
437
425
frequency = 1.0 / self .period ,
438
426
)
439
427
440
- self .tf_interpolated_same_period = self .tf_base .interpolate (
441
- self .period
442
- )
428
+ self .tf_interpolated_same_period = self .tf_base .interpolate (self .period )
443
429
444
430
self .new_period = np .logspace (- 4 , 4 , 24 )
445
431
self .tf_interpolated_different_period = self .tf_base .interpolate (
@@ -471,9 +457,7 @@ def test_backfill_nans(self):
471
457
)
472
458
self .assertEqual (
473
459
True ,
474
- np .all (
475
- np .isclose (np .nan_to_num (self .tf ), np .nan_to_num (new_tf_nans ))
476
- ),
460
+ np .all (np .isclose (np .nan_to_num (self .tf ), np .nan_to_num (new_tf_nans ))),
477
461
)
478
462
479
463
def test_same_tf (self ):
@@ -494,9 +478,7 @@ def test_same_tf_error(self):
494
478
True ,
495
479
np .all (
496
480
np .isclose (
497
- np .nan_to_num (
498
- self .tf_base ._dataset .transfer_function_error
499
- ),
481
+ np .nan_to_num (self .tf_base ._dataset .transfer_function_error ),
500
482
np .nan_to_num (
501
483
self .tf_interpolated_same_period ._dataset .transfer_function_error
502
484
),
@@ -509,9 +491,7 @@ def test_same_tf_model_error(self):
509
491
True ,
510
492
np .all (
511
493
np .isclose (
512
- np .nan_to_num (
513
- self .tf_base ._dataset .transfer_function_model_error
514
- ),
494
+ np .nan_to_num (self .tf_base ._dataset .transfer_function_model_error ),
515
495
np .nan_to_num (
516
496
self .tf_interpolated_same_period ._dataset .transfer_function_model_error
517
497
),
@@ -532,15 +512,11 @@ def test_different_period_index(self):
532
512
with self .subTest (
533
513
f"period_min: in = { true_entry ['input' ]} out = { true_entry ['output' ]} "
534
514
):
535
- self .assertTrue (
536
- true_entry ["period_min" ] <= new_entry ["period_min" ]
537
- )
515
+ self .assertTrue (true_entry ["period_min" ] <= new_entry ["period_min" ])
538
516
with self .subTest (
539
517
f"period_max: in = { true_entry ['input' ]} out = { true_entry ['output' ]} "
540
518
):
541
- self .assertTrue (
542
- true_entry ["period_max" ] >= new_entry ["period_max" ]
543
- )
519
+ self .assertTrue (true_entry ["period_max" ] >= new_entry ["period_max" ])
544
520
545
521
546
522
# =============================================================================
0 commit comments