summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/sphinx/source/gr/index.rst1
-rw-r--r--docs/sphinx/source/gr/sink_blk.rst1
-rw-r--r--gnuradio-core/src/lib/general/CMakeLists.txt1
-rw-r--r--gnuradio-core/src/lib/general/general.i2
-rw-r--r--gnuradio-core/src/lib/general/gr_bin_statistics_f.cc174
-rw-r--r--gnuradio-core/src/lib/general/gr_bin_statistics_f.h100
-rw-r--r--gnuradio-core/src/lib/general/gr_bin_statistics_f.i47
-rwxr-xr-xgr-blocks/python/qa_bin_statistics.py13
-rwxr-xr-xgr-uhd/examples/python/usrp_spectrum_sense.py8
9 files changed, 10 insertions, 337 deletions
diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst
index 3372816eff..b1663a7e23 100644
--- a/docs/sphinx/source/gr/index.rst
+++ b/docs/sphinx/source/gr/index.rst
@@ -39,7 +39,6 @@ Signal Sinks
.. autosummary::
:nosignatures:
- gnuradio.gr.bin_statistics_f
gnuradio.gr.check_counting_s
gnuradio.gr.check_lfsr_32k_s
gnuradio.gr.null_sink
diff --git a/docs/sphinx/source/gr/sink_blk.rst b/docs/sphinx/source/gr/sink_blk.rst
index 1be1130dce..56b29efff9 100644
--- a/docs/sphinx/source/gr/sink_blk.rst
+++ b/docs/sphinx/source/gr/sink_blk.rst
@@ -1,7 +1,6 @@
gnuradio.gr: Signal Sinks
=========================
-.. autooldblock:: gnuradio.gr.bin_statistics_f
.. autooldblock:: gnuradio.gr.check_counting_s
.. autooldblock:: gnuradio.gr.check_lfsr_32k_s
.. autooldblock:: gnuradio.gr.null_sink
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
index bbc6a7612b..bca0583b59 100644
--- a/gnuradio-core/src/lib/general/CMakeLists.txt
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -140,7 +140,6 @@ endif(ENABLE_PYTHON)
set(gr_core_general_triple_threats
complex_vec_test
gr_align_on_samplenumbers_ss
- gr_bin_statistics_f
gr_block_gateway
gr_check_counting_s
gr_check_lfsr_32k_s
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index f7f7942577..2712c4101c 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -43,7 +43,6 @@
#include <gr_test_types.h>
#include <gr_test.h>
#include <gr_feval.h>
-#include <gr_bin_statistics_f.h>
#include <gr_copy.h>
#include <complex_vec_test.h>
#include <gr_annotator_alltoall.h>
@@ -73,7 +72,6 @@
%include "gr_test_types.h"
%include "gr_test.i"
%include "gr_feval.i"
-%include "gr_bin_statistics_f.i"
%include "gr_copy.i"
%include "complex_vec_test.i"
%include "gr_annotator_alltoall.i"
diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc b/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc
deleted file mode 100644
index 3938f2b487..0000000000
--- a/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc
+++ /dev/null
@@ -1,174 +0,0 @@
-/* -*- c++ -*- */
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_bin_statistics_f.h>
-#include <gr_io_signature.h>
-#include <string.h>
-
-gr_bin_statistics_f_sptr
-gr_make_bin_statistics_f(unsigned int vlen,
- gr_msg_queue_sptr msgq,
- gr_feval_dd *tune,
- size_t tune_delay,
- size_t dwell_delay)
-{
- return gnuradio::get_initial_sptr(new gr_bin_statistics_f(vlen,
- msgq,
- tune,
- tune_delay,
- dwell_delay));
-}
-
-gr_bin_statistics_f::gr_bin_statistics_f(unsigned int vlen,
- gr_msg_queue_sptr msgq,
- gr_feval_dd *tune,
- size_t tune_delay,
- size_t dwell_delay)
- : gr_sync_block("bin_statistics_f",
- gr_make_io_signature(1, 1, sizeof(float) * vlen),
- gr_make_io_signature(0, 0, 0)),
- d_vlen(vlen), d_msgq(msgq), d_tune(tune),
- d_tune_delay(tune_delay), d_dwell_delay(dwell_delay),
- d_center_freq(0), d_delay(0),
- d_max(vlen)
-{
- enter_init();
-}
-
-gr_bin_statistics_f::~gr_bin_statistics_f()
-{
- // NOP
-}
-
-void
-gr_bin_statistics_f::enter_init()
-{
- d_state = ST_INIT;
- d_delay = 0;
-}
-
-void
-gr_bin_statistics_f::enter_tune_delay()
-{
- d_state = ST_TUNE_DELAY;
- d_delay = d_tune_delay;
- d_center_freq = d_tune->calleval(0);
-}
-
-void
-gr_bin_statistics_f::enter_dwell_delay()
-{
- d_state = ST_DWELL_DELAY;
- d_delay = d_dwell_delay;
- reset_stats();
-}
-
-void
-gr_bin_statistics_f::leave_dwell_delay()
-{
- send_stats();
-}
-
-int
-gr_bin_statistics_f::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const float *input = (const float *) input_items[0];
- size_t vlen = d_max.size();
-
- int n = 0;
- int t;
-
- while (n < noutput_items){
- switch (d_state){
-
- case ST_INIT:
- enter_tune_delay();
- break;
-
- case ST_TUNE_DELAY:
- t = std::min(noutput_items - n, int(d_delay));
- n += t;
- d_delay -= t;
- assert(d_delay >= 0);
- if (d_delay == 0)
- enter_dwell_delay();
- break;
-
- case ST_DWELL_DELAY:
- t = std::min(noutput_items - n, int(d_delay));
- for (int i = 0; i < t; i++){
- accrue_stats(&input[n * vlen]);
- n++;
- }
- d_delay -= t;
- assert(d_delay >= 0);
- if (d_delay == 0){
- leave_dwell_delay();
- enter_tune_delay();
- }
- break;
-
- default:
- assert(0);
- }
- }
-
- return noutput_items;
-}
-
-//////////////////////////////////////////////////////////////////////////
-// virtual methods for gathering stats
-//////////////////////////////////////////////////////////////////////////
-
-void
-gr_bin_statistics_f::reset_stats()
-{
- for (size_t i = 0; i < vlen(); i++){
- d_max[i] = 0;
- }
-}
-
-void
-gr_bin_statistics_f::accrue_stats(const float *input)
-{
- for (size_t i = 0; i < vlen(); i++){
- d_max[i] = std::max(d_max[i], input[i]); // compute per bin maxima
- }
-}
-
-void
-gr_bin_statistics_f::send_stats()
-{
- if (msgq()->full_p()) // if the queue is full, don't block, drop the data...
- return;
-
- // build & send a message
- gr_message_sptr msg = gr_make_message(0, center_freq(), vlen(), vlen() * sizeof(float));
- memcpy(msg->msg(), &d_max[0], vlen() * sizeof(float));
- msgq()->insert_tail(msg);
-}
diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.h b/gnuradio-core/src/lib/general/gr_bin_statistics_f.h
deleted file mode 100644
index dd10759096..0000000000
--- a/gnuradio-core/src/lib/general/gr_bin_statistics_f.h
+++ /dev/null
@@ -1,100 +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_BIN_STATISTICS_F_H
-#define INCLUDED_GR_BIN_STATISTICS_F_H
-
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-#include <gr_feval.h>
-#include <gr_message.h>
-#include <gr_msg_queue.h>
-
-class gr_bin_statistics_f;
-typedef boost::shared_ptr<gr_bin_statistics_f> gr_bin_statistics_f_sptr;
-
-
-GR_CORE_API gr_bin_statistics_f_sptr
-gr_make_bin_statistics_f(unsigned int vlen, // vector length
- gr_msg_queue_sptr msgq,
- gr_feval_dd *tune, // callback
- size_t tune_delay, // samples
- size_t dwell_delay); // samples
-
-/*!
- * \brief control scanning and record frequency domain statistics
- * \ingroup sink_blk
- */
-class GR_CORE_API gr_bin_statistics_f : public gr_sync_block
-{
- friend GR_CORE_API gr_bin_statistics_f_sptr
- gr_make_bin_statistics_f(unsigned int vlen, // vector length
- gr_msg_queue_sptr msgq,
- gr_feval_dd *tune, // callback
- size_t tune_delay, // samples
- size_t dwell_delay); // samples
-
- enum state_t { ST_INIT, ST_TUNE_DELAY, ST_DWELL_DELAY };
-
- size_t d_vlen;
- gr_msg_queue_sptr d_msgq;
- gr_feval_dd *d_tune;
- size_t d_tune_delay;
- size_t d_dwell_delay;
- double d_center_freq;
-
- state_t d_state;
- size_t d_delay; // nsamples remaining to state transition
-
- gr_bin_statistics_f(unsigned int vlen,
- gr_msg_queue_sptr msgq,
- gr_feval_dd *tune,
- size_t tune_delay,
- size_t dwell_delay);
-
- void enter_init();
- void enter_tune_delay();
- void enter_dwell_delay();
- void leave_dwell_delay();
-
-protected:
- std::vector<float> d_max; // per bin maxima
-
- size_t vlen() const { return d_vlen; }
- double center_freq() const { return d_center_freq; }
- gr_msg_queue_sptr msgq() const { return d_msgq; }
-
- virtual void reset_stats();
- virtual void accrue_stats(const float *input);
- virtual void send_stats();
-
-public:
- ~gr_bin_statistics_f();
-
- 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_bin_statistics_f.i b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
deleted file mode 100644
index 94a3db69a2..0000000000
--- a/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- c++ -*- */
-/*
- * 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 this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-// Directors are only supported in Python, Java and C#. gr_feval_dd uses directors
-#ifdef SWIGPYTHON
-
-GR_SWIG_BLOCK_MAGIC(gr,bin_statistics_f);
-
-gr_bin_statistics_f_sptr
-gr_make_bin_statistics_f(unsigned int vlen, // vector length
- gr_msg_queue_sptr msgq,
- gr_feval_dd *tune, // callback
- size_t tune_delay, // samples
- size_t dwell_delay); // samples
-
-
-class gr_bin_statistics_f : public gr_sync_block
-{
-private:
- gr_bin_statistics_f(unsigned int vlen,
- gr_msg_queue_sptr msgq,
- gr_feval_dd *tune,
- size_t tune_delay,
- size_t dwell_delay);
-public:
- ~gr_bin_statistics_f();
-};
-
-#endif
diff --git a/gr-blocks/python/qa_bin_statistics.py b/gr-blocks/python/qa_bin_statistics.py
index c1b3072530..666f7c0d68 100755
--- a/gr-blocks/python/qa_bin_statistics.py
+++ b/gr-blocks/python/qa_bin_statistics.py
@@ -27,9 +27,8 @@ import struct
"""
Note: There has been an issue with this block in the past, see Issue
-#199. This looks like it might have fixed itself over the years. I am
-leaving these tests disabled on our master branch for v3.6 for now,
-though, just in case. TWR.
+#199. This test is being enabled only on the 'next' branch for version
+v3.7 for now. TWR
"""
class counter(gr.feval_dd):
@@ -100,7 +99,7 @@ class test_bin_statistics(gr_unittest.TestCase):
def tearDown(self):
self.tb = None
- def xtest_001(self):
+ def test_001(self):
vlen = 4
tune = counter(1)
tune_delay = 0
@@ -132,7 +131,7 @@ class test_bin_statistics(gr_unittest.TestCase):
#print "m =", m.center_freq, m.data
self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data)
- def xtest_002(self):
+ def test_002(self):
vlen = 4
tune = counter(1)
tune_delay = 1
@@ -162,7 +161,7 @@ class test_bin_statistics(gr_unittest.TestCase):
- def xtest_003(self):
+ def test_003(self):
vlen = 4
tune = counter3(foobar3, 1)
tune_delay = 1
@@ -194,7 +193,7 @@ class test_bin_statistics(gr_unittest.TestCase):
#print "foobar4: new_t =", new_t
pass
- def xtest_004(self):
+ def test_004(self):
vlen = 4
tune = counter4(self, 1)
tune_delay = 1
diff --git a/gr-uhd/examples/python/usrp_spectrum_sense.py b/gr-uhd/examples/python/usrp_spectrum_sense.py
index 077365a916..39e85ab18a 100755
--- a/gr-uhd/examples/python/usrp_spectrum_sense.py
+++ b/gr-uhd/examples/python/usrp_spectrum_sense.py
@@ -49,7 +49,7 @@ class tune(gr.feval_dd):
def eval(self, ignore):
"""
- This method is called from gr.bin_statistics_f when it wants
+ This method is called from blocks.bin_statistics_f when it wants
to change the center frequency. This method tunes the front
end to the new center frequency, and returns the new frequency
as its result.
@@ -183,9 +183,9 @@ class my_top_block(gr.top_block):
self.msgq = gr.msg_queue(16)
self._tune_callback = tune(self) # hang on to this to keep it from being GC'd
- stats = gr.bin_statistics_f(self.fft_size, self.msgq,
- self._tune_callback, tune_delay,
- dwell_delay)
+ stats = blocks.bin_statistics_f(self.fft_size, self.msgq,
+ self._tune_callback, tune_delay,
+ dwell_delay)
# FIXME leave out the log10 until we speed it up
#self.connect(self.u, s2v, ffter, c2mag, log, stats)