⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qa_agc.py

📁 这是用python语言写的一个数字广播的信号处理工具包。利用它
💻 PY
📖 第 1 页 / 共 2 页
字号:
                         (-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 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE,                                sampling_freq * 0.10, 100)        dst1 = gr.vector_sink_c ()        head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10))        agc = gr.agc2_cc(1e-2, 1e-3, 1, 1, 1000)                fg.connect (src1, head)        fg.connect (head, agc)        fg.connect (agc, dst1)        if test_output == True:            fg.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat"))        fg.run ()        dst_data = dst1.data ()        self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4)    def test_004(self):        ''' Test the floating point AGC loop (attack and decay rate inputs) '''        fg = self.fg        expected_result = \            (7.2191943445432116e-07,             58.837181091308594,             40.194305419921875,             2.9183335304260254,             0.67606079578399658,             8.6260438791896377e-09,             -1.4542514085769653,             -1.9210131168365479,             -1.0450780391693115,             -0.61939650774002075,             -1.2590258613442984e-08,             1.4308931827545166,             1.9054338932037354,             1.0443156957626343,             0.61937344074249268,             2.0983527804219193e-08,             -1.4308838844299316,             -1.9054274559020996,             -1.0443152189254761,             -0.61937344074249268,             -2.5180233009791664e-08,             1.4308837652206421,             1.9054274559020996,             1.0443154573440552,             0.61937344074249268,             3.3573645197293445e-08,             -1.4308838844299316,             -1.9054274559020996,             -1.0443152189254761,             -0.61937350034713745,             -3.7770352179222755e-08,             1.4308837652206421,             1.9054274559020996,             1.0443154573440552,             0.61937350034713745,             4.6163762590367696e-08,             -1.4308838844299316,             -1.9054274559020996,             -1.0443153381347656,             -0.61937344074249268,             -5.0360466019583328e-08,             1.4308837652206421,             1.9054274559020996,             1.0443155765533447,             0.61937344074249268,             5.8753879983441948e-08,             -1.4308837652206421,             -1.9054274559020996,             -1.0443153381347656,             -0.61937344074249268)        sampling_freq = 100        src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,                                sampling_freq * 0.10, 100)        dst1 = gr.vector_sink_f ()        head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10))        agc = gr.agc2_ff(1e-2, 1e-3, 1, 1, 1000)                fg.connect (src1, head)        fg.connect (head, agc)        fg.connect (agc, dst1)        if test_output == True:            fg.connect (agc, gr.file_sink(gr.sizeof_float, "test_agc2_ff.dat"))        fg.run ()        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) '''        fg = self.fg        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))        sampling_freq = 100        src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE,                                sampling_freq * 0.10, 100)        dst1 = gr.vector_sink_c ()        head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10))        agc = gr.agc2_cc(1e-2, 1e-3, 1, 1, 1000)                fg.connect (src1, head)        fg.connect (head, agc)        fg.connect (agc, dst1)        if test_output == True:            fg.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat"))        fg.run ()        dst_data = dst1.data ()        self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4)    def test_100(self):        # FIXME needs work        ''' Test complex feedforward agc with constant input '''        input_data = 16*(0.0,) + 64*(1.0,) + 64*(0.0,)        expected_result = ()        src = gr.vector_source_c(input_data)        agc = gr.feedforward_agc_cc(16, 2.0)        dst = gr.vector_sink_c ()        self.fg.connect (src, agc, dst)        if test_output == True:            self.fg.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_feedforward_cc.dat"))        self.fg.run ()        dst_data = dst.data ()        #self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4)if __name__ == '__main__':    gr_unittest.main ()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -