From f22f9ab1466b99e6f3e897f3867c2ccff4f5a2f5 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Sun, 24 Feb 2013 14:22:17 -0500 Subject: blocks: removed peak_detector2 and regenerate blocks from gnuradio-core. --- .../src/python/gnuradio/gr/qa_regenerate.py | 90 ---------------------- 1 file changed, 90 deletions(-) delete mode 100755 gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py (limited to 'gnuradio-core/src/python') diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py b/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py deleted file mode 100755 index 5aca03b777..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010 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, gr_unittest -import math - -class test_regenerate (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_regen1 (self): - tb = self.tb - - data = [0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - - expected_result = (0, 0, 0, - 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - - - src = gr.vector_source_b(data, False) - regen = gr.regenerate_bb(5, 2) - dst = gr.vector_sink_b() - - tb.connect (src, regen) - tb.connect (regen, dst) - tb.run () - - dst_data = dst.data () - - self.assertEqual (expected_result, dst_data) - - def test_regen2 (self): - tb = self.tb - - data = 200*[0,] - data[9] = 1 - data[99] = 1 - - expected_result = 200*[0,] - expected_result[9] = 1 - expected_result[19] = 1 - expected_result[29] = 1 - expected_result[39] = 1 - - expected_result[99] = 1 - expected_result[109] = 1 - expected_result[119] = 1 - expected_result[129] = 1 - - src = gr.vector_source_b(data, False) - regen = gr.regenerate_bb(10, 3) - dst = gr.vector_sink_b() - - tb.connect (src, regen) - tb.connect (regen, dst) - tb.run () - - dst_data = dst.data () - - self.assertEqual (tuple(expected_result), dst_data) - - -if __name__ == '__main__': - gr_unittest.run(test_regenerate, "test_regenerate.xml") -- cgit v1.2.3 From d858f1402b4fb4e302d0b488eec0e4628b62296d Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Sun, 24 Feb 2013 19:44:25 -0500 Subject: blocks: removing throttle, threshold, stretch from gnuradio-core. --- docs/sphinx/source/gr/index.rst | 2 - docs/sphinx/source/gr/misc_blk.rst | 2 - .../src/examples/ctrlport/pfb_sync_test-qt.grc | 8 +- .../src/examples/ctrlport/pfb_sync_test.grc | 8 +- .../src/examples/mp-sched/affinity_set.py | 7 +- .../src/examples/network/dial_tone_source.py | 3 +- gnuradio-core/src/examples/tags/test_file_tags.py | 3 +- gnuradio-core/src/lib/general/CMakeLists.txt | 3 - gnuradio-core/src/lib/general/general.i | 6 -- gnuradio-core/src/lib/general/gr_stretch_ff.cc | 74 -------------- gnuradio-core/src/lib/general/gr_stretch_ff.h | 60 ----------- gnuradio-core/src/lib/general/gr_stretch_ff.i | 31 ------ gnuradio-core/src/lib/general/gr_threshold_ff.cc | 67 ------------- gnuradio-core/src/lib/general/gr_threshold_ff.h | 59 ----------- gnuradio-core/src/lib/general/gr_threshold_ff.i | 39 -------- gnuradio-core/src/lib/general/gr_throttle.cc | 110 --------------------- gnuradio-core/src/lib/general/gr_throttle.h | 51 ---------- gnuradio-core/src/lib/general/gr_throttle.i | 29 ------ .../src/python/gnuradio/ctrlport/GrDataPlotter.py | 15 +-- gr-analog/python/standard_squelch.py | 2 +- gr-audio/examples/grc/cvsd_sweep.grc | 2 +- .../examples/metadata/file_metadata_source.grc | 12 +-- .../metadata/file_metadata_vector_source.grc | 12 +-- gr-blocks/python/qa_stretch.py | 4 +- gr-channels/examples/channel_tone_response.grc | 8 +- gr-digital/examples/demod/ber_simulation.grc | 8 +- gr-digital/examples/demod/digital_freq_lock.grc | 8 +- gr-digital/examples/demod/dpsk_loopback.grc | 8 +- gr-digital/examples/demod/gfsk_loopback.grc | 8 +- gr-digital/examples/demod/gmsk_loopback.grc | 8 +- gr-digital/examples/demod/mpsk_demod.grc | 10 +- gr-digital/examples/demod/pam_sync.grc | 8 +- gr-digital/examples/demod/pam_timing.grc | 8 +- .../examples/narrowband/benchmark_add_channel.py | 2 +- gr-digital/examples/narrowband/rx_voice.py | 4 +- gr-digital/examples/ofdm/benchmark_add_channel.py | 2 +- gr-digital/python/ofdm_sync_ml.py | 2 +- gr-digital/python/ofdm_sync_pnac.py | 2 +- gr-filter/examples/gr_filtdes_live_upd.py | 3 +- gr-filter/examples/resampler_demo.grc | 64 ++++++------ gr-howto-write-a-block/apps/howto_square.grc | 2 +- gr-howto-write-a-block/apps/howto_square.py | 3 +- gr-howto-write-a-block/apps/howto_square_qt.grc | 12 +-- gr-howto-write-a-block/apps/howto_square_qt.py | 11 ++- gr-noaa/examples/file_rx_hrpt.grc | 2 +- gr-qtgui/apps/grc_qt_example.grc | 8 +- gr-qtgui/apps/qt_digital.py | 3 +- gr-qtgui/examples/pyqt_const_c.py | 2 +- gr-qtgui/examples/pyqt_example_c.py | 2 +- gr-qtgui/examples/pyqt_example_f.py | 2 +- gr-qtgui/examples/pyqt_freq_c.py | 2 +- gr-qtgui/examples/pyqt_freq_f.py | 2 +- gr-qtgui/examples/pyqt_time_c.py | 2 +- gr-qtgui/examples/pyqt_time_f.py | 2 +- gr-qtgui/examples/pyqt_time_raster_b.py | 3 +- gr-qtgui/examples/pyqt_time_raster_f.py | 3 +- gr-qtgui/examples/pyqt_waterfall_c.py | 2 +- gr-qtgui/examples/pyqt_waterfall_f.py | 2 +- .../examples/grc/interference_cancellation.grc | 8 +- gr-trellis/examples/grc/pccc.grc | 8 +- gr-trellis/examples/grc/pccc1.grc | 8 +- gr-trellis/examples/grc/sccc.grc | 8 +- gr-trellis/examples/grc/sccc1.grc | 8 +- gr-wavelet/CMakeLists.txt | 1 + gr-wavelet/lib/CMakeLists.txt | 2 + gr-wavelet/python/CMakeLists.txt | 2 + gr-wavelet/python/qa_classify.py | 3 +- gr-wavelet/swig/CMakeLists.txt | 1 + gr-wxgui/python/fftsink_gl.py | 4 +- gr-wxgui/python/fftsink_nongl.py | 4 +- gr-wxgui/python/histosink_gl.py | 3 +- gr-wxgui/python/numbersink2.py | 4 +- gr-wxgui/python/scopesink_gl.py | 2 +- gr-wxgui/python/scopesink_nongl.py | 3 +- gr-wxgui/python/waterfallsink_gl.py | 5 +- gr-wxgui/python/waterfallsink_nongl.py | 4 +- grc/blocks/block_tree.xml | 3 - grc/blocks/gr_threshold_ff.xml | 40 -------- grc/blocks/gr_throttle.xml | 67 ------------- grc/examples/simple/variable_config.grc | 8 +- grc/examples/xmlrpc/xmlrpc_server.grc | 10 +- 81 files changed, 205 insertions(+), 828 deletions(-) delete mode 100644 gnuradio-core/src/lib/general/gr_stretch_ff.cc delete mode 100644 gnuradio-core/src/lib/general/gr_stretch_ff.h delete mode 100644 gnuradio-core/src/lib/general/gr_stretch_ff.i delete mode 100644 gnuradio-core/src/lib/general/gr_threshold_ff.cc delete mode 100644 gnuradio-core/src/lib/general/gr_threshold_ff.h delete mode 100644 gnuradio-core/src/lib/general/gr_threshold_ff.i delete mode 100644 gnuradio-core/src/lib/general/gr_throttle.cc delete mode 100644 gnuradio-core/src/lib/general/gr_throttle.h delete mode 100644 gnuradio-core/src/lib/general/gr_throttle.i delete mode 100644 grc/blocks/gr_threshold_ff.xml delete mode 100644 grc/blocks/gr_throttle.xml (limited to 'gnuradio-core/src/python') diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index 1617d709bb..9c4f34f93c 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -172,8 +172,6 @@ Miscellaneous Blocks gnuradio.gr.kludge_copy gnuradio.gr.nop gnuradio.gr.pa_2x2_phase_combiner - gnuradio.gr.threshold_ff - gnuradio.gr.throttle gnuradio.gr.channel_model Slicing and Dicing Streams diff --git a/docs/sphinx/source/gr/misc_blk.rst b/docs/sphinx/source/gr/misc_blk.rst index 4c1a0ee551..a4dcc58a2d 100644 --- a/docs/sphinx/source/gr/misc_blk.rst +++ b/docs/sphinx/source/gr/misc_blk.rst @@ -5,6 +5,4 @@ gnuradio.gr: Miscellaneous Blocks .. autooldblock:: gnuradio.gr.kludge_copy .. autooldblock:: gnuradio.gr.nop .. autooldblock:: gnuradio.gr.pa_2x2_phase_combiner -.. autooldblock:: gnuradio.gr.threshold_ff -.. autooldblock:: gnuradio.gr.throttle .. autooldblock:: gnuradio.gr.channel_model diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc index 15452e5399..f19c7303d2 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc @@ -613,10 +613,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -749,7 +749,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_psk_mod_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -798,7 +798,7 @@ </connection> <connection> <source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc index 36238e5c18..20e8e7f7db 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc @@ -558,10 +558,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -624,7 +624,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_psk_mod_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -661,7 +661,7 @@ </connection> <connection> <source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/mp-sched/affinity_set.py b/gnuradio-core/src/examples/mp-sched/affinity_set.py index 6db632e0fa..c1c1a33932 100755 --- a/gnuradio-core/src/examples/mp-sched/affinity_set.py +++ b/gnuradio-core/src/examples/mp-sched/affinity_set.py @@ -6,6 +6,7 @@ from gnuradio import eng_notation from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from optparse import OptionParser @@ -25,7 +26,7 @@ class affinity_set(gr.top_block): # Blocks ################################################## vec_len = 1 - self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*vec_len, samp_rate) + self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*vec_len, samp_rate) self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex*vec_len) self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*vec_len) self.gr_filt_0 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,]) @@ -37,8 +38,8 @@ class affinity_set(gr.top_block): ################################################## # Connections ################################################## - self.connect((self.gr_null_source_0, 0), (self.gr_throttle_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.gr_filt_0, 0)) + self.connect((self.gr_null_source_0, 0), (self.blocks_throttle_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.gr_filt_0, 0)) self.connect((self.gr_filt_0, 0), (self.gr_filt_1, 0)) self.connect((self.gr_filt_1, 0), (self.gr_null_sink_0, 0)) diff --git a/gnuradio-core/src/examples/network/dial_tone_source.py b/gnuradio-core/src/examples/network/dial_tone_source.py index a8d85c4c57..d0d3cc7a8d 100755 --- a/gnuradio-core/src/examples/network/dial_tone_source.py +++ b/gnuradio-core/src/examples/network/dial_tone_source.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import sys @@ -45,7 +46,7 @@ class dial_tone_source(gr.top_block): add = blocks.add_ff() # Throttle needed here to account for the other side's audio card sampling rate - thr = gr.throttle(gr.sizeof_float, sample_rate) + thr = blocks.throttle(gr.sizeof_float, sample_rate) sink = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) self.connect(src0, (add, 0)) self.connect(src1, (add, 1)) diff --git a/gnuradio-core/src/examples/tags/test_file_tags.py b/gnuradio-core/src/examples/tags/test_file_tags.py index 135626d2c6..1dfc9e46cd 100755 --- a/gnuradio-core/src/examples/tags/test_file_tags.py +++ b/gnuradio-core/src/examples/tags/test_file_tags.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys try: @@ -36,7 +37,7 @@ def main(): src = gr.vector_source_s(data, True) trigger = gr.vector_source_s(trig, True) - thr = gr.throttle(gr.sizeof_short, 10e3) + thr = blocks.throttle(gr.sizeof_short, 10e3) ann = gr.annotator_alltoall(1000000, gr.sizeof_short) tagger = gr.burst_tagger(gr.sizeof_short) diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 581d57f8d8..d4287685d9 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -167,10 +167,7 @@ set(gr_core_general_triple_threats gr_random_pdu gr_remez gr_skiphead - gr_stretch_ff gr_test - gr_threshold_ff - gr_throttle gr_transcendental gr_vco_f gr_vector_map diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 64b2816327..36ae0de6f3 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -40,10 +40,8 @@ #include <gr_firdes.h> #include <gr_random_pdu.h> #include <gr_fake_channel_coder_pp.h> -#include <gr_throttle.h> #include <gr_transcendental.h> #include <gr_vco_f.h> -#include <gr_threshold_ff.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> #include <gr_prefs.h> @@ -54,7 +52,6 @@ #include <gr_pack_k_bits_bb.h> #include <gr_feval.h> #include <gr_bin_statistics_f.h> -#include <gr_stretch_ff.h> #include <gr_copy.h> #include <complex_vec_test.h> #include <gr_annotator_alltoall.h> @@ -84,10 +81,8 @@ %include "gr_firdes.i" %include "gr_random_pdu.i" %include "gr_fake_channel_coder_pp.i" -%include "gr_throttle.i" %include "gr_transcendental.i" %include "gr_vco_f.i" -%include "gr_threshold_ff.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" %include "gr_prefs.i" @@ -98,7 +93,6 @@ %include "gr_pack_k_bits_bb.i" %include "gr_feval.i" %include "gr_bin_statistics_f.i" -%include "gr_stretch_ff.i" %include "gr_copy.i" %include "complex_vec_test.i" %include "gr_annotator_alltoall.i" diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.cc b/gnuradio-core/src/lib/general/gr_stretch_ff.cc deleted file mode 100644 index e89eadf8b1..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_stretch_ff.h> -#include <gr_io_signature.h> - -gr_stretch_ff_sptr -gr_make_stretch_ff(float lo, size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_stretch_ff(lo, vlen)); -} - -gr_stretch_ff::gr_stretch_ff(float lo, size_t vlen) - : gr_sync_block("stretch_ff", - gr_make_io_signature(1, 1, vlen * sizeof(float)), - gr_make_io_signature(1, 1, vlen * sizeof(float))), - d_lo(lo), d_vlen(vlen) -{ -} - -int -gr_stretch_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - float vmax = in[0] - d_lo; - - for (unsigned int i = 1; i < d_vlen; i++) { - float vtmp = in[i] - d_lo; - if (vtmp > vmax) - vmax = vtmp; - } - - if (vmax != 0.0) - for (unsigned int i = 0; i < d_vlen; i++) - out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax); - else - for (unsigned int i = 0; i < d_vlen; i++) - out[i] = in[i]; - - in += d_vlen; - out += d_vlen; - } - - return noutput_items; -} - diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.h b/gnuradio-core/src/lib/general/gr_stretch_ff.h deleted file mode 100644 index f592c94a78..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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. - */ - -#ifndef INCLUDED_GR_STRETCH_FF_H_ -# define INCLUDED_GR_STRETCH_FF_H_ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief adjust y-range of an input vector by mapping to range - * (max-of-input, stipulated-min). Primarily for spectral signature - * matching by normalizing spectrum dynamic ranges. - * \ingroup misc_blk - */ - - -class gr_stretch_ff; -typedef boost::shared_ptr<gr_stretch_ff> gr_stretch_ff_sptr; - -GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - -class GR_CORE_API gr_stretch_ff : public gr_sync_block -{ - friend GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - - float d_lo; // the constant - size_t d_vlen; - gr_stretch_ff(float lo, size_t vlen); - - public: - float lo() const { return d_lo; } - void set_lo(float lo) { d_lo = lo; } - size_t vlen() const { return d_vlen; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.i b/gnuradio-core/src/lib/general/gr_stretch_ff.i deleted file mode 100644 index 81366655eb..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,stretch_ff); - -gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - -class gr_stretch_ff : public gr_sync_block -{ -private: - gr_stretch_ff(float lo, size_t vlen); -}; - diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.cc b/gnuradio-core/src/lib/general/gr_threshold_ff.cc deleted file mode 100644 index 952613151f..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_threshold_ff.h> -#include <gr_io_signature.h> - -gr_threshold_ff_sptr -gr_make_threshold_ff (float lo, float hi, float initial_state) -{ - return gnuradio::get_initial_sptr(new gr_threshold_ff (lo, hi, initial_state)); -} - -gr_threshold_ff::gr_threshold_ff (float lo, float hi, float initial_state) - : gr_sync_block ("threshold_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_lo (lo), d_hi (hi), d_last_state (initial_state) -{ -} - -int -gr_threshold_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - - for(int i=0; i<noutput_items; i++) { - if (in[i] > d_hi) { - out[i] = 1.0; - d_last_state = 1.0; - } else if (in[i] < d_lo) { - out[i] = 0.0; - d_last_state = 0.0; - } else - out[i] = d_last_state; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.h b/gnuradio-core/src/lib/general/gr_threshold_ff.h deleted file mode 100644 index 678f8b1d2d..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifndef INCLUDED_GR_THRESHOLD_FF_H -#define INCLUDED_GR_THRESHOLD_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_threshold_ff; -typedef boost::shared_ptr<gr_threshold_ff> gr_threshold_ff_sptr; - -GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); - -/*! - * \brief Please fix my documentation - * \ingroup misc_blk - */ -class GR_CORE_API gr_threshold_ff : public gr_sync_block -{ - friend GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state); - - float d_lo,d_hi; // the constant - float d_last_state; - gr_threshold_ff (float lo, float hi, float initial_state); - - public: - float lo () const { return d_lo; } - void set_lo (float lo) { d_lo = lo; } - float hi () const { return d_hi; } - void set_hi (float hi) { d_hi = hi; } - float last_state () const { return d_last_state; } - void set_last_state (float last_state) { d_last_state = last_state; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.i b/gnuradio-core/src/lib/general/gr_threshold_ff.i deleted file mode 100644 index 7584feea8a..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,threshold_ff); - -gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); - -class gr_threshold_ff : public gr_sync_block -{ - private: - gr_threshold_ff (float lo, float hi, float initial_state); - - public: - float lo () const { return d_lo; } - void set_lo (float lo) { d_lo = lo; } - float hi () const { return d_hi; } - void set_hi (float hi) { d_hi = hi; } - float last_state () const { return d_last_state; } - void set_last_state (float last_state) { d_last_state = last_state; } -}; diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc deleted file mode 100644 index 1c6c8cf893..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_throttle.h> -#include <gr_io_signature.h> -#include <cstring> -#include <boost/thread/thread.hpp> - -class gr_throttle_impl : public gr_throttle{ -public: - gr_throttle_impl(size_t itemsize): - gr_sync_block("throttle", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize) - { - /* NOP */ - } - - double sample_rate(){ - return d_samps_per_us*1e6; - } - - void set_sample_rate(double rate){ - //changing the sample rate performs a reset of state params - d_start = boost::get_system_time(); - d_total_samples = 0; - d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second(); - d_samps_per_us = rate/1e6; - } - - int work ( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - //calculate the expected number of samples to have passed through - boost::system_time now = boost::get_system_time(); - boost::int64_t ticks = (now - d_start).ticks(); - uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks); - - //if the expected samples was less, we need to throttle back - if (d_total_samples > expected_samps){ - boost::this_thread::sleep(boost::posix_time::microseconds( - long((d_total_samples - expected_samps)/d_samps_per_us) - )); - } - - //copy all samples output[i] <= input[i] - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - std::memcpy(out, in, noutput_items * d_itemsize); - d_total_samples += noutput_items; - return noutput_items; - } - -private: - boost::system_time d_start; - size_t d_itemsize; - uint64_t d_total_samples; - double d_samps_per_tick, d_samps_per_us; - - void setup_rpc(){ -#ifdef GR_CTRLPORT - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_throttle_impl, double>( - alias(), "sample_rate", &gr_throttle_impl::sample_rate, - pmt::mp(0.0), pmt::mp(100.0e6), pmt::mp(0.0), - "Hz", "Sample Rate", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_set<gr_throttle_impl, double>( - alias(), "sample_rate", &gr_throttle_impl::set_sample_rate, - pmt::mp(0.0), pmt::mp(100.0e6), pmt::mp(0.0), - "Hz", "Sample Rate", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); -#endif - } -}; - -gr_throttle::sptr -gr_make_throttle(size_t itemsize, double samples_per_sec) -{ - gr_throttle::sptr throttle(new gr_throttle_impl(itemsize)); - throttle->set_sample_rate(samples_per_sec); - return throttle; -} diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h deleted file mode 100644 index 2235ffacf1..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-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. - */ -#ifndef INCLUDED_GR_THROTTLE_H -#define INCLUDED_GR_THROTTLE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief throttle flow of samples such that the average rate does not exceed samples_per_sec. - * \ingroup misc_blk - * - * input: one stream of itemsize; output: one stream of itemsize - * - * N.B. this should only be used in GUI apps where there is no other - * rate limiting block. It is not intended nor effective at precisely - * controlling the rate of samples. That should be controlled by a - * source or sink tied to sample clock. E.g., a USRP or audio card. - */ -class GR_CORE_API gr_throttle : virtual public gr_sync_block -{ -public: - typedef boost::shared_ptr<gr_throttle> sptr; - - //! Sets the sample rate in samples per second - virtual double sample_rate() = 0; - virtual void set_sample_rate(double rate) = 0; -}; - -GR_CORE_API gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec); - -#endif /* INCLUDED_GR_THROTTLE_H */ diff --git a/gnuradio-core/src/lib/general/gr_throttle.i b/gnuradio-core/src/lib/general/gr_throttle.i deleted file mode 100644 index 5ba32de6ed..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.i +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-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 <gr_throttle.h> -%} - -GR_SWIG_BLOCK_MAGIC(gr,throttle); - -%include <gr_throttle.h> diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py index 27858b575b..091f0642c6 100644 --- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py +++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys, time try: @@ -44,7 +45,7 @@ class GrDataPlotterC(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.time_sink_c(self._npts, samp_rate, self._name, 1) self.snk.enable_autoscale(True) @@ -129,7 +130,7 @@ class GrDataPlotterF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.time_sink_f(self._npts, samp_rate, self._name, 1) self.snk.enable_autoscale(True) @@ -207,7 +208,7 @@ class GrDataPlotterConst(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.const_sink_c(self._npts, self._name, 1) self.snk.enable_autoscale(True) @@ -286,7 +287,7 @@ class GrDataPlotterPsdC(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.freq_sink_c(self._fftsize, self._wintype, self._fc, self._samp_rate, self._name, 1) @@ -359,7 +360,7 @@ class GrDataPlotterPsdF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.freq_sink_f(self._fftsize, self._wintype, self._fc, self._samp_rate, self._name, 1) @@ -432,7 +433,7 @@ class GrTimeRasterF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.time_raster_sink_f(samp_rate, self._npts, self._rows, [], [], self._name, 1) @@ -499,7 +500,7 @@ class GrTimeRasterB(gr.top_block): self._data_len = 0 self.src = gr.vector_source_b([]) - self.thr = gr.throttle(gr.sizeof_char, rate) + self.thr = blocks.throttle(gr.sizeof_char, rate) self.snk = qtgui.time_raster_sink_b(samp_rate, self._npts, self._rows, [], [], self._name, 1) diff --git a/gr-analog/python/standard_squelch.py b/gr-analog/python/standard_squelch.py index c1fa406b48..3ed9ebceaa 100644 --- a/gr-analog/python/standard_squelch.py +++ b/gr-analog/python/standard_squelch.py @@ -42,7 +42,7 @@ class standard_squelch(gr.hier_block2): self.sub = blocks.sub_ff(); self.add = blocks.add_ff(); - self.gate = gr.threshold_ff(0.3,0.43,0) + self.gate = blocks.threshold_ff(0.3,0.43,0) self.squelch_lpf = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) self.div = blocks.divide_ff() diff --git a/gr-audio/examples/grc/cvsd_sweep.grc b/gr-audio/examples/grc/cvsd_sweep.grc index c0cd99ba1e..2fb4c4cc7b 100644 --- a/gr-audio/examples/grc/cvsd_sweep.grc +++ b/gr-audio/examples/grc/cvsd_sweep.grc @@ -777,7 +777,7 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> <value>throttle</value> diff --git a/gr-blocks/examples/metadata/file_metadata_source.grc b/gr-blocks/examples/metadata/file_metadata_source.grc index 23757881bc..2ce73c029f 100644 --- a/gr-blocks/examples/metadata/file_metadata_source.grc +++ b/gr-blocks/examples/metadata/file_metadata_source.grc @@ -244,10 +244,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -318,19 +318,19 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>gr_file_sink_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>gr_tag_debug_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>analog_agc2_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -343,7 +343,7 @@ </connection> <connection> <source_block_id>blocks_file_meta_source_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/examples/metadata/file_metadata_vector_source.grc b/gr-blocks/examples/metadata/file_metadata_vector_source.grc index d52257e06d..2d95d4c947 100644 --- a/gr-blocks/examples/metadata/file_metadata_vector_source.grc +++ b/gr-blocks/examples/metadata/file_metadata_vector_source.grc @@ -232,10 +232,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -306,13 +306,13 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>gr_file_sink_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>gr_tag_debug_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -324,14 +324,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>blocks_vector_to_stream_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>blocks_file_meta_source_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/python/qa_stretch.py b/gr-blocks/python/qa_stretch.py index 013d878a8f..078b404dbf 100755 --- a/gr-blocks/python/qa_stretch.py +++ b/gr-blocks/python/qa_stretch.py @@ -43,9 +43,9 @@ class test_stretch(gr_unittest.TestCase): src0 = gr.vector_source_f(data0, False) src1 = gr.vector_source_f(data1, False) - inter = gr.streams_to_vector(gr.sizeof_float, 2) + inter = blocks.streams_to_vector(gr.sizeof_float, 2) op = blocks.stretch_ff(0.1, 2) - deinter = gr.vector_to_streams(gr.sizeof_float, 2) + deinter = blocks.vector_to_streams(gr.sizeof_float, 2) dst0 = gr.vector_sink_f() dst1 = gr.vector_sink_f() diff --git a/gr-channels/examples/channel_tone_response.grc b/gr-channels/examples/channel_tone_response.grc index bd02f6000a..37e2171eb2 100644 --- a/gr-channels/examples/channel_tone_response.grc +++ b/gr-channels/examples/channel_tone_response.grc @@ -216,10 +216,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -748,14 +748,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>channels_fading_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc index 515f7f91f6..b216912a6f 100644 --- a/gr-digital/examples/demod/ber_simulation.grc +++ b/gr-digital/examples/demod/ber_simulation.grc @@ -61,10 +61,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle</value> + <value>blocks_throttle</value> </param> <param> <key>_enabled</key> @@ -648,7 +648,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle</source_block_id> + <source_block_id>blocks_throttle</source_block_id> <sink_block_id>blks2_error_rate</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -667,7 +667,7 @@ </connection> <connection> <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_throttle</sink_block_id> + <sink_block_id>blocks_throttle</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc index 7597e1a0fa..965768ece3 100644 --- a/gr-digital/examples/demod/digital_freq_lock.grc +++ b/gr-digital/examples/demod/digital_freq_lock.grc @@ -771,10 +771,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -876,12 +876,12 @@ </connection> <connection> <source_block_id>digital_psk_mod_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>channels_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-digital/examples/demod/dpsk_loopback.grc b/gr-digital/examples/demod/dpsk_loopback.grc index 7a6b2d293f..9befa69b6c 100644 --- a/gr-digital/examples/demod/dpsk_loopback.grc +++ b/gr-digital/examples/demod/dpsk_loopback.grc @@ -139,10 +139,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0_0</value> + <value>blocks_throttle_0_0</value> </param> <param> <key>_enabled</key> @@ -488,14 +488,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0_0</source_block_id> + <source_block_id>blocks_throttle_0_0</source_block_id> <sink_block_id>blks2_packet_encoder_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> + <sink_block_id>blocks_throttle_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/gfsk_loopback.grc b/gr-digital/examples/demod/gfsk_loopback.grc index 51f5ade77a..179a8102f3 100644 --- a/gr-digital/examples/demod/gfsk_loopback.grc +++ b/gr-digital/examples/demod/gfsk_loopback.grc @@ -310,10 +310,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0_0</value> + <value>blocks_throttle_0_0</value> </param> <param> <key>_enabled</key> @@ -554,7 +554,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0_0</source_block_id> + <source_block_id>blocks_throttle_0_0</source_block_id> <sink_block_id>blks2_packet_encoder_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -579,7 +579,7 @@ </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> + <sink_block_id>blocks_throttle_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/gmsk_loopback.grc b/gr-digital/examples/demod/gmsk_loopback.grc index c4361fbed8..710070e908 100644 --- a/gr-digital/examples/demod/gmsk_loopback.grc +++ b/gr-digital/examples/demod/gmsk_loopback.grc @@ -357,10 +357,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0_0</value> + <value>blocks_throttle_0_0</value> </param> <param> <key>_enabled</key> @@ -540,7 +540,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0_0</source_block_id> + <source_block_id>blocks_throttle_0_0</source_block_id> <sink_block_id>blks2_packet_encoder_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -571,7 +571,7 @@ </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> + <sink_block_id>blocks_throttle_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/mpsk_demod.grc b/gr-digital/examples/demod/mpsk_demod.grc index 61391de545..1045ef5797 100644 --- a/gr-digital/examples/demod/mpsk_demod.grc +++ b/gr-digital/examples/demod/mpsk_demod.grc @@ -385,10 +385,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -523,18 +523,18 @@ </connection> <connection> <source_block_id>channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>qtgui_freq_sink_x_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>qtgui_const_sink_x_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc index 3e7f0b3a82..4785482e3f 100644 --- a/gr-digital/examples/demod/pam_sync.grc +++ b/gr-digital/examples/demod/pam_sync.grc @@ -1124,10 +1124,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -1360,14 +1360,14 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>channels_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>blocks_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc index 3e437a7ccc..632477821a 100644 --- a/gr-digital/examples/demod/pam_timing.grc +++ b/gr-digital/examples/demod/pam_timing.grc @@ -231,10 +231,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -1121,7 +1121,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_pfb_clock_sync_xxx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -1176,7 +1176,7 @@ </connection> <connection> <source_block_id>channels_channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py index 05b55e3755..28824dff4b 100755 --- a/gr-digital/examples/narrowband/benchmark_add_channel.py +++ b/gr-digital/examples/narrowband/benchmark_add_channel.py @@ -43,7 +43,7 @@ class my_top_block(gr.top_block): noise_voltage = math.sqrt(noise_power) self.src = gr.file_source(gr.sizeof_gr_complex, ifile) - #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) + #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate) self.channel = filter.channel_model(noise_voltage, frequency_offset, time_offset, noise_seed=-random.randint(0,100000)) diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py index b1a1b0782e..a9cb0c0702 100755 --- a/gr-digital/examples/narrowband/rx_voice.py +++ b/gr-digital/examples/narrowband/rx_voice.py @@ -82,12 +82,12 @@ class my_top_block(gr.top_block): self.connect(self.source, self.resampler, self.rxpath) elif(options.from_file is not None): - self.thr = gr.throttle(gr.sizeof_gr_complex, options.bitrate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, options.bitrate) self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) self.connect(self.source, self.thr, self.rxpath) else: - self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6) + self.thr = blocks.throttle(gr.sizeof_gr_complex, 1e6) self.source = gr.null_source(gr.sizeof_gr_complex) self.connect(self.source, self.thr, self.rxpath) diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py index 369087b4c1..0d17efd052 100755 --- a/gr-digital/examples/ofdm/benchmark_add_channel.py +++ b/gr-digital/examples/ofdm/benchmark_add_channel.py @@ -45,7 +45,7 @@ class my_top_block(gr.top_block): frequency_offset = options.frequency_offset / options.fft_length self.src = gr.file_source(gr.sizeof_gr_complex, ifile) - #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) + #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate) self.channel = filter.channel_model(noise_voltage, frequency_offset, time_offset, noise_seed=-random.randint(0,100000)) diff --git a/gr-digital/python/ofdm_sync_ml.py b/gr-digital/python/ofdm_sync_ml.py index 895ab767a0..8d81707e30 100644 --- a/gr-digital/python/ofdm_sync_ml.py +++ b/gr-digital/python/ofdm_sync_ml.py @@ -135,7 +135,7 @@ class ofdm_sync_ml(gr.hier_block2): # The output theta of the correlator above is multiplied with this correlation to # identify the proper peak and remove other products in this cross-correlation self.threshold_factor = 0.1 - self.slice = gr.threshold_ff(self.threshold_factor, self.threshold_factor, 0) + self.slice = blocks.threshold_ff(self.threshold_factor, self.threshold_factor, 0) self.f2b = blocks.float_to_char() self.b2f = blocks.char_to_float() self.mul = blocks.multiply_ff() diff --git a/gr-digital/python/ofdm_sync_pnac.py b/gr-digital/python/ofdm_sync_pnac.py index f6627a4aba..7ffe112fb8 100644 --- a/gr-digital/python/ofdm_sync_pnac.py +++ b/gr-digital/python/ofdm_sync_pnac.py @@ -91,7 +91,7 @@ class ofdm_sync_pnac(gr.hier_block2): self.sample_and_hold = gr.sample_and_hold_ff() #ML measurements input to sampler block and detect - self.threshold = gr.threshold_ff(0,0,0) # threshold detection might need to be tweaked + self.threshold = blocks.threshold_ff(0,0,0) # threshold detection might need to be tweaked self.peaks = blocksx.float_to_char() self.connect(self, self.input) diff --git a/gr-filter/examples/gr_filtdes_live_upd.py b/gr-filter/examples/gr_filtdes_live_upd.py index b21e381a46..52985119e0 100755 --- a/gr-filter/examples/gr_filtdes_live_upd.py +++ b/gr-filter/examples/gr_filtdes_live_upd.py @@ -22,6 +22,7 @@ from gnuradio.filter import filter_design from gnuradio import gr, filter +from gnuradio import blocks import sys try: @@ -70,7 +71,7 @@ class my_top_block(gr.top_block): src = blocks.add_cc() channel = channels.channel_model(0.01) self.filt = filter.fft_filter_ccc(1, self.filt_taps) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.freq_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Freq Example", 1) diff --git a/gr-filter/examples/resampler_demo.grc b/gr-filter/examples/resampler_demo.grc index 9c19cd7dcc..62ebdd34cd 100644 --- a/gr-filter/examples/resampler_demo.grc +++ b/gr-filter/examples/resampler_demo.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sat Nov 10 14:47:16 2012</timestamp> + <timestamp>Sun Feb 24 19:43:22 2013</timestamp> <block> <key>options</key> <param> @@ -235,37 +235,6 @@ <value>0</value> </param> </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>throttle</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(227, 493)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> <block> <key>pfb_arb_resampler_xxx</key> <param> @@ -607,6 +576,37 @@ <value>0</value> </param> </block> + <block> + <key>blocks_throttle</key> + <param> + <key>id</key> + <value>throttle</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(227, 492)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <connection> <source_block_id>adder</source_block_id> <sink_block_id>throttle</sink_block_id> diff --git a/gr-howto-write-a-block/apps/howto_square.grc b/gr-howto-write-a-block/apps/howto_square.grc index 98f73774e3..1f3324e4eb 100644 --- a/gr-howto-write-a-block/apps/howto_square.grc +++ b/gr-howto-write-a-block/apps/howto_square.grc @@ -178,7 +178,7 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> <value>thr</value> diff --git a/gr-howto-write-a-block/apps/howto_square.py b/gr-howto-write-a-block/apps/howto_square.py index 0b293b882f..140067b59f 100755 --- a/gr-howto-write-a-block/apps/howto_square.py +++ b/gr-howto-write-a-block/apps/howto_square.py @@ -7,6 +7,7 @@ from gnuradio import eng_notation from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from gnuradio.wxgui import scopesink2 @@ -28,7 +29,7 @@ class howto_square(grc_wxgui.top_block_gui): ################################################## # Blocks ################################################## - self.thr = gr.throttle(gr.sizeof_float*1, samp_rate) + self.thr = blocks.throttle(gr.sizeof_float*1, samp_rate) self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1) self.sqr = howto.square_ff() self.sink2 = scopesink2.scope_sink_f( diff --git a/gr-howto-write-a-block/apps/howto_square_qt.grc b/gr-howto-write-a-block/apps/howto_square_qt.grc index 6281c3a310..c4c72adca0 100644 --- a/gr-howto-write-a-block/apps/howto_square_qt.grc +++ b/gr-howto-write-a-block/apps/howto_square_qt.grc @@ -173,10 +173,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -253,19 +253,19 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>howto_square2_ff_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>howto_square_ff_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>qtgui_time_sink_x_0</sink_block_id> <source_key>0</source_key> <sink_key>1</sink_key> @@ -278,7 +278,7 @@ </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-howto-write-a-block/apps/howto_square_qt.py b/gr-howto-write-a-block/apps/howto_square_qt.py index 986f1c7585..3215ea8ab4 100755 --- a/gr-howto-write-a-block/apps/howto_square_qt.py +++ b/gr-howto-write-a-block/apps/howto_square_qt.py @@ -7,6 +7,7 @@ from PyQt4 import Qt from gnuradio import analog +from gnuradio import blocks from gnuradio import eng_notation from gnuradio import gr from gnuradio import qtgui @@ -59,18 +60,18 @@ class howto_square_qt(gr.top_block, Qt.QWidget): self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.howto_square_ff_0 = howto.square_ff() self.howto_square2_ff_0 = howto.square2_ff() - self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate) + self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate) self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0) ################################################## # Connections ################################################## self.connect((self.howto_square2_ff_0, 0), (self.qtgui_time_sink_x_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.howto_square2_ff_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.howto_square_ff_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.qtgui_time_sink_x_0, 1)) + self.connect((self.blocks_throttle_0, 0), (self.howto_square2_ff_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.howto_square_ff_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.howto_square_ff_0, 0), (self.qtgui_time_sink_x_0, 2)) - self.connect((self.analog_sig_source_x_0, 0), (self.gr_throttle_0, 0)) + self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0)) # QT sink close method reimplementation def closeEvent(self, event): diff --git a/gr-noaa/examples/file_rx_hrpt.grc b/gr-noaa/examples/file_rx_hrpt.grc index 664b200a5f..b8a93d56e3 100644 --- a/gr-noaa/examples/file_rx_hrpt.grc +++ b/gr-noaa/examples/file_rx_hrpt.grc @@ -438,7 +438,7 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> <value>throttle</value> diff --git a/gr-qtgui/apps/grc_qt_example.grc b/gr-qtgui/apps/grc_qt_example.grc index a0c9a0b6ae..320320edcc 100644 --- a/gr-qtgui/apps/grc_qt_example.grc +++ b/gr-qtgui/apps/grc_qt_example.grc @@ -249,10 +249,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -434,7 +434,7 @@ </block> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -445,7 +445,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>channels_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py index d353e0041c..2e8cf2fd66 100755 --- a/gr-qtgui/apps/qt_digital.py +++ b/gr-qtgui/apps/qt_digital.py @@ -21,6 +21,7 @@ # from gnuradio import gr, digital +from gnuradio import blocks from gnuradio import eng_notation import sys @@ -215,7 +216,7 @@ class my_top_block(gr.top_block): self.to = 1.0 self.channel = gr.channel_model(noise, self.fo, self.to) - self.thr = gr.throttle(gr.sizeof_char, self._sample_rate) + self.thr = blocks.throttle(gr.sizeof_char, self._sample_rate) self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, self._sample_rate*self.sps, "Tx", True, True, True, True) diff --git a/gr-qtgui/examples/pyqt_const_c.py b/gr-qtgui/examples/pyqt_const_c.py index e26ce0bd90..3a43bf9a92 100755 --- a/gr-qtgui/examples/pyqt_const_c.py +++ b/gr-qtgui/examples/pyqt_const_c.py @@ -156,7 +156,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.5, 0) src = blocks.add_cc() channel = channels.channel_model(0.001) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.const_sink_c(npts, "Constellation Example", 1) self.connect(src1, (src,0)) diff --git a/gr-qtgui/examples/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py index ccacc246bf..cb708360f1 100755 --- a/gr-qtgui/examples/pyqt_example_c.py +++ b/gr-qtgui/examples/pyqt_example_c.py @@ -160,7 +160,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_cc() channel = channels.channel_model(0.001) - thr = gr.throttle(gr.sizeof_gr_complex, 100*fftsize) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*fftsize) self.snk1 = qtgui.sink_c(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Signal Example", diff --git a/gr-qtgui/examples/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py index f975bf0d1a..5bd582d1e1 100755 --- a/gr-qtgui/examples/pyqt_example_f.py +++ b/gr-qtgui/examples/pyqt_example_f.py @@ -149,7 +149,7 @@ class my_top_block(gr.top_block): src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_ff() - thr = gr.throttle(gr.sizeof_float, 100*fftsize) + thr = blocks.throttle(gr.sizeof_float, 100*fftsize) noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001) add = blocks.add_ff() self.snk1 = qtgui.sink_f(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS, diff --git a/gr-qtgui/examples/pyqt_freq_c.py b/gr-qtgui/examples/pyqt_freq_c.py index 5941622130..7632176878 100755 --- a/gr-qtgui/examples/pyqt_freq_c.py +++ b/gr-qtgui/examples/pyqt_freq_c.py @@ -160,7 +160,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_cc() channel = channels.channel_model(0.01) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.freq_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Freq Example", 3) diff --git a/gr-qtgui/examples/pyqt_freq_f.py b/gr-qtgui/examples/pyqt_freq_f.py index 44d81314a4..668b54d249 100755 --- a/gr-qtgui/examples/pyqt_freq_f.py +++ b/gr-qtgui/examples/pyqt_freq_f.py @@ -150,7 +150,7 @@ class my_top_block(gr.top_block): src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_ff() - thr = gr.throttle(gr.sizeof_float, 100*npts) + thr = blocks.throttle(gr.sizeof_float, 100*npts) self.snk1 = qtgui.freq_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Real freq Example", 3) diff --git a/gr-qtgui/examples/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py index 65d62c4167..ae8ebfc257 100755 --- a/gr-qtgui/examples/pyqt_time_c.py +++ b/gr-qtgui/examples/pyqt_time_c.py @@ -160,7 +160,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_cc() channel = channels.channel_model(0.01) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.time_sink_c(npts, Rs, "Complex Time Example", 1) diff --git a/gr-qtgui/examples/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py index e64d6fcfde..b733a5a809 100755 --- a/gr-qtgui/examples/pyqt_time_f.py +++ b/gr-qtgui/examples/pyqt_time_f.py @@ -149,7 +149,7 @@ class my_top_block(gr.top_block): src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_ff() - thr = gr.throttle(gr.sizeof_float, 100*npts) + thr = blocks.throttle(gr.sizeof_float, 100*npts) noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001) add = blocks.add_ff() self.snk1 = qtgui.time_sink_f(npts, Rs, diff --git a/gr-qtgui/examples/pyqt_time_raster_b.py b/gr-qtgui/examples/pyqt_time_raster_b.py index b9db6e1e8e..b29403819d 100755 --- a/gr-qtgui/examples/pyqt_time_raster_b.py +++ b/gr-qtgui/examples/pyqt_time_raster_b.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys try: @@ -59,7 +60,7 @@ class my_top_block(gr.top_block): fs = 200 src0 = gr.vector_source_b(data0, True) src1 = gr.vector_source_b(data1, True) - thr = gr.throttle(gr.sizeof_char, 50000) + thr = blocks.throttle(gr.sizeof_char, 50000) head = gr.head(gr.sizeof_char, 10000000) self.snk1 = qtgui.time_raster_sink_b(fs, nrows, ncols, [], [], "Time Raster Example", 2) diff --git a/gr-qtgui/examples/pyqt_time_raster_f.py b/gr-qtgui/examples/pyqt_time_raster_f.py index 0b343e6a6e..957e694b38 100755 --- a/gr-qtgui/examples/pyqt_time_raster_f.py +++ b/gr-qtgui/examples/pyqt_time_raster_f.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys try: @@ -59,7 +60,7 @@ class my_top_block(gr.top_block): fs = 200 src0 = gr.vector_source_f(data0, True) src1 = gr.vector_source_f(data1, True) - thr = gr.throttle(gr.sizeof_float, 50000) + thr = blocks.throttle(gr.sizeof_float, 50000) hed = gr.head(gr.sizeof_float, 10000000) self.snk1 = qtgui.time_raster_sink_f(fs, nrows, ncols, [], [], "Float Time Raster Example", 2) diff --git a/gr-qtgui/examples/pyqt_waterfall_c.py b/gr-qtgui/examples/pyqt_waterfall_c.py index 407e8d1bb0..13168e1475 100755 --- a/gr-qtgui/examples/pyqt_waterfall_c.py +++ b/gr-qtgui/examples/pyqt_waterfall_c.py @@ -162,7 +162,7 @@ class my_top_block(gr.top_block): src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_cc() channel = channels.channel_model(0.01) - thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) + thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) filt = filter.fft_filter_ccc(1, taps) self.snk1 = qtgui.waterfall_sink_c(npts, gr.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, diff --git a/gr-qtgui/examples/pyqt_waterfall_f.py b/gr-qtgui/examples/pyqt_waterfall_f.py index 8843f19528..f9680c28cf 100755 --- a/gr-qtgui/examples/pyqt_waterfall_f.py +++ b/gr-qtgui/examples/pyqt_waterfall_f.py @@ -149,7 +149,7 @@ class my_top_block(gr.top_block): src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = blocks.add_ff() - thr = gr.throttle(gr.sizeof_float, 100*npts) + thr = blocks.throttle(gr.sizeof_float, 100*npts) self.snk1 = qtgui.waterfall_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Real Waterfall Example", 2) diff --git a/gr-trellis/examples/grc/interference_cancellation.grc b/gr-trellis/examples/grc/interference_cancellation.grc index 891426660a..29452311c6 100644 --- a/gr-trellis/examples/grc/interference_cancellation.grc +++ b/gr-trellis/examples/grc/interference_cancellation.grc @@ -1507,10 +1507,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -2152,7 +2152,7 @@ </connection> <connection> <source_block_id>trellis_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -2163,7 +2163,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-trellis/examples/grc/pccc.grc b/gr-trellis/examples/grc/pccc.grc index a9f65cf856..359cfefc83 100644 --- a/gr-trellis/examples/grc/pccc.grc +++ b/gr-trellis/examples/grc/pccc.grc @@ -663,10 +663,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -807,7 +807,7 @@ </connection> <connection> <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -830,7 +830,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-trellis/examples/grc/pccc1.grc b/gr-trellis/examples/grc/pccc1.grc index 1bc0e189d0..8f58404794 100644 --- a/gr-trellis/examples/grc/pccc1.grc +++ b/gr-trellis/examples/grc/pccc1.grc @@ -647,10 +647,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -832,7 +832,7 @@ </connection> <connection> <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -849,7 +849,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-trellis/examples/grc/sccc.grc b/gr-trellis/examples/grc/sccc.grc index abfbeb8b81..ee532da9fe 100644 --- a/gr-trellis/examples/grc/sccc.grc +++ b/gr-trellis/examples/grc/sccc.grc @@ -628,10 +628,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -783,7 +783,7 @@ </connection> <connection> <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -824,7 +824,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-trellis/examples/grc/sccc1.grc b/gr-trellis/examples/grc/sccc1.grc index 906ca25389..fa6506ba18 100644 --- a/gr-trellis/examples/grc/sccc1.grc +++ b/gr-trellis/examples/grc/sccc1.grc @@ -647,10 +647,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -802,7 +802,7 @@ </connection> <connection> <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -849,7 +849,7 @@ <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt index 8d7ac65f7b..1eb536f9d9 100644 --- a/gr-wavelet/CMakeLists.txt +++ b/gr-wavelet/CMakeLists.txt @@ -32,6 +32,7 @@ include(GrComponent) GR_REGISTER_COMPONENT("gr-wavelet" ENABLE_GR_WAVELET Boost_FOUND ENABLE_GR_CORE + ENABLE_GR_BLOCKS ENABLE_GR_ANALOG GSL_FOUND ) diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt index e49a5433f3..92f1082660 100644 --- a/gr-wavelet/lib/CMakeLists.txt +++ b/gr-wavelet/lib/CMakeLists.txt @@ -24,6 +24,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${GR_WAVELET_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} ${GNURADIO_CORE_INCLUDE_DIRS} ${GRUEL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} @@ -47,6 +48,7 @@ list(APPEND gr_wavelet_sources list(APPEND wavelet_libs gnuradio-core + gnuradio-blocks ${Boost_LIBRARIES} ${WAVELET_LIBRARIES} ${GSL_LIBRARIES} diff --git a/gr-wavelet/python/CMakeLists.txt b/gr-wavelet/python/CMakeLists.txt index 9234c62bdb..7f7fd99ecf 100644 --- a/gr-wavelet/python/CMakeLists.txt +++ b/gr-wavelet/python/CMakeLists.txt @@ -37,6 +37,8 @@ list(APPEND GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/gr-analog/swig ${CMAKE_BINARY_DIR}/gr-wavelet/python ${CMAKE_BINARY_DIR}/gr-wavelet/swig + ${CMAKE_BINARY_DIR}/gr-blocks/python + ${CMAKE_BINARY_DIR}/gr-blocks/swig ) list(APPEND GR_TEST_TARGET_DEPS gnuradio-wavelet) diff --git a/gr-wavelet/python/qa_classify.py b/gr-wavelet/python/qa_classify.py index 0906761aca..c2972c92f2 100755 --- a/gr-wavelet/python/qa_classify.py +++ b/gr-wavelet/python/qa_classify.py @@ -27,6 +27,7 @@ import copy import math import wavelet_swig import analog_swig as analog +import blocks_swig as blocks def sqr(x): return x*x @@ -88,7 +89,7 @@ class test_classify(gr_unittest.TestCase): trg_data = copy.deepcopy(src_data) src = gr.vector_source_f(src_data, False, len(src_data)) - st = gr.stretch_ff(-1.0/5.0, len(src_data)) + st = blocks.stretch_ff(-1.0/5.0, len(src_data)) dst = gr.vector_sink_f(len(src_data)) self.tb.connect(src, st) self.tb.connect(st, dst) diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt index ea7a24b244..0c78c8936f 100644 --- a/gr-wavelet/swig/CMakeLists.txt +++ b/gr-wavelet/swig/CMakeLists.txt @@ -25,6 +25,7 @@ include(GrSwig) set(GR_SWIG_INCLUDE_DIRS ${GR_WAVELET_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} ${GRUEL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} diff --git a/gr-wxgui/python/fftsink_gl.py b/gr-wxgui/python/fftsink_gl.py index e87b86ec2a..88a5968e2c 100644 --- a/gr-wxgui/python/fftsink_gl.py +++ b/gr-wxgui/python/fftsink_gl.py @@ -169,7 +169,7 @@ class test_app_block (stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) + thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3, @@ -183,7 +183,7 @@ class test_app_block (stdgui2.std_top_block): #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1) src2 = analog.sig_source_f (input_rate, analog.GR_CONST_WAVE, 57.50e3, 1) - thr2 = gr.throttle(gr.sizeof_float, input_rate) + thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2, sample_rate=input_rate, baseband_freq=100e3, ref_level=0, y_per_div=20, y_divs=10) diff --git a/gr-wxgui/python/fftsink_nongl.py b/gr-wxgui/python/fftsink_nongl.py index e9308fd354..d13b296d56 100644 --- a/gr-wxgui/python/fftsink_nongl.py +++ b/gr-wxgui/python/fftsink_nongl.py @@ -613,7 +613,7 @@ class test_app_block (stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) + thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3, @@ -624,7 +624,7 @@ class test_app_block (stdgui2.std_top_block): #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 100*2e3, 1) src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 100*5.75e3, 1) - thr2 = gr.throttle(gr.sizeof_float, input_rate) + thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2, sample_rate=input_rate, baseband_freq=100e3, ref_level=0, y_per_div=20, y_divs=10) diff --git a/gr-wxgui/python/histosink_gl.py b/gr-wxgui/python/histosink_gl.py index 8d90204046..6fa7539aa7 100644 --- a/gr-wxgui/python/histosink_gl.py +++ b/gr-wxgui/python/histosink_gl.py @@ -26,6 +26,7 @@ import histo_window import common from gnuradio import gr from gnuradio import analog +from gnuradio import blocks from pubsub import pubsub from constants import * @@ -97,7 +98,7 @@ class test_app_block (stdgui2.std_top_block): src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1) #src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1) - thr2 = gr.throttle(gr.sizeof_float, input_rate) + thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = histo_sink_f(panel, title="Data", num_bins=31, frame_size=1000) vbox.Add(sink2.win, 1, wx.EXPAND) diff --git a/gr-wxgui/python/numbersink2.py b/gr-wxgui/python/numbersink2.py index 1619b09eb6..395bddbd61 100644 --- a/gr-wxgui/python/numbersink2.py +++ b/gr-wxgui/python/numbersink2.py @@ -149,8 +149,8 @@ class test_app_flow_graph(stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - thr1 = gr.throttle(gr.sizeof_float, input_rate) - thr2 = gr.throttle(gr.sizeof_gr_complex, input_rate) + thr1 = blocks.throttle(gr.sizeof_float, input_rate) + thr2 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = number_sink_f(panel, unit='V',label="Real Data", avg_alpha=0.001, sample_rate=input_rate, minval=-1, maxval=1, diff --git a/gr-wxgui/python/scopesink_gl.py b/gr-wxgui/python/scopesink_gl.py index 647ea60983..7d6cd09ec9 100644 --- a/gr-wxgui/python/scopesink_gl.py +++ b/gr-wxgui/python/scopesink_gl.py @@ -216,7 +216,7 @@ class test_top_block (stdgui2.std_top_block): # We add this throttle block so that this demo doesn't suck down # all the CPU available. You normally wouldn't use it... - self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, input_rate) scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate, v_scale=v_scale, t_scale=t_scale) diff --git a/gr-wxgui/python/scopesink_nongl.py b/gr-wxgui/python/scopesink_nongl.py index 6351daa723..5f44eeca74 100644 --- a/gr-wxgui/python/scopesink_nongl.py +++ b/gr-wxgui/python/scopesink_nongl.py @@ -22,6 +22,7 @@ from gnuradio import gr, gru, eng_notation from gnuradio import analog +from gnuradio import blocks from gnuradio.wxgui import stdgui2 import wx import gnuradio.wxgui.plot as plot @@ -631,7 +632,7 @@ class test_top_block(stdgui2.std_top_block): # We add this throttle block so that this demo doesn't suck down # all the CPU available. You normally wouldn't use it... - self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, input_rate) scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate, frame_decim=frame_decim, diff --git a/gr-wxgui/python/waterfallsink_gl.py b/gr-wxgui/python/waterfallsink_gl.py index 17900a6e4f..dba50ce551 100644 --- a/gr-wxgui/python/waterfallsink_gl.py +++ b/gr-wxgui/python/waterfallsink_gl.py @@ -26,6 +26,7 @@ import waterfall_window import common from gnuradio import gr, fft from gnuradio import analog +from gnuradio import blocks from gnuradio.fft import logpwrfft from pubsub import pubsub from constants import * @@ -150,7 +151,7 @@ class test_top_block(stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) + self.thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) @@ -159,7 +160,7 @@ class test_top_block(stdgui2.std_top_block): # generate a real sinusoid self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000) - self.thr2 = gr.throttle(gr.sizeof_float, input_rate) + self.thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) self.connect(self.src2, self.thr2, sink2) diff --git a/gr-wxgui/python/waterfallsink_nongl.py b/gr-wxgui/python/waterfallsink_nongl.py index 1ff44a88c6..df1534f993 100644 --- a/gr-wxgui/python/waterfallsink_nongl.py +++ b/gr-wxgui/python/waterfallsink_nongl.py @@ -407,7 +407,7 @@ class test_top_block (stdgui2.std_top_block): # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) + self.thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate) sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) @@ -416,7 +416,7 @@ class test_top_block (stdgui2.std_top_block): # generate a real sinusoid self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000) - self.thr2 = gr.throttle(gr.sizeof_float, input_rate) + self.thr2 = blocks.throttle(gr.sizeof_float, input_rate) sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) self.connect(self.src2, self.thr2, sink2) diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index f066af1dc6..c30808bb6b 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -89,7 +89,6 @@ <block>gr_sample_and_hold_xx</block> <block>gr_mute_xx</block> - <block>gr_threshold_ff</block> </cat> <cat> <name>Filters</name> @@ -122,8 +121,6 @@ <block>note</block> <block>import</block> - <block>gr_throttle</block> - <block>blks2_selector</block> <block>blks2_valve</block> <block>blks2_error_rate</block> diff --git a/grc/blocks/gr_threshold_ff.xml b/grc/blocks/gr_threshold_ff.xml deleted file mode 100644 index 740ce5794c..0000000000 --- a/grc/blocks/gr_threshold_ff.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Threshold -################################################### - --> -<block> - <name>Threshold</name> - <key>gr_threshold_ff</key> - <import>from gnuradio import gr</import> - <make>gr.threshold_ff($low, $high, $init)</make> - <callback>set_hi($high)</callback> - <callback>set_lo($low)</callback> - <param> - <name>Low</name> - <key>low</key> - <value>-100</value> - <type>real</type> - </param> - <param> - <name>High</name> - <key>high</key> - <value>100</value> - <type>real</type> - </param> - <param> - <name>Initial State</name> - <key>init</key> - <value>0</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>float</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> -</block> diff --git a/grc/blocks/gr_throttle.xml b/grc/blocks/gr_throttle.xml deleted file mode 100644 index e3a5a2ba19..0000000000 --- a/grc/blocks/gr_throttle.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Throttle -################################################### - --> -<block> - <name>Throttle</name> - <key>gr_throttle</key> - <throttle>1</throttle> - <import>from gnuradio import gr</import> - <make>gr.throttle($type.size*$vlen, $samples_per_second)</make> - <callback>set_sample_rate($samples_per_second)</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Sample Rate</name> - <key>samples_per_second</key> - <value>samp_rate</value> - <type>real</type> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - </source> -</block> diff --git a/grc/examples/simple/variable_config.grc b/grc/examples/simple/variable_config.grc index fc0d2fea6b..0b50b1e5bb 100644 --- a/grc/examples/simple/variable_config.grc +++ b/grc/examples/simple/variable_config.grc @@ -273,10 +273,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -347,14 +347,14 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>wxgui_fftsink2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/grc/examples/xmlrpc/xmlrpc_server.grc b/grc/examples/xmlrpc/xmlrpc_server.grc index ea70ded720..7497117f28 100644 --- a/grc/examples/xmlrpc/xmlrpc_server.grc +++ b/grc/examples/xmlrpc/xmlrpc_server.grc @@ -346,10 +346,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle</value> + <value>blocks_throttle</value> </param> <param> <key>_enabled</key> @@ -420,20 +420,20 @@ </param> </block> <connection> - <source_block_id>gr_throttle</source_block_id> + <source_block_id>blocks_throttle</source_block_id> <sink_block_id>wxgui_scopesink2</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle</source_block_id> + <source_block_id>blocks_throttle</source_block_id> <sink_block_id>wxgui_fftsink2</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>analog_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle</sink_block_id> + <sink_block_id>blocks_throttle</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> -- cgit v1.2.3 From 46bceb9491075c08a3d665dd71ec8a9d70c13e25 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Tue, 26 Feb 2013 14:38:53 -0500 Subject: ctrlport: turn off controlport inside gr-ctrlport-monitor for plotters. --- .../src/python/gnuradio/ctrlport/gr-ctrlport-monitor | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src/python') diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor index 60a810b04e..3f717da5ca 100755 --- a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor +++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,7 +24,7 @@ from gnuradio import gr, ctrlport from PyQt4 import QtCore,Qt import PyQt4.QtGui as QtGui -import sys, time +import os, sys, time import Ice from gnuradio.ctrlport.IceRadioClient import * @@ -83,6 +83,11 @@ class MAINWindow(QtGui.QMainWindow): icon = QtGui.QIcon(ctrlport.__path__[0] + "/icon.png" ) self.setWindowIcon(icon) + # Locally turn off ControlPort export from GR. This prevents + # our GR-based plotters from launching their own ControlPort + # instance (and possibly causing a port collision if one has + # been specified). + os.environ['GR_CONF_CONTROLPORT_ON'] = 'False' def setUpdateRate(self,nur): self.updateRate = int(nur); @@ -631,7 +636,7 @@ class MForm(QtGui.QWidget): self.constupdatediv = 0 self.tableupdatediv = 0 plotsize=250 - + # make table self.table = GrDataPlotterValueTable(uid, self, 0, 0, 400, 200) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) -- cgit v1.2.3 From 7388cc248d523d55e74ebfd4e434cc9d82001949 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Wed, 27 Feb 2013 10:51:56 -0500 Subject: blocks: removing (un)pack_k_bits from gnuradio-core. --- docs/sphinx/source/gr/converter_blk.rst | 1 - docs/sphinx/source/gr/index.rst | 1 - gnuradio-core/src/lib/general/CMakeLists.txt | 2 - gnuradio-core/src/lib/general/general.i | 4 -- gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc | 69 --------------------- gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h | 56 ----------------- gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i | 34 ----------- .../src/lib/general/gr_unpack_k_bits_bb.cc | 70 ---------------------- .../src/lib/general/gr_unpack_k_bits_bb.h | 56 ----------------- .../src/lib/general/gr_unpack_k_bits_bb.i | 34 ----------- .../src/python/gnuradio/gr/qa_pack_k_bits.py | 67 --------------------- .../src/python/gnuradio/gr/qa_unpack_k_bits.py | 57 ------------------ gr-digital/examples/berawgn.py | 2 +- gr-digital/python/generic_mod_demod.py | 14 ++--- gr-digital/python/qa_constellation.py | 2 +- grc/blocks/block_tree.xml | 5 -- grc/blocks/gr_pack_k_bits_bb.xml | 30 ---------- grc/blocks/gr_unpack_k_bits_bb.xml | 25 -------- 18 files changed, 9 insertions(+), 520 deletions(-) delete mode 100644 gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc delete mode 100644 gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h delete mode 100644 gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i delete mode 100644 gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc delete mode 100644 gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h delete mode 100644 gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i delete mode 100755 gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py delete mode 100755 gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py delete mode 100644 grc/blocks/gr_pack_k_bits_bb.xml delete mode 100644 grc/blocks/gr_unpack_k_bits_bb.xml (limited to 'gnuradio-core/src/python') diff --git a/docs/sphinx/source/gr/converter_blk.rst b/docs/sphinx/source/gr/converter_blk.rst index 81d159ece0..be643d2cb1 100644 --- a/docs/sphinx/source/gr/converter_blk.rst +++ b/docs/sphinx/source/gr/converter_blk.rst @@ -8,4 +8,3 @@ gnuradio.gr: Type Conversions .. autooldblock:: gnuradio.gr.complex_to_mag .. autooldblock:: gnuradio.gr.complex_to_mag_squared .. autooldblock:: gnuradio.gr.complex_to_arg -.. autooldblock:: gnuradio.gr.unpack_k_bits_bb diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index 9c4f34f93c..9cba4089fd 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -132,7 +132,6 @@ Type Conversions gnuradio.gr.complex_to_mag gnuradio.gr.complex_to_mag_squared gnuradio.gr.complex_to_arg - gnuradio.gr.unpack_k_bits_bb Signal Level Control (AGC) ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index d38d478e7d..b844cf302c 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -170,8 +170,6 @@ set(gr_core_general_triple_threats gr_test gr_vco_f gr_vector_map - gr_unpack_k_bits_bb - gr_pack_k_bits_bb gr_annotator_alltoall gr_annotator_1to1 gr_annotator_raw diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 1769c1e832..ff4c95631b 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -47,8 +47,6 @@ #include <gr_constants.h> #include <gr_test_types.h> #include <gr_test.h> -#include <gr_unpack_k_bits_bb.h> -#include <gr_pack_k_bits_bb.h> #include <gr_feval.h> #include <gr_bin_statistics_f.h> #include <gr_copy.h> @@ -87,8 +85,6 @@ %include "gr_constants.i" %include "gr_test_types.h" %include "gr_test.i" -%include "gr_unpack_k_bits_bb.i" -%include "gr_pack_k_bits_bb.i" %include "gr_feval.i" %include "gr_bin_statistics_f.i" %include "gr_copy.i" diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc deleted file mode 100644 index 0ea0c9e388..0000000000 --- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pack_k_bits_bb.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb(unsigned k) -{ - return gnuradio::get_initial_sptr(new gr_pack_k_bits_bb(k)); -} - - -gr_pack_k_bits_bb::gr_pack_k_bits_bb (unsigned k) - : gr_sync_decimator("pack_k_bits_bb", - gr_make_io_signature (1, 1, sizeof(unsigned char)), - gr_make_io_signature (1, 1, sizeof(unsigned char)), - k), - d_k (k) -{ - if (d_k == 0) - throw std::out_of_range("interpolation must be > 0"); -} - -gr_pack_k_bits_bb::~gr_pack_k_bits_bb() -{ -} - -int -gr_pack_k_bits_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *)input_items[0]; - unsigned char *out = (unsigned char *)output_items[0]; - - for(int i = 0; i < noutput_items; i++) { - out[i] = 0x00; - for(unsigned int j = 0; j < d_k; j++) { - out[i] |= (0x01 & in[i*d_k+j])<<(d_k-j-1); - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h deleted file mode 100644 index 8e1508c78b..0000000000 --- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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. - */ - -#ifndef INCLUDED_GR_PACK_K_BITS_BB_H -#define INCLUDED_GR_PACK_K_BITS_BB_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_pack_k_bits_bb; -typedef boost::shared_ptr<gr_pack_k_bits_bb> gr_pack_k_bits_bb_sptr; -GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k); - -class gr_pack_k_bits_bb; - -/*! - * \brief Converts a stream of bytes with 1 bit in the LSB to a byte with k relevent bits. - * \ingroup converter_blk - */ -class GR_CORE_API gr_pack_k_bits_bb : public gr_sync_decimator -{ - private: - friend GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k); - - gr_pack_k_bits_bb (unsigned k); - - unsigned d_k; // number of relevent bits to pack from k input bytes - - public: - ~gr_pack_k_bits_bb (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i deleted file mode 100644 index 6ae2095ec7..0000000000 --- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pack_k_bits_bb) - -gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (int k) throw(std::exception); - -class gr_pack_k_bits_bb : public gr_sync_decimator -{ - private: - gr_pack_k_bits_bb (int k); - - public: - ~gr_pack_k_bits_bb (); -}; diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc deleted file mode 100644 index 00b88e9724..0000000000 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 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. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_unpack_k_bits_bb.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k) -{ - return gnuradio::get_initial_sptr(new gr_unpack_k_bits_bb (k)); -} - - -gr_unpack_k_bits_bb::gr_unpack_k_bits_bb (unsigned k) - : gr_sync_interpolator ("unpack_k_bits_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char)), - k), - d_k (k) -{ - if (d_k == 0) - throw std::out_of_range ("interpolation must be > 0"); -} - -gr_unpack_k_bits_bb::~gr_unpack_k_bits_bb () -{ -} - -int -gr_unpack_k_bits_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - int n = 0; - for (unsigned int i = 0; i < noutput_items/d_k; i++){ - unsigned int t = in[i]; - for (int j = d_k - 1; j >= 0; j--) - out[n++] = (t >> j) & 0x01; - } - - assert(n == noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h deleted file mode 100644 index c3ea28d3fa..0000000000 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -#ifndef INCLUDED_GR_UNPACK_K_BITS_BB_H -#define INCLUDED_GR_UNPACK_K_BITS_BB_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_unpack_k_bits_bb; -typedef boost::shared_ptr<gr_unpack_k_bits_bb> gr_unpack_k_bits_bb_sptr; -GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); - -class gr_unpack_k_bits_bb; - -/*! - * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB. - * \ingroup converter_blk - */ -class GR_CORE_API gr_unpack_k_bits_bb : public gr_sync_interpolator -{ - private: - friend GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); - - gr_unpack_k_bits_bb (unsigned k); - - unsigned d_k; // number of relevent bits to unpack into k output bytes - - public: - ~gr_unpack_k_bits_bb (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i deleted file mode 100644 index de0f4b33e7..0000000000 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,unpack_k_bits_bb) - -gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k) throw(std::exception); - -class gr_unpack_k_bits_bb : public gr_sync_interpolator -{ - private: - gr_unpack_k_bits_bb (int k); - - public: - ~gr_unpack_k_bits_bb (); -}; diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py deleted file mode 100755 index 25fc5e9fcc..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2010 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, gr_unittest -import random - -class test_pack(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - - def tearDown(self): - self.tb = None - - def test_001(self): - src_data = (1,0,1,1,0,1,1,0) - expected_results = (1,0,1,1,0,1,1,0) - src = gr.vector_source_b(src_data,False) - op = gr.pack_k_bits_bb(1) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - self.assertEqual(expected_results, dst.data()) - - def test_002(self): - src_data = (1,0,1,1,0,0,0,1) - expected_results = ( 2, 3, 0, 1) - src = gr.vector_source_b(src_data,False) - op = gr.pack_k_bits_bb(2) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - #self.assertEqual(expected_results, dst.data()) - self.assertEqual(expected_results, dst.data()) - - def test_003(self): - src_data = expected_results = map(lambda x: random.randint(0,3), range(10)); - src = gr.vector_source_b( src_data ); - pack = gr.pack_k_bits_bb(2); - unpack = gr.unpack_k_bits_bb(2); - snk = gr.vector_sink_b(); - self.tb.connect(src,unpack,pack,snk); - self.tb.run() - self.assertEqual(list(expected_results), list(snk.data())); - -if __name__ == '__main__': - gr_unittest.run(test_pack, "test_pack.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py deleted file mode 100755 index bb4e7733d4..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2010 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, gr_unittest -import random - -class test_unpack(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - - def tearDown(self): - self.tb = None - - def test_001(self): - src_data = (1,0,1,1,0,1,1,0) - expected_results = (1,0,1,1,0,1,1,0) - src = gr.vector_source_b(src_data,False) - op = gr.unpack_k_bits_bb(1) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - self.assertEqual(expected_results, dst.data()) - - def test_002(self): - src_data = ( 2, 3, 0, 1) - expected_results = (1,0,1,1,0,0,0,1) - src = gr.vector_source_b(src_data,False) - op = gr.unpack_k_bits_bb(2) - dst = gr.vector_sink_b() - self.tb.connect(src, op, dst) - self.tb.run() - self.assertEqual(expected_results, dst.data()) - - -if __name__ == '__main__': - gr_unittest.run(test_unpack, "test_unpack.xml") - diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py index b20b17fd39..6f9679d555 100755 --- a/gr-digital/examples/berawgn.py +++ b/gr-digital/examples/berawgn.py @@ -77,7 +77,7 @@ class BitErrors(gr.hier_block2): intdump_decim = int(N_BITS) self.connect(self, comp, - gr.unpack_k_bits_bb(bits_per_byte), + blocks.unpack_k_bits_bb(bits_per_byte), blocks.uchar_to_float(), blocks.integrate_ff(intdump_decim), blocks.multiply_const_ff(1.0/N_BITS), diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py index a5d1d9eb37..bc00646ccc 100644 --- a/gr-digital/python/generic_mod_demod.py +++ b/gr-digital/python/generic_mod_demod.py @@ -303,7 +303,7 @@ class generic_demod(gr.hier_block2): mod_codes.invert_code(self._constellation.pre_diff_code())) # unpack the k bit vector into a stream of bits - self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol()) + self.unpack = blocks.unpack_k_bits_bb(self.bits_per_symbol()) if verbose: self._print_verbage() @@ -312,14 +312,14 @@ class generic_demod(gr.hier_block2): self._setup_logging() # Connect and Initialize base class - blocks = [self, self.agc, self.freq_recov, - self.time_recov, self.receiver] + self._blocks = [self, self.agc, self.freq_recov, + self.time_recov, self.receiver] if differential: - blocks.append(self.diffdec) + self._blocks.append(self.diffdec) if self.pre_diff_code: - blocks.append(self.symbol_mapper) - blocks += [self.unpack, self] - self.connect(*blocks) + self._blocks.append(self.symbol_mapper) + self._blocks += [self.unpack, self] + self.connect(*self._blocks) def samples_per_symbol(self): return self._samples_per_symbol diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py index 12dbca232f..37112f70a3 100755 --- a/gr-digital/python/qa_constellation.py +++ b/gr-digital/python/qa_constellation.py @@ -206,7 +206,7 @@ class mod_demod(gr.hier_block2): self.blocks.append(digital.map_bb( mod_codes.invert_code(self.constellation.pre_diff_code()))) # unpack the k bit vector into a stream of bits - self.blocks.append(gr.unpack_k_bits_bb( + self.blocks.append(blocks.unpack_k_bits_bb( self.constellation.bits_per_symbol())) # connect to block output check_index = len(self.blocks) diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index a78184dff1..8ddcaac61d 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -68,11 +68,6 @@ <name>Stream Conversions</name> <block>gr_burst_tagger</block> </cat> - <cat> - <name>Misc Conversions</name> - <block>gr_unpack_k_bits_bb</block> - <block>gr_pack_k_bits_bb</block> - </cat> <cat> <name>Synchronizers</name> diff --git a/grc/blocks/gr_pack_k_bits_bb.xml b/grc/blocks/gr_pack_k_bits_bb.xml deleted file mode 100644 index 34e64a5d96..0000000000 --- a/grc/blocks/gr_pack_k_bits_bb.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Pack K Bits -################################################### - --> -<block> - <name>Pack K Bits</name> - <key>gr_pack_k_bits_bb</key> - <import>from gnuradio import gr</import> - <make>gr.pack_k_bits_bb($k)</make> - <param> - <name>K</name> - <key>k</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> - - <doc> - Pack K unpacked bits (one bit per byte) into a single packed byte containing k bits and 8 - k zeros. - </doc> - -</block> diff --git a/grc/blocks/gr_unpack_k_bits_bb.xml b/grc/blocks/gr_unpack_k_bits_bb.xml deleted file mode 100644 index 9917644ab5..0000000000 --- a/grc/blocks/gr_unpack_k_bits_bb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Unpack K Bits -################################################### - --> -<block> - <name>Unpack K Bits</name> - <key>gr_unpack_k_bits_bb</key> - <import>from gnuradio import gr</import> - <make>gr.unpack_k_bits_bb($k)</make> - <param> - <name>K</name> - <key>k</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> -- cgit v1.2.3 From eaedba3fa9969e6579afe986200b128285b3b9c9 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Wed, 27 Feb 2013 17:22:17 -0500 Subject: ctrlport: Allows drag-and-drop from table list to a plotter to add a new curve to the plot. --- .../src/python/gnuradio/ctrlport/GrDataPlotter.py | 672 ++++++++------------- .../python/gnuradio/ctrlport/gr-ctrlport-monitor | 50 +- 2 files changed, 298 insertions(+), 424 deletions(-) (limited to 'gnuradio-core/src/python') diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py index 091f0642c6..1bcf6bf807 100644 --- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py +++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -32,34 +32,68 @@ except ImportError: print "Error: Program requires PyQt4 and gr-qtgui." sys.exit(1) -class GrDataPlotterC(gr.top_block): - def __init__(self, name, rate, pmin=None, pmax=None, stripchart=False): +class GrDataPlotParent(gr.top_block, QtGui.QWidget): + # Setup signals + plotupdated = QtCore.pyqtSignal(QtGui.QWidget) + + def __init__(self, name, rate, pmin=None, pmax=None): gr.top_block.__init__(self) + QtGui.QWidget.__init__(self, None) - self._stripchart = stripchart self._name = name self._npts = 500 - samp_rate = 1.0 + self._rate = rate + self.knobnames = [name,] + + self.layout = QtGui.QVBoxLayout() + self.setLayout(self.layout) + + self.setAcceptDrops(True) - self._last_data = self._npts*[0,] - self._data_len = 0 + def _setup(self, nconnections): + self.stop() + self.wait() - self.src = gr.vector_source_c([]) - self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) - self.snk = qtgui.time_sink_c(self._npts, samp_rate, - self._name, 1) - self.snk.enable_autoscale(True) + if(self.layout.count() > 0): + # Remove and disconnect. Making sure no references to snk + # remain so that the plot gets deleted. + self.layout.removeWidget(self.py_window) + self.disconnect(self.thr, (self.snk, 0)) + self.disconnect(self.src[0], self.thr) + for n in xrange(1, self._ncons): + self.disconnect(self.src[n], (self.snk,n)) - self.connect(self.src, self.thr, (self.snk, 0)) + self._ncons = nconnections + self._data_len = self._ncons*[0,] - self.snk.set_line_label(0, "Real") - self.snk.set_line_label(1, "Imag") + self.thr = blocks.throttle(self._datasize, self._rate) + self.snk = self.get_qtsink() + + self.connect(self.thr, (self.snk, 0)) + + self._last_data = [] + self.src = [] + for n in xrange(self._ncons): + self.set_line_label(n, self.knobnames[n]) + + self._last_data.append(int(self._npts)*[0,]) + self.src.append(self.get_vecsource()) + + if(n == 0): + self.connect(self.src[n], self.thr) + else: + self.connect(self.src[n], (self.snk,n)) self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + self.layout.addWidget(self.py_window) + def __del__(self): pass + def close(self): + self.snk.close() + def qwidget(self): return self.py_window @@ -69,162 +103,162 @@ class GrDataPlotterC(gr.top_block): def semilogy(self, en=True): self.snk.enable_semilogy(en) - def stem(self, en=True): - self.snk.enable_stem_plot(en) + def dragEnterEvent(self, e): + e.acceptProposedAction() + + def dropEvent(self, e): + self.knobnames.append(str(e.mimeData().text())) + + # create a new qwidget plot with the new data stream. + self._setup(len(self.knobnames)) + + # emit that this plot has been updated with a new qwidget. + self.plotupdated.emit(self) + + e.acceptProposedAction() + + def data_to_complex(self, data): + if(self._iscomplex): + data_r = data[0::2] + data_i = data[1::2] + data = [complex(r,i) for r,i in zip(data_r, data_i)] + return data def update(self, data): # Ask GUI if there has been a change in nsamps - npts = self.snk.nsamps() + npts = self.get_npts() if(self._npts != npts): # Adjust buffers to accomodate new settings - if(npts < self._npts): - if(self._data_len < npts): - self._last_data = self._last_data[0:npts] + for n in xrange(self._ncons): + if(npts < self._npts): + if(self._data_len[n] < npts): + self._last_data[n] = self._last_data[n][0:npts] + else: + self._last_data[n] = self._last_data[n][self._data_len[n]-npts:self._data_len[n]] + self._data_len[n] = npts else: - self._last_data = self._last_data[self._data_len-npts:self._data_len] - self._data_len = npts - else: - self._last_data += (npts - self._npts)*[0,] + self._last_data[n] += (npts - self._npts)*[0,] self._npts = npts self.snk.reset() - + if(self._stripchart): # Update the plot data depending on type - if(type(data) == list): - data_r = data[0::2] - data_i = data[1::2] - data = [complex(r,i) for r,i in zip(data_r, data_i)] - if(len(data) > self._npts): - self.src.set_data(data) - self._last_data = data[-self._npts:] - else: - newdata = self._last_data[-(self._npts-len(data)):] - newdata += data - self.src.set_data(newdata) - self._last_data = newdata - - else: # single value update - if(self._data_len < self._npts): - self._last_data[self._data_len] = data - self._data_len += 1 - else: - self._last_data = self._last_data[1:] - self._last_data.append(data) - self.src.set_data(self._last_data) + for n in xrange(self._ncons): + if(type(data[n]) == list): + data[n] = self.data_to_complex(data[n]) + if(len(data[n]) > self._npts): + self.src[n].set_data(data[n]) + self._last_data[n] = data[n][-self._npts:] + else: + newdata = self._last_data[n][-(self._npts-len(data)):] + newdata += data[n] + self.src[n].set_data(newdata) + self._last_data[n] = newdata + + else: # single value update + if(self._iscomplex): + data[n] = complex(data[n][0], data[n][1]) + if(self._data_len[n] < self._npts): + self._last_data[n][self._data_len[n]] = data[n] + self._data_len[n] += 1 + else: + self._last_data[n] = self._last_data[n][1:] + self._last_data[n].append(data[n]) + self.src[n].set_data(self._last_data[n]) else: - if(type(data) != list): - data = [data,] - self.src.set_data(data) + for n in xrange(self._ncons): + if(type(data[n]) != list): + data[n] = [data[n],] + data[n] = self.data_to_complex(data[n]) + self.src[n].set_data(data[n]) + + -class GrDataPlotterF(gr.top_block): +class GrDataPlotterC(GrDataPlotParent): def __init__(self, name, rate, pmin=None, pmax=None, stripchart=False): - gr.top_block.__init__(self) + GrDataPlotParent.__init__(self, name, rate, pmin, pmax) self._stripchart = stripchart - self._name = name - self._npts = 500 - samp_rate = 1.0 + self._datasize = gr.sizeof_gr_complex + self._iscomplex = True - self._last_data = self._npts*[0,] - self._data_len = 0 + self._setup(1) - self.src = gr.vector_source_f([]) - self.thr = blocks.throttle(gr.sizeof_float, rate) - self.snk = qtgui.time_sink_f(self._npts, samp_rate, - self._name, 1) - self.snk.enable_autoscale(True) + def stem(self, en=True): + self.snk.enable_stem_plot(en) - self.connect(self.src, self.thr, (self.snk, 0)) + def get_qtsink(self): + snk = qtgui.time_sink_c(self._npts, 1.0, + self._name, self._ncons) + snk.enable_autoscale(True) + return snk - self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + def get_vecsource(self): + return gr.vector_source_c([]) - def __del__(self): - pass + def get_npts(self): + self._npts = self.snk.nsamps() + return self._npts - def qwidget(self): - return self.py_window + def set_line_label(self, n, name): + self.snk.set_line_label(2*n+0, "Re{" + self.knobnames[n] + "}") + self.snk.set_line_label(2*n+1, "Im{" + self.knobnames[n] + "}") - def name(self): - return self._name - def semilogy(self, en=True): - self.snk.enable_semilogy(en) +class GrDataPlotterF(GrDataPlotParent): + def __init__(self, name, rate, pmin=None, pmax=None, stripchart=False): + GrDataPlotParent.__init__(self, name, rate, pmin, pmax) - def stem(self, en=True): - self.snk.enable_stem_plot(en) + self._stripchart = stripchart + self._datasize = gr.sizeof_float + self._iscomplex = False - def update(self, data): - # Ask GUI if there has been a change in nsamps - npts = self.snk.nsamps() - if(self._npts != npts): + self._setup(1) - # Adjust buffers to accomodate new settings - if(npts < self._npts): - if(self._data_len < npts): - self._last_data = self._last_data[0:npts] - else: - self._last_data = self._last_data[self._data_len-npts:self._data_len] - self._data_len = npts - else: - self._last_data += (npts - self._npts)*[0,] - self._npts = npts - self.snk.reset() + def stem(self, en=True): + self.snk.enable_stem_plot(en) - if(self._stripchart): - # Update the plot data depending on type - if(type(data) == list): - if(len(data) > self._npts): - self.src.set_data(data) - self._last_data = data[-self._npts:] - else: - newdata = self._last_data[-(self._npts-len(data)):] - newdata += data - self.src.set_data(newdata) - self._last_data = newdata - - else: # single value update - if(self._data_len < self._npts): - self._last_data[self._data_len] = data - self._data_len += 1 - else: - self._last_data = self._last_data[1:] - self._last_data.append(data) - self.src.set_data(self._last_data) - else: - if(type(data) != list): - data = [data,] - self.src.set_data(data) + def get_qtsink(self): + snk = qtgui.time_sink_f(self._npts, 1.0, + self._name, self._ncons) + snk.enable_autoscale(True) + return snk + + def get_vecsource(self): + return gr.vector_source_f([]) + + def get_npts(self): + self._npts = self.snk.nsamps() + return self._npts + + def set_line_label(self, n, name): + self.snk.set_line_label(n, self.knobnames[n]) -class GrDataPlotterConst(gr.top_block): + +class GrDataPlotterConst(GrDataPlotParent): def __init__(self, name, rate, pmin=None, pmax=None): - gr.top_block.__init__(self) + GrDataPlotParent.__init__(self, name, rate, pmin, pmax) - self._name = name - self._npts = 500 - samp_rate = 1.0 + self._datasize = gr.sizeof_gr_complex + self._stripchart = False + self._iscomplex = True - self._last_data = self._npts*[0,] - self._data_len = 0 + self._setup(1) - self.src = gr.vector_source_c([]) - self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) - self.snk = qtgui.const_sink_c(self._npts, - self._name, 1) - self.snk.enable_autoscale(True) + def get_qtsink(self): + snk = qtgui.const_sink_c(self._npts, + self._name, + self._ncons) + snk.enable_autoscale(True) + return snk - self.connect(self.src, self.thr, (self.snk, 0)) + def get_vecsource(self): + return gr.vector_source_c([]) - self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) - - def __del__(self): - pass - - def qwidget(self): - return self.py_window - - def name(self): - return self._name + def get_npts(self): + self._npts = self.snk.nsamps() + return self._npts def scatter(self, en=True): if(en): @@ -232,327 +266,133 @@ class GrDataPlotterConst(gr.top_block): else: self.snk.set_line_style(0, 1) - def update(self, data): - # Ask GUI if there has been a change in nsamps - npts = self.snk.nsamps() - if(self._npts != npts): - - # Adjust buffers to accomodate new settings - if(npts < self._npts): - if(self._data_len < npts): - self._last_data = self._last_data[0:npts] - else: - self._last_data = self._last_data[self._data_len-npts:self._data_len] - self._data_len = npts - else: - self._last_data += (npts - self._npts)*[0,] - self._npts = npts - self.snk.reset() - - # Update the plot data depending on type - if(type(data) == list): - data_r = data[0::2] - data_i = data[1::2] - data = [complex(r,i) for r,i in zip(data_r, data_i)] - if(len(data) > self._npts): - self.src.set_data(data) - self._last_data = data[-self._npts:] - else: - newdata = self._last_data[-(self._npts-len(data)):] - newdata += data - self.src.set_data(newdata) - self._last_data = newdata - - else: # single value update - if(self._data_len < self._npts): - self._last_data[self._data_len] = data - self._data_len += 1 - else: - self._last_data = self._last_data[1:] - self._last_data.append(data) - self.src.set_data(self._last_data) + def set_line_label(self, n, name): + self.snk.set_line_label(n, self.knobnames[n]) -class GrDataPlotterPsdC(gr.top_block): +class GrDataPlotterPsdC(GrDataPlotParent): def __init__(self, name, rate, pmin=None, pmax=None): - gr.top_block.__init__(self) + GrDataPlotParent.__init__(self, name, rate, pmin, pmax) - self._name = name - self._samp_rate = 1.0 - self._fftsize = 2048 + self._datasize = gr.sizeof_gr_complex + self._stripchart = True + self._iscomplex = True + + self._npts = 2048 self._wintype = gr.firdes.WIN_BLACKMAN_hARRIS self._fc = 0 - - self._last_data = self._fftsize*[0,] - self._data_len = 0 - - self.src = gr.vector_source_c([]) - self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) - self.snk = qtgui.freq_sink_c(self._fftsize, self._wintype, - self._fc, self._samp_rate, - self._name, 1) - self.snk.enable_autoscale(True) - self.connect(self.src, self.thr, (self.snk, 0)) + self._setup(1) - self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + def get_qtsink(self): + snk = qtgui.freq_sink_c(self._npts, self._wintype, + self._fc, 1.0, + self._name, + self._ncons) + snk.enable_autoscale(True) + return snk - def __del__(self): - pass + def get_vecsource(self): + return gr.vector_source_c([]) - def qwidget(self): - return self.py_window + def get_npts(self): + self._npts = self.snk.fft_size() + return self._npts - def name(self): - return self._name + def set_line_label(self, n, name): + self.snk.set_line_label(n, self.knobnames[n]) - def update(self, data): - # Ask GUI if there has been a change in nsamps - fftsize = self.snk.fft_size() - if(self._fftsize != fftsize): - # Adjust buffers to accomodate new settings - if(fftsize < self._fftsize): - if(self._data_len < fftsize): - self._last_data = self._last_data[0:fftsize] - else: - self._last_data = self._last_data[self._data_len-fftsize:self._data_len] - self._data_len = fftsize - else: - self._last_data += (fftsize - self._fftsize)*[0,] - self._fftsize = fftsize - self.snk.reset() - - # Update the plot data depending on type - if(type(data) == list): - data_r = data[0::2] - data_i = data[1::2] - data = [complex(r,i) for r,i in zip(data_r, data_i)] - if(len(data) > self._fftsize): - self.src.set_data(data) - self._last_data = data[-self._fftsize:] - else: - newdata = self._last_data[-(self._fftsize-len(data)):] - newdata += data - self.src.set_data(newdata) - self._last_data = newdata - - else: # single value update - if(self._data_len < self._fftsize): - self._last_data[self._data_len] = data - self._data_len += 1 - else: - self._last_data = self._last_data[1:] - self._last_data.append(data) - self.src.set_data(self._last_data) - -class GrDataPlotterPsdF(gr.top_block): +class GrDataPlotterPsdF(GrDataPlotParent): def __init__(self, name, rate, pmin=None, pmax=None): - gr.top_block.__init__(self) + GrDataPlotParent.__init__(self, name, rate, pmin, pmax) - self._name = name - self._samp_rate = 1.0 - self._fftsize = 2048 + self._datasize = gr.sizeof_float + self._stripchart = True + self._iscomplex = False + + self._npts = 2048 self._wintype = gr.firdes.WIN_BLACKMAN_hARRIS self._fc = 0 - - self._last_data = self._fftsize*[0,] - self._data_len = 0 - - self.src = gr.vector_source_f([]) - self.thr = blocks.throttle(gr.sizeof_float, rate) - self.snk = qtgui.freq_sink_f(self._fftsize, self._wintype, - self._fc, self._samp_rate, - self._name, 1) - self.snk.enable_autoscale(True) - self.connect(self.src, self.thr, (self.snk, 0)) + self._setup(1) - self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + def get_qtsink(self): + snk = qtgui.freq_sink_f(self._npts, self._wintype, + self._fc, 1.0, + self._name, + self._ncons) + snk.enable_autoscale(True) + return snk - def __del__(self): - pass - - def qwidget(self): - return self.py_window - - def name(self): - return self._name + def get_vecsource(self): + return gr.vector_source_f([]) - def update(self, data): - # Ask GUI if there has been a change in nsamps - fftsize = self.snk.fft_size() - if(self._fftsize != fftsize): + def get_npts(self): + self._npts = self.snk.fft_size() + return self._npts - # Adjust buffers to accomodate new settings - if(fftsize < self._fftsize): - if(self._data_len < fftsize): - self._last_data = self._last_data[0:fftsize] - else: - self._last_data = self._last_data[self._data_len-fftsize:self._data_len] - self._data_len = fftsize - else: - self._last_data += (fftsize - self._fftsize)*[0,] - self._fftsize = fftsize - self.snk.reset() - - # Update the plot data depending on type - if(type(data) == list): - data_r = data[0::2] - data_i = data[1::2] - data = [complex(r,i) for r,i in zip(data_r, data_i)] - if(len(data) > self._fftsize): - self.src.set_data(data) - self._last_data = data[-self._fftsize:] - else: - newdata = self._last_data[-(self._fftsize-len(data)):] - newdata += data - self.src.set_data(newdata) - self._last_data = newdata - - else: # single value update - if(self._data_len < self._fftsize): - self._last_data[self._data_len] = data - self._data_len += 1 - else: - self._last_data = self._last_data[1:] - self._last_data.append(data) - self.src.set_data(self._last_data) + def set_line_label(self, n, name): + self.snk.set_line_label(n, self.knobnames[n]) -class GrTimeRasterF(gr.top_block): +class GrTimeRasterF(GrDataPlotParent): def __init__(self, name, rate, pmin=None, pmax=None): - gr.top_block.__init__(self) - - self._name = name - self._npts = 100 - self._rows = 100 - samp_rate = 1.0 - - self._last_data = self._npts*[0,] - self._data_len = 0 + GrDataPlotParent.__init__(self, name, rate, pmin, pmax) - self.src = gr.vector_source_f([]) - self.thr = blocks.throttle(gr.sizeof_float, rate) - self.snk = qtgui.time_raster_sink_f(samp_rate, self._npts, self._rows, - [], [], self._name, 1) + self._npts = 10 + self._rows = 40 - self.connect(self.src, self.thr, (self.snk, 0)) + self._datasize = gr.sizeof_float + self._stripchart = False + self._iscomplex = False - self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + self._setup(1) - def __del__(self): - pass + def get_qtsink(self): + snk = qtgui.time_raster_sink_f(1.0, self._npts, self._rows, + [], [], self._name, + self._ncons) + return snk - def qwidget(self): - return self.py_window + def get_vecsource(self): + return gr.vector_source_f([]) - def name(self): - return self._name + def get_npts(self): + self._npts = self.snk.num_cols() + return self._npts - def update(self, data): - # Ask GUI if there has been a change in nsamps - npts = int(self.snk.num_cols()) - if(self._npts != npts): - - # Adjust buffers to accomodate new settings - if(npts < self._npts): - if(self._data_len < npts): - self._last_data = self._last_data[0:npts] - else: - self._last_data = self._last_data[self._data_len-npts:self._data_len] - self._data_len = npts - else: - self._last_data += (npts - self._npts)*[0,] - self._npts = npts - self.snk.reset() - - # Update the plot data depending on type - if(type(data) == list): - if(len(data) > self._npts): - self.src.set_data(data) - self._last_data = data[-self._npts:] - else: - newdata = self._last_data[-(self._npts-len(data)):] - newdata += data - self.src.set_data(newdata) - self._last_data = newdata - - else: # single value update - if(self._data_len < self._npts): - self._last_data[self._data_len] = data - self._data_len += 1 - else: - self._last_data = self._last_data[1:] - self._last_data.append(data) - self.src.set_data(self._last_data) + def set_line_label(self, n, name): + self.snk.set_line_label(n, self.knobnames[n]) -class GrTimeRasterB(gr.top_block): +class GrTimeRasterB(GrDataPlotParent): def __init__(self, name, rate, pmin=None, pmax=None): - gr.top_block.__init__(self) - - self._name = name - self._npts = 100 - self._rows = 100 - samp_rate = 1.0 + GrDataPlotParent.__init__(self, name, rate, pmin, pmax) - self._last_data = self._npts*[0,] - self._data_len = 0 + self._npts = 10 + self._rows = 40 - self.src = gr.vector_source_b([]) - self.thr = blocks.throttle(gr.sizeof_char, rate) - self.snk = qtgui.time_raster_sink_b(samp_rate, self._npts, self._rows, - [], [], self._name, 1) + self._datasize = gr.sizeof_char + self._stripchart = False + self._iscomplex = False - self.connect(self.src, self.thr, (self.snk, 0)) + self._setup(1) - self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + def get_qtsink(self): + snk = qtgui.time_raster_sink_b(1.0, self._npts, self._rows, + [], [], self._name, + self._ncons) + return snk - def __del__(self): - pass - - def qwidget(self): - return self.py_window - - def name(self): - return self._name + def get_vecsource(self): + return gr.vector_source_b([]) - def update(self, data): - # Ask GUI if there has been a change in nsamps - npts = self.snk.num_cols() - if(self._npts != npts): + def get_npts(self): + self._npts = self.snk.num_cols() + return self._npts - # Adjust buffers to accomodate new settings - if(npts < self._npts): - if(self._data_len < npts): - self._last_data = self._last_data[0:npts] - else: - self._last_data = self._last_data[self._data_len-npts:self._data_len] - self._data_len = npts - else: - self._last_data += (npts - self._npts)*[0,] - self._npts = npts - self.snk.reset() - - # Update the plot data depending on type - if(type(data) == list): - if(len(data) > self._npts): - self.src.set_data(data) - self._last_data = data[-self._npts:] - else: - newdata = self._last_data[-(self._npts-len(data)):] - newdata += data - self.src.set_data(newdata) - self._last_data = newdata - - else: # single value update - if(self._data_len < self._npts): - self._last_data[self._data_len] = data - self._data_len += 1 - else: - self._last_data = self._last_data[1:] - self._last_data.append(data) - self.src.set_data(self._last_data) + def set_line_label(self, n, name): + self.snk.set_line_label(n, self.knobnames[n]) class GrDataPlotterValueTable: diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor index 3f717da5ca..d5d349a38a 100755 --- a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor +++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor @@ -55,7 +55,7 @@ class MAINWindow(QtGui.QMainWindow): def __init__(self, radio, port, interface): super(MAINWindow, self).__init__() - self.updateRate = 2000; + self.updateRate = 1000; self.conns = [] self.plots = [] self.knobprops = [] @@ -83,7 +83,7 @@ class MAINWindow(QtGui.QMainWindow): icon = QtGui.QIcon(ctrlport.__path__[0] + "/icon.png" ) self.setWindowIcon(icon) - # Locally turn off ControlPort export from GR. This prevents + # Locally turn off ControlPort export from GR. This prevents # our GR-based plotters from launching their own ControlPort # instance (and possibly causing a port collision if one has # been specified). @@ -222,17 +222,44 @@ class MAINWindow(QtGui.QMainWindow): else: self.newPlotPsdC(tag, uid, title) + def startDrag(self, e): + drag = QtGui.QDrag(self) + mime_data = QtCore.QMimeData() + + mime_data.setText(e.text(0)) + drag.setMimeData(mime_data) + + drop = drag.start() + def createPlot(self, plot, uid, title): plot.start() self.plots[uid].append(plot) - self.mdiArea.addSubWindow(plot.qwidget()) - plot.qwidget().setWindowTitle("{0}: {1}".format(title, plot.name())) + self.mdiArea.addSubWindow(plot) + plot.setWindowTitle("{0}: {1}".format(title, plot.name())) self.connect(plot.qwidget(), QtCore.SIGNAL('destroyed(QObject*)'), self.destroyPlot) - plot.qwidget().show() + # when the plot is updated via drag-and-drop, we need to be + # notified of the new qwidget that's created so we can + # properly destroy it. + plot.plotupdated.connect(self.plotUpdated) + + plot.show() + + def plotUpdated(self, q): + # the plot has been updated with a new qwidget; make sure this + # gets dies to the destroyPlot function. + for i, plots in enumerate(self.plots): + for p in plots: + if(p == q): + #plots.remove(p) + #plots.append(q) + self.connect(q.qwidget(), + QtCore.SIGNAL('destroyed(QObject*)'), + self.destroyPlot) + break def destroyPlot(self, obj): for plots in self.plots: @@ -280,7 +307,9 @@ class MAINWindow(QtGui.QMainWindow): def update(self, knobs, uid): #sys.stderr.write("KNOB KEYS: {0}\n".format(knobs.keys())) for plot in self.plots[uid]: - data = knobs[plot.name()].value + data = [] + for n in plot.knobnames: + data.append(knobs[n].value) plot.update(data) plot.stop() plot.wait() @@ -636,7 +665,7 @@ class MForm(QtGui.QWidget): self.constupdatediv = 0 self.tableupdatediv = 0 plotsize=250 - + # make table self.table = GrDataPlotterValueTable(uid, self, 0, 0, 400, 200) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) @@ -644,7 +673,7 @@ class MForm(QtGui.QWidget): self.table.treeWidget.setEditTriggers(QtGui.QAbstractItemView.EditKeyPressed) self.table.treeWidget.setSortingEnabled(True) self.table.treeWidget.setDragEnabled(True) - + # add things to layouts self.horizontalLayout.addWidget(self.table.treeWidget) @@ -662,6 +691,11 @@ class MForm(QtGui.QWidget): QtCore.SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'), self.parent.newSub); + # Allow drag/drop event from table item to plotter + self.connect(self.table.treeWidget, + QtCore.SIGNAL('itemPressed(QTreeWidgetItem*, int)'), + self.parent.startDrag) + def openMenu(self, pos): index = self.table.treeWidget.selectedIndexes() item = self.table.treeWidget.itemFromIndex(index[0]) -- cgit v1.2.3 From ab64b2a5dddf61d2039ab9a36aff84a90a5a713b Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Wed, 27 Feb 2013 18:23:57 -0500 Subject: ctrlport: adding minor protection for dropped data onto plot so we don't just try and plot random stuff. --- .../src/python/gnuradio/ctrlport/GrDataPlotter.py | 22 ++++++++++++++++------ .../python/gnuradio/ctrlport/gr-ctrlport-monitor | 13 ++++++++++++- 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'gnuradio-core/src/python') diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py index 1bcf6bf807..f797271970 100644 --- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py +++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py @@ -107,15 +107,25 @@ class GrDataPlotParent(gr.top_block, QtGui.QWidget): e.acceptProposedAction() def dropEvent(self, e): - self.knobnames.append(str(e.mimeData().text())) + if(e.mimeData().hasFormat("text/plain")): + data = str(e.mimeData().text()) - # create a new qwidget plot with the new data stream. - self._setup(len(self.knobnames)) + #"PlotData:{0}:{1}".format(tag, iscomplex) + datalst = data.split(":::") + tag = datalst[0] + name = datalst[1] + cpx = datalst[2] != "0" - # emit that this plot has been updated with a new qwidget. - self.plotupdated.emit(self) + if(tag == "PlotData" and cpx == self._iscomplex): + self.knobnames.append(name) - e.acceptProposedAction() + # create a new qwidget plot with the new data stream. + self._setup(len(self.knobnames)) + + # emit that this plot has been updated with a new qwidget. + self.plotupdated.emit(self) + + e.acceptProposedAction() def data_to_complex(self, data): if(self._iscomplex): diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor index d5d349a38a..e71cd92ab7 100755 --- a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor +++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor @@ -226,7 +226,18 @@ class MAINWindow(QtGui.QMainWindow): drag = QtGui.QDrag(self) mime_data = QtCore.QMimeData() - mime_data.setText(e.text(0)) + tag = str(e.text(0)) + tree = e.treeWidget().parent() + knobprop = self.knobprops[tree.uid][tag] + disp = knobprop.display + iscomplex = (disp & gr.DISPOPTCPLX) or (disp & gr.DISPXY) + + if(disp != gr.DISPNULL): + data = "PlotData:::{0}:::{1}".format(tag, iscomplex) + else: + data = "OtherData:::{0}:::{1}".format(tag, iscomplex) + + mime_data.setText(data) drag.setMimeData(mime_data) drop = drag.start() -- cgit v1.2.3