diff options
17 files changed, 339 insertions, 597 deletions
diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4 index ddb7c7ca90..2204e49aeb 100644 --- a/config/grc_gr_qtgui.m4 +++ b/config/grc_gr_qtgui.m4 @@ -83,6 +83,7 @@ AC_DEFUN([GRC_GR_QTGUI],[ gr-qtgui/Makefile \ gr-qtgui/gnuradio-qtgui.pc \ gr-qtgui/apps/Makefile \ + gr-qtgui/examples/Makefile \ gr-qtgui/grc/Makefile \ gr-qtgui/lib/Makefile \ gr-qtgui/python/Makefile \ diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc index 19ab316a19..1668f71f0c 100644 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc +++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc @@ -99,6 +99,9 @@ gr_pll_carriertracking_cc::work (int noutput_items, float t_imag, t_real; for (int i = 0; i < noutput_items; i++){ + gr_sincosf(d_phase,&t_imag,&t_real); + optr[i] = iptr[i] * gr_complex(t_real,-t_imag); + error = phase_detector(iptr[i],d_phase); d_freq = d_freq + d_beta * error; @@ -108,9 +111,8 @@ gr_pll_carriertracking_cc::work (int noutput_items, d_freq = d_max_freq; else if (d_freq < d_min_freq) d_freq = d_min_freq; - gr_sincosf(d_phase,&t_imag,&t_real); - optr[i] = iptr[i] * gr_complex(t_real,-t_imag); - d_locksig = d_locksig * (1.0 - d_alpha) + d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag); + d_locksig = d_locksig * (1.0 - d_alpha) + + d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag); if ((d_squelch_enable) && !lock_detector()) optr[i] = 0; diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc index 1f17f2afc6..997ba40425 100644 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc +++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc @@ -80,6 +80,8 @@ gr_pll_freqdet_cf::work (int noutput_items, int size = noutput_items; while (size-- > 0) { + *optr++ = d_freq; + error = phase_detector(*iptr++,d_phase); d_freq = d_freq + d_beta * error; @@ -89,7 +91,6 @@ gr_pll_freqdet_cf::work (int noutput_items, d_freq = d_max_freq; else if (d_freq < d_min_freq) d_freq = d_min_freq; - *optr++ = d_freq; } return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc index 8a7fbf88ba..d01f28e456 100644 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc +++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc @@ -82,6 +82,9 @@ gr_pll_refout_cc::work (int noutput_items, int size = noutput_items; while (size-- > 0) { + gr_sincosf(d_phase,&t_imag,&t_real); + *optr++ = gr_complex(t_real,t_imag); + error = phase_detector(*iptr++,d_phase); d_freq = d_freq + d_beta * error; @@ -91,8 +94,6 @@ gr_pll_refout_cc::work (int noutput_items, d_freq = d_max_freq; else if (d_freq < d_min_freq) d_freq = d_min_freq; - gr_sincosf(d_phase,&t_imag,&t_real); - *optr++ = gr_complex(t_real,t_imag); } return noutput_items; } diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py index 8e4a0eefa0..47f0ecb228 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py @@ -32,106 +32,106 @@ class test_pll_carriertracking (gr_unittest.TestCase): self.tb = None def test_pll_carriertracking (self): - expected_result = ((1.00000238419+6.47922693275e-09j), - (0.998399555683+0.0565364062786j), - (0.994261980057+0.10695001483j), - (0.98843306303+0.151648163795j), - (0.981579363346+0.191063538194j), - (0.974212288857+0.225630432367j), - (0.966734290123+0.255773901939j), - (0.959442555904+0.281897842884j), - (0.952551782131+0.304379671812j), - (0.946205317974+0.323566257954j), - (0.940503358841+0.339778244495j), - (0.935505151749+0.353307723999j), - (0.931235432625+0.364419162273j), - (0.927616357803+0.373535633087j), - (0.924710214138+0.380666583776j), - (0.922494113445+0.386005342007j), - (0.92093116045+0.389725029469j), - (0.919974088669+0.391981720924j), - (0.919572234154+0.392916500568j), - (0.919680893421+0.392660915852j), - (0.920248389244+0.39133310318j), - (0.921222627163+0.389039844275j), - (0.922548472881+0.385877460241j), - (0.924184799194+0.381939411163j), - (0.926086127758+0.377309292555j), - (0.928135097027+0.37224984169j), - (0.930293083191+0.366814315319j), - (0.932614028454+0.360868781805j), - (0.935064375401+0.354473829269j), - (0.937613248825+0.347684770823j), - (0.940225422382+0.340550601482j), - (0.942881464958+0.33312189579j), - (0.945559620857+0.325443327427j), - (0.948240220547+0.31755694747j), - (0.950899422169+0.309499144554j), - (0.953524827957+0.301307469606j), - (0.956105649471+0.293015599251j), - (0.958630502224+0.284654557705j), - (0.96103054285+0.276443749666j), - (0.963361799717+0.26819768548j), - (0.965623259544+0.259936869144j), - (0.967810571194+0.251679092646j), - (0.969916880131+0.243440493941j), - (0.971936583519+0.235235646367j), - (0.97387367487+0.227080151439j), - (0.975726902485+0.218987599015j), - (0.977494239807+0.210969462991j), - (0.979169845581+0.203035995364j), - (0.980761289597+0.195199295878j), - (0.982269346714+0.187469303608j), - (0.983659446239+0.180052131414j), - (0.984931468964+0.1729388237j), - (0.986136198044+0.165923252702j), - (0.987275123596+0.159012272954j), - (0.988349795341+0.15221118927j), - (0.989354014397+0.145524248481j), - (0.990296065807+0.138957872987j), - (0.991178870201+0.132516458631j), - (0.992005050182+0.126204773784j), - (0.992770493031+0.120025672019j), - (0.993480443954+0.113984130323j), - (0.994139909744+0.108083210886j), - (0.994751393795+0.102326385677j), - (0.995293080807+0.0969148278236j), - (0.995791256428+0.091630294919j), - (0.996252119541+0.0864710733294j), - (0.996678769588+0.0814334899187j), - (0.997069239616+0.0765165910125j), - (0.997423350811+0.071716658771j), - (0.997748315334+0.0670333206654j), - (0.998046517372+0.0624645166099j), - (0.998317599297+0.058009263128j), - (0.998557567596+0.053665690124j), - (0.998775064945+0.0494344644248j), - (0.998971700668+0.0453144386411j), - (0.999140620232+0.0415064357221j), - (0.99927687645+0.0379924885929j), - (0.999400436878+0.0345549099147j), - (0.999511957169+0.0311931278557j), - (0.99961233139+0.0279070306569j), - (0.999694347382+0.0246965941042j), - (0.999765276909+0.0215622838587j), - (0.999826848507+0.0185046810657j), - (0.999880313873+0.0155246723443j), - (0.999920129776+0.0126227736473j), - (0.999949812889+0.00980060640723j), - (0.99997317791+0.00705910893157j), - (0.999990820885+0.00439921114594j), - (0.999998450279+0.00202245195396j), - (0.999998092651-0.00029227725463j), - (0.999994516373-0.00254815118387j), - (0.999988794327-0.00474932929501j), - (0.999977111816-0.00689708162099j), - (0.999957799911-0.00899503659457j), - (0.999936699867-0.0110441967845j), - (0.999914228916-0.0130464555696j), - (0.999889075756-0.0150024276227j), - (0.999855577946-0.0169130507857j), - (0.999821305275-0.0187777336687j), - (0.999786794186-0.0205969288945j)) + expected_result = ((1.00000238419+7.21919457547e-09j), + (0.998025715351+0.062790453434j), + (0.992878139019+0.119114711881j), + (0.985585451126+0.16916936636j), + (0.976963579655+0.21341380477j), + (0.967643141747+0.252319812775j), + (0.958120942116+0.286356031895j), + (0.948766887188+0.315971136093j), + (0.939851403236+0.341586351395j), + (0.931558966637+0.363589793444j), + (0.924019515514+0.382339715958j), + (0.917312920094+0.398162424564j), + (0.9114767313+0.411352336407j), + (0.906515955925+0.422172755003j), + (0.902329206467+0.431043088436j), + (0.8989828825+0.437978446484j), + (0.896438419819+0.443168222904j), + (0.894643902779+0.446782171726j), + (0.893543541431+0.448972672224j), + (0.893085837364+0.449881345034j), + (0.893211960793+0.449634194374j), + (0.893862366676+0.448344886303j), + (0.894974172115+0.446114838123j), + (0.89649784565+0.443042784929j), + (0.898379862309+0.439216792583j), + (0.900570392609+0.434715718031j), + (0.902926802635+0.429791986942j), + (0.905423760414+0.424503326416j), + (0.908115327358+0.418716549873j), + (0.910964310169+0.412489384413j), + (0.913929581642+0.405871063471j), + (0.916985273361+0.398915469646j), + (0.920104384422+0.391668856144j), + (0.923261523247+0.384174525738j), + (0.926428377628+0.376470327377j), + (0.929587602615+0.3685952425j), + (0.932724237442+0.360585510731j), + (0.935822367668+0.352472603321j), + (0.938865244389+0.344285786152j), + (0.941773712635+0.336241692305j), + (0.944620370865+0.328158795834j), + (0.94739818573+0.32005661726j), + (0.950098872185+0.311952739954j), + (0.952714562416+0.303861320019j), + (0.955247402191+0.295800030231j), + (0.957694888115+0.287783116102j), + (0.960053324699+0.279822826385j), + (0.962315440178+0.271930038929j), + (0.96448802948+0.264117747545j), + (0.966570436954+0.256397068501j), + (0.968563258648+0.248777091503j), + (0.970409572124+0.241460204124j), + (0.972127914429+0.234440952539j), + (0.97377294302+0.227515518665j), + (0.975345790386+0.220690101385j), + (0.976839780807+0.213968709111j), + (0.978262722492+0.207358703017j), + (0.979616940022+0.200864806771j), + (0.980905056+0.194491744041j), + (0.982122182846+0.188243359327j), + (0.983273088932+0.18212479353j), + (0.984363257885+0.176140069962j), + (0.985394001007+0.170292437077j), + (0.986363172531+0.16458517313j), + (0.98724168539+0.159217983484j), + (0.988072276115+0.153976023197j), + (0.988858819008+0.148855358362j), + (0.989599764347+0.143855035305j), + (0.990294575691+0.138971716166j), + (0.990951240063+0.134203910828j), + (0.991572141647+0.129550367594j), + (0.992157161236+0.125009477139j), + (0.992702245712+0.120578929782j), + (0.993216574192+0.116259463131j), + (0.993701457977+0.112050771713j), + (0.994158565998+0.107951454818j), + (0.994559407234+0.104160495102j), + (0.9949182868+0.100662395358j), + (0.995259582996+0.0972395762801j), + (0.995584189892+0.0938917249441j), + (0.995885193348+0.0906178206205j), + (0.99616932869+0.0874189138412j), + (0.996438741684+0.0842954516411j), + (0.996694862843+0.0812477469444j), + (0.996931552887+0.0782764554024j), + (0.997152447701+0.0753828883171j), + (0.997361660004+0.0725681483746j), + (0.997559130192+0.0698337852955j), + (0.997741162777+0.067180365324j), + (0.99789583683+0.0648084580898j), + (0.998042702675+0.0624987781048j), + (0.998183488846+0.0602464973927j), + (0.998314678669+0.0580499768257j), + (0.998434245586+0.0559054017067j), + (0.998548746109+0.053810685873j), + (0.998658537865+0.0517641305923j), + (0.998762428761+0.0497645735741j), + (0.998855054379+0.0478102117777j), + (0.998943626881+0.0459015443921j), + (0.999028742313+0.0440383702517j)) sampling_freq = 10e3 freq = sampling_freq / 100 @@ -151,7 +151,6 @@ class test_pll_carriertracking (gr_unittest.TestCase): self.tb.run () dst_data = dst.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) if __name__ == '__main__': diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py index 5225a9a3b6..a044ca4e34 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py @@ -32,52 +32,53 @@ class test_pll_freqdet (gr_unittest.TestCase): self.tb = None def test_pll_refout (self): - expected_result = (1.1489677586e-07, - 0.972821060568, + expected_result = (0.0, + 1.1489677586e-07, + 0.972820967928, 2.74556447638, - 5.14063078448, - 8.00965819311, - 11.2291393027, - 14.6967068752, + 5.14063115504, + 8.00965893424, + 11.2291407849, + 14.6967083575, 18.3279143967, 22.0534772463, - 25.8170093072, - 29.5729107661, - 33.284774699, - 36.923857393, - 40.4367950308, - 43.8452195091, - 47.1363835133, - 50.3011949468, - 53.3336447847, - 56.2301489564, + 25.8170063427, + 29.5729048372, + 33.28476877, + 36.923851464, + 40.4367920663, + 43.8452165447, + 47.1363805488, + 50.3011890178, + 53.3336388558, + 56.2301430274, 58.9891659262, 61.6107668417, 64.0962975824, - 66.4481356707, - 68.6694531128, - 70.7640326003, - 72.7048735417, - 74.5033180826, + 66.4481415997, + 68.6694590418, + 70.7640385293, + 72.7048794706, + 74.5033240115, 76.2012544926, - 77.8019199967, + 77.8019140677, 79.3088126954, - 80.7255907715, - 82.0560369166, - 83.3039516093, - 84.47312347, - 85.5673411194, + 80.7255967005, + 82.0560428456, + 83.3039575383, + 84.473129399, + 85.5673470484, 86.5902864563, - 87.5456117346, - 88.4368565575, - 89.2363918613, - 89.9860999864, - 90.688880206, - 91.3474598523, - 91.9644654653, - 92.5423042123, - 93.0832706099, - 93.5894872344, + 87.5456176636, + 88.4368624865, + 89.2363977903, + 89.9861118444, + 90.6888920639, + 91.3474657813, + 91.9644713943, + 92.5423101413, + 93.0832765389, + 93.5894931633, 94.0629225081, 94.5054203452, 94.9186882929, @@ -92,46 +93,45 @@ class test_pll_freqdet (gr_unittest.TestCase): 97.3504727968, 97.5493842694, 97.7366275022, - 97.9123092169, + 97.9123032879, 98.0766013539, 98.2297054988, - 98.3408087235, - 98.448722155, - 98.5534457933, - 98.6549322065, - 98.7531932527, - 98.8481459259, - 98.9397487233, - 99.0279067813, - 99.1125074491, - 99.193438076, - 99.2705800823, - 99.3438030304, - 99.3817663128, - 99.3911400359, - 99.4089388448, - 99.4334136894, - 99.4630408207, - 99.4964684305, - 99.5325166512, - 99.5701538394, - 99.6084432158, - 99.6466021546, - 99.6839073198, - 99.7197895289, + 98.3408027946, + 98.4487102971, + 98.5534280064, + 98.6549025616, + 98.7531576788, + 98.848110352, + 98.9397131494, + 99.0278712074, + 99.1124718752, + 99.193408431, + 99.2705445084, + 99.3437733855, + 99.3817366678, + 99.391110391, + 99.4089151289, + 99.4333959024, + 99.4630289627, + 99.4964565726, + 99.5325047932, + 99.5701419814, + 99.6084313579, + 99.6465902967, + 99.6838954618, + 99.7197776709, 99.7537270313, 99.7542606398, 99.7595848672, - 99.7691186729, - 99.7822928746, - 99.7986331535, - 99.8175940432, - 99.838713083, - 99.8614922382, - 99.8854571901, - 99.9101454781, - 99.9351302152, - 99.9599845147) + 99.7691305308, + 99.7823047325, + 99.7986450115, + 99.8176059012, + 99.838724941, + 99.8615040962, + 99.8854690481, + 99.910157336, + 99.9351302152) sampling_freq = 10e3 freq = sampling_freq / 100 diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py index c40a885a86..c719d901d1 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py @@ -32,106 +32,106 @@ class test_pll_refout (gr_unittest.TestCase): self.tb = None def test_pll_refout (self): - expected_result = ((1+7.39965699825e-10j), + expected_result = ((1+0j), + (1+7.39965699825e-10j), (0.999980390072+0.00626518437639j), - (0.999828696251+0.0185074284673j), - (0.999342679977+0.0362518876791j), - (0.998255133629+0.0590478181839j), - (0.996255218983+0.0864609107375j), + (0.999828696251+0.0185074303299j), + (0.999342679977+0.0362518914044j), + (0.998255133629+0.0590478256345j), + (0.996255218983+0.0864609181881j), (0.993005692959+0.118066303432j), (0.988157629967+0.153442293406j), (0.981362581253+0.192165210843j), (0.972283244133+0.233806177974j), (0.960601866245+0.277928203344j), - (0.946027755737+0.324085712433j), + (0.946027696133+0.324085712433j), (0.928303182125+0.371824204922j), (0.907292485237+0.420500129461j), - (0.882742881775+0.469856351614j), + (0.882742881775+0.469856321812j), (0.854515135288+0.519426465034j), (0.822515428066+0.568742752075j), - (0.786696314812+0.617340147495j), - (0.747057616711+0.664759278297j), - (0.703645646572+0.710551083088j), - (0.656552672386+0.754280209541j), - (0.605915129185+0.795529305935j), - (0.551911592484+0.833902597427j), - (0.494760006666+0.869029641151j), - (0.43471455574+0.900568306446j), - (0.37224894762+0.928132891655j), - (0.30767711997+0.951490819454j), - (0.241136431694+0.970491230488j), - (0.172981828451+0.984925031662j), - (0.103586450219+0.99462044239j), - (0.0333373323083+0.999444127083j), - (-0.0373690575361+0.999301552773j), - (-0.108130030334+0.994136750698j), - (-0.178540825844+0.983932495117j), - (-0.248198583722+0.968709170818j), - (-0.316705673933+0.948523879051j), - (-0.383672952652+0.923469007015j), - (-0.448723316193+0.893670737743j), - (-0.51132196188+0.85938924551j), - (-0.571328520775+0.820721447468j), - (-0.628420114517+0.777874112129j), - (-0.682293117046+0.73107868433j), - (-0.732665538788+0.680588841438j), - (-0.779277384281+0.626679122448j), - (-0.821892917156+0.569642007351j), - (-0.860301196575+0.509786069393j), - (-0.894317150116+0.447433561087j), - (-0.923782229424+0.382918298244j), - (-0.948564887047+0.316582858562j), - (-0.968560874462+0.248776733875j), - (-0.983657121658+0.180051699281j), - (-0.993847966194+0.110753215849j), - (-0.999158322811+0.0410195216537j), - (-0.999585151672-0.0288011860102j), - (-0.995150566101-0.0983632653952j), - (-0.985901713371-0.16732545197j), - (-0.971909940243-0.235353127122j), - (-0.953270018101-0.302119642496j), - (-0.9300994277-0.367307811975j), - (-0.902537107468-0.430612027645j), - (-0.870742559433-0.49173912406j), - (-0.834894418716-0.550410091877j), - (-0.795189499855-0.606360971928j), - (-0.751972675323-0.659194231033j), + (0.786696374416+0.617340147495j), + (0.747057676315+0.664759278297j), + (0.703645706177+0.710551023483j), + (0.656552672386+0.754280149937j), + (0.605915188789+0.795529305935j), + (0.551911652088+0.833902597427j), + (0.494760125875+0.869029581547j), + (0.43471467495+0.900568246841j), + (0.37224906683+0.928132891655j), + (0.307677358389+0.95149075985j), + (0.241136670113+0.970491170883j), + (0.17298206687+0.984924972057j), + (0.103586681187+0.99462044239j), + (0.0333374515176+0.999444127083j), + (-0.0373689383268+0.999301552773j), + (-0.108129791915+0.994136810303j), + (-0.178540587425+0.983932554722j), + (-0.248198464513+0.968709230423j), + (-0.316705435514+0.948523938656j), + (-0.383672863245+0.92346906662j), + (-0.448723107576+0.893670797348j), + (-0.511321544647+0.859389483929j), + (-0.571328163147+0.820721685886j), + (-0.628419756889+0.777874410152j), + (-0.682292759418+0.731079041958j), + (-0.73266518116+0.680589199066j), + (-0.779277086258+0.626679480076j), + (-0.821892678738+0.569642364979j), + (-0.860300958157+0.509786486626j), + (-0.894316911697+0.447434008121j), + (-0.923782110214+0.382918506861j), + (-0.948564827442+0.316582858562j), + (-0.968560934067+0.248776495457j), + (-0.983657181263+0.180051460862j), + (-0.993847966194+0.110752984881j), + (-0.999158382416+0.0410190448165j), + (-0.999585151672-0.0288016609848j), + (-0.995150506496-0.0983637422323j), + (-0.985901653767-0.167325690389j), + (-0.971909880638-0.235353350639j), + (-0.953269898891-0.302119880915j), + (-0.930099308491-0.367308050394j), + (-0.902536988258-0.430612236261j), + (-0.870742440224-0.491739332676j), + (-0.834894299507-0.550410330296j), + (-0.795189321041-0.606361210346j), + (-0.751972556114-0.659194409847j), (-0.705345034599-0.708864152431j), - (-0.65554022789-0.755160272121j), + (-0.65554022789-0.755160212517j), (-0.602804005146-0.79788929224j), (-0.547393083572-0.836875617504j), - (-0.489574223757-0.871961653233j), + (-0.489574193954-0.871961593628j), (-0.429622590542-0.903008520603j), (-0.367820799351-0.929896712303j), (-0.30445766449-0.952525854111j), (-0.239826664329-0.970815718174j), (-0.174224823713-0.984705924988j), (-0.107951194048-0.994156181812j), - (-0.0415063276887-0.999138236046j), + (-0.0415062084794-0.999138236046j), (0.0248276274651-0.999691724777j), (0.0909758731723-0.995853126049j), - (0.156649470329-0.987654268742j), + (0.156649366021-0.987654268742j), (0.221562758088-0.975146114826j), (0.285434871912-0.958398103714j), - (0.347990810871-0.937497973442j), - (0.408962905407-0.912550985813j), - (0.468091338873-0.883680105209j), - (0.525126338005-0.851024270058j), - (0.57982814312-0.814738810062j), - (0.631968915462-0.77499371767j), - (0.681333422661-0.731973171234j), - (0.727582573891-0.68602013588j), - (0.770699381828-0.637198925018j), - (0.810512244701-0.585721731186j), - (0.846863090992-0.531810998917j), - (0.879608631134-0.475698113441j), - (0.908620357513-0.417623132467j), + (0.34799093008-0.937497913837j), + (0.408963024616-0.912550985813j), + (0.468091547489-0.883679986j), + (0.525126516819-0.851024150848j), + (0.579828321934-0.814738690853j), + (0.631969094276-0.774993598461j), + (0.68133354187-0.731973052025j), + (0.727582633495-0.68602001667j), + (0.770699501038-0.637198805809j), + (0.810512304306-0.585721611977j), + (0.846863090992-0.531810939312j), + (0.879608631134-0.475698083639j), + (0.908620357513-0.417623102665j), (0.933785498142-0.357833325863j), - (0.955007195473-0.296582698822j), - (0.972205162048-0.234130680561j), + (0.955007135868-0.29658266902j), + (0.972205162048-0.23413066566j), (0.985315918922-0.170741200447j), - (0.994293272495-0.106681488454j), - (0.999108314514-0.0422209985554j)) + (0.994293212891-0.106681533158j)) sampling_freq = 10e3 freq = sampling_freq / 100 diff --git a/gr-qtgui/Makefile.am b/gr-qtgui/Makefile.am index cc194e4c0f..38033e1ac0 100644 --- a/gr-qtgui/Makefile.am +++ b/gr-qtgui/Makefile.am @@ -24,7 +24,7 @@ include $(top_srcdir)/Makefile.common SUBDIRS = lib if PYTHON -SUBDIRS += swig python apps grc +SUBDIRS += swig python apps grc examples endif pkgconfigdir = $(libdir)/pkgconfig diff --git a/gr-qtgui/apps/Makefile.am b/gr-qtgui/apps/Makefile.am index 7b35d949e3..4d0c550a17 100644 --- a/gr-qtgui/apps/Makefile.am +++ b/gr-qtgui/apps/Makefile.am @@ -28,13 +28,9 @@ nodist_bin_SCRIPTS = \ usrp_display_qtgui.ui noinst_PYTHON = \ - pyqt_example_f.py \ - pyqt_example_c.py \ - pyqt_time_c.py \ qt_digital.py \ qt_digital_window.py \ - usrp2_display.py \ - usrp_display.py \ + uhd_display.py \ qt_digital_window.py \ usrp_display_qtgui.py diff --git a/gr-qtgui/apps/usrp2_display.py b/gr-qtgui/apps/uhd_display.py index ab1a6f742c..1d69586ef6 100755 --- a/gr-qtgui/apps/usrp2_display.py +++ b/gr-qtgui/apps/uhd_display.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009 Free Software Foundation, Inc. +# Copyright 2009,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # from gnuradio import gr -from gnuradio import usrp2 +from gnuradio import uhd from gnuradio import eng_notation from gnuradio.eng_option import eng_option from gnuradio.qtgui import qtgui @@ -163,53 +163,40 @@ class main_window(QtGui.QMainWindow): class my_top_block(gr.top_block): - def __init__(self): + def __init__(self, options): gr.top_block.__init__(self) - parser = OptionParser(option_class=eng_option) - parser.add_option("-e", "--interface", type="string", default="eth0", - help="select Ethernet interface, default is eth0") - parser.add_option("-m", "--mac-addr", type="string", default="", - help="select USRP by MAC address, default is auto-select") - parser.add_option("-W", "--bw", type="eng_float", default=1e6, - help="set bandwidth of receiver [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=2412e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("--fft-size", type="int", default=2048, - help="Set number of FFT bins [default=%default]") - (options, args) = parser.parse_args() - - if len(args) != 0: - parser.print_help() - sys.exit(1) - self.options = options + self.options = options self.show_debug_info = True self.qapp = QtGui.QApplication(sys.argv) - self.u = usrp2.source_32fc(options.interface, options.mac_addr) - self._adc_rate = self.u.adc_rate() - self.set_bandwidth(options.bw) + self.u = uhd.usrp_source(device_addr=options.address, + io_type=uhd.io_type.COMPLEX_FLOAT32, + num_channels=1) + self.set_bandwidth(options.samp_rate) if options.gain is None: # if no gain was specified, use the mid-point in dB - g = self.u.gain_range() - options.gain = float(g[0]+g[1])/2 + g = self.u.get_gain_range() + options.gain = float(g.start()+g.stop())/2 self.set_gain(options.gain) if options.freq is None: - # if no frequency was specified, use the mid-point of the subdev - f = self.u.freq_range() - options.freq = float(f[0]+f[1])/2 + # if no freq was specified, use the mid-point + r = self.u.get_freq_range() + options.freq = float(r.start()+r.stop())/2 self.set_frequency(options.freq) + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self._fftsize = options.fft_size - self.snk = qtgui.sink_c(options.fft_size, gr.firdes.WIN_BLACKMAN_hARRIS, + self.snk = qtgui.sink_c(options.fft_size, + gr.firdes.WIN_BLACKMAN_hARRIS, self._freq, self._bandwidth, - "USRP2 Display", + "UHD Display", True, True, True, False) # Set up internal amplifier @@ -225,9 +212,9 @@ class my_top_block(gr.top_block): self.connect(self.u, self.amp, self.snk) if self.show_debug_info: - print "Decimation rate: ", self._decim - print "Bandwidth: ", self._bandwidth - print "D'board: ", self.u.daughterboard_id() + print "Bandwidth: ", self.u.get_samp_rate() + print "Center Freq: ", self.u.get_center_freq() + print "Freq Range: ", self.u.get_freq_range() # Get the reference pointer to the SpectrumDisplayForm QWidget # Wrap the pointer as a PyQt SIP object @@ -268,8 +255,7 @@ class my_top_block(gr.top_block): def set_bandwidth(self, bw): self._bandwidth = bw - self._decim = int(self._adc_rate / self._bandwidth) - self.u.set_decim(self._decim) + self.u.set_samp_rate(self._bandwidth) try: self.snk.set_frequency_range(self._freq, self._bandwidth) @@ -301,7 +287,26 @@ class my_top_block(gr.top_block): self.unlock() def main (): - tb = my_top_block() + parser = OptionParser(option_class=eng_option) + parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", + help="Address of UHD device, [default=%default]") + parser.add_option("-A", "--antenna", type="string", default=None, + help="select Rx Antenna where appropriate") + parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6, + help="set sample rate (bandwidth) [default=%default]") + parser.add_option("-f", "--freq", type="eng_float", default=2412e6, + help="set frequency to FREQ", metavar="FREQ") + parser.add_option("-g", "--gain", type="eng_float", default=None, + help="set gain in dB (default is midpoint)") + parser.add_option("--fft-size", type="int", default=2048, + help="Set number of FFT bins [default=%default]") + (options, args) = parser.parse_args() + + if len(args) != 0: + parser.print_help() + sys.exit(1) + + tb = my_top_block(options) tb.start() tb.snk.exec_(); diff --git a/gr-qtgui/apps/usrp_display.py b/gr-qtgui/apps/usrp_display.py deleted file mode 100755 index 131bc4a7e1..0000000000 --- a/gr-qtgui/apps/usrp_display.py +++ /dev/null @@ -1,299 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from gnuradio.qtgui import qtgui -from optparse import OptionParser -import sys - -try: - from gnuradio.qtgui import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Please install gr-qtgui." - sys.exit(1) - -try: - from usrp_display_qtgui import Ui_MainWindow -except ImportError: - print "Error: could not find usrp_display_qtgui.py:" - print "\t\"pyuic4 usrp_display_qtgui.ui -o usrp_display_qtgui.py\"" - sys.exit(1) - - - -# //////////////////////////////////////////////////////////////////// -# Define the QT Interface and Control Dialog -# //////////////////////////////////////////////////////////////////// - - -class main_window(QtGui.QMainWindow): - def __init__(self, snk, fg, parent=None): - - QtGui.QWidget.__init__(self, parent) - self.gui = Ui_MainWindow() - self.gui.setupUi(self) - - self.fg = fg - - # Add the qtsnk widgets to the layout box - self.gui.sinkLayout.addWidget(snk) - - # Connect up some signals - self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), - self.pauseFg) - self.connect(self.gui.frequencyEdit, QtCore.SIGNAL("editingFinished()"), - self.frequencyEditText) - self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"), - self.gainEditText) - self.connect(self.gui.bandwidthEdit, QtCore.SIGNAL("editingFinished()"), - self.bandwidthEditText) - self.connect(self.gui.amplifierEdit, QtCore.SIGNAL("editingFinished()"), - self.amplifierEditText) - - self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"), - self.saveData) - self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save) - - def pauseFg(self): - if(self.gui.pauseButton.text() == "Pause"): - self.fg.stop() - self.fg.wait() - self.gui.pauseButton.setText("Unpause") - else: - self.fg.start() - self.gui.pauseButton.setText("Pause") - - - # Functions to set the values in the GUI - def set_frequency(self, freq): - self.freq = freq - sfreq = eng_notation.num_to_str(self.freq) - self.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq)) - - def set_gain(self, gain): - self.gain = gain - self.gui.gainEdit.setText(QtCore.QString("%1").arg(self.gain)) - - def set_bandwidth(self, bw): - self.bw = bw - sbw = eng_notation.num_to_str(self.bw) - self.gui.bandwidthEdit.setText(QtCore.QString("%1").arg(sbw)) - - def set_amplifier(self, amp): - self.amp = amp - self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp)) - - - # Functions called when signals are triggered in the GUI - def frequencyEditText(self): - try: - freq = eng_notation.str_to_num(self.gui.frequencyEdit.text().toAscii()) - self.fg.set_frequency(freq) - self.freq = freq - except RuntimeError: - pass - - def gainEditText(self): - try: - gain = float(self.gui.gainEdit.text()) - self.fg.set_gain(gain) - self.gain = gain - except ValueError: - pass - - def bandwidthEditText(self): - try: - bw = eng_notation.str_to_num(self.gui.bandwidthEdit.text().toAscii()) - self.fg.set_bandwidth(bw) - self.bw = bw - except ValueError: - pass - - def amplifierEditText(self): - try: - amp = float(self.gui.amplifierEdit.text()) - self.fg.set_amplifier_gain(amp) - self.amp = amp - except ValueError: - pass - - def saveData(self): - fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to file", "."); - if(len(fileName)): - self.fg.save_to_file(str(fileName)) - - -def pick_subdevice(u): - """ - The user didn't specify a subdevice on the command line. - If there's a daughterboard on A, select A. - If there's a daughterboard on B, select B. - Otherwise, select A. - """ - if u.db(0, 0).dbid() >= 0: # dbid is < 0 if there's no d'board or a problem - return (0, 0) - if u.db(0, 0).dbid() >= 0: - return (1, 0) - return (0, 0) - -class my_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-w", "--which", type="int", default=0, - help="select which USRP (0, 1, ...) default is %default", - metavar="NUM") - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="select USRP Rx side A or B (default=first one with a daughterboard)") - parser.add_option("-A", "--antenna", default=None, - help="select Rx Antenna (only on RFX-series boards)") - parser.add_option("-W", "--bw", type="float", default=1e6, - help="set bandwidth of receiver [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB [default is midpoint]") - parser.add_option("-8", "--width-8", action="store_true", default=False, - help="Enable 8-bit samples across USB") - parser.add_option( "--no-hb", action="store_true", default=False, - help="don't use halfband filter in usrp") - parser.add_option("-S", "--oscilloscope", action="store_true", default=False, - help="Enable oscilloscope display") - parser.add_option("", "--avg-alpha", type="eng_float", default=1e-1, - help="Set fftsink averaging factor, [default=%default]") - parser.add_option("", "--ref-scale", type="eng_float", default=13490.0, - help="Set dBFS=0dB input value, [default=%default]") - parser.add_option("", "--fft-size", type="int", default=2048, - help="Set FFT frame size, [default=%default]"); - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - self.options = options - self.show_debug_info = True - - # Call this before creating the Qt sink - self.qapp = QtGui.QApplication(sys.argv) - - self._fftsize = options.fft_size - - self.u = usrp.source_c(which=options.which) - self._adc_rate = self.u.converter_rate() - self.set_bandwidth(options.bw) - - if options.rx_subdev_spec is None: - options.rx_subdev_spec = pick_subdevice(self.u) - self._rx_subdev_spec = options.rx_subdev_spec - self.u.set_mux(usrp.determine_rx_mux_value(self.u, self._rx_subdev_spec)) - self.subdev = usrp.selected_subdev(self.u, self._rx_subdev_spec) - - self._gain_range = self.subdev.gain_range() - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self._gain_range - options.gain = float(g[0]+g[1])/2 - self.set_gain(options.gain) - - if options.freq is None: - # if no frequency was specified, use the mid-point of the subdev - f = self.subdev.freq_range() - options.freq = float(f[0]+f[1])/2 - self.set_frequency(options.freq) - - self.snk = qtgui.sink_c(self._fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - self._freq, self._bandwidth, - "USRP Display", - True, True, True, False) - - # Set up internal amplifier - self.amp = gr.multiply_const_cc(0.0) - self.set_amplifier_gain(0.001) - - # Connect the flow graph - self.connect(self.u, self.amp, self.snk) - - - # Get the reference pointer to the SpectrumDisplayForm QWidget - # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - self.pysink = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) - - self.main_win = main_window(self.pysink, self) - - self.main_win.set_frequency(self._freq) - self.main_win.set_gain(self._gain) - self.main_win.set_bandwidth(self._bandwidth) - self.main_win.set_amplifier(self._amp_value) - - self.main_win.show() - - def save_to_file(self, name): - # Pause the flow graph - self.stop() - self.wait() - - # Add file sink to save data - self.file_sink = gr.file_sink(gr.sizeof_gr_complex, name) - self.connect(self.amp, self.file_sink) - - # Restart flow graph - self.start() - - def set_gain(self, gain): - self._gain = gain - self.subdev.set_gain(self._gain) - - def set_frequency(self, freq): - self._freq = freq - self.u.tune(0, self.subdev, self._freq) - - try: - self.snk.set_frequency_range(self._freq, self._bandwidth) - except: - pass - - def set_bandwidth(self, bw): - self._bandwidth = bw - self._decim = int(self._adc_rate / self._bandwidth) - self.u.set_decim_rate(self._decim) - - try: - self.snk.set_frequency_range(self._freq, self._bandwidth) - except: - pass - - def set_amplifier_gain(self, amp): - self._amp_value = amp - self.amp.set_k(self._amp_value) - - -if __name__ == "__main__": - tb = my_top_block(); - tb.start() - tb.qapp.exec_() diff --git a/gr-qtgui/examples/.gitignore b/gr-qtgui/examples/.gitignore new file mode 100644 index 0000000000..b336cc7cec --- /dev/null +++ b/gr-qtgui/examples/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gr-qtgui/examples/Makefile.am b/gr-qtgui/examples/Makefile.am new file mode 100644 index 0000000000..a204d1fcc4 --- /dev/null +++ b/gr-qtgui/examples/Makefile.am @@ -0,0 +1,34 @@ +# +# Copyright 2008-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common + +if PYTHON +ourdatadir = $(exampledir)/qt-gui + +dist_ourdata_SCRIPTS = \ + pyqt_example_c.py \ + pyqt_example_f.py \ + pyqt_time_c.py \ + pyqt_time_f.py +endif + +EXTRA_DIST += diff --git a/gr-qtgui/apps/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py index 607ab12ee4..607ab12ee4 100755 --- a/gr-qtgui/apps/pyqt_example_c.py +++ b/gr-qtgui/examples/pyqt_example_c.py diff --git a/gr-qtgui/apps/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py index 2d957c85ad..2d957c85ad 100755 --- a/gr-qtgui/apps/pyqt_example_f.py +++ b/gr-qtgui/examples/pyqt_example_f.py diff --git a/gr-qtgui/apps/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py index fa7d60e818..fa7d60e818 100755 --- a/gr-qtgui/apps/pyqt_time_c.py +++ b/gr-qtgui/examples/pyqt_time_c.py diff --git a/gr-qtgui/apps/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py index 1b9efa10d8..1b9efa10d8 100755 --- a/gr-qtgui/apps/pyqt_time_f.py +++ b/gr-qtgui/examples/pyqt_time_f.py |