commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/02: fixed QA, conditionalized adding loo


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/02: fixed QA, conditionalized adding loop
Date: Fri, 16 Sep 2016 16:00:10 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch next
in repository gnuradio.

commit 54ede29960f9022a8040e10c0d58fa8fed989a3f
Author: Marcus Müller <address@hidden>
Date:   Thu Sep 15 21:21:17 2016 -0600

    fixed QA, conditionalized adding loop
---
 gr-blocks/lib/nlog10_ff_impl.cc      | 7 ++++---
 gr-blocks/python/blocks/qa_nlog10.py | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/gr-blocks/lib/nlog10_ff_impl.cc b/gr-blocks/lib/nlog10_ff_impl.cc
index 67dafae..5bc234f 100644
--- a/gr-blocks/lib/nlog10_ff_impl.cc
+++ b/gr-blocks/lib/nlog10_ff_impl.cc
@@ -64,15 +64,16 @@ namespace gr {
                              gr_vector_const_void_star &input_items,
                              gr_vector_void_star &output_items)
     {
-      #define novolk  0
       const float *in = (const float *) input_items[0];
       float *out = (float *) output_items[0];
       int noi = noutput_items * d_vlen;
 
       volk_32f_log2_32f(out, in, noi);
       volk_32f_s32f_multiply_32f(out, out, d_prefactor, noi);
-      for(int i = 0; i < noi; ++i) {
-        out[i] += d_k;
+      if(d_k != 0.0f) {
+        for(int i = 0; i < noi; ++i) {
+          out[i] += d_k;
+        }
       }
       return noutput_items;
     }
diff --git a/gr-blocks/python/blocks/qa_nlog10.py 
b/gr-blocks/python/blocks/qa_nlog10.py
index 0194e85..c925479 100755
--- a/gr-blocks/python/blocks/qa_nlog10.py
+++ b/gr-blocks/python/blocks/qa_nlog10.py
@@ -31,15 +31,15 @@ class test_nlog10(gr_unittest.TestCase):
         self.tb = None
 
     def test_001(self):
-        src_data = (-10, 0, 10, 100, 1000, 10000, 100000)
-        expected_result = (-180, -180, 10, 20, 30, 40, 50)
+        src_data = (1, 10, 100, 1000, 10000, 100000)
+        expected_result = (0, 10, 20, 30, 40, 50)
         src = blocks.vector_source_f(src_data)
         op = blocks.nlog10_ff(10)
         dst = blocks.vector_sink_f()
         self.tb.connect (src, op, dst)
         self.tb.run()
         result_data = dst.data()
-        self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+        self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5)
 
 
 if __name__ == '__main__':



reply via email to

[Prev in Thread] Current Thread [Next in Thread]