aboutsummaryrefslogtreecommitdiffstats
path: root/gr-analog
diff options
context:
space:
mode:
authormormj <mormjb@gmail.com>2020-10-30 10:59:50 -0400
committerMarcus Müller <marcus@hostalia.de>2020-10-30 17:52:53 +0100
commit7a0948ba85758fba1cc3858ef99bfa600dcc7416 (patch)
tree610d7f9d773a193562def6df2d4b50f1bb3b3f86 /gr-analog
parentqa: remove xml file parameter causing deprecation warnings (diff)
downloadgnuradio-7a0948ba85758fba1cc3858ef99bfa600dcc7416.tar.xz
gnuradio-7a0948ba85758fba1cc3858ef99bfa600dcc7416.zip
qa: run autopep8 formatting on qa python files
find ./ -iname qa*.py | xargs autopep8 --in-place -a -a mostly formats whitespace and gets rid of trailing semicolons
Diffstat (limited to 'gr-analog')
-rw-r--r--gr-analog/python/analog/qa_agc.py336
-rw-r--r--gr-analog/python/analog/qa_cpfsk.py9
-rw-r--r--gr-analog/python/analog/qa_ctcss_squelch.py3
-rw-r--r--gr-analog/python/analog/qa_dpll.py7
-rw-r--r--gr-analog/python/analog/qa_fastnoise.py86
-rw-r--r--gr-analog/python/analog/qa_fmdet.py9
-rw-r--r--gr-analog/python/analog/qa_frequency_modulator.py7
-rw-r--r--gr-analog/python/analog/qa_noise.py8
-rw-r--r--gr-analog/python/analog/qa_phase_modulator.py7
-rw-r--r--gr-analog/python/analog/qa_pll_carriertracking.py208
-rw-r--r--gr-analog/python/analog/qa_pll_freqdet.py208
-rw-r--r--gr-analog/python/analog/qa_pll_refout.py204
-rw-r--r--gr-analog/python/analog/qa_probe_avg_mag_sqrd.py40
-rw-r--r--gr-analog/python/analog/qa_pwr_squelch.py8
-rw-r--r--gr-analog/python/analog/qa_quadrature_demod.py7
-rw-r--r--gr-analog/python/analog/qa_rail_ff.py4
-rw-r--r--gr-analog/python/analog/qa_sig_source.py10
-rw-r--r--gr-analog/python/analog/qa_simple_squelch.py5
18 files changed, 623 insertions, 543 deletions
diff --git a/gr-analog/python/analog/qa_agc.py b/gr-analog/python/analog/qa_agc.py
index 28bcd5434..b65456a8c 100644
--- a/gr-analog/python/analog/qa_agc.py
+++ b/gr-analog/python/analog/qa_agc.py
@@ -11,6 +11,7 @@
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_agc(gr_unittest.TestCase):
def setUp(self):
@@ -37,62 +38,62 @@ class test_agc(gr_unittest.TestCase):
tb = self.tb
expected_result = (
- (100.000244140625+7.2191943445432116e-07j),
- (72.892257690429688+52.959323883056641j),
- (25.089065551757812+77.216217041015625j),
- (-22.611061096191406+69.589706420898438j),
- (-53.357715606689453+38.766635894775391j),
- (-59.458671569824219+3.4792964243024471e-07j),
- (-43.373462677001953-31.512666702270508j),
- (-14.94139289855957-45.984889984130859j),
- (13.478158950805664-41.48150634765625j),
- (31.838506698608398-23.132022857666016j),
- (35.519271850585938-3.1176801940091536e-07j),
- (25.942903518676758+18.848621368408203j),
- (8.9492912292480469+27.5430908203125j),
- (-8.0852642059326172+24.883890151977539j),
- (-19.131628036499023+13.899936676025391j),
- (-21.383295059204102+3.1281737733479531e-07j),
- (-15.650330543518066-11.370632171630859j),
- (-5.4110145568847656-16.65339469909668j),
- (4.9008159637451172-15.083160400390625j),
- (11.628337860107422-8.4484796524047852j),
- (13.036135673522949-2.288476110834381e-07j),
- (9.5726661682128906+6.954948902130127j),
- (3.3216962814331055+10.223132133483887j),
- (-3.0204284191131592+9.2959251403808594j),
- (-7.1977195739746094+5.2294478416442871j),
- (-8.1072216033935547+1.8976157889483147e-07j),
- (-5.9838657379150391-4.3475332260131836j),
- (-2.0879747867584229-6.4261269569396973j),
- (1.9100792407989502-5.8786196708679199j),
- (4.5814824104309082-3.3286411762237549j),
- (5.1967458724975586-1.3684227440080576e-07j),
- (3.8647139072418213+2.8078789710998535j),
- (1.3594740629196167+4.1840314865112305j),
- (-1.2544282674789429+3.8607344627380371j),
- (-3.0366206169128418+2.2062335014343262j),
- (-3.4781389236450195+1.1194014604143376e-07j),
- (-2.6133756637573242-1.8987287282943726j),
- (-0.9293016791343689-2.8600969314575195j),
- (0.86727333068847656-2.6691930294036865j),
- (2.1243946552276611-1.5434627532958984j),
- (2.4633183479309082-8.6486437567145913e-08j),
- (1.8744727373123169+1.3618841171264648j),
- (0.67528903484344482+2.0783262252807617j),
- (-0.63866174221038818+1.965599536895752j),
- (-1.5857341289520264+1.152103066444397j),
- (-1.8640764951705933+7.6355092915036948e-08j),
- (-1.4381576776504517-1.0448826551437378j),
- (-0.52529704570770264-1.6166983842849731j),
- (0.50366902351379395-1.5501341819763184j),
- (1.26766037940979-0.92100900411605835j))
+ (100.000244140625 + 7.2191943445432116e-07j),
+ (72.892257690429688 + 52.959323883056641j),
+ (25.089065551757812 + 77.216217041015625j),
+ (-22.611061096191406 + 69.589706420898438j),
+ (-53.357715606689453 + 38.766635894775391j),
+ (-59.458671569824219 + 3.4792964243024471e-07j),
+ (-43.373462677001953 - 31.512666702270508j),
+ (-14.94139289855957 - 45.984889984130859j),
+ (13.478158950805664 - 41.48150634765625j),
+ (31.838506698608398 - 23.132022857666016j),
+ (35.519271850585938 - 3.1176801940091536e-07j),
+ (25.942903518676758 + 18.848621368408203j),
+ (8.9492912292480469 + 27.5430908203125j),
+ (-8.0852642059326172 + 24.883890151977539j),
+ (-19.131628036499023 + 13.899936676025391j),
+ (-21.383295059204102 + 3.1281737733479531e-07j),
+ (-15.650330543518066 - 11.370632171630859j),
+ (-5.4110145568847656 - 16.65339469909668j),
+ (4.9008159637451172 - 15.083160400390625j),
+ (11.628337860107422 - 8.4484796524047852j),
+ (13.036135673522949 - 2.288476110834381e-07j),
+ (9.5726661682128906 + 6.954948902130127j),
+ (3.3216962814331055 + 10.223132133483887j),
+ (-3.0204284191131592 + 9.2959251403808594j),
+ (-7.1977195739746094 + 5.2294478416442871j),
+ (-8.1072216033935547 + 1.8976157889483147e-07j),
+ (-5.9838657379150391 - 4.3475332260131836j),
+ (-2.0879747867584229 - 6.4261269569396973j),
+ (1.9100792407989502 - 5.8786196708679199j),
+ (4.5814824104309082 - 3.3286411762237549j),
+ (5.1967458724975586 - 1.3684227440080576e-07j),
+ (3.8647139072418213 + 2.8078789710998535j),
+ (1.3594740629196167 + 4.1840314865112305j),
+ (-1.2544282674789429 + 3.8607344627380371j),
+ (-3.0366206169128418 + 2.2062335014343262j),
+ (-3.4781389236450195 + 1.1194014604143376e-07j),
+ (-2.6133756637573242 - 1.8987287282943726j),
+ (-0.9293016791343689 - 2.8600969314575195j),
+ (0.86727333068847656 - 2.6691930294036865j),
+ (2.1243946552276611 - 1.5434627532958984j),
+ (2.4633183479309082 - 8.6486437567145913e-08j),
+ (1.8744727373123169 + 1.3618841171264648j),
+ (0.67528903484344482 + 2.0783262252807617j),
+ (-0.63866174221038818 + 1.965599536895752j),
+ (-1.5857341289520264 + 1.152103066444397j),
+ (-1.8640764951705933 + 7.6355092915036948e-08j),
+ (-1.4381576776504517 - 1.0448826551437378j),
+ (-0.52529704570770264 - 1.6166983842849731j),
+ (0.50366902351379395 - 1.5501341819763184j),
+ (1.26766037940979 - 0.92100900411605835j))
sampling_freq = 100
src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE,
sampling_freq * 0.10, 100.0)
dst1 = blocks.vector_sink_c()
- head = blocks.head(gr.sizeof_gr_complex, int (5*sampling_freq * 0.10))
+ head = blocks.head(gr.sizeof_gr_complex, int(5 * sampling_freq * 0.10))
agc = analog.agc_cc(1e-3, 1, 1)
@@ -176,18 +177,18 @@ class test_agc(gr_unittest.TestCase):
sampling_freq = 100
src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE,
sampling_freq * 0.10, 100.0)
- dst1 = blocks.vector_sink_f ()
- head = blocks.head (gr.sizeof_float, int (5*sampling_freq * 0.10))
+ dst1 = blocks.vector_sink_f()
+ head = blocks.head(gr.sizeof_float, int(5 * sampling_freq * 0.10))
agc = analog.agc_ff(1e-3, 1, 1)
- tb.connect (src1, head)
- tb.connect (head, agc)
- tb.connect (agc, dst1)
+ tb.connect(src1, head)
+ tb.connect(head, agc)
+ tb.connect(agc, dst1)
- tb.run ()
- dst_data = dst1.data ()
- self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4)
+ tb.run()
+ dst_data = dst1.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 4)
def test_003_sets(self):
agc = analog.agc2_cc(1e-3, 1e-1, 1, 1)
@@ -209,62 +210,62 @@ class test_agc(gr_unittest.TestCase):
tb = self.tb
expected_result = \
- ((100.000244140625+7.2191943445432116e-07j),
- (0.80881959199905396+0.58764183521270752j),
- (0.30894950032234192+0.95084899663925171j),
- (-0.30895623564720154+0.95086973905563354j),
- (-0.80887287855148315+0.58768033981323242j),
- (-0.99984413385391235+5.850709250410091e-09j),
- (-0.80889981985092163-0.58770018815994263j),
- (-0.30897706747055054-0.95093393325805664j),
- (0.30898112058639526-0.95094609260559082j),
- (0.80893135070800781-0.58772283792495728j),
- (0.99990922212600708-8.7766354184282136e-09j),
- (0.80894720554351807+0.58773452043533325j),
- (0.30899339914321899+0.95098406076431274j),
- (-0.30899572372436523+0.95099133253097534j),
- (-0.80896598100662231+0.58774799108505249j),
- (-0.99994778633117676+1.4628290578855285e-08j),
- (-0.80897533893585205-0.58775502443313599j),
- (-0.30900305509567261-0.95101380348205566j),
- (0.30900448560714722-0.95101797580718994j),
- (0.80898630619049072-0.58776277303695679j),
- (0.99997037649154663-1.7554345532744264e-08j),
- (0.80899184942245483+0.58776694536209106j),
- (0.30900871753692627+0.95103120803833008j),
- (-0.30900952219963074+0.95103377103805542j),
- (-0.8089984655380249+0.58777159452438354j),
- (-0.99998390674591064+2.3406109050938539e-08j),
- (-0.809001624584198-0.58777409791946411j),
- (-0.30901208519935608-0.95104163885116577j),
- (0.30901262164115906-0.95104306936264038j),
- (0.80900543928146362-0.587776780128479j),
- (0.99999171495437622-2.6332081404234486e-08j),
- (0.80900734663009644+0.58777821063995361j),
- (0.30901408195495605+0.95104765892028809j),
- (-0.30901429057121277+0.95104855298995972j),
- (-0.80900967121124268+0.58777981996536255j),
- (-0.99999648332595825+3.2183805842578295e-08j),
- (-0.80901080369949341-0.58778077363967896j),
- (-0.30901527404785156-0.95105135440826416j),
- (0.30901545286178589-0.95105189085006714j),
- (0.80901217460632324-0.58778166770935059j),
- (0.99999916553497314-3.5109700036173308e-08j),
- (0.809012770652771+0.58778214454650879j),
- (0.30901595950126648+0.9510534405708313j),
- (-0.30901598930358887+0.95105385780334473j),
- (-0.80901366472244263+0.58778274059295654j),
- (-1.0000008344650269+4.0961388947380328e-08j),
- (-0.8090139627456665-0.58778303861618042j),
- (-0.30901634693145752-0.95105475187301636j),
- (0.30901640653610229-0.95105493068695068j),
- (0.80901449918746948-0.5877833366394043j))
+ ((100.000244140625 + 7.2191943445432116e-07j),
+ (0.80881959199905396 + 0.58764183521270752j),
+ (0.30894950032234192 + 0.95084899663925171j),
+ (-0.30895623564720154 + 0.95086973905563354j),
+ (-0.80887287855148315 + 0.58768033981323242j),
+ (-0.99984413385391235 + 5.850709250410091e-09j),
+ (-0.80889981985092163 - 0.58770018815994263j),
+ (-0.30897706747055054 - 0.95093393325805664j),
+ (0.30898112058639526 - 0.95094609260559082j),
+ (0.80893135070800781 - 0.58772283792495728j),
+ (0.99990922212600708 - 8.7766354184282136e-09j),
+ (0.80894720554351807 + 0.58773452043533325j),
+ (0.30899339914321899 + 0.95098406076431274j),
+ (-0.30899572372436523 + 0.95099133253097534j),
+ (-0.80896598100662231 + 0.58774799108505249j),
+ (-0.99994778633117676 + 1.4628290578855285e-08j),
+ (-0.80897533893585205 - 0.58775502443313599j),
+ (-0.30900305509567261 - 0.95101380348205566j),
+ (0.30900448560714722 - 0.95101797580718994j),
+ (0.80898630619049072 - 0.58776277303695679j),
+ (0.99997037649154663 - 1.7554345532744264e-08j),
+ (0.80899184942245483 + 0.58776694536209106j),
+ (0.30900871753692627 + 0.95103120803833008j),
+ (-0.30900952219963074 + 0.95103377103805542j),
+ (-0.8089984655380249 + 0.58777159452438354j),
+ (-0.99998390674591064 + 2.3406109050938539e-08j),
+ (-0.809001624584198 - 0.58777409791946411j),
+ (-0.30901208519935608 - 0.95104163885116577j),
+ (0.30901262164115906 - 0.95104306936264038j),
+ (0.80900543928146362 - 0.587776780128479j),
+ (0.99999171495437622 - 2.6332081404234486e-08j),
+ (0.80900734663009644 + 0.58777821063995361j),
+ (0.30901408195495605 + 0.95104765892028809j),
+ (-0.30901429057121277 + 0.95104855298995972j),
+ (-0.80900967121124268 + 0.58777981996536255j),
+ (-0.99999648332595825 + 3.2183805842578295e-08j),
+ (-0.80901080369949341 - 0.58778077363967896j),
+ (-0.30901527404785156 - 0.95105135440826416j),
+ (0.30901545286178589 - 0.95105189085006714j),
+ (0.80901217460632324 - 0.58778166770935059j),
+ (0.99999916553497314 - 3.5109700036173308e-08j),
+ (0.809012770652771 + 0.58778214454650879j),
+ (0.30901595950126648 + 0.9510534405708313j),
+ (-0.30901598930358887 + 0.95105385780334473j),
+ (-0.80901366472244263 + 0.58778274059295654j),
+ (-1.0000008344650269 + 4.0961388947380328e-08j),
+ (-0.8090139627456665 - 0.58778303861618042j),
+ (-0.30901634693145752 - 0.95105475187301636j),
+ (0.30901640653610229 - 0.95105493068695068j),
+ (0.80901449918746948 - 0.5877833366394043j))
sampling_freq = 100
src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE,
sampling_freq * 0.10, 100)
dst1 = blocks.vector_sink_c()
- head = blocks.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10))
+ head = blocks.head(gr.sizeof_gr_complex, int(5 * sampling_freq * 0.10))
agc = analog.agc2_cc(1e-2, 1e-3, 1, 1)
@@ -351,7 +352,7 @@ class test_agc(gr_unittest.TestCase):
src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE,
sampling_freq * 0.10, 100)
dst1 = blocks.vector_sink_f()
- head = blocks.head(gr.sizeof_float, int(5*sampling_freq * 0.10))
+ head = blocks.head(gr.sizeof_float, int(5 * sampling_freq * 0.10))
agc = analog.agc2_ff(1e-2, 1e-3, 1, 1)
@@ -363,68 +364,67 @@ class test_agc(gr_unittest.TestCase):
dst_data = dst1.data()
self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 4)
-
def test_005(self):
''' Test the complex AGC loop (attack and decay rate inputs) '''
tb = self.tb
expected_result = \
- ((100.000244140625+7.2191943445432116e-07j),
- (0.80881959199905396+0.58764183521270752j),
- (0.30894950032234192+0.95084899663925171j),
- (-0.30895623564720154+0.95086973905563354j),
- (-0.80887287855148315+0.58768033981323242j),
- (-0.99984413385391235+5.850709250410091e-09j),
- (-0.80889981985092163-0.58770018815994263j),
- (-0.30897706747055054-0.95093393325805664j),
- (0.30898112058639526-0.95094609260559082j),
- (0.80893135070800781-0.58772283792495728j),
- (0.99990922212600708-8.7766354184282136e-09j),
- (0.80894720554351807+0.58773452043533325j),
- (0.30899339914321899+0.95098406076431274j),
- (-0.30899572372436523+0.95099133253097534j),
- (-0.80896598100662231+0.58774799108505249j),
- (-0.99994778633117676+1.4628290578855285e-08j),
- (-0.80897533893585205-0.58775502443313599j),
- (-0.30900305509567261-0.95101380348205566j),
- (0.30900448560714722-0.95101797580718994j),
- (0.80898630619049072-0.58776277303695679j),
- (0.99997037649154663-1.7554345532744264e-08j),
- (0.80899184942245483+0.58776694536209106j),
- (0.30900871753692627+0.95103120803833008j),
- (-0.30900952219963074+0.95103377103805542j),
- (-0.8089984655380249+0.58777159452438354j),
- (-0.99998390674591064+2.3406109050938539e-08j),
- (-0.809001624584198-0.58777409791946411j),
- (-0.30901208519935608-0.95104163885116577j),
- (0.30901262164115906-0.95104306936264038j),
- (0.80900543928146362-0.587776780128479j),
- (0.99999171495437622-2.6332081404234486e-08j),
- (0.80900734663009644+0.58777821063995361j),
- (0.30901408195495605+0.95104765892028809j),
- (-0.30901429057121277+0.95104855298995972j),
- (-0.80900967121124268+0.58777981996536255j),
- (-0.99999648332595825+3.2183805842578295e-08j),
- (-0.80901080369949341-0.58778077363967896j),
- (-0.30901527404785156-0.95105135440826416j),
- (0.30901545286178589-0.95105189085006714j),
- (0.80901217460632324-0.58778166770935059j),
- (0.99999916553497314-3.5109700036173308e-08j),
- (0.809012770652771+0.58778214454650879j),
- (0.30901595950126648+0.9510534405708313j),
- (-0.30901598930358887+0.95105385780334473j),
- (-0.80901366472244263+0.58778274059295654j),
- (-1.0000008344650269+4.0961388947380328e-08j),
- (-0.8090139627456665-0.58778303861618042j),
- (-0.30901634693145752-0.95105475187301636j),
- (0.30901640653610229-0.95105493068695068j),
- (0.80901449918746948-0.5877833366394043j))
+ ((100.000244140625 + 7.2191943445432116e-07j),
+ (0.80881959199905396 + 0.58764183521270752j),
+ (0.30894950032234192 + 0.95084899663925171j),
+ (-0.30895623564720154 + 0.95086973905563354j),
+ (-0.80887287855148315 + 0.58768033981323242j),
+ (-0.99984413385391235 + 5.850709250410091e-09j),
+ (-0.80889981985092163 - 0.58770018815994263j),
+ (-0.30897706747055054 - 0.95093393325805664j),
+ (0.30898112058639526 - 0.95094609260559082j),
+ (0.80893135070800781 - 0.58772283792495728j),
+ (0.99990922212600708 - 8.7766354184282136e-09j),
+ (0.80894720554351807 + 0.58773452043533325j),
+ (0.30899339914321899 + 0.95098406076431274j),
+ (-0.30899572372436523 + 0.95099133253097534j),
+ (-0.80896598100662231 + 0.58774799108505249j),
+ (-0.99994778633117676 + 1.4628290578855285e-08j),
+ (-0.80897533893585205 - 0.58775502443313599j),
+ (-0.30900305509567261 - 0.95101380348205566j),
+ (0.30900448560714722 - 0.95101797580718994j),
+ (0.80898630619049072 - 0.58776277303695679j),
+ (0.99997037649154663 - 1.7554345532744264e-08j),
+ (0.80899184942245483 + 0.58776694536209106j),
+ (0.30900871753692627 + 0.95103120803833008j),
+ (-0.30900952219963074 + 0.95103377103805542j),
+ (-0.8089984655380249 + 0.58777159452438354j),
+ (-0.99998390674591064 + 2.3406109050938539e-08j),
+ (-0.809001624584198 - 0.58777409791946411j),
+ (-0.30901208519935608 - 0.95104163885116577j),
+ (0.30901262164115906 - 0.95104306936264038j),
+ (0.80900543928146362 - 0.587776780128479j),
+ (0.99999171495437622 - 2.6332081404234486e-08j),
+ (0.80900734663009644 + 0.58777821063995361j),
+ (0.30901408195495605 + 0.95104765892028809j),
+ (-0.30901429057121277 + 0.95104855298995972j),
+ (-0.80900967121124268 + 0.58777981996536255j),
+ (-0.99999648332595825 + 3.2183805842578295e-08j),
+ (-0.80901080369949341 - 0.58778077363967896j),
+ (-0.30901527404785156 - 0.95105135440826416j),
+ (0.30901545286178589 - 0.95105189085006714j),
+ (0.80901217460632324 - 0.58778166770935059j),
+ (0.99999916553497314 - 3.5109700036173308e-08j),
+ (0.809012770652771 + 0.58778214454650879j),
+ (0.30901595950126648 + 0.9510534405708313j),
+ (-0.30901598930358887 + 0.95105385780334473j),
+ (-0.80901366472244263 + 0.58778274059295654j),
+ (-1.0000008344650269 + 4.0961388947380328e-08j),
+ (-0.8090139627456665 - 0.58778303861618042j),
+ (-0.30901634693145752 - 0.95105475187301636j),
+ (0.30901640653610229 - 0.95105493068695068j),
+ (0.80901449918746948 - 0.5877833366394043j))
sampling_freq = 100
src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE,
sampling_freq * 0.10, 100)
dst1 = blocks.vector_sink_c()
- head = blocks.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10))
+ head = blocks.head(gr.sizeof_gr_complex, int(5 * sampling_freq * 0.10))
agc = analog.agc2_cc(1e-2, 1e-3, 1, 1)
@@ -454,7 +454,7 @@ class test_agc(gr_unittest.TestCase):
tb = self.tb
sampling_freq = 100
- N = int(5*sampling_freq)
+ N = int(5 * sampling_freq)
src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE,
sampling_freq * 0.10, 100)
dst1 = blocks.vector_sink_c()
@@ -470,8 +470,8 @@ class test_agc(gr_unittest.TestCase):
tb.run()
dst_data = dst1.data()
M = 100
- result = [abs(x) for x in dst_data[N-M:]]
- self.assertFloatTuplesAlmostEqual(result, M*[ref,], 4)
+ result = [abs(x) for x in dst_data[N - M:]]
+ self.assertFloatTuplesAlmostEqual(result, M * [ref, ], 4)
def test_100(self):
''' Test complex feedforward agc with constant input '''
@@ -479,8 +479,8 @@ class test_agc(gr_unittest.TestCase):
length = 8
gain = 2
- input_data = 8*(0.0,) + 24*(1.0,) + 24*(0.0,)
- expected_result = (8+length-1)*(0.0,) + 24*(gain*1.0,) + (0,)
+ input_data = 8 * (0.0,) + 24 * (1.0,) + 24 * (0.0,)
+ expected_result = (8 + length - 1) * (0.0,) + 24 * (gain * 1.0,) + (0,)
src = blocks.vector_source_c(input_data)
agc = analog.feedforward_agc_cc(8, 2.0)
diff --git a/gr-analog/python/analog/qa_cpfsk.py b/gr-analog/python/analog/qa_cpfsk.py
index 7e866c185..f6fa00a26 100644
--- a/gr-analog/python/analog/qa_cpfsk.py
+++ b/gr-analog/python/analog/qa_cpfsk.py
@@ -13,6 +13,7 @@ import math
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_cpfsk_bc(gr_unittest.TestCase):
def setUp(self):
@@ -30,7 +31,7 @@ class test_cpfsk_bc(gr_unittest.TestCase):
a = op.amplitude()
self.assertEqual(2, a)
- freq = 2*math.pi/2.0
+ freq = 2 * math.pi / 2.0
f = op.freq()
self.assertAlmostEqual(freq, f, 5)
@@ -38,8 +39,8 @@ class test_cpfsk_bc(gr_unittest.TestCase):
self.assertEqual(0, p)
def test_cpfsk_bc_002(self):
- src_data = 10*[0, 1]
- expected_result = [complex(2*x-1,0) for x in src_data]
+ src_data = 10 * [0, 1]
+ expected_result = [complex(2 * x - 1, 0) for x in src_data]
src = blocks.vector_source_b(src_data)
op = analog.cpfsk_bc(2, 1, 2)
@@ -52,6 +53,6 @@ class test_cpfsk_bc(gr_unittest.TestCase):
result_data = dst.data()[0:len(expected_result)]
self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4)
+
if __name__ == '__main__':
gr_unittest.run(test_cpfsk_bc)
-
diff --git a/gr-analog/python/analog/qa_ctcss_squelch.py b/gr-analog/python/analog/qa_ctcss_squelch.py
index 8a7e5353d..6151641aa 100644
--- a/gr-analog/python/analog/qa_ctcss_squelch.py
+++ b/gr-analog/python/analog/qa_ctcss_squelch.py
@@ -11,6 +11,7 @@
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_ctcss_squelch(gr_unittest.TestCase):
def setUp(self):
@@ -93,6 +94,6 @@ class test_ctcss_squelch(gr_unittest.TestCase):
result_data = dst.data()
self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4)
+
if __name__ == '__main__':
gr_unittest.run(test_ctcss_squelch)
-
diff --git a/gr-analog/python/analog/qa_dpll.py b/gr-analog/python/analog/qa_dpll.py
index 90b060bd2..627db53f5 100644
--- a/gr-analog/python/analog/qa_dpll.py
+++ b/gr-analog/python/analog/qa_dpll.py
@@ -11,6 +11,7 @@
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_dpll_bb(gr_unittest.TestCase):
def setUp(self):
@@ -33,7 +34,7 @@ class test_dpll_bb(gr_unittest.TestCase):
f = op.freq()
self.assertEqual(1 / period, f)
- d0 = 1.0 - 0.5*f;
+ d0 = 1.0 - 0.5 * f
d1 = op.decision_threshold()
self.assertAlmostEqual(d0, d1)
@@ -44,7 +45,7 @@ class test_dpll_bb(gr_unittest.TestCase):
period = 4
gain = 0.1
- src_data = 10*((period-1)*[0,] + [1,])
+ src_data = 10 * ((period - 1) * [0, ] + [1, ])
expected_result = src_data
src = blocks.vector_source_b(src_data)
@@ -58,6 +59,6 @@ class test_dpll_bb(gr_unittest.TestCase):
result_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4)
+
if __name__ == '__main__':
gr_unittest.run(test_dpll_bb)
-
diff --git a/gr-analog/python/analog/qa_fastnoise.py b/gr-analog/python/analog/qa_fastnoise.py
index b80d2e04d..3e5e0c300 100644
--- a/gr-analog/python/analog/qa_fastnoise.py
+++ b/gr-analog/python/analog/qa_fastnoise.py
@@ -14,13 +14,13 @@ import numpy
class test_fastnoise_source(gr_unittest.TestCase):
- def setUp (self):
+ def setUp(self):
self.num = 2**22
self.num_items = 10**6
self.default_args = {"samples": self.num, "seed": 43, "ampl": 1}
- def tearDown (self):
+ def tearDown(self):
pass
def run_test_real(self, form):
@@ -28,7 +28,9 @@ class test_fastnoise_source(gr_unittest.TestCase):
"""
tb = gr.top_block()
src = analog.fastnoise_source_f(type=form, **self.default_args)
- head = blocks.head(nitems=self.num_items, sizeof_stream_item=gr.sizeof_float)
+ head = blocks.head(
+ nitems=self.num_items,
+ sizeof_stream_item=gr.sizeof_float)
sink = blocks.vector_sink_f()
tb.connect(src, head, sink)
tb.run()
@@ -39,7 +41,9 @@ class test_fastnoise_source(gr_unittest.TestCase):
"""
tb = gr.top_block()
src = analog.fastnoise_source_c(type=form, **self.default_args)
- head = blocks.head(nitems=self.num_items, sizeof_stream_item=gr.sizeof_gr_complex)
+ head = blocks.head(
+ nitems=self.num_items,
+ sizeof_stream_item=gr.sizeof_gr_complex)
sink = blocks.vector_sink_c()
tb.connect(src, head, sink)
tb.run()
@@ -54,7 +58,7 @@ class test_fastnoise_source(gr_unittest.TestCase):
# mean, variance
self.assertAlmostEqual(data.mean(), 0, places=2)
- self.assertAlmostEqual(data.var(), (1-(-1))**2./12, places=3)
+ self.assertAlmostEqual(data.var(), (1 - (-1))**2. / 12, places=3)
def test_001_real_gaussian_moments(self):
data = self.run_test_real(analog.GR_GAUSSIAN)
@@ -75,10 +79,12 @@ class test_fastnoise_source(gr_unittest.TestCase):
# mean, variance
self.assertAlmostEqual(data.real.mean(), 0, places=2)
- self.assertAlmostEqual(data.real.var(), 0.5*(1-(-1))**2./12, places=3)
+ self.assertAlmostEqual(data.real.var(), 0.5 *
+ (1 - (-1))**2. / 12, places=3)
self.assertAlmostEqual(data.imag.mean(), 0, places=2)
- self.assertAlmostEqual(data.imag.var(), 0.5*(1-(-1))**2./12, places=3)
+ self.assertAlmostEqual(data.imag.var(), 0.5 *
+ (1 - (-1))**2. / 12, places=3)
def test_001_complex_gaussian_moments(self):
data = self.run_test_complex(analog.GR_GAUSSIAN)
@@ -104,24 +110,60 @@ class test_fastnoise_source(gr_unittest.TestCase):
self.assertTrue(numpy.array_equal(data1, data2))
def test_003_real_uniform_pool(self):
- src = analog.fastnoise_source_f(type=analog.GR_UNIFORM, **self.default_args)
- src2 = analog.fastnoise_source_f(type=analog.GR_UNIFORM, **self.default_args)
- self.assertTrue(numpy.array_equal(numpy.array(src.samples()), numpy.array(src2.samples())))
+ src = analog.fastnoise_source_f(
+ type=analog.GR_UNIFORM, **self.default_args)
+ src2 = analog.fastnoise_source_f(
+ type=analog.GR_UNIFORM, **self.default_args)
+ self.assertTrue(
+ numpy.array_equal(
+ numpy.array(
+ src.samples()), numpy.array(
+ src2.samples())))
+
def test_003_real_gaussian_pool(self):
- src = analog.fastnoise_source_f(type=analog.GR_GAUSSIAN, **self.default_args)
- src2 = analog.fastnoise_source_f(type=analog.GR_GAUSSIAN, **self.default_args)
- self.assertTrue(numpy.array_equal(numpy.array(src.samples()), numpy.array(src2.samples())))
+ src = analog.fastnoise_source_f(
+ type=analog.GR_GAUSSIAN, **self.default_args)
+ src2 = analog.fastnoise_source_f(
+ type=analog.GR_GAUSSIAN, **self.default_args)
+ self.assertTrue(
+ numpy.array_equal(
+ numpy.array(
+ src.samples()), numpy.array(
+ src2.samples())))
+
def test_003_cmplx_gaussian_pool(self):
- src = analog.fastnoise_source_c(type=analog.GR_GAUSSIAN, **self.default_args)
- src2 = analog.fastnoise_source_c(type=analog.GR_GAUSSIAN, **self.default_args)
- self.assertTrue(numpy.array_equal(numpy.array(src.samples()), numpy.array(src2.samples())))
+ src = analog.fastnoise_source_c(
+ type=analog.GR_GAUSSIAN, **self.default_args)
+ src2 = analog.fastnoise_source_c(
+ type=analog.GR_GAUSSIAN, **self.default_args)
+ self.assertTrue(
+ numpy.array_equal(
+ numpy.array(
+ src.samples()), numpy.array(
+ src2.samples())))
+
def test_003_cmplx_uniform_pool(self):
- src = analog.fastnoise_source_c(type=analog.GR_UNIFORM, **self.default_args)
- src2 = analog.fastnoise_source_c(type=analog.GR_UNIFORM, **self.default_args)
- self.assertTrue(numpy.array_equal(numpy.array(src.samples()), numpy.array(src2.samples())))
+ src = analog.fastnoise_source_c(
+ type=analog.GR_UNIFORM, **self.default_args)
+ src2 = analog.fastnoise_source_c(
+ type=analog.GR_UNIFORM, **self.default_args)
+ self.assertTrue(
+ numpy.array_equal(
+ numpy.array(
+ src.samples()), numpy.array(
+ src2.samples())))
+
def test_003_real_laplacian_pool(self):
- src = analog.fastnoise_source_f(type=analog.GR_LAPLACIAN, **self.default_args)
- src2 = analog.fastnoise_source_f(type=analog.GR_LAPLACIAN, **self.default_args)
- self.assertTrue(numpy.array_equal(numpy.array(src.samples()), numpy.array(src2.samples())))
+ src = analog.fastnoise_source_f(
+ type=analog.GR_LAPLACIAN, **self.default_args)
+ src2 = analog.fastnoise_source_f(
+ type=analog.GR_LAPLACIAN, **self.default_args)
+ self.assertTrue(
+ numpy.array_equal(
+ numpy.array(
+ src.samples()), numpy.array(
+ src2.samples())))
+
+
if __name__ == '__main__':
gr_unittest.run(test_fastnoise_source)
diff --git a/gr-analog/python/analog/qa_fmdet.py b/gr-analog/python/analog/qa_fmdet.py
index 84ba1b8b0..9480f2a4d 100644
--- a/gr-analog/python/analog/qa_fmdet.py
+++ b/gr-analog/python/analog/qa_fmdet.py
@@ -11,6 +11,7 @@
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_fmdet_cf(gr_unittest.TestCase):
def setUp(self):
@@ -33,7 +34,7 @@ class test_fmdet_cf(gr_unittest.TestCase):
op.set_freq_range(fl2, fh2)
lo = op.freq_low()
hi = op.freq_high()
- f = op.freq()
+ f = op.freq()
self.assertEqual(fl2, lo)
self.assertEqual(fh2, hi)
self.assertEqual(0, f)
@@ -41,7 +42,7 @@ class test_fmdet_cf(gr_unittest.TestCase):
op.set_scale(scale2)
s = op.scale()
b = op.bias()
- eb = 0.5*scale2*(hi + lo) / (hi - lo);
+ eb = 0.5 * scale2 * (hi + lo) / (hi - lo)
self.assertEqual(scale2, s)
self.assertAlmostEqual(eb, b)
@@ -59,9 +60,9 @@ class test_fmdet_cf(gr_unittest.TestCase):
self.tb.run()
result_data = dst.data()[4:N]
- expected_result = (100-4)*[-0.21755,]
+ expected_result = (100 - 4) * [-0.21755, ]
self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4)
+
if __name__ == '__main__':
gr_unittest.run(test_fmdet_cf)
-
diff --git a/gr-analog/python/analog/qa_frequency_modulator.py b/gr-analog/python/analog/qa_frequency_modulator.py
index 8e99b29c1..c967aaee2 100644
--- a/gr-analog/python/analog/qa_frequency_modulator.py
+++ b/gr-analog/python/analog/qa_frequency_modulator.py
@@ -13,8 +13,9 @@ import math
from gnuradio import gr, gr_unittest, analog, blocks
+
def sincos(x):
- return math.cos(x) + math.sin(x) * 1j
+ return math.cos(x) + math.sin(x) * 1j
class test_frequency_modulator(gr_unittest.TestCase):
@@ -29,7 +30,7 @@ class test_frequency_modulator(gr_unittest.TestCase):
pi = math.pi
sensitivity = pi / 4
src_data = (1.0 / 4, 1.0 / 2, 1.0 / 4, -1.0 / 4, -1.0 / 2, -1 / 4.0)
- running_sum = (pi / 16, 3*pi/16, pi / 4, 3*pi/16, pi / 16, 0)
+ running_sum = (pi / 16, 3 * pi / 16, pi / 4, 3 * pi / 16, pi / 16, 0)
expected_result = tuple([sincos(x) for x in running_sum])
src = blocks.vector_source_f(src_data)
op = analog.frequency_modulator_fc(sensitivity)
@@ -40,6 +41,6 @@ class test_frequency_modulator(gr_unittest.TestCase):
result_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5)
+
if __name__ == '__main__':
gr_unittest.run(test_frequency_modulator)
-
diff --git a/gr-analog/python/analog/qa_noise.py b/gr-analog/python/analog/qa_noise.py
index dbdce9b35..97a5c5cc4 100644
--- a/gr-analog/python/analog/qa_noise.py
+++ b/gr-analog/python/analog/qa_noise.py
@@ -11,12 +11,13 @@
from gnuradio import gr, gr_unittest, analog
+
class test_noise_source(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def test_001(self):
@@ -37,4 +38,3 @@ class test_noise_source(gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_noise_source)
-
diff --git a/gr-analog/python/analog/qa_phase_modulator.py b/gr-analog/python/analog/qa_phase_modulator.py
index 305b6ee66..abf079d9f 100644
--- a/gr-analog/python/analog/qa_phase_modulator.py
+++ b/gr-analog/python/analog/qa_phase_modulator.py
@@ -13,8 +13,9 @@ import math
from gnuradio import gr, gr_unittest, analog, blocks
+
def sincos(x):
- return math.cos(x) + math.sin(x) * 1j
+ return math.cos(x) + math.sin(x) * 1j
class test_phase_modulator(gr_unittest.TestCase):
@@ -29,7 +30,7 @@ class test_phase_modulator(gr_unittest.TestCase):
pi = math.pi
sensitivity = pi / 4
src_data = (1.0 / 4, 1.0 / 2, 1.0 / 4, -1.0 / 4, -1.0 / 2, -1 / 4.0)
- expected_result = tuple([sincos(sensitivity*x) for x in src_data])
+ expected_result = tuple([sincos(sensitivity * x) for x in src_data])
src = blocks.vector_source_f(src_data)
op = analog.phase_modulator_fc(sensitivity)
@@ -42,6 +43,6 @@ class test_phase_modulator(gr_unittest.TestCase):
result_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5)
+
if __name__ == '__main__':
gr_unittest.run(test_phase_modulator)
-
diff --git a/gr-analog/python/analog/qa_pll_carriertracking.py b/gr-analog/python/analog/qa_pll_carriertracking.py
index 5406e3470..b83510088 100644
--- a/gr-analog/python/analog/qa_pll_carriertracking.py
+++ b/gr-analog/python/analog/qa_pll_carriertracking.py
@@ -13,115 +13,116 @@ import math
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_pll_carriertracking(gr_unittest.TestCase):
- def setUp (self):
+ def setUp(self):
self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def test_pll_carriertracking(self):
- expected_result = ((1.000002384185791+7.219194575469601e-09j),
- (0.9980257153511047+0.06279045343399048j),
- (0.992796003818512+0.11979719996452332j),
- (0.9852395057678223+0.17117266356945038j),
- (0.9761406779289246+0.2171468883752823j),
- (0.9661445617675781+0.25799843668937683j),
- (0.9557913541793823+0.29403796792030334j),
- (0.9455097317695618+0.3255884349346161j),
- (0.935634434223175+0.35297322273254395j),
- (0.9264140129089355+0.37650591135025024j),
- (0.918036699295044+0.3964899182319641j),
- (0.9106329679489136+0.4132115840911865j),
- (0.9042812585830688+0.42693787813186646j),
- (0.899017333984375+0.4379141628742218j),
- (0.89484703540802+0.4463684558868408j),
- (0.891755223274231+0.45251286029815674j),
- (0.8897027969360352+0.4565400779247284j),
- (0.8886303901672363+0.45862627029418945j),
- (0.8884686827659607+0.4589335024356842j),
- (0.8891477584838867+0.4576151967048645j),
- (0.8905870318412781+0.4548112750053406j),
- (0.8927018642425537+0.4506511092185974j),
- (0.8954030275344849+0.4452534019947052j),
- (0.898613452911377+0.43873584270477295j),
- (0.9022520780563354+0.4312065541744232j),
- (0.9062415361404419+0.42276597023010254j),
- (0.9104995131492615+0.4135076403617859j),
- (0.9149653315544128+0.4035266935825348j),
- (0.9195748567581177+0.3929111361503601j),
- (0.9242699146270752+0.3817441761493683j),
- (0.9289909601211548+0.37010061740875244j),
- (0.9336962103843689+0.3580598831176758j),
- (0.9383456707000732+0.3456934690475464j),
- (0.9429033994674683+0.3330692648887634j),
- (0.9473329186439514+0.3202497363090515j),
- (0.9516113996505737+0.3072968125343323j),
- (0.9557210206985474+0.2942683696746826j),
- (0.9596443772315979+0.2812172472476959j),
- (0.963365912437439+0.2681918740272522j),
- (0.9668760299682617+0.2552390694618225j),
- (0.9701738357543945+0.24240154027938843j),
- (0.9732568264007568+0.22971850633621216j),
- (0.9761228561401367+0.21722495555877686j),
- (0.9787704944610596+0.20495179295539856j),
- (0.9812103509902954+0.1929289996623993j),
- (0.98344886302948+0.18118229508399963j),
- (0.9854917526245117+0.1697331666946411j),
- (0.9873413443565369+0.1586003601551056j),
- (0.989014744758606+0.147801473736763j),
- (0.9905213713645935+0.1373506784439087j),
- (0.9918720126152039+0.12725868821144104j),
- (0.9930678606033325+0.1175333634018898j),
- (0.9941287040710449+0.10818269848823547j),
- (0.9950648546218872+0.0992119163274765j),
- (0.995887041091919+0.09062285721302032j),
- (0.9965973496437073+0.08241605758666992j),
- (0.9972119927406311+0.07459107041358948j),
- (0.997741162776947+0.06714606285095215j),
- (0.9981945753097534+0.06007742881774902j),
- (0.9985741376876831+0.05337977409362793j),
- (0.9988903999328613+0.04704824090003967j),
- (0.9991542100906372+0.04107558727264404j),
- (0.9993717074394226+0.03545379638671875j),
- (0.9995449185371399+0.03017553687095642j),
- (0.9996798634529114+0.025230854749679565j),
- (0.999785304069519+0.02061113715171814j),
- (0.9998669624328613+0.01630493998527527j),
- (0.9999253749847412+0.012303531169891357j),
- (0.999961256980896+0.008596181869506836j),
- (0.9999842047691345+0.005170613527297974j),
- (0.9999972581863403+0.0020167529582977295j),
- (1.0000011920928955-0.0008766651153564453j),
- (0.9999923706054688-0.0035211145877838135j),
- (0.999980092048645-0.00592736154794693j),
- (0.9999660849571228-0.008106544613838196j),
- (0.9999516606330872-0.010069712996482849j),
- (0.9999289512634277-0.011828280985355377j),
- (0.9999079704284668-0.013392657041549683j),
- (0.9998894333839417-0.01477348804473877j),
- (0.9998739957809448-0.015980780124664307j),
- (0.9998545050621033-0.017024904489517212j),
- (0.9998371601104736-0.017916440963745117j),
- (0.9998237490653992-0.01866436004638672j),
- (0.999815046787262-0.01927858591079712j),
- (0.9998044967651367-0.019767403602600098j),
- (0.9997949600219727-0.020140081644058228j),
- (0.9997900128364563-0.020405471324920654j),
- (0.9997888207435608-0.020570307970046997j),
- (0.9997872114181519-0.020643681287765503j),
- (0.9997851848602295-0.020633310079574585j),
- (0.9997866153717041-0.020545780658721924j),
- (0.9997920989990234-0.020388543605804443j),
- (0.9997975826263428-0.02016708254814148j),
- (0.9998003840446472-0.019888341426849365j),
- (0.99980628490448-0.019558459520339966j),
- (0.9998152256011963-0.019182950258255005j),
- (0.9998254179954529-0.01876668632030487j),
- (0.9998309016227722-0.01831553876399994j),
- (0.999838650226593-0.017833217978477478j),
- (0.9998488426208496-0.017324130982160568j))
+ expected_result = ((1.000002384185791 + 7.219194575469601e-09j),
+ (0.9980257153511047 + 0.06279045343399048j),
+ (0.992796003818512 + 0.11979719996452332j),
+ (0.9852395057678223 + 0.17117266356945038j),
+ (0.9761406779289246 + 0.2171468883752823j),
+ (0.9661445617675781 + 0.25799843668937683j),
+ (0.9557913541793823 + 0.29403796792030334j),
+ (0.9455097317695618 + 0.3255884349346161j),
+ (0.935634434223175 + 0.35297322273254395j),
+ (0.9264140129089355 + 0.37650591135025024j),
+ (0.918036699295044 + 0.3964899182319641j),
+ (0.9106329679489136 + 0.4132115840911865j),
+ (0.9042812585830688 + 0.42693787813186646j),
+ (0.899017333984375 + 0.4379141628742218j),
+ (0.89484703540802 + 0.4463684558868408j),
+ (0.891755223274231 + 0.45251286029815674j),
+ (0.8897027969360352 + 0.4565400779247284j),
+ (0.8886303901672363 + 0.45862627029418945j),
+ (0.8884686827659607 + 0.4589335024356842j),
+ (0.8891477584838867 + 0.4576151967048645j),
+ (0.8905870318412781 + 0.4548112750053406j),
+ (0.8927018642425537 + 0.4506511092185974j),
+ (0.8954030275344849 + 0.4452534019947052j),
+ (0.898613452911377 + 0.43873584270477295j),
+ (0.9022520780563354 + 0.4312065541744232j),
+ (0.9062415361404419 + 0.42276597023010254j),
+ (0.9104995131492615 + 0.4135076403617859j),
+ (0.9149653315544128 + 0.4035266935825348j),
+ (0.9195748567581177 + 0.3929111361503601j),
+ (0.9242699146270752 + 0.3817441761493683j),
+ (0.9289909601211548 + 0.37010061740875244j),
+ (0.9336962103843689 + 0.3580598831176758j),
+ (0.9383456707000732 + 0.3456934690475464j),
+ (0.9429033994674683 + 0.3330692648887634j),
+ (0.9473329186439514 + 0.3202497363090515j),
+ (0.9516113996505737 + 0.3072968125343323j),
+ (0.9557210206985474 + 0.2942683696746826j),
+ (0.9596443772315979 + 0.2812172472476959j),
+ (0.963365912437439 + 0.2681918740272522j),
+ (0.9668760299682617 + 0.2552390694618225j),
+ (0.9701738357543945 + 0.24240154027938843j),
+ (0.9732568264007568 + 0.22971850633621216j),
+ (0.9761228561401367 + 0.21722495555877686j),
+ (0.9787704944610596 + 0.20495179295539856j),
+ (0.9812103509902954 + 0.1929289996623993j),
+ (0.98344886302948 + 0.18118229508399963j),
+ (0.9854917526245117 + 0.1697331666946411j),
+ (0.9873413443565369 + 0.1586003601551056j),
+ (0.989014744758606 + 0.147801473736763j),
+ (0.9905213713645935 + 0.1373506784439087j),
+ (0.9918720126152039 + 0.12725868821144104j),
+ (0.9930678606033325 + 0.1175333634018898j),
+ (0.9941287040710449 + 0.10818269848823547j),
+ (0.9950648546218872 + 0.0992119163274765j),
+ (0.995887041091919 + 0.09062285721302032j),
+ (0.9965973496437073 + 0.08241605758666992j),
+ (0.9972119927406311 + 0.07459107041358948j),
+ (0.997741162776947 + 0.06714606285095215j),
+ (0.9981945753097534 + 0.06007742881774902j),
+ (0.9985741376876831 + 0.05337977409362793j),
+ (0.9988903999328613 + 0.04704824090003967j),
+ (0.9991542100906372 + 0.04107558727264404j),
+ (0.9993717074394226 + 0.03545379638671875j),
+ (0.9995449185371399 + 0.03017553687095642j),
+ (0.9996798634529114 + 0.025230854749679565j),
+ (0.999785304069519 + 0.02061113715171814j),
+ (0.9998669624328613 + 0.01630493998527527j),
+ (0.9999253749847412 + 0.012303531169891357j),
+ (0.999961256980896 + 0.008596181869506836j),
+ (0.9999842047691345 + 0.005170613527297974j),
+ (0.9999972581863403 + 0.0020167529582977295j),
+ (1.0000011920928955 - 0.0008766651153564453j),
+ (0.9999923706054688 - 0.0035211145877838135j),
+ (0.999980092048645 - 0.00592736154794693j),
+ (0.9999660849571228 - 0.008106544613838196j),
+ (0.9999516606330872 - 0.010069712996482849j),
+ (0.9999289512634277 - 0.011828280985355377j),
+ (0.9999079704284668 - 0.013392657041549683j),
+ (0.9998894333839417 - 0.01477348804473877j),
+ (0.9998739957809448 - 0.015980780124664307j),
+ (0.9998545050621033 - 0.017024904489517212j),
+ (0.9998371601104736 - 0.017916440963745117j),
+ (0.9998237490653992 - 0.01866436004638672j),
+ (0.999815046787262 - 0.01927858591079712j),
+ (0.9998044967651367 - 0.019767403602600098j),
+ (0.9997949600219727 - 0.020140081644058228j),
+ (0.9997900128364563 - 0.020405471324920654j),
+ (0.9997888207435608 - 0.020570307970046997j),
+ (0.9997872114181519 - 0.020643681287765503j),
+ (0.9997851848602295 - 0.020633310079574585j),
+ (0.9997866153717041 - 0.020545780658721924j),
+ (0.9997920989990234 - 0.020388543605804443j),
+ (0.9997975826263428 - 0.02016708254814148j),
+ (0.9998003840446472 - 0.019888341426849365j),
+ (0.99980628490448 - 0.019558459520339966j),
+ (0.9998152256011963 - 0.019182950258255005j),
+ (0.9998254179954529 - 0.01876668632030487j),
+ (0.9998309016227722 - 0.01831553876399994j),
+ (0.999838650226593 - 0.017833217978477478j),
+ (0.9998488426208496 - 0.017324130982160568j))
sampling_freq = 10e3
freq = sampling_freq / 100
@@ -132,7 +133,7 @@ class test_pll_carriertracking(gr_unittest.TestCase):
src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0)
pll = analog.pll_carriertracking_cc(loop_bw, maxf, minf)
- head = blocks.head(gr.sizeof_gr_complex, int (freq))
+ head = blocks.head(gr.sizeof_gr_complex, int(freq))
dst = blocks.vector_sink_c()
self.tb.connect(src, pll, head)
@@ -142,5 +143,6 @@ class test_pll_carriertracking(gr_unittest.TestCase):
dst_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
+
if __name__ == '__main__':
gr_unittest.run(test_pll_carriertracking)
diff --git a/gr-analog/python/analog/qa_pll_freqdet.py b/gr-analog/python/analog/qa_pll_freqdet.py
index 12909e771..e77f85656 100644
--- a/gr-analog/python/analog/qa_pll_freqdet.py
+++ b/gr-analog/python/analog/qa_pll_freqdet.py
@@ -13,115 +13,116 @@ import math
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_pll_freqdet(gr_unittest.TestCase):
- def setUp (self):
+ def setUp(self):
self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def test_pll_freqdet(self):
expected_result = (0.0,
- 4.338889228818161e-08,
- 0.3776331578612825,
- 1.0993741049896133,
- 2.1332509128284287,
- 3.448827166947317,
- 5.017193050406445,
- 6.810936277840595,
- 8.804128662605573,
- 10.972292025122194,
- 13.292363360097312,
- 15.742678902380248,
- 18.302902979158944,
- 20.954030233328815,
- 23.678333003762834,
- 26.459293141999492,
- 29.2815901542755,
- 32.13105969864019,
- 34.99462836613535,
- 37.860284035876894,
- 40.71702547869386,
- 43.5548208542428,
- 46.364569172614004,
- 49.138038040003174,
- 51.86783994277676,
- 54.547378886619114,
- 57.17080592915505,
- 59.73298657053974,
- 62.229444428114014,
- 64.65634937843706,
- 67.01044048049889,
- 69.28902004673668,
- 71.48990028218192,
- 73.61137363954212,
- 75.65217724529884,
- 77.61146325478951,
- 79.48876920728905,
- 81.28396466515709,
- 82.9972452848542,
- 84.62912095897468,
- 86.18033873945902,
- 87.65188876657749,
- 89.0449983399466,
- 90.36106669970881,
- 91.6016768844999,
- 92.76854829957963,
- 93.86354857479924,
- 94.88865206171563,
- 95.84592204664062,
- 96.73751075064077,
- 97.56564154258655,
- 98.33257336525031,
- 99.04061259327368,
- 99.69208931723288,
- 100.28935141465512,
- 100.83475862103487,
- 101.33065881389933,
- 101.77937615484109,
- 102.18323480545271,
- 102.54452335342484,
- 102.8654948125462,
- 103.14836662270359,
- 103.39530879191456,
- 103.6084320383601,
- 103.78982336428665,
- 103.94148676616939,
- 104.06536695064705,
- 104.16337305045634,
- 104.23733119256288,
- 104.28900821409572,
- 104.32008794641274,
- 104.33220678900258,
- 104.32694185151738,
- 104.30578723783803,
- 104.27016590404165,
- 104.22144151636876,
- 104.16091845122337,
- 104.08982993720561,
- 104.00932619714447,
- 103.9205337379343,
- 103.82447234476369,
- 103.72213808688659,
- 103.6144440277858,
- 103.50225579907487,
- 103.38636788456353,
- 103.26755105212685,
- 103.14649306386876,
- 103.02383425002395,
- 102.90019122489248,
- 102.7761213129379,
- 102.65211069081985,
- 102.5286218192634,
- 102.40608158509168,
- 102.28486944325857,
- 102.16532927481605,
- 102.04778124488143,
- 101.93248622873554,
- 101.81969324369186,
- 101.70961573316195,
- 101.60243156665544)
+ 4.338889228818161e-08,
+ 0.3776331578612825,
+ 1.0993741049896133,
+ 2.1332509128284287,
+ 3.448827166947317,
+ 5.017193050406445,
+ 6.810936277840595,
+ 8.804128662605573,
+ 10.972292025122194,
+ 13.292363360097312,
+ 15.742678902380248,
+ 18.302902979158944,
+ 20.954030233328815,
+ 23.678333003762834,
+ 26.459293141999492,
+ 29.2815901542755,
+ 32.13105969864019,
+ 34.99462836613535,
+ 37.860284035876894,
+ 40.71702547869386,
+ 43.5548208542428,
+ 46.364569172614004,
+ 49.138038040003174,
+ 51.86783994277676,
+ 54.547378886619114,
+ 57.17080592915505,
+ 59.73298657053974,
+ 62.229444428114014,
+ 64.65634937843706,
+ 67.01044048049889,
+ 69.28902004673668,
+ 71.48990028218192,
+ 73.61137363954212,
+ 75.65217724529884,
+ 77.61146325478951,
+ 79.48876920728905,
+ 81.28396466515709,
+ 82.9972452848542,
+ 84.62912095897468,
+ 86.18033873945902,
+ 87.65188876657749,
+ 89.0449983399466,
+ 90.36106669970881,
+ 91.6016768844999,
+ 92.76854829957963,
+ 93.86354857479924,
+ 94.88865206171563,
+ 95.84592204664062,
+ 96.73751075064077,
+ 97.56564154258655,
+ 98.33257336525031,
+ 99.04061259327368,
+ 99.69208931723288,
+ 100.28935141465512,
+ 100.83475862103487,
+ 101.33065881389933,
+ 101.77937615484109,
+ 102.18323480545271,
+ 102.54452335342484,
+ 102.8654948125462,
+ 103.14836662270359,
+ 103.39530879191456,
+ 103.6084320383601,
+ 103.78982336428665,
+ 103.94148676616939,
+ 104.06536695064705,
+ 104.16337305045634,
+ 104.23733119256288,
+ 104.28900821409572,
+ 104.32008794641274,
+ 104.33220678900258,
+ 104.32694185151738,
+ 104.30578723783803,
+ 104.27016590404165,
+ 104.22144151636876,
+ 104.16091845122337,
+ 104.08982993720561,
+ 104.00932619714447,
+ 103.9205337379343,
+ 103.82447234476369,
+ 103.72213808688659,
+ 103.6144440277858,
+ 103.50225579907487,
+ 103.38636788456353,
+ 103.26755105212685,
+ 103.14649306386876,
+ 103.02383425002395,
+ 102.90019122489248,
+ 102.7761213129379,
+ 102.65211069081985,
+ 102.5286218192634,
+ 102.40608158509168,
+ 102.28486944325857,
+ 102.16532927481605,
+ 102.04778124488143,
+ 101.93248622873554,
+ 101.81969324369186,
+ 101.70961573316195,
+ 101.60243156665544)
sampling_freq = 10e3
freq = sampling_freq / 100
@@ -132,7 +133,7 @@ class test_pll_freqdet(gr_unittest.TestCase):
src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0)
pll = analog.pll_freqdet_cf(loop_bw, maxf, minf)
- head = blocks.head(gr.sizeof_float, int (freq))
+ head = blocks.head(gr.sizeof_float, int(freq))
dst = blocks.vector_sink_f()
self.tb.connect(src, pll, head)
@@ -142,9 +143,10 @@ class test_pll_freqdet(gr_unittest.TestCase):
dst_data = dst.data()
# convert it from normalized frequency to absolute frequency (Hz)
- dst_data = [i*(sampling_freq / (2*math.pi)) for i in dst_data]
+ dst_data = [i * (sampling_freq / (2 * math.pi)) for i in dst_data]
self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 3)
+
if __name__ == '__main__':
gr_unittest.run(test_pll_freqdet)
diff --git a/gr-analog/python/analog/qa_pll_refout.py b/gr-analog/python/analog/qa_pll_refout.py
index 872043261..0a2ec724c 100644
--- a/gr-analog/python/analog/qa_pll_refout.py
+++ b/gr-analog/python/analog/qa_pll_refout.py
@@ -13,6 +13,7 @@ import math
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_pll_refout(gr_unittest.TestCase):
def setUp(self):
@@ -22,106 +23,106 @@ class test_pll_refout(gr_unittest.TestCase):
self.tb = None
def test_pll_refout(self):
- expected_result = ((1+0j),
- (1+6.408735764296125e-10j),
- (0.9999844431877136+0.005577784031629562j),
- (0.9998642802238464+0.016474783420562744j),
- (0.9994739890098572+0.032431427389383316j),
- (0.9985847473144531+0.05318402871489525j),
- (0.996917188167572+0.07846084982156754j),
- (0.9941533207893372+0.10797744989395142j),
- (0.9899479150772095+0.14143235981464386j),
- (0.9839394092559814+0.1785029172897339j),
- (0.9757603406906128+0.2188417762517929j),
- (0.9650475978851318+0.26207470893859863j),
- (0.9514514803886414+0.30779871344566345j),
- (0.9346449971199036+0.35558223724365234j),
- (0.9143316149711609+0.40496626496315j),
- (0.8902531862258911+0.4554659426212311j),
- (0.8621962666511536+0.5065743923187256j),
- (0.8299974799156189+0.5577671527862549j),
- (0.7935484647750854+0.6085070967674255j),
- (0.7527987360954285+0.6582507491111755j),
- (0.7077582478523254+0.7064547538757324j),
- (0.6584978699684143+0.7525825500488281j),
- (0.6051493883132935+0.7961119413375854j),
- (0.547903835773468+0.8365413546562195j),
- (0.48700881004333496+0.8733970522880554j),
- (0.42276495695114136+0.90623939037323j),
- (0.35552138090133667+0.9346681237220764j),
- (0.2856702208518982+0.9583280086517334j),
- (0.21364101767539978+0.976912260055542j),
- (0.13989387452602386+0.9901664853096008j),
- (0.06491273641586304+0.9978909492492676j),
- (-0.01080091018229723+0.9999416470527649j),
- (-0.08673560619354248+0.9962313771247864j),
- (-0.16237612068653107+0.9867289662361145j),
- (-0.23721040785312653+0.9714583158493042j),
- (-0.3107353150844574+0.95049649477005j),
- (-0.3824624717235565+0.9239710569381714j),
- (-0.45192304253578186+0.892056941986084j),
- (-0.5186731219291687+0.8549726009368896j),
- (-0.5822963714599609+0.812976598739624j),
- (-0.6424083709716797+0.7663624882698059j),
- (-0.6986585855484009+0.7154552340507507j),
- (-0.7507330775260925+0.6606056690216064j),
- (-0.7983550429344177+0.6021870970726013j),
- (-0.841286301612854+0.5405898094177246j),
- (-0.879327654838562+0.47621726989746094j),
- (-0.912318229675293+0.4094819128513336j),
- (-0.9401354789733887+0.340800940990448j),
- (-0.9626938104629517+0.27059316635131836j),
- (-0.979943573474884+0.1992751508951187j),
- (-0.9918696284294128+0.12725839018821716j),
- (-0.9984893202781677+0.054946307092905045j),
- (-0.9998509287834167-0.017267409712076187j),
- (-0.9960314631462097-0.08900183439254761j),
- (-0.9871346950531006-0.1598907858133316j),
- (-0.9732890129089355-0.2295832633972168j),
- (-0.9546451568603516-0.29774588346481323j),
- (-0.9313743710517883-0.3640628457069397j),
- (-0.9036663174629211-0.42823725938796997j),
- (-0.8717266321182251-0.48999255895614624j),
- (-0.8357754945755005-0.5490713119506836j),
- (-0.7960456013679504-0.6052366495132446j),
- (-0.7527803182601929-0.658271849155426j),
- (-0.706232488155365-0.7079799771308899j),
- (-0.6566619873046875-0.7541850209236145j),
- (-0.6043350696563721-0.7967302799224854j),
- (-0.5495226979255676-0.8354787826538086j),
- (-0.4924990236759186-0.8703129887580872j),
- (-0.4335414469242096-0.9011335968971252j),
- (-0.3729270100593567-0.927860677242279j),
- (-0.3109343349933624-0.9504314064979553j),
- (-0.2478405237197876-0.9688008427619934j),
- (-0.18392162024974823-0.9829409122467041j),
- (-0.11945075541734695-0.9928401112556458j),
- (-0.05469784513115883-0.9985029697418213j),
- (0.010069688782095909-0.9999492764472961j),
- (0.07459097355604172-0.9972141981124878j),
- (0.13860897719860077-0.9903472065925598j),
- (0.2018725872039795-0.979411780834198j),
- (0.2641367018222809-0.964485228061676j),
- (0.32516375184059143-0.9456577301025391j),
- (0.3847236633300781-0.9230318069458008j),
- (0.44259318709373474-0.8967224955558777j),
- (0.49855801463127136-0.8668563365936279j),
- (0.5524120926856995-0.8335711359977722j),
- (0.6039596796035767-0.7970148921012878j),
- (0.6530137062072754-0.7573460936546326j),
- (0.6993972063064575-0.7147331833839417j),
- (0.7429447770118713-0.6693527102470398j),
- (0.7835012078285217-0.6213902235031128j),
- (0.8209227919578552-0.5710391998291016j),
- (0.8550769090652466-0.5185011625289917j),
- (0.8858439326286316-0.46398329734802246j),
- (0.9131162166595459-0.4076994061470032j),
- (0.936798632144928-0.3498689830303192j),
- (0.956809401512146-0.2907160222530365j),
- (0.9730796813964844-0.23046888411045074j),
- (0.9855544567108154-0.16935895383358002j),
- (0.9941920042037964-0.10762103646993637j),
- (0.9989647269248962-0.045491550117731094j))
+ expected_result = ((1 + 0j),
+ (1 + 6.408735764296125e-10j),
+ (0.9999844431877136 + 0.005577784031629562j),
+ (0.9998642802238464 + 0.016474783420562744j),
+ (0.9994739890098572 + 0.032431427389383316j),
+ (0.9985847473144531 + 0.05318402871489525j),
+ (0.996917188167572 + 0.07846084982156754j),
+ (0.9941533207893372 + 0.10797744989395142j),
+ (0.9899479150772095 + 0.14143235981464386j),
+ (0.9839394092559814 + 0.1785029172897339j),
+ (0.9757603406906128 + 0.2188417762517929j),
+ (0.9650475978851318 + 0.26207470893859863j),
+ (0.9514514803886414 + 0.30779871344566345j),
+ (0.9346449971199036 + 0.35558223724365234j),
+ (0.9143316149711609 + 0.40496626496315j),
+ (0.8902531862258911 + 0.4554659426212311j),
+ (0.8621962666511536 + 0.5065743923187256j),
+ (0.8299974799156189 + 0.5577671527862549j),
+ (0.7935484647750854 + 0.6085070967674255j),
+ (0.7527987360954285 + 0.6582507491111755j),
+ (0.7077582478523254 + 0.7064547538757324j),
+ (0.6584978699684143 + 0.7525825500488281j),
+ (0.6051493883132935 + 0.7961119413375854j),
+ (0.547903835773468 + 0.8365413546562195j),
+ (0.48700881004333496 + 0.8733970522880554j),
+ (0.42276495695114136 + 0.90623939037323j),
+ (0.35552138090133667 + 0.9346681237220764j),
+ (0.2856702208518982 + 0.9583280086517334j),
+ (0.21364101767539978 + 0.976912260055542j),
+ (0.13989387452602386 + 0.9901664853096008j),
+ (0.06491273641586304 + 0.9978909492492676j),
+ (-0.01080091018229723 + 0.9999416470527649j),
+ (-0.08673560619354248 + 0.9962313771247864j),
+ (-0.16237612068653107 + 0.9867289662361145j),
+ (-0.23721040785312653 + 0.9714583158493042j),
+ (-0.3107353150844574 + 0.95049649477005j),
+ (-0.3824624717235565 + 0.9239710569381714j),
+ (-0.45192304253578186 + 0.892056941986084j),
+ (-0.5186731219291687 + 0.8549726009368896j),
+ (-0.5822963714599609 + 0.812976598739624j),
+ (-0.6424083709716797 + 0.7663624882698059j),
+ (-0.6986585855484009 + 0.7154552340507507j),
+ (-0.7507330775260925 + 0.6606056690216064j),
+ (-0.7983550429344177 + 0.6021870970726013j),
+ (-0.841286301612854 + 0.5405898094177246j),
+ (-0.879327654838562 + 0.47621726989746094j),
+ (-0.912318229675293 + 0.4094819128513336j),
+ (-0.9401354789733887 + 0.340800940990448j),
+ (-0.9626938104629517 + 0.27059316635131836j),
+ (-0.979943573474884 + 0.1992751508951187j),
+ (-0.9918696284294128 + 0.12725839018821716j),
+ (-0.9984893202781677 + 0.054946307092905045j),
+ (-0.9998509287834167 - 0.017267409712076187j),
+ (-0.9960314631462097 - 0.08900183439254761j),
+ (-0.9871346950531006 - 0.1598907858133316j),
+ (-0.9732890129089355 - 0.2295832633972168j),
+ (-0.9546451568603516 - 0.29774588346481323j),
+ (-0.9313743710517883 - 0.3640628457069397j),
+ (-0.9036663174629211 - 0.42823725938796997j),
+ (-0.8717266321182251 - 0.48999255895614624j),
+ (-0.8357754945755005 - 0.5490713119506836j),
+ (-0.7960456013679504 - 0.6052366495132446j),
+ (-0.7527803182601929 - 0.658271849155426j),
+ (-0.706232488155365 - 0.7079799771308899j),
+ (-0.6566619873046875 - 0.7541850209236145j),
+ (-0.6043350696563721 - 0.7967302799224854j),
+ (-0.5495226979255676 - 0.8354787826538086j),
+ (-0.4924990236759186 - 0.8703129887580872j),
+ (-0.4335414469242096 - 0.9011335968971252j),
+ (-0.3729270100593567 - 0.927860677242279j),
+ (-0.3109343349933624 - 0.9504314064979553j),
+ (-0.2478405237197876 - 0.9688008427619934j),
+ (-0.18392162024974823 - 0.9829409122467041j),
+ (-0.11945075541734695 - 0.9928401112556458j),
+ (-0.05469784513115883 - 0.9985029697418213j),
+ (0.010069688782095909 - 0.9999492764472961j),
+ (0.07459097355604172 - 0.9972141981124878j),
+ (0.13860897719860077 - 0.9903472065925598j),
+ (0.2018725872039795 - 0.979411780834198j),
+ (0.2641367018222809 - 0.964485228061676j),
+ (0.32516375184059143 - 0.9456577301025391j),
+ (0.3847236633300781 - 0.9230318069458008j),
+ (0.44259318709373474 - 0.8967224955558777j),
+ (0.49855801463127136 - 0.8668563365936279j),
+ (0.5524120926856995 - 0.8335711359977722j),
+ (0.6039596796035767 - 0.7970148921012878j),
+ (0.6530137062072754 - 0.7573460936546326j),
+ (0.6993972063064575 - 0.7147331833839417j),
+ (0.7429447770118713 - 0.6693527102470398j),
+ (0.7835012078285217 - 0.6213902235031128j),
+ (0.8209227919578552 - 0.5710391998291016j),
+ (0.8550769090652466 - 0.5185011625289917j),
+ (0.8858439326286316 - 0.46398329734802246j),
+ (0.9131162166595459 - 0.4076994061470032j),
+ (0.936798632144928 - 0.3498689830303192j),
+ (0.956809401512146 - 0.2907160222530365j),
+ (0.9730796813964844 - 0.23046888411045074j),
+ (0.9855544567108154 - 0.16935895383358002j),
+ (0.9941920042037964 - 0.10762103646993637j),
+ (0.9989647269248962 - 0.045491550117731094j))
sampling_freq = 10e3
freq = sampling_freq / 100
@@ -132,7 +133,7 @@ class test_pll_refout(gr_unittest.TestCase):
src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0)
pll = analog.pll_refout_cc(loop_bw, maxf, minf)
- head = blocks.head(gr.sizeof_gr_complex, int (freq))
+ head = blocks.head(gr.sizeof_gr_complex, int(freq))
dst = blocks.vector_sink_c()
self.tb.connect(src, pll, head)
@@ -142,5 +143,6 @@ class test_pll_refout(gr_unittest.TestCase):
dst_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4)
+
if __name__ == '__main__':
gr_unittest.run(test_pll_refout)
diff --git a/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py b/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
index cc2bc4909..721b9a6f6 100644
--- a/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
+++ b/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
@@ -13,20 +13,24 @@ import math
from gnuradio import gr, gr_unittest, analog, blocks
+
def avg_mag_sqrd_c(x, alpha):
- y = [0,]
+ y = [0, ]
for xi in x:
- tmp = alpha*(xi.real*xi.real + xi.imag*xi.imag) + (1-alpha)*y[-1]
+ tmp = alpha * (xi.real * xi.real + xi.imag *
+ xi.imag) + (1 - alpha) * y[-1]
y.append(tmp)
return y
+
def avg_mag_sqrd_f(x, alpha):
- y = [0,]
+ y = [0, ]
for xi in x:
- tmp = alpha*(xi*xi) + (1-alpha)*y[-1]
+ tmp = alpha * (xi * xi) + (1 - alpha) * y[-1]
y.append(tmp)
return y
+
class test_probe_avg_mag_sqrd(gr_unittest.TestCase):
def setUp(self):
@@ -37,8 +41,17 @@ class test_probe_avg_mag_sqrd(gr_unittest.TestCase):
def test_c_001(self):
alpha = 0.0001
- src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j,
- 6.0+6.0j, 7.0+7.0j, 8.0+8.0j, 9.0+9.0j, 10.0+10.0j]
+ src_data = [
+ 1.0 + 1.0j,
+ 2.0 + 2.0j,
+ 3.0 + 3.0j,
+ 4.0 + 4.0j,
+ 5.0 + 5.0j,
+ 6.0 + 6.0j,
+ 7.0 + 7.0j,
+ 8.0 + 8.0j,
+ 9.0 + 9.0j,
+ 10.0 + 10.0j]
expected_result = avg_mag_sqrd_c(src_data, alpha)[-1]
src = blocks.vector_source_c(src_data)
@@ -52,8 +65,17 @@ class test_probe_avg_mag_sqrd(gr_unittest.TestCase):
def test_cf_002(self):
alpha = 0.0001
- src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j,
- 6.0+6.0j, 7.0+7.0j, 8.0+8.0j, 9.0+9.0j, 10.0+10.0j]
+ src_data = [
+ 1.0 + 1.0j,
+ 2.0 + 2.0j,
+ 3.0 + 3.0j,
+ 4.0 + 4.0j,
+ 5.0 + 5.0j,
+ 6.0 + 6.0j,
+ 7.0 + 7.0j,
+ 8.0 + 8.0j,
+ 9.0 + 9.0j,
+ 10.0 + 10.0j]
expected_result = avg_mag_sqrd_c(src_data, alpha)[0:-1]
src = blocks.vector_source_c(src_data)
@@ -82,6 +104,6 @@ class test_probe_avg_mag_sqrd(gr_unittest.TestCase):
result_data = op.level()
self.assertAlmostEqual(expected_result, result_data, 5)
+
if __name__ == '__main__':
gr_unittest.run(test_probe_avg_mag_sqrd)
-
diff --git a/gr-analog/python/analog/qa_pwr_squelch.py b/gr-analog/python/analog/qa_pwr_squelch.py
index 2ef4e9938..81ecd7edd 100644
--- a/gr-analog/python/analog/qa_pwr_squelch.py
+++ b/gr-analog/python/analog/qa_pwr_squelch.py
@@ -11,6 +11,7 @@
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_pwr_squelch(gr_unittest.TestCase):
def setUp(self):
@@ -60,7 +61,7 @@ class test_pwr_squelch(gr_unittest.TestCase):
self.tb.run()
expected_result = src_data
- expected_result[0:20] = 20*[0,]
+ expected_result[0:20] = 20 * [0, ]
result_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4)
@@ -91,7 +92,6 @@ class test_pwr_squelch(gr_unittest.TestCase):
g = op.gate()
self.assertEqual(gate2, g)
-
def test_pwr_squelch_004(self):
alpha = 0.0001
thr = -25
@@ -106,11 +106,11 @@ class test_pwr_squelch(gr_unittest.TestCase):
self.tb.run()
expected_result = src_data
- expected_result[0:20] = 20*[0,]
+ expected_result[0:20] = 20 * [0, ]
result_data = dst.data()
self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4)
+
if __name__ == '__main__':
gr_unittest.run(test_pwr_squelch)
-
diff --git a/gr-analog/python/analog/qa_quadrature_demod.py b/gr-analog/python/analog/qa_quadrature_demod.py
index b44f70049..a3ca92cd1 100644
--- a/gr-analog/python/analog/qa_quadrature_demod.py
+++ b/gr-analog/python/analog/qa_quadrature_demod.py
@@ -13,6 +13,7 @@ import cmath
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_quadrature_demod(gr_unittest.TestCase):
def setUp(self):
@@ -28,13 +29,13 @@ class test_quadrature_demod(gr_unittest.TestCase):
src_data = []
for i in range(200):
ti = i / fs
- src_data.append(cmath.exp(2j*cmath.pi*f*ti))
+ src_data.append(cmath.exp(2j * cmath.pi * f * ti))
# f/fs is a quarter turn per sample.
# Set the gain based on this to get 1 out.
gain = 1.0 / (cmath.pi / 4)
- expected_result = [0,] + 199*[1.0]
+ expected_result = [0, ] + 199 * [1.0]
src = blocks.vector_source_c(src_data)
op = analog.quadrature_demod_cf(gain)
@@ -47,6 +48,6 @@ class test_quadrature_demod(gr_unittest.TestCase):
result_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5)
+
if __name__ == '__main__':
gr_unittest.run(test_quadrature_demod)
-
diff --git a/gr-analog/python/analog/qa_rail_ff.py b/gr-analog/python/analog/qa_rail_ff.py
index e7556188e..43c2d46d7 100644
--- a/gr-analog/python/analog/qa_rail_ff.py
+++ b/gr-analog/python/analog/qa_rail_ff.py
@@ -11,6 +11,7 @@
from gnuradio import gr, gr_unittest, analog, blocks
+
def clip(x, lo, hi):
if(x < lo):
return lo
@@ -19,6 +20,7 @@ def clip(x, lo, hi):
else:
return x
+
class test_rail(gr_unittest.TestCase):
def setUp(self):
@@ -62,6 +64,6 @@ class test_rail(gr_unittest.TestCase):
result_data = dst.data()
self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4)
+
if __name__ == '__main__':
gr_unittest.run(test_rail)
-
diff --git a/gr-analog/python/analog/qa_sig_source.py b/gr-analog/python/analog/qa_sig_source.py
index aafcc2848..977a17d37 100644
--- a/gr-analog/python/analog/qa_sig_source.py
+++ b/gr-analog/python/analog/qa_sig_source.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python
#
-#Copyright 2004, 2007, 2010, 2012, 2013, 2020 Free Software Foundation, Inc.
+# Copyright 2004, 2007, 2010, 2012, 2013, 2020 Free Software Foundation, Inc.
#
-#This file is part of GNU Radio
+# This file is part of GNU Radio
#
-#SPDX-License-Identifier: GPL-3.0-or-later
+# SPDX-License-Identifier: GPL-3.0-or-later
#
#
@@ -83,7 +83,7 @@ class test_sig_source(gr_unittest.TestCase):
tb.connect(op, dst1)
tb.run()
dst_data = dst1.data()
- #Let the python know we are dealing with signed int behind scenes
+ # Let the python know we are dealing with signed int behind scenes
dst_data_signed = [b if b < 127 else (256 - b) * -1 for b in dst_data]
self.assertFloatTuplesAlmostEqual(expected_result, dst_data_signed)
@@ -118,7 +118,7 @@ class test_sig_source(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
def test_sqr_c(self):
- tb = self.tb #arg6 is a bit before -PI/2
+ tb = self.tb # arg6 is a bit before -PI/2
expected_result = [1j, 1j, 0, 0, 1, 1, 1 + 0j, 1 + 1j, 1j]
src1 = analog.sig_source_c(8, analog.GR_SQR_WAVE, 1.0, 1.0)
op = blocks.head(gr.sizeof_gr_complex, 9)
diff --git a/gr-analog/python/analog/qa_simple_squelch.py b/gr-analog/python/analog/qa_simple_squelch.py
index a5635eca0..7fa9b7077 100644
--- a/gr-analog/python/analog/qa_simple_squelch.py
+++ b/gr-analog/python/analog/qa_simple_squelch.py
@@ -11,6 +11,7 @@
from gnuradio import gr, gr_unittest, analog, blocks
+
class test_simple_squelch(gr_unittest.TestCase):
def setUp(self):
@@ -47,11 +48,11 @@ class test_simple_squelch(gr_unittest.TestCase):
self.tb.run()
expected_result = src_data
- expected_result[0:20] = 20*[0,]
+ expected_result[0:20] = 20 * [0, ]
result_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4)
+
if __name__ == '__main__':
gr_unittest.run(test_simple_squelch)
-