summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/general/Makefile.am9
-rw-r--r--gnuradio-core/src/lib/general/general.i2
-rw-r--r--gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc129
-rw-r--r--gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h86
-rw-r--r--gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i60
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_one_in_n.cc24
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_one_in_n.h1
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc8
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc3
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_refout_cc.cc5
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.cc6
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio.i18
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py8
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py201
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py144
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py150
16 files changed, 590 insertions, 264 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am
index 2a7a4b025..15272dd5c 100644
--- a/gnuradio-core/src/lib/general/Makefile.am
+++ b/gnuradio-core/src/lib/general/Makefile.am
@@ -181,7 +181,8 @@ libgeneral_la_SOURCES = \
gr_probe_density_b.cc \
gr_annotator_alltoall.cc \
gr_annotator_1to1.cc \
- gr_burst_tagger.cc
+ gr_burst_tagger.cc \
+ gr_correlate_access_code_tag_bb.cc
libgeneral_qa_la_SOURCES = \
qa_general.cc \
@@ -355,7 +356,8 @@ grinclude_HEADERS = \
gr_probe_density_b.h \
gr_annotator_alltoall.h \
gr_annotator_1to1.h \
- gr_burst_tagger.h
+ gr_burst_tagger.h \
+ gr_correlate_access_code_tag_bb.h
noinst_HEADERS = \
qa_general.h \
@@ -499,4 +501,5 @@ swiginclude_HEADERS = \
gr_probe_density_b.i \
gr_annotator_alltoall.i \
gr_annotator_1to1.i \
- gr_burst_tagger.i
+ gr_burst_tagger.i \
+ gr_correlate_access_code_tag_bb.i
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index e8a18ab19..fd158cd1f 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -146,6 +146,7 @@
#include <gr_annotator_alltoall.h>
#include <gr_annotator_1to1.h>
#include <gr_burst_tagger.h>
+#include <gr_correlate_access_code_tag_bb.h>
%}
%include "gr_nop.i"
@@ -272,3 +273,4 @@
%include "gr_annotator_alltoall.i"
%include "gr_annotator_1to1.i"
%include "gr_burst_tagger.i"
+%include "gr_correlate_access_code_tag_bb.i"
diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc
new file mode 100644
index 000000000..23311f7a4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc
@@ -0,0 +1,129 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010,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_correlate_access_code_tag_bb.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <gr_count_bits.h>
+#include <cstdio>
+#include <iostream>
+
+#define VERBOSE 0
+
+
+gr_correlate_access_code_tag_bb_sptr
+gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name)
+{
+ return gnuradio::get_initial_sptr(new gr_correlate_access_code_tag_bb (access_code, threshold, tag_name));
+}
+
+
+gr_correlate_access_code_tag_bb::gr_correlate_access_code_tag_bb (
+ const std::string &access_code, int threshold, const std::string &tag_name)
+ : gr_sync_block ("correlate_access_code_tag_bb",
+ gr_make_io_signature (1, 1, sizeof(char)),
+ gr_make_io_signature (1, 1, sizeof(char))),
+ d_data_reg(0), d_mask(0), d_len(0),
+ d_threshold(threshold)
+
+{
+ if (!set_access_code(access_code)){
+ fprintf(stderr, "gr_correlate_access_code_tag_bb: access_code is > 64 bits\n");
+ throw std::out_of_range ("access_code is > 64 bits");
+ }
+
+ std::stringstream str;
+ str << name() << unique_id();
+ d_me = pmt::pmt_string_to_symbol(str.str());
+ d_key = pmt::pmt_string_to_symbol(tag_name);
+}
+
+gr_correlate_access_code_tag_bb::~gr_correlate_access_code_tag_bb ()
+{
+}
+
+bool
+gr_correlate_access_code_tag_bb::set_access_code(
+ const std::string &access_code)
+{
+ d_len = access_code.length(); // # of bytes in string
+ if (d_len > 64)
+ return false;
+
+ // set len top bits to 1.
+ d_mask = ((~0ULL) >> (64 - d_len)) << (64 - d_len);
+
+ d_access_code = 0;
+ for (unsigned i=0; i < 64; i++){
+ d_access_code <<= 1;
+ if (i < d_len)
+ d_access_code |= access_code[i] & 1; // look at LSB only
+ }
+
+ return true;
+}
+
+int
+gr_correlate_access_code_tag_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];
+
+ uint64_t abs_out_sample_cnt = nitems_written(0);
+
+ for (int i = 0; i < noutput_items; i++){
+
+ out[i] = in[i];
+
+ // compute hamming distance between desired access code and current data
+ unsigned long long wrong_bits = 0;
+ unsigned int nwrong = d_threshold+1;
+ int new_flag = 0;
+
+ wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
+ nwrong = gr_count_bits64(wrong_bits);
+
+ // test for access code with up to threshold errors
+ new_flag = (nwrong <= d_threshold);
+
+ // shift in new data and new flag
+ d_data_reg = (d_data_reg << 1) | (in[i] & 0x1);
+ if (new_flag) {
+ if(VERBOSE) std::cout << "writing tag at sample " << abs_out_sample_cnt + i << std::endl;
+ add_item_tag(0, //stream ID
+ abs_out_sample_cnt + i - 64 + d_len, //sample
+ d_key, //frame info
+ pmt::pmt_t(), //data (unused)
+ d_me //block src id
+ );
+ }
+ }
+
+ return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h
new file mode 100644
index 000000000..1067bbc56
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,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_correlate_access_code_tag_bb_H
+#define INCLUDED_gr_correlate_access_code_tag_bb_H
+
+#include <gr_sync_block.h>
+#include <string>
+
+class gr_correlate_access_code_tag_bb;
+typedef boost::shared_ptr<gr_correlate_access_code_tag_bb> gr_correlate_access_code_tag_bb_sptr;
+
+/*!
+ * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
+ * \param threshold maximum number of bits that may be wrong
+ * \param tag_name key of the tag inserted into the tag stream
+ */
+gr_correlate_access_code_tag_bb_sptr
+gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold,
+ const std::string &tag_name);
+
+/*!
+ * \brief Examine input for specified access code, one bit at a time.
+ * \ingroup sync_blk
+ *
+ * input: stream of bits, 1 bit per input byte (data in LSB)
+ * output: unaltered stream of bits (plus tags)
+ *
+ * This block annotates the input stream with tags. The tags have key
+ * name [tag_name], specified in the constructor. Used for searching
+ * an input data stream for preambles, etc.
+ */
+class gr_correlate_access_code_tag_bb : public gr_sync_block
+{
+ friend gr_correlate_access_code_tag_bb_sptr
+ gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold,
+ const std::string &tag_name);
+ private:
+ unsigned long long d_access_code; // access code to locate start of packet
+ // access code is left justified in the word
+ unsigned long long d_data_reg; // used to look for access_code
+ unsigned long long d_mask; // masks access_code bits (top N bits are set where
+ // N is the number of bits in the access code)
+ unsigned int d_threshold; // how many bits may be wrong in sync vector
+ unsigned int d_len; //the length of the access code
+
+ pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID
+
+ protected:
+ gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold,
+ const std::string &tag_name);
+
+ public:
+ ~gr_correlate_access_code_tag_bb();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+
+ /*!
+ * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
+ */
+ bool set_access_code (const std::string &access_code);
+};
+
+#endif /* INCLUDED_gr_correlate_access_code_tag_bb_H */
diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i
new file mode 100644
index 000000000..fb832194d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i
@@ -0,0 +1,60 @@
+/* -*- 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,correlate_access_code_tag_bb);
+
+/*!
+ * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
+ * \param threshold maximum number of bits that may be wrong
+ */
+gr_correlate_access_code_tag_bb_sptr
+gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name)
+ throw(std::out_of_range);
+
+/*!
+ * \brief Examine input for specified access code, one bit at a time.
+ * \ingroup block
+ *
+ * input: stream of bits, 1 bit per input byte (data in LSB)
+ * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit)
+ *
+ * Each output byte contains two valid bits, the data bit, and the
+ * flag bit. The LSB (bit 0) is the data bit, and is the original
+ * input data, delayed 64 bits. Bit 1 is the
+ * flag bit and is 1 if the corresponding data bit is the first data
+ * bit following the access code. Otherwise the flag bit is 0.
+ */
+class gr_correlate_access_code_tag_bb : public gr_sync_block
+{
+ friend gr_correlate_access_code_tag_bb_sptr
+ gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name);
+ protected:
+ gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold, const std::string &tag_name);
+
+ public:
+ ~gr_correlate_access_code_tag_bb();
+
+ /*!
+ * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
+ */
+ bool set_access_code (const std::string &access_code);
+};
diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
index 85495e277..8bccefa95 100644
--- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
+++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
@@ -40,6 +40,12 @@ gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n)
gr_make_io_signature (1, 1, item_size)),
d_count(n)
{
+ // To avoid bad behavior with using set_relative_rate in this block with
+ // VERY large values of n, we will keep track of things ourselves. Using
+ // this to turn off automatic tag propagation, which will be handled
+ // locally in general_work().
+ set_tag_propagation_policy(TPP_DONT);
+
set_n(n);
}
@@ -52,7 +58,10 @@ gr_keep_one_in_n::set_n(int n)
d_n = n;
d_count = n;
- set_relative_rate(1.0 / (float)n);
+ // keep our internal understanding of the relative rate of this block
+ // don't set the relative rate, though, and we will handle our own
+ // tag propagation.
+ d_decim_rate = 1.0/(float)d_n;
}
int
@@ -80,6 +89,19 @@ gr_keep_one_in_n::general_work (int noutput_items,
ni++;
}
+ // Because we have set TPP_DONT, we have to propagate the tags here manually.
+ // Adjustment of the tag sample value is done using the float d_decim_rate.
+ std::vector<pmt::pmt_t> tags;
+ std::vector<pmt::pmt_t>::iterator t;
+ get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+ni);
+ for(t = tags.begin(); t != tags.end(); t++) {
+ uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0));
+ add_item_tag(0, newcount * d_decim_rate,
+ pmt::pmt_tuple_ref(*t, 1),
+ pmt::pmt_tuple_ref(*t, 2),
+ pmt::pmt_tuple_ref(*t, 3));
+ }
+
consume_each (ni);
return no;
}
diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h
index 337827446..ba573618e 100644
--- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h
+++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h
@@ -43,6 +43,7 @@ class gr_keep_one_in_n : public gr_block
int d_n;
int d_count;
+ float d_decim_rate;
protected:
gr_keep_one_in_n (size_t item_size, int n);
diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
index 19ab316a1..1668f71f0 100644
--- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
@@ -99,6 +99,9 @@ gr_pll_carriertracking_cc::work (int noutput_items,
float t_imag, t_real;
for (int i = 0; i < noutput_items; i++){
+ gr_sincosf(d_phase,&t_imag,&t_real);
+ optr[i] = iptr[i] * gr_complex(t_real,-t_imag);
+
error = phase_detector(iptr[i],d_phase);
d_freq = d_freq + d_beta * error;
@@ -108,9 +111,8 @@ gr_pll_carriertracking_cc::work (int noutput_items,
d_freq = d_max_freq;
else if (d_freq < d_min_freq)
d_freq = d_min_freq;
- gr_sincosf(d_phase,&t_imag,&t_real);
- optr[i] = iptr[i] * gr_complex(t_real,-t_imag);
- d_locksig = d_locksig * (1.0 - d_alpha) + d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag);
+ d_locksig = d_locksig * (1.0 - d_alpha) +
+ d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag);
if ((d_squelch_enable) && !lock_detector())
optr[i] = 0;
diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
index 1f17f2afc..997ba4042 100644
--- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
+++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
@@ -80,6 +80,8 @@ gr_pll_freqdet_cf::work (int noutput_items,
int size = noutput_items;
while (size-- > 0) {
+ *optr++ = d_freq;
+
error = phase_detector(*iptr++,d_phase);
d_freq = d_freq + d_beta * error;
@@ -89,7 +91,6 @@ gr_pll_freqdet_cf::work (int noutput_items,
d_freq = d_max_freq;
else if (d_freq < d_min_freq)
d_freq = d_min_freq;
- *optr++ = d_freq;
}
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
index 8a7fbf88b..d01f28e45 100644
--- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
@@ -82,6 +82,9 @@ gr_pll_refout_cc::work (int noutput_items,
int size = noutput_items;
while (size-- > 0) {
+ gr_sincosf(d_phase,&t_imag,&t_real);
+ *optr++ = gr_complex(t_real,t_imag);
+
error = phase_detector(*iptr++,d_phase);
d_freq = d_freq + d_beta * error;
@@ -91,8 +94,6 @@ gr_pll_refout_cc::work (int noutput_items,
d_freq = d_max_freq;
else if (d_freq < d_min_freq)
d_freq = d_min_freq;
- gr_sincosf(d_phase,&t_imag,&t_real);
- *optr++ = gr_complex(t_real,t_imag);
}
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
index 91618bad6..67184b9c5 100644
--- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
@@ -183,7 +183,8 @@ gr_tagged_file_sink::work (int noutput_items,
//std::cout << "Found end of burst: "
// << idx_stop << ", " << N << std::endl;
- int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle);
+ int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize,
+ idx_stop-idx, d_handle);
if (count == 0) {
if(ferror(d_handle)) {
perror("gr_tagged_file_sink: error writing file");
@@ -200,7 +201,8 @@ gr_tagged_file_sink::work (int noutput_items,
}
}
if(d_state == IN_BURST) {
- int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle);
+ int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize,
+ noutput_items-idx, d_handle);
if (count == 0) {
if(ferror(d_handle)) {
perror("gr_tagged_file_sink: error writing file");
diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i
index 1856d5007..e365aeac7 100644
--- a/gnuradio-core/src/lib/swig/gnuradio.i
+++ b/gnuradio-core/src/lib/swig/gnuradio.i
@@ -26,6 +26,24 @@
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
+// Language independent exception handler
+////////////////////////////////////////////////////////////////////////
+%include exception.i
+
+%exception {
+ try {
+ $action
+ }
+ catch(std::exception &e) {
+ SWIG_exception(SWIG_RuntimeError, e.what());
+ }
+ catch(...) {
+ SWIG_exception(SWIG_RuntimeError, "Unknown exception");
+ }
+
+}
+
+////////////////////////////////////////////////////////////////////////
// Headers
%{
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
index 200c4cfbe..6f7fc520f 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
@@ -54,13 +54,13 @@ class _logpwrfft_base(gr.hier_block2):
fft = self._fft_block[0](fft_size, True, fft_window)
window_power = sum(map(lambda x: x*x, fft_window))
- c2mag = gr.complex_to_mag(fft_size)
+ c2magsq = gr.complex_to_mag_squared(fft_size)
self._avg = gr.single_pole_iir_filter_ff(1.0, fft_size)
- self._log = gr.nlog10_ff(20, fft_size,
+ self._log = gr.nlog10_ff(10, fft_size,
-20*math.log10(fft_size) # Adjust for number of bins
-10*math.log10(window_power/fft_size) # Adjust for windowing loss
- -20*math.log10(ref_scale/2)+3.0) # Adjust for reference scale
- self.connect(self, self._sd, fft, c2mag, self._avg, self._log, self)
+ -20*math.log10(ref_scale/2)) # Adjust for reference scale
+ self.connect(self, self._sd, fft, c2magsq, self._avg, self._log, self)
self._average = average
self._avg_alpha = avg_alpha
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
index 8e4a0eefa..47f0ecb22 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
@@ -32,106 +32,106 @@ class test_pll_carriertracking (gr_unittest.TestCase):
self.tb = None
def test_pll_carriertracking (self):
- expected_result = ((1.00000238419+6.47922693275e-09j),
- (0.998399555683+0.0565364062786j),
- (0.994261980057+0.10695001483j),
- (0.98843306303+0.151648163795j),
- (0.981579363346+0.191063538194j),
- (0.974212288857+0.225630432367j),
- (0.966734290123+0.255773901939j),
- (0.959442555904+0.281897842884j),
- (0.952551782131+0.304379671812j),
- (0.946205317974+0.323566257954j),
- (0.940503358841+0.339778244495j),
- (0.935505151749+0.353307723999j),
- (0.931235432625+0.364419162273j),
- (0.927616357803+0.373535633087j),
- (0.924710214138+0.380666583776j),
- (0.922494113445+0.386005342007j),
- (0.92093116045+0.389725029469j),
- (0.919974088669+0.391981720924j),
- (0.919572234154+0.392916500568j),
- (0.919680893421+0.392660915852j),
- (0.920248389244+0.39133310318j),
- (0.921222627163+0.389039844275j),
- (0.922548472881+0.385877460241j),
- (0.924184799194+0.381939411163j),
- (0.926086127758+0.377309292555j),
- (0.928135097027+0.37224984169j),
- (0.930293083191+0.366814315319j),
- (0.932614028454+0.360868781805j),
- (0.935064375401+0.354473829269j),
- (0.937613248825+0.347684770823j),
- (0.940225422382+0.340550601482j),
- (0.942881464958+0.33312189579j),
- (0.945559620857+0.325443327427j),
- (0.948240220547+0.31755694747j),
- (0.950899422169+0.309499144554j),
- (0.953524827957+0.301307469606j),
- (0.956105649471+0.293015599251j),
- (0.958630502224+0.284654557705j),
- (0.96103054285+0.276443749666j),
- (0.963361799717+0.26819768548j),
- (0.965623259544+0.259936869144j),
- (0.967810571194+0.251679092646j),
- (0.969916880131+0.243440493941j),
- (0.971936583519+0.235235646367j),
- (0.97387367487+0.227080151439j),
- (0.975726902485+0.218987599015j),
- (0.977494239807+0.210969462991j),
- (0.979169845581+0.203035995364j),
- (0.980761289597+0.195199295878j),
- (0.982269346714+0.187469303608j),
- (0.983659446239+0.180052131414j),
- (0.984931468964+0.1729388237j),
- (0.986136198044+0.165923252702j),
- (0.987275123596+0.159012272954j),
- (0.988349795341+0.15221118927j),
- (0.989354014397+0.145524248481j),
- (0.990296065807+0.138957872987j),
- (0.991178870201+0.132516458631j),
- (0.992005050182+0.126204773784j),
- (0.992770493031+0.120025672019j),
- (0.993480443954+0.113984130323j),
- (0.994139909744+0.108083210886j),
- (0.994751393795+0.102326385677j),
- (0.995293080807+0.0969148278236j),
- (0.995791256428+0.091630294919j),
- (0.996252119541+0.0864710733294j),
- (0.996678769588+0.0814334899187j),
- (0.997069239616+0.0765165910125j),
- (0.997423350811+0.071716658771j),
- (0.997748315334+0.0670333206654j),
- (0.998046517372+0.0624645166099j),
- (0.998317599297+0.058009263128j),
- (0.998557567596+0.053665690124j),
- (0.998775064945+0.0494344644248j),
- (0.998971700668+0.0453144386411j),
- (0.999140620232+0.0415064357221j),
- (0.99927687645+0.0379924885929j),
- (0.999400436878+0.0345549099147j),
- (0.999511957169+0.0311931278557j),
- (0.99961233139+0.0279070306569j),
- (0.999694347382+0.0246965941042j),
- (0.999765276909+0.0215622838587j),
- (0.999826848507+0.0185046810657j),
- (0.999880313873+0.0155246723443j),
- (0.999920129776+0.0126227736473j),
- (0.999949812889+0.00980060640723j),
- (0.99997317791+0.00705910893157j),
- (0.999990820885+0.00439921114594j),
- (0.999998450279+0.00202245195396j),
- (0.999998092651-0.00029227725463j),
- (0.999994516373-0.00254815118387j),
- (0.999988794327-0.00474932929501j),
- (0.999977111816-0.00689708162099j),
- (0.999957799911-0.00899503659457j),
- (0.999936699867-0.0110441967845j),
- (0.999914228916-0.0130464555696j),
- (0.999889075756-0.0150024276227j),
- (0.999855577946-0.0169130507857j),
- (0.999821305275-0.0187777336687j),
- (0.999786794186-0.0205969288945j))
+ expected_result = ((1.00000238419+7.21919457547e-09j),
+ (0.998025715351+0.062790453434j),
+ (0.992878139019+0.119114711881j),
+ (0.985585451126+0.16916936636j),
+ (0.976963579655+0.21341380477j),
+ (0.967643141747+0.252319812775j),
+ (0.958120942116+0.286356031895j),
+ (0.948766887188+0.315971136093j),
+ (0.939851403236+0.341586351395j),
+ (0.931558966637+0.363589793444j),
+ (0.924019515514+0.382339715958j),
+ (0.917312920094+0.398162424564j),
+ (0.9114767313+0.411352336407j),
+ (0.906515955925+0.422172755003j),
+ (0.902329206467+0.431043088436j),
+ (0.8989828825+0.437978446484j),
+ (0.896438419819+0.443168222904j),
+ (0.894643902779+0.446782171726j),
+ (0.893543541431+0.448972672224j),
+ (0.893085837364+0.449881345034j),
+ (0.893211960793+0.449634194374j),
+ (0.893862366676+0.448344886303j),
+ (0.894974172115+0.446114838123j),
+ (0.89649784565+0.443042784929j),
+ (0.898379862309+0.439216792583j),
+ (0.900570392609+0.434715718031j),
+ (0.902926802635+0.429791986942j),
+ (0.905423760414+0.424503326416j),
+ (0.908115327358+0.418716549873j),
+ (0.910964310169+0.412489384413j),
+ (0.913929581642+0.405871063471j),
+ (0.916985273361+0.398915469646j),
+ (0.920104384422+0.391668856144j),
+ (0.923261523247+0.384174525738j),
+ (0.926428377628+0.376470327377j),
+ (0.929587602615+0.3685952425j),
+ (0.932724237442+0.360585510731j),
+ (0.935822367668+0.352472603321j),
+ (0.938865244389+0.344285786152j),
+ (0.941773712635+0.336241692305j),
+ (0.944620370865+0.328158795834j),
+ (0.94739818573+0.32005661726j),
+ (0.950098872185+0.311952739954j),
+ (0.952714562416+0.303861320019j),
+ (0.955247402191+0.295800030231j),
+ (0.957694888115+0.287783116102j),
+ (0.960053324699+0.279822826385j),
+ (0.962315440178+0.271930038929j),
+ (0.96448802948+0.264117747545j),
+ (0.966570436954+0.256397068501j),
+ (0.968563258648+0.248777091503j),
+ (0.970409572124+0.241460204124j),
+ (0.972127914429+0.234440952539j),
+ (0.97377294302+0.227515518665j),
+ (0.975345790386+0.220690101385j),
+ (0.976839780807+0.213968709111j),
+ (0.978262722492+0.207358703017j),
+ (0.979616940022+0.200864806771j),
+ (0.980905056+0.194491744041j),
+ (0.982122182846+0.188243359327j),
+ (0.983273088932+0.18212479353j),
+ (0.984363257885+0.176140069962j),
+ (0.985394001007+0.170292437077j),
+ (0.986363172531+0.16458517313j),
+ (0.98724168539+0.159217983484j),
+ (0.988072276115+0.153976023197j),
+ (0.988858819008+0.148855358362j),
+ (0.989599764347+0.143855035305j),
+ (0.990294575691+0.138971716166j),
+ (0.990951240063+0.134203910828j),
+ (0.991572141647+0.129550367594j),
+ (0.992157161236+0.125009477139j),
+ (0.992702245712+0.120578929782j),
+ (0.993216574192+0.116259463131j),
+ (0.993701457977+0.112050771713j),
+ (0.994158565998+0.107951454818j),
+ (0.994559407234+0.104160495102j),
+ (0.9949182868+0.100662395358j),
+ (0.995259582996+0.0972395762801j),
+ (0.995584189892+0.0938917249441j),
+ (0.995885193348+0.0906178206205j),
+ (0.99616932869+0.0874189138412j),
+ (0.996438741684+0.0842954516411j),
+ (0.996694862843+0.0812477469444j),
+ (0.996931552887+0.0782764554024j),
+ (0.997152447701+0.0753828883171j),
+ (0.997361660004+0.0725681483746j),
+ (0.997559130192+0.0698337852955j),
+ (0.997741162777+0.067180365324j),
+ (0.99789583683+0.0648084580898j),
+ (0.998042702675+0.0624987781048j),
+ (0.998183488846+0.0602464973927j),
+ (0.998314678669+0.0580499768257j),
+ (0.998434245586+0.0559054017067j),
+ (0.998548746109+0.053810685873j),
+ (0.998658537865+0.0517641305923j),
+ (0.998762428761+0.0497645735741j),
+ (0.998855054379+0.0478102117777j),
+ (0.998943626881+0.0459015443921j),
+ (0.999028742313+0.0440383702517j))
sampling_freq = 10e3
freq = sampling_freq / 100
@@ -151,7 +151,6 @@ class test_pll_carriertracking (gr_unittest.TestCase):
self.tb.run ()
dst_data = dst.data ()
-
self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
if __name__ == '__main__':
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
index 5225a9a3b..a044ca4e3 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
@@ -32,52 +32,53 @@ class test_pll_freqdet (gr_unittest.TestCase):
self.tb = None
def test_pll_refout (self):
- expected_result = (1.1489677586e-07,
- 0.972821060568,
+ expected_result = (0.0,
+ 1.1489677586e-07,
+ 0.972820967928,
2.74556447638,
- 5.14063078448,
- 8.00965819311,
- 11.2291393027,
- 14.6967068752,
+ 5.14063115504,
+ 8.00965893424,
+ 11.2291407849,
+ 14.6967083575,
18.3279143967,
22.0534772463,
- 25.8170093072,
- 29.5729107661,
- 33.284774699,
- 36.923857393,
- 40.4367950308,
- 43.8452195091,
- 47.1363835133,
- 50.3011949468,
- 53.3336447847,
- 56.2301489564,
+ 25.8170063427,
+ 29.5729048372,
+ 33.28476877,
+ 36.923851464,
+ 40.4367920663,
+ 43.8452165447,
+ 47.1363805488,
+ 50.3011890178,
+ 53.3336388558,
+ 56.2301430274,
58.9891659262,
61.6107668417,
64.0962975824,
- 66.4481356707,
- 68.6694531128,
- 70.7640326003,
- 72.7048735417,
- 74.5033180826,
+ 66.4481415997,
+ 68.6694590418,
+ 70.7640385293,
+ 72.7048794706,
+ 74.5033240115,
76.2012544926,
- 77.8019199967,
+ 77.8019140677,
79.3088126954,
- 80.7255907715,
- 82.0560369166,
- 83.3039516093,
- 84.47312347,
- 85.5673411194,
+ 80.7255967005,
+ 82.0560428456,
+ 83.3039575383,
+ 84.473129399,
+ 85.5673470484,
86.5902864563,
- 87.5456117346,
- 88.4368565575,
- 89.2363918613,
- 89.9860999864,
- 90.688880206,
- 91.3474598523,
- 91.9644654653,
- 92.5423042123,
- 93.0832706099,
- 93.5894872344,
+ 87.5456176636,
+ 88.4368624865,
+ 89.2363977903,
+ 89.9861118444,
+ 90.6888920639,
+ 91.3474657813,
+ 91.9644713943,
+ 92.5423101413,
+ 93.0832765389,
+ 93.5894931633,
94.0629225081,
94.5054203452,
94.9186882929,
@@ -92,46 +93,45 @@ class test_pll_freqdet (gr_unittest.TestCase):
97.3504727968,
97.5493842694,
97.7366275022,
- 97.9123092169,
+ 97.9123032879,
98.0766013539,
98.2297054988,
- 98.3408087235,
- 98.448722155,
- 98.5534457933,
- 98.6549322065,
- 98.7531932527,
- 98.8481459259,
- 98.9397487233,
- 99.0279067813,
- 99.1125074491,
- 99.193438076,
- 99.2705800823,
- 99.3438030304,
- 99.3817663128,
- 99.3911400359,
- 99.4089388448,
- 99.4334136894,
- 99.4630408207,
- 99.4964684305,
- 99.5325166512,
- 99.5701538394,
- 99.6084432158,
- 99.6466021546,
- 99.6839073198,
- 99.7197895289,
+ 98.3408027946,
+ 98.4487102971,
+ 98.5534280064,
+ 98.6549025616,
+ 98.7531576788,
+ 98.848110352,
+ 98.9397131494,
+ 99.0278712074,
+ 99.1124718752,
+ 99.193408431,
+ 99.2705445084,
+ 99.3437733855,
+ 99.3817366678,
+ 99.391110391,
+ 99.4089151289,
+ 99.4333959024,
+ 99.4630289627,
+ 99.4964565726,
+ 99.5325047932,
+ 99.5701419814,
+ 99.6084313579,
+ 99.6465902967,
+ 99.6838954618,
+ 99.7197776709,
99.7537270313,
99.7542606398,
99.7595848672,
- 99.7691186729,
- 99.7822928746,
- 99.7986331535,
- 99.8175940432,
- 99.838713083,
- 99.8614922382,
- 99.8854571901,
- 99.9101454781,
- 99.9351302152,
- 99.9599845147)
+ 99.7691305308,
+ 99.7823047325,
+ 99.7986450115,
+ 99.8176059012,
+ 99.838724941,
+ 99.8615040962,
+ 99.8854690481,
+ 99.910157336,
+ 99.9351302152)
sampling_freq = 10e3
freq = sampling_freq / 100
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
index c40a885a8..c719d901d 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
@@ -32,106 +32,106 @@ class test_pll_refout (gr_unittest.TestCase):
self.tb = None
def test_pll_refout (self):
- expected_result = ((1+7.39965699825e-10j),
+ expected_result = ((1+0j),
+ (1+7.39965699825e-10j),
(0.999980390072+0.00626518437639j),
- (0.999828696251+0.0185074284673j),
- (0.999342679977+0.0362518876791j),
- (0.998255133629+0.0590478181839j),
- (0.996255218983+0.0864609107375j),
+ (0.999828696251+0.0185074303299j),
+ (0.999342679977+0.0362518914044j),
+ (0.998255133629+0.0590478256345j),
+ (0.996255218983+0.0864609181881j),
(0.993005692959+0.118066303432j),
(0.988157629967+0.153442293406j),
(0.981362581253+0.192165210843j),
(0.972283244133+0.233806177974j),
(0.960601866245+0.277928203344j),
- (0.946027755737+0.324085712433j),
+ (0.946027696133+0.324085712433j),
(0.928303182125+0.371824204922j),
(0.907292485237+0.420500129461j),
- (0.882742881775+0.469856351614j),
+ (0.882742881775+0.469856321812j),
(0.854515135288+0.519426465034j),
(0.822515428066+0.568742752075j),
- (0.786696314812+0.617340147495j),
- (0.747057616711+0.664759278297j),
- (0.703645646572+0.710551083088j),
- (0.656552672386+0.754280209541j),
- (0.605915129185+0.795529305935j),
- (0.551911592484+0.833902597427j),
- (0.494760006666+0.869029641151j),
- (0.43471455574+0.900568306446j),
- (0.37224894762+0.928132891655j),
- (0.30767711997+0.951490819454j),
- (0.241136431694+0.970491230488j),
- (0.172981828451+0.984925031662j),
- (0.103586450219+0.99462044239j),
- (0.0333373323083+0.999444127083j),
- (-0.0373690575361+0.999301552773j),
- (-0.108130030334+0.994136750698j),
- (-0.178540825844+0.983932495117j),
- (-0.248198583722+0.968709170818j),
- (-0.316705673933+0.948523879051j),
- (-0.383672952652+0.923469007015j),
- (-0.448723316193+0.893670737743j),
- (-0.51132196188+0.85938924551j),
- (-0.571328520775+0.820721447468j),
- (-0.628420114517+0.777874112129j),
- (-0.682293117046+0.73107868433j),
- (-0.732665538788+0.680588841438j),
- (-0.779277384281+0.626679122448j),
- (-0.821892917156+0.569642007351j),
- (-0.860301196575+0.509786069393j),
- (-0.894317150116+0.447433561087j),
- (-0.923782229424+0.382918298244j),
- (-0.948564887047+0.316582858562j),
- (-0.968560874462+0.248776733875j),
- (-0.983657121658+0.180051699281j),
- (-0.993847966194+0.110753215849j),
- (-0.999158322811+0.0410195216537j),
- (-0.999585151672-0.0288011860102j),
- (-0.995150566101-0.0983632653952j),
- (-0.985901713371-0.16732545197j),
- (-0.971909940243-0.235353127122j),
- (-0.953270018101-0.302119642496j),
- (-0.9300994277-0.367307811975j),
- (-0.902537107468-0.430612027645j),
- (-0.870742559433-0.49173912406j),
- (-0.834894418716-0.550410091877j),
- (-0.795189499855-0.606360971928j),
- (-0.751972675323-0.659194231033j),
+ (0.786696374416+0.617340147495j),
+ (0.747057676315+0.664759278297j),
+ (0.703645706177+0.710551023483j),
+ (0.656552672386+0.754280149937j),
+ (0.605915188789+0.795529305935j),
+ (0.551911652088+0.833902597427j),
+ (0.494760125875+0.869029581547j),
+ (0.43471467495+0.900568246841j),
+ (0.37224906683+0.928132891655j),
+ (0.307677358389+0.95149075985j),
+ (0.241136670113+0.970491170883j),
+ (0.17298206687+0.984924972057j),
+ (0.103586681187+0.99462044239j),
+ (0.0333374515176+0.999444127083j),
+ (-0.0373689383268+0.999301552773j),
+ (-0.108129791915+0.994136810303j),
+ (-0.178540587425+0.983932554722j),
+ (-0.248198464513+0.968709230423j),
+ (-0.316705435514+0.948523938656j),
+ (-0.383672863245+0.92346906662j),
+ (-0.448723107576+0.893670797348j),
+ (-0.511321544647+0.859389483929j),
+ (-0.571328163147+0.820721685886j),
+ (-0.628419756889+0.777874410152j),
+ (-0.682292759418+0.731079041958j),
+ (-0.73266518116+0.680589199066j),
+ (-0.779277086258+0.626679480076j),
+ (-0.821892678738+0.569642364979j),
+ (-0.860300958157+0.509786486626j),
+ (-0.894316911697+0.447434008121j),
+ (-0.923782110214+0.382918506861j),
+ (-0.948564827442+0.316582858562j),
+ (-0.968560934067+0.248776495457j),
+ (-0.983657181263+0.180051460862j),
+ (-0.993847966194+0.110752984881j),
+ (-0.999158382416+0.0410190448165j),
+ (-0.999585151672-0.0288016609848j),
+ (-0.995150506496-0.0983637422323j),
+ (-0.985901653767-0.167325690389j),
+ (-0.971909880638-0.235353350639j),
+ (-0.953269898891-0.302119880915j),
+ (-0.930099308491-0.367308050394j),
+ (-0.902536988258-0.430612236261j),
+ (-0.870742440224-0.491739332676j),
+ (-0.834894299507-0.550410330296j),
+ (-0.795189321041-0.606361210346j),
+ (-0.751972556114-0.659194409847j),
(-0.705345034599-0.708864152431j),
- (-0.65554022789-0.755160272121j),
+ (-0.65554022789-0.755160212517j),
(-0.602804005146-0.79788929224j),
(-0.547393083572-0.836875617504j),
- (-0.489574223757-0.871961653233j),
+ (-0.489574193954-0.871961593628j),
(-0.429622590542-0.903008520603j),
(-0.367820799351-0.929896712303j),
(-0.30445766449-0.952525854111j),
(-0.239826664329-0.970815718174j),
(-0.174224823713-0.984705924988j),
(-0.107951194048-0.994156181812j),
- (-0.0415063276887-0.999138236046j),
+ (-0.0415062084794-0.999138236046j),
(0.0248276274651-0.999691724777j),
(0.0909758731723-0.995853126049j),
- (0.156649470329-0.987654268742j),
+ (0.156649366021-0.987654268742j),
(0.221562758088-0.975146114826j),
(0.285434871912-0.958398103714j),
- (0.347990810871-0.937497973442j),
- (0.408962905407-0.912550985813j),
- (0.468091338873-0.883680105209j),
- (0.525126338005-0.851024270058j),
- (0.57982814312-0.814738810062j),
- (0.631968915462-0.77499371767j),
- (0.681333422661-0.731973171234j),
- (0.727582573891-0.68602013588j),
- (0.770699381828-0.637198925018j),
- (0.810512244701-0.585721731186j),
- (0.846863090992-0.531810998917j),
- (0.879608631134-0.475698113441j),
- (0.908620357513-0.417623132467j),
+ (0.34799093008-0.937497913837j),
+ (0.408963024616-0.912550985813j),
+ (0.468091547489-0.883679986j),
+ (0.525126516819-0.851024150848j),
+ (0.579828321934-0.814738690853j),
+ (0.631969094276-0.774993598461j),
+ (0.68133354187-0.731973052025j),
+ (0.727582633495-0.68602001667j),
+ (0.770699501038-0.637198805809j),
+ (0.810512304306-0.585721611977j),
+ (0.846863090992-0.531810939312j),
+ (0.879608631134-0.475698083639j),
+ (0.908620357513-0.417623102665j),
(0.933785498142-0.357833325863j),
- (0.955007195473-0.296582698822j),
- (0.972205162048-0.234130680561j),
+ (0.955007135868-0.29658266902j),
+ (0.972205162048-0.23413066566j),
(0.985315918922-0.170741200447j),
- (0.994293272495-0.106681488454j),
- (0.999108314514-0.0422209985554j))
+ (0.994293212891-0.106681533158j))
sampling_freq = 10e3
freq = sampling_freq / 100