11# Authors: Bastien Trotobas <bastien.trotobas@gmail.com>
22# License: BSD 3-Clause
33
4+ from __future__ import division , print_function # Python 2 compatibility
5+
46from numpy import ones , inf , sqrt , array , identity , zeros , dot , trace , einsum , absolute
57from numpy .random import seed , choice , randn
68from numpy .testing import run_module_suite , assert_raises , assert_equal , assert_allclose , \
@@ -174,7 +176,7 @@ def test_k_factor(self):
174176 err_msg = 'Wrong k-factor with rician fading in SISO channels' )
175177
176178
177- class MIMOTestCase :
179+ class MIMOTestCase ( object ) :
178180 msg_length = 100000
179181 real_mods = array ((- 1 , 1 )), array ((- 3 , 3 ))
180182 all_mods = array ((- 1 , 1 )), array ((- 3 , 3 )), \
@@ -218,6 +220,9 @@ def test_SISO(self):
218220
219221
220222class TestMIMODefaultArgs (MIMOTestCase ):
223+ def __init__ (self ):
224+ super (TestMIMODefaultArgs , self ).__init__ ()
225+
221226 def do (self , nb_tx , nb_rx ):
222227 def check (chan ):
223228 assert_equal (chan .noises , None ,
@@ -242,6 +247,9 @@ def check(chan):
242247
243248@dec .slow
244249class TestMIMOFading (MIMOTestCase ):
250+ def __init__ (self ):
251+ super (TestMIMOFading , self ).__init__ ()
252+
245253 def do (self , nb_tx , nb_rx ):
246254 def check_chan_gain (mod , chan ):
247255 msg = choice (mod , self .msg_length )
@@ -315,6 +323,9 @@ def check_chan_gain(mod, chan):
315323
316324@dec .slow
317325class TestMIMONoiseGeneration (MIMOTestCase ):
326+ def __init__ (self ):
327+ super (TestMIMONoiseGeneration , self ).__init__ ()
328+
318329 def do (self , nb_tx , nb_rx ):
319330 def check_noise (mod , chan , corrected_SNR_lin ):
320331 msg = choice (mod , self .msg_length )
@@ -348,13 +359,19 @@ def check_noise(mod, chan, corrected_SNR_lin):
348359
349360
350361class TestMIMOTypeCheck (MIMOTestCase ):
362+ def __init__ (self ):
363+ super (TestMIMOTypeCheck , self ).__init__ ()
364+
351365 def do (self , nb_tx , nb_rx ):
352366 chan = MIMOFlatChannel (nb_tx , nb_rx , 0 )
353367 with assert_raises (TypeError ):
354368 chan .propagate (array ((1 , 1j )))
355369
356370
357371class TestMIMOShapes (MIMOTestCase ):
372+ def __init__ (self ):
373+ super (TestMIMOShapes , self ).__init__ ()
374+
358375 def do (self , nb_tx , nb_rx ):
359376 # Without padding
360377 chan = MIMOFlatChannel (nb_tx , nb_rx , 0 )
@@ -382,6 +399,9 @@ def do(self, nb_tx, nb_rx):
382399
383400
384401class TestMIMOkFactor (MIMOTestCase ):
402+ def __init__ (self ):
403+ super (TestMIMOkFactor , self ).__init__ ()
404+
385405 def do (self , nb_tx , nb_rx ):
386406 prod_nb = nb_tx * nb_rx
387407
0 commit comments