[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3859 - in gnuradio/branches/developers/eb/binstats: g
From: |
eb |
Subject: |
[Commit-gnuradio] r3859 - in gnuradio/branches/developers/eb/binstats: gnuradio-core/src/lib/general gnuradio-core/src/python/gnuradio/gr gnuradio-examples/python/usrp |
Date: |
Thu, 26 Oct 2006 02:56:49 -0600 (MDT) |
Author: eb
Date: 2006-10-26 02:56:49 -0600 (Thu, 26 Oct 2006)
New Revision: 3859
Added:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
Modified:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/Makefile.am
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/general.i
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/Makefile.am
gnuradio/branches/developers/eb/binstats/gnuradio-examples/python/usrp/usrp_spectrum_sense.py
Log:
work-in-progress: needs special swig hack
Modified:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/Makefile.am
===================================================================
---
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/Makefile.am
2006-10-25 20:58:17 UTC (rev 3858)
+++
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/Makefile.am
2006-10-26 08:56:49 UTC (rev 3859)
@@ -361,6 +361,7 @@
gr_agc2_cc.i \
gr_agc2_ff.i \
gr_align_on_samplenumbers_ss.i \
+ gr_bin_statistics_f.i \
gr_binary_slicer_fb.i \
gr_bytes_to_syms.i \
gr_char_to_float.i \
Modified:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/general.i
===================================================================
---
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/general.i
2006-10-25 20:58:17 UTC (rev 3858)
+++
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/general.i
2006-10-26 08:56:49 UTC (rev 3859)
@@ -112,6 +112,7 @@
#include <gr_pwr_squelch_ff.h>
#include <gr_ctcss_squelch_ff.h>
#include <gr_feedforward_agc_cc.h>
+#include <gr_bin_statistics_f.h>
%}
%include "gr_sync_block.i"
@@ -205,5 +206,6 @@
%include "gr_pwr_squelch_ff.i"
%include "gr_ctcss_squelch_ff.i"
%include "gr_feedforward_agc_cc.i"
+%include "gr_bin_statistics_f.i"
%include "general_generated.i"
Modified:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc
===================================================================
---
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc
2006-10-25 20:58:17 UTC (rev 3858)
+++
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc
2006-10-26 08:56:49 UTC (rev 3859)
@@ -54,6 +54,7 @@
d_center_freq(0), d_delay(0),
d_max(vlen)
{
+ enter_init();
}
gr_bin_statistics_f::~gr_bin_statistics_f()
@@ -88,7 +89,6 @@
gr_bin_statistics_f::leave_dwell_delay()
{
send_stats();
- enter_tune_delay();
}
int
@@ -163,5 +163,11 @@
void
gr_bin_statistics_f::send_stats()
{
- // FIXME build & send a message
+ 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);
}
Added:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
===================================================================
---
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
(rev 0)
+++
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
2006-10-26 08:56:49 UTC (rev 3859)
@@ -0,0 +1,42 @@
+/* -*- 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 2, 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,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();
+};
Modified:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/Makefile.am
===================================================================
---
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/Makefile.am
2006-10-25 20:58:17 UTC (rev 3858)
+++
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/Makefile.am
2006-10-26 08:56:49 UTC (rev 3859)
@@ -48,6 +48,7 @@
qa_add_v_and_friends.py \
qa_agc.py \
qa_basic_flow_graph.py \
+ qa_bin_statistics.py \
qa_cma_equalizer.py \
qa_complex_to_xxx.py \
qa_constellation_decoder_cb.py \
Added:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
===================================================================
---
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
(rev 0)
+++
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
2006-10-26 08:56:49 UTC (rev 3859)
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+#
+# 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 2, 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
+import struct
+
+class counter(gr.feval_dd):
+ def __init__(self, step_size=1):
+ gr.feval_dd.__init__(self)
+ self.step_size = step_size
+ self.count = 0
+
+ def eval(self, input):
+ #print "eval: self.count =", self.count
+ t = self.count
+ self.count = self.count + self.step_size
+ return t
+
+
+class parse_msg(object):
+ def __init__(self, msg):
+ self.center_freq = msg.arg1()
+ self.vlen = int(msg.arg2())
+ assert(msg.length() == self.vlen * gr.sizeof_float)
+ self.data = struct.unpack('%df' % (self.vlen,), msg.to_string())
+
+
+class test_bin_statistics(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.fg = gr.flow_graph ()
+
+ def tearDown(self):
+ self.fg = None
+
+ def test_001(self):
+ vlen = 4
+ tune = counter(1)
+ #tune = gr.feval_dd()
+ tune_delay = 1
+ dwell_delay = 2
+ msgq = gr.msg_queue()
+
+ src_data = ( 1, 2, 3, 4,
+ 5, 6, 7, 8,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16
+ )
+
+ expected_results = ( 1, 2, 3, 4,
+ 5, 6, 7, 8,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16
+ )
+
+ src = gr.vector_source_f(src_data, False)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vlen)
+ stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
+ self.fg.connect(src, s2v, stats)
+ self.fg.run()
+ #self.assertEqual(4, msgq.count())
+ while not msgq.empty_p():
+ m = parse_msg(msgq.delete_head())
+ print "m =", m.center_freq, m.data
+
+
+if __name__ == '__main__':
+ gr_unittest.main ()
+
Property changes on:
gnuradio/branches/developers/eb/binstats/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
___________________________________________________________________
Name: svn:executable
+ *
Modified:
gnuradio/branches/developers/eb/binstats/gnuradio-examples/python/usrp/usrp_spectrum_sense.py
===================================================================
---
gnuradio/branches/developers/eb/binstats/gnuradio-examples/python/usrp/usrp_spectrum_sense.py
2006-10-25 20:58:17 UTC (rev 3858)
+++
gnuradio/branches/developers/eb/binstats/gnuradio-examples/python/usrp/usrp_spectrum_sense.py
2006-10-26 08:56:49 UTC (rev 3859)
@@ -35,8 +35,8 @@
self.u = usrp.source_c() # usrp is data source
adc_rate = self.u.adc_rate() # 64 MS/s
- #usrp_decim = 8
- usrp_decim = 16
+ usrp_decim = 8
+ #usrp_decim = 16
self.u.set_decim_rate(usrp_decim)
usrp_rate = adc_rate / usrp_decim # 8 MS/s
@@ -58,7 +58,6 @@
c2mag = gr.complex_to_mag(self.fft_size)
#self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
- # FIXME We need to add 3dB to all bins but the DC bin
log = gr.nlog10_ff(20, self.fft_size,
-20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3859 - in gnuradio/branches/developers/eb/binstats: gnuradio-core/src/lib/general gnuradio-core/src/python/gnuradio/gr gnuradio-examples/python/usrp,
eb <=