diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2015-04-26 15:32:58 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2015-04-26 15:32:58 -0700 |
commit | c5e6d08637be1703af6f5905f21deceed49470a8 (patch) | |
tree | b4cdf25645874cf3b80c2c90080e8f4269448a32 | |
parent | 58486e918fc4c67cd4bb29c0e30a23b8425afd0e (diff) | |
parent | c0a88bebb5ac163dd774f113b3eef71ed30221ea (diff) |
Merge branch 'master' into next
-rw-r--r-- | gnuradio-runtime/include/gnuradio/tags.h | 12 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gr/tag_utils.py | 2 | ||||
-rw-r--r-- | gr-blocks/lib/vector_source_X_impl.cc.t | 3 | ||||
-rwxr-xr-x | gr-blocks/python/blocks/qa_vector_sink_source.py | 52 | ||||
-rw-r--r-- | gr-channels/doc/channels.dox | 36 | ||||
-rw-r--r-- | gr-channels/include/gnuradio/channels/fading_model.h | 2 | ||||
-rw-r--r-- | gr-channels/include/gnuradio/channels/selective_fading_model.h | 8 | ||||
-rw-r--r-- | gr-filter/include/gnuradio/filter/pfb_channelizer_ccf.h | 9 | ||||
-rw-r--r-- | gr-filter/include/gnuradio/filter/pfb_synthesizer_ccf.h | 8 | ||||
-rw-r--r-- | gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h | 1 | ||||
-rw-r--r-- | gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h | 1 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.cc | 5 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.cc | 7 |
13 files changed, 109 insertions, 37 deletions
diff --git a/gnuradio-runtime/include/gnuradio/tags.h b/gnuradio-runtime/include/gnuradio/tags.h index 4e63d77755..0551e468d1 100644 --- a/gnuradio-runtime/include/gnuradio/tags.h +++ b/gnuradio-runtime/include/gnuradio/tags.h @@ -60,6 +60,18 @@ namespace gr { return (t.key == key) && (t.value == value) && \ (t.srcid == srcid) && (t.offset == offset); } + + tag_t() + : offset(0), + key(pmt::PMT_NIL), + value(pmt::PMT_NIL), + srcid(pmt::PMT_F) // consistent with default srcid value in block::add_item_tag + { + } + + ~tag_t() + { + } }; } /* namespace gr */ diff --git a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py index ba46e3f4d9..dc36e05250 100644 --- a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py +++ b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py @@ -8,7 +8,7 @@ class PythonTag(object): self.offset = None self.key = None self.value = None - self.srcid = None + self.srcid = False def tag_to_python(tag): """ Convert a stream tag to a Python-readable object """ diff --git a/gr-blocks/lib/vector_source_X_impl.cc.t b/gr-blocks/lib/vector_source_X_impl.cc.t index cb17c70d63..287864fcac 100644 --- a/gr-blocks/lib/vector_source_X_impl.cc.t +++ b/gr-blocks/lib/vector_source_X_impl.cc.t @@ -133,7 +133,8 @@ namespace gr { } for(unsigned t = 0; t < d_tags.size(); t++) { if((d_tags[t].offset >= d_offset) && (d_tags[t].offset < d_offset+n)) - add_item_tag(0, d_tags[t].offset, d_tags[t].key, d_tags[t].value); + add_item_tag(0, d_tags[t].offset, d_tags[t].key, d_tags[t].value, + d_tags[t].srcid); } d_offset += n; return n/d_vlen; diff --git a/gr-blocks/python/blocks/qa_vector_sink_source.py b/gr-blocks/python/blocks/qa_vector_sink_source.py index 6c9f933668..5dab7014cd 100755 --- a/gr-blocks/python/blocks/qa_vector_sink_source.py +++ b/gr-blocks/python/blocks/qa_vector_sink_source.py @@ -21,8 +21,22 @@ # from gnuradio import gr, gr_unittest, blocks +import pmt import math +def make_tag(key, value, offset, srcid=None): + tag = gr.tag_t() + tag.key = pmt.string_to_symbol(key) + tag.value = pmt.to_pmt(value) + tag.offset = offset + if srcid is not None: + tag.srcid = pmt.to_pmt(srcid) + return tag + +def compare_tags(a, b): + return a.offset == b.offset and pmt.equal(a.key, b.key) and \ + pmt.equal(a.value, b.value) and pmt.equal(a.srcid, b.srcid) + class test_vector_sink_source(gr_unittest.TestCase): def setUp(self): @@ -60,6 +74,44 @@ class test_vector_sink_source(gr_unittest.TestCase): expected_result = tuple(src_data) self.assertRaises(RuntimeError, lambda : blocks.vector_source_f(src_data, False, 3)) + def test_004(self): + src_data = [float(x) for x in range(16)] + expected_result = tuple(src_data) + src_tags = tuple([make_tag('key', 'val', 0, 'src')]) + expected_tags = src_tags[:] + + src = blocks.vector_source_f(src_data, repeat=False, tags=src_tags) + dst = blocks.vector_sink_f() + + self.tb.connect(src, dst) + self.tb.run() + result_data = dst.data() + result_tags = dst.tags() + self.assertEqual(expected_result, result_data) + self.assertEqual(len(result_tags), 1) + self.assertTrue(compare_tags(expected_tags[0], result_tags[0])) + + def test_005(self): + length = 16 + src_data = [float(x) for x in range(length)] + expected_result = tuple(src_data + src_data) + src_tags = tuple([make_tag('key', 'val', 0, 'src')]) + expected_tags = tuple([make_tag('key', 'val', 0, 'src'), + make_tag('key', 'val', length, 'src')]) + + src = blocks.vector_source_f(src_data, repeat=True, tags=src_tags) + head = blocks.head(gr.sizeof_float, 2*length) + dst = blocks.vector_sink_f() + + self.tb.connect(src, head, dst) + self.tb.run() + result_data = dst.data() + result_tags = dst.tags() + self.assertEqual(expected_result, result_data) + self.assertEqual(len(result_tags), 2) + self.assertTrue(compare_tags(expected_tags[0], result_tags[0])) + self.assertTrue(compare_tags(expected_tags[1], result_tags[1])) + if __name__ == '__main__': gr_unittest.run(test_vector_sink_source, "test_vector_sink_source.xml") diff --git a/gr-channels/doc/channels.dox b/gr-channels/doc/channels.dox index bb87ed5dc5..7b60c308b7 100644 --- a/gr-channels/doc/channels.dox +++ b/gr-channels/doc/channels.dox @@ -33,16 +33,16 @@ multipath environment. The parameters include: -\li noise_voltage: The AWGN noise level as a voltage (to be calculated +\li <b>noise_voltage</b> The AWGN noise level as a voltage (to be calculated externally to meet, say, a desired SNR). -\li frequency_offset The normalized frequency offset. 0 is no offset; +\li <b>frequency_offset</b> The normalized frequency offset. 0 is no offset; 0.25 would be, for a digital modem, one quarter of the symbol rate. -\li epsilon The sample timing offset to emulate the different rates +\li <b>epsilon</b> The sample timing offset to emulate the different rates between the sample clocks of the transmitter and receiver. 1.0 is no difference. -\li taps Taps of a FIR filter to emulate a multipath delay profile. -\li noise_seed A random number generator seed for the noise source. +\li <b>taps</b> Taps of a FIR filter to emulate a multipath delay profile. +\li <b>noise_seed</b> A random number generator seed for the noise source. \subsection channels_fading Fading Channel Model @@ -55,11 +55,11 @@ in the Doppler frequency shift as a normalized value, a line-of-sight a random seed to the noise generators. These parameters are provided in the documentation as: -\li N The number of sinusiods to use in simulating the channel 8 is a good value -\li fDTs normalized maximum Doppler frequency, fD * Ts -\li LOS include Line-of-Site path? selects between Rayleigh (NLOS) and Rician (LOS) models -\li K Rician factor (ratio of the specular power to the scattered power) -\li seed a random number to seed the noise generators +\li <b>N</b> the number of sinusoids to use in simulating the channel; 8 is a good value +\li <b>fDTs</b> normalized maximum Doppler frequency, fD * Ts +\li <b>LOS</b> include Line-of-Site path? selects between Rayleigh (NLOS) and Rician (LOS) models +\li <b>K</b> Rician factor (ratio of the specular power to the scattered power) +\li <b>seed</b> a random number to seed the noise generators \subsection channels_selective_fading Frequency-Selective Fading Model @@ -73,14 +73,14 @@ and another vector of the corresponding magnitudes of the PDP. We also specify the number of taps in the filter to simulate this. These parameters are provided in the documentation as: -\li N The number of sinusiods to use in simulating the channel 8 is a good value -\li fDTs normalized maximum Doppler frequency, fD * Ts -\li LOS include Line-of-Site path? selects between Rayleigh (NLOS) and Rician (LOS) models -\li K Rician factor (ratio of the specular power to the scattered power) -\li seed a random number to seed the noise generators -\li delays A vector of values the specify the time delay of each impulse -\li mags A vector of values that specifies the magnitude of each impulse -\li ntaps The number of filter taps. +\li <b>N</b> the number of sinusoids to use in simulating the channel; 8 is a good value +\li <b>fDTs</b> normalized maximum Doppler frequency, fD * Ts +\li <b>LOS</b> include Line-of-Site path? selects between Rayleigh (NLOS) and Rician (LOS) models +\li <b>K</b> Rician factor (ratio of the specular power to the scattered power) +\li <b>seed</b> a random number to seed the noise generators +\li <b>delays</b> a vector of values that specify the time delay of each impulse +\li <b>mags</b> a vector of values that specify the magnitude of each impulse +\li <b>ntaps</b> the number of filter taps. \subsection channels_hw_impairments Hardware Impairments Model diff --git a/gr-channels/include/gnuradio/channels/fading_model.h b/gr-channels/include/gnuradio/channels/fading_model.h index 4b1411369a..3d9d500b15 100644 --- a/gr-channels/include/gnuradio/channels/fading_model.h +++ b/gr-channels/include/gnuradio/channels/fading_model.h @@ -47,7 +47,7 @@ namespace gr { /*! \brief Build the channel simulator. * - * \param N The number of sinusiods to use in simulating the channel; 8 is a good value + * \param N the number of sinusoids to use in simulating the channel; 8 is a good value * \param fDTs normalized maximum Doppler frequency, fD * Ts * \param LOS include Line-of-Site path? selects between Rayleigh (NLOS) and Rician (LOS) models * \param K Rician factor (ratio of the specular power to the scattered power) diff --git a/gr-channels/include/gnuradio/channels/selective_fading_model.h b/gr-channels/include/gnuradio/channels/selective_fading_model.h index 5788d8dc09..0296d9376d 100644 --- a/gr-channels/include/gnuradio/channels/selective_fading_model.h +++ b/gr-channels/include/gnuradio/channels/selective_fading_model.h @@ -50,14 +50,14 @@ namespace gr { /*! \brief Build the channel simulator. * - * \param N The number of sinusiods to use in simulating the channel; 8 is a good value + * \param N the number of sinusoids to use in simulating the channel; 8 is a good value * \param fDTs normalized maximum Doppler frequency, fD * Ts * \param LOS include Line-of-Site path? selects between Rayleigh (NLOS) and Rician (LOS) models * \param K Rician factor (ratio of the specular power to the scattered power) * \param seed a random number to seed the noise generators - * \param delays A vector of values the specify the time delay of each impulse - * \param mags A vector of values that specifies the magnitude of each impulse - * \param ntaps The number of filter taps. + * \param delays a vector of values that specify the time delay of each impulse + * \param mags a vector of values that specify the magnitude of each impulse + * \param ntaps the number of filter taps */ static sptr make(unsigned int N, float fDTs, diff --git a/gr-filter/include/gnuradio/filter/pfb_channelizer_ccf.h b/gr-filter/include/gnuradio/filter/pfb_channelizer_ccf.h index 96ffd60daa..b6da9e19f5 100644 --- a/gr-filter/include/gnuradio/filter/pfb_channelizer_ccf.h +++ b/gr-filter/include/gnuradio/filter/pfb_channelizer_ccf.h @@ -165,10 +165,11 @@ namespace gr { /*! * Set the channel map. Channels are numbers as: - * - * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2 - * <------------------- 0 --------------------> - * freq + * <pre> + * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2 + * <------------------- 0 --------------------> + * freq + * </pre> * * So output stream 0 comes from channel 0, etc. Setting a new * channel map allows the user to specify which channel in frequency diff --git a/gr-filter/include/gnuradio/filter/pfb_synthesizer_ccf.h b/gr-filter/include/gnuradio/filter/pfb_synthesizer_ccf.h index 32465b61ac..d0a061fdd3 100644 --- a/gr-filter/include/gnuradio/filter/pfb_synthesizer_ccf.h +++ b/gr-filter/include/gnuradio/filter/pfb_synthesizer_ccf.h @@ -123,9 +123,11 @@ namespace gr { /*! * Set the channel map. Channels are numbers as: - * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2 - * <------------------- 0 --------------------> - * freq + * <pre> + * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2 + * <------------------- 0 --------------------> + * freq + * </pre> * * So input stream 0 goes to channel 0, etc. Setting a new channel * map allows the user to specify where in frequency he/she wants diff --git a/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h index c947892862..8b2ef457fb 100644 --- a/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h @@ -147,6 +147,7 @@ private: double d_start_frequency; double d_stop_frequency; + double d_center_frequency; double d_ymax; double d_ymin; bool d_half_freq; diff --git a/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h index f885deb24f..42f252cf0c 100644 --- a/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h @@ -109,6 +109,7 @@ private: double d_start_frequency; double d_stop_frequency; + double d_center_frequency; int d_xaxis_multiplier; bool d_half_freq; bool d_legend_enabled; diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index 349ce8e1a0..afbd771f0e 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -290,7 +290,7 @@ FrequencyDisplayPlot::setFrequencyRange(const double centerfreq, double startFreq; double stopFreq = (centerfreq + bandwidth/2.0f) / units; if(d_half_freq) - startFreq = 0; + startFreq = centerfreq / units; else startFreq = (centerfreq - bandwidth/2.0f) / units; @@ -303,6 +303,7 @@ FrequencyDisplayPlot::setFrequencyRange(const double centerfreq, if(stopFreq > startFreq) { d_start_frequency = startFreq; d_stop_frequency = stopFreq; + d_center_frequency = centerfreq / units; if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (d_zoomer != NULL)) { double display_units = ceil(log10(units)/2.0); @@ -493,7 +494,7 @@ FrequencyDisplayPlot::setPlotPosHalf(bool half) { d_half_freq = half; if(half) - d_start_frequency = 0; + d_start_frequency = d_center_frequency; } diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc index 8564758175..2f7e96707f 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc @@ -138,7 +138,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent) d_stop_frequency = 1; resize(parent->width(), parent->height()); - d_numPoints = 1024; + d_numPoints = 0; d_half_freq = false; d_legend_enabled = true; @@ -230,7 +230,7 @@ WaterfallDisplayPlot::setFrequencyRange(const double centerfreq, double startFreq; double stopFreq = (centerfreq + bandwidth/2.0f) / units; if(d_half_freq) - startFreq = 0; + startFreq = centerfreq / units; else startFreq = (centerfreq - bandwidth/2.0f) / units; @@ -244,6 +244,7 @@ WaterfallDisplayPlot::setFrequencyRange(const double centerfreq, if(stopFreq > startFreq) { d_start_frequency = startFreq; d_stop_frequency = stopFreq; + d_center_frequency = centerfreq / units; if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (d_zoomer != NULL)) { double display_units = ceil(log10(units)/2.0); @@ -633,7 +634,7 @@ WaterfallDisplayPlot::setPlotPosHalf(bool half) { d_half_freq = half; if(half) - d_start_frequency = 0; + d_start_frequency = d_center_frequency; } |