1
1
# Authors: Bastien Trotobas <[email protected] >
2
2
# License: BSD 3-Clause
3
3
4
+ from __future__ import division , print_function # Python 2 compatibility
5
+
4
6
from numpy import ones , inf , sqrt , array , identity , zeros , dot , trace , einsum , absolute
5
7
from numpy .random import seed , choice , randn
6
8
from numpy .testing import run_module_suite , assert_raises , assert_equal , assert_allclose , \
@@ -174,7 +176,7 @@ def test_k_factor(self):
174
176
err_msg = 'Wrong k-factor with rician fading in SISO channels' )
175
177
176
178
177
- class MIMOTestCase :
179
+ class MIMOTestCase ( object ) :
178
180
msg_length = 100000
179
181
real_mods = array ((- 1 , 1 )), array ((- 3 , 3 ))
180
182
all_mods = array ((- 1 , 1 )), array ((- 3 , 3 )), \
@@ -218,6 +220,9 @@ def test_SISO(self):
218
220
219
221
220
222
class TestMIMODefaultArgs (MIMOTestCase ):
223
+ def __init__ (self ):
224
+ super (TestMIMODefaultArgs , self ).__init__ ()
225
+
221
226
def do (self , nb_tx , nb_rx ):
222
227
def check (chan ):
223
228
assert_equal (chan .noises , None ,
@@ -242,6 +247,9 @@ def check(chan):
242
247
243
248
@dec .slow
244
249
class TestMIMOFading (MIMOTestCase ):
250
+ def __init__ (self ):
251
+ super (TestMIMOFading , self ).__init__ ()
252
+
245
253
def do (self , nb_tx , nb_rx ):
246
254
def check_chan_gain (mod , chan ):
247
255
msg = choice (mod , self .msg_length )
@@ -315,6 +323,9 @@ def check_chan_gain(mod, chan):
315
323
316
324
@dec .slow
317
325
class TestMIMONoiseGeneration (MIMOTestCase ):
326
+ def __init__ (self ):
327
+ super (TestMIMONoiseGeneration , self ).__init__ ()
328
+
318
329
def do (self , nb_tx , nb_rx ):
319
330
def check_noise (mod , chan , corrected_SNR_lin ):
320
331
msg = choice (mod , self .msg_length )
@@ -348,13 +359,19 @@ def check_noise(mod, chan, corrected_SNR_lin):
348
359
349
360
350
361
class TestMIMOTypeCheck (MIMOTestCase ):
362
+ def __init__ (self ):
363
+ super (TestMIMOTypeCheck , self ).__init__ ()
364
+
351
365
def do (self , nb_tx , nb_rx ):
352
366
chan = MIMOFlatChannel (nb_tx , nb_rx , 0 )
353
367
with assert_raises (TypeError ):
354
368
chan .propagate (array ((1 , 1j )))
355
369
356
370
357
371
class TestMIMOShapes (MIMOTestCase ):
372
+ def __init__ (self ):
373
+ super (TestMIMOShapes , self ).__init__ ()
374
+
358
375
def do (self , nb_tx , nb_rx ):
359
376
# Without padding
360
377
chan = MIMOFlatChannel (nb_tx , nb_rx , 0 )
@@ -382,6 +399,9 @@ def do(self, nb_tx, nb_rx):
382
399
383
400
384
401
class TestMIMOkFactor (MIMOTestCase ):
402
+ def __init__ (self ):
403
+ super (TestMIMOkFactor , self ).__init__ ()
404
+
385
405
def do (self , nb_tx , nb_rx ):
386
406
prod_nb = nb_tx * nb_rx
387
407
0 commit comments