📄 qa_filter_delay_fc.py
字号:
(-0.5877840518951416 +0.87856143712997437j), (-0.95105588436126709 +0.35447561740875244j), (-0.95105588436126709 -0.26055556535720825j), (-0.5877838134765625 -0.77606213092803955j), (-8.7774534307527574e-09 -0.96460390090942383j), (0.58778399229049683 -0.78470128774642944j), (0.95105588436126709 -0.28380891680717468j), (0.95105588436126709 +0.32548999786376953j), (0.5877838134765625 +0.82514488697052002j), (1.4629089051254596e-08 +1.0096219778060913j), (-0.5877840518951416 +0.81836479902267456j), (-0.95105588436126709 +0.31451958417892456j), (-0.95105588436126709 -0.3030143678188324j), (-0.5877838134765625 -0.80480599403381348j), (-1.7554906861505515e-08 -0.99516552686691284j), (0.58778399229049683 -0.80540722608566284j), (0.95105582475662231 -0.30557557940483093j), (0.95105588436126709 +0.31097668409347534j), (0.5877838134765625 +0.81027895212173462j), (2.3406542482007353e-08 +1.0000816583633423j), (-0.5877840518951416 +0.80908381938934326j), (-0.95105588436126709 +0.30904293060302734j), (-0.95105588436126709 -0.30904296040534973j), (-0.5877838134765625 -0.80908387899398804j), (-2.6332360292258272e-08 -1.0000815391540527j), (0.58778399229049683 -0.80908381938934326j), (0.95105582475662231 -0.30904299020767212j), (0.95105588436126709 +0.30904293060302734j), (0.5877838134765625 +0.80908381938934326j), (3.218399768911695e-08 +1.0000815391540527j)) fg = self.fg sampling_freq = 100 ntaps = 51 src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, sampling_freq * 0.10, 1.0) head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) dst2 = gr.vector_sink_c () # calculate taps taps = gr.firdes_hilbert (ntaps) hd = gr.filter_delay_fc (taps) fg.connect (src1, head) fg.connect (head, (hd,0)) fg.connect (head, (hd,1)) fg.connect (hd,dst2) fg.run () # get output result_data = dst2.data () self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) def test_003_filter_delay_two_inputs (self): # give two different inputs # expected result expected_result = ( -0.0020331963896751404j, -0.0016448829555884004j, -0.0032375147566199303j, -0.0014826074475422502j, -0.0033034090884029865j, -0.00051144487224519253j, -0.0043686260469257832j, -0.0010198024101555347j, -0.0082517862319946289j, -0.003456643782556057j, -0.014193611219525337j, -0.005875137634575367j, -0.020293503999710083j, -0.0067503536120057106j, -0.026798896491527557j, -0.0073488112539052963j, -0.037041611969470978j, -0.010557252913713455j, -0.055669989436864853j, -0.018332764506340027j, -0.089904911816120148j, -0.033361352980136871j, -0.16902604699134827j, -0.074318811297416687j, -0.58429563045501709j, (7.2191945754696007e-09 -0.35892376303672791j), (0.58778399229049683 +0.63660913705825806j), (0.95105588436126709 +0.87681591510772705j), (0.95105588436126709 +0.98705857992172241j), (0.5877838134765625 +0.55447429418563843j), (5.8516356205018383e-09 +0.026006083935499191j), (-0.5877840518951416 -0.60616838932037354j), (-0.95105588436126709 -0.9311758279800415j), (-0.95105588436126709 -0.96169203519821167j), (-0.5877838134765625 -0.57292771339416504j), (-8.7774534307527574e-09 -0.0073488391935825348j), (0.58778399229049683 +0.59720659255981445j), (0.95105588436126709 +0.94438445568084717j), (0.95105588436126709 +0.95582199096679688j), (0.5877838134765625 +0.58196049928665161j), (1.4629089051254596e-08 +0.0026587247848510742j), (-0.5877840518951416 -0.59129220247268677j), (-0.95105588436126709 -0.94841635227203369j), (-0.95105588436126709 -0.95215457677841187j), (-0.5877838134765625 -0.58535969257354736j), (-1.7554906861505515e-08 -0.00051158666610717773j), (0.58778399229049683 +0.58867418766021729j), (0.95105582475662231 +0.94965213537216187j), (0.95105588436126709 +0.95050644874572754j), (0.5877838134765625 +0.58619076013565063j), (2.3406542482007353e-08 +1.1920928955078125e-07j), (-0.5877840518951416 -0.58783555030822754j), (-0.95105588436126709 -0.95113480091094971j), (-0.95105588436126709 -0.95113474130630493j), (-0.5877838134765625 -0.58783555030822754j), (-2.6332360292258272e-08 -8.1956386566162109e-08j), (0.58778399229049683 +0.58783555030822754j), (0.95105582475662231 +0.95113474130630493j), (0.95105588436126709 +0.95113474130630493j), (0.5877838134765625 +0.58783560991287231j), (3.218399768911695e-08 +1.1920928955078125e-07j)) fg = self.fg sampling_freq = 100 ntaps = 51 src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,sampling_freq * 0.10, 1.0) src2 = gr.sig_source_f (sampling_freq, gr.GR_COS_WAVE,sampling_freq * 0.10, 1.0) head1 = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) head2 = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) taps = gr.firdes_hilbert (ntaps) hd = gr.filter_delay_fc (taps) dst2 = gr.vector_sink_c () fg.connect (src1, head1) fg.connect (src2, head2) fg.connect (head1, (hd,0)) fg.connect (head2, (hd,1)) fg.connect (hd, dst2) fg.run () # get output result_data = dst2.data () self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) if __name__ == '__main__': gr_unittest.main ()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -