added Trond's gr_max_* and gr_argmax_* blocks
authoreb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 30 May 2007 18:14:59 +0000 (18:14 +0000)
committereb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 30 May 2007 18:14:59 +0000 (18:14 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@5575 221aa14e-8319-0410-a670-987f0aec2ac5

13 files changed:
gnuradio-core/src/lib/gengen/Makefile.am
gnuradio-core/src/lib/gengen/Makefile.gen
gnuradio-core/src/lib/gengen/generate_common.py
gnuradio-core/src/lib/gengen/gengen_generated.i
gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t [new file with mode: 0644]
gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t [new file with mode: 0644]
gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t [new file with mode: 0644]
gnuradio-core/src/lib/gengen/gr_max_XX.cc.t [new file with mode: 0644]
gnuradio-core/src/lib/gengen/gr_max_XX.h.t [new file with mode: 0644]
gnuradio-core/src/lib/gengen/gr_max_XX.i.t [new file with mode: 0644]
gnuradio-core/src/python/gnuradio/gr/Makefile.am
gnuradio-core/src/python/gnuradio/gr/qa_argmax.py [new file with mode: 0644]
gnuradio-core/src/python/gnuradio/gr/qa_max.py [new file with mode: 0644]

index c566570e2510ae1dd5dee386c63353b8fe534c67..7c585dda90973123cd70ce66ca185b9555e0154d 100644 (file)
@@ -44,12 +44,18 @@ CODE_GENERATOR =                    \
        gr_add_const_vXX.cc.t           \
        gr_add_const_vXX.h.t            \
        gr_add_const_vXX.i.t            \
+       gr_argmax_XX.cc.t               \
+       gr_argmax_XX.h.t                \
+       gr_argmax_XX.i.t                \
        gr_chunks_to_symbols_XX.cc.t    \
        gr_chunks_to_symbols_XX.h.t     \
        gr_chunks_to_symbols_XX.i.t     \
        gr_divide_XX.cc.t               \
        gr_divide_XX.h.t                \
        gr_divide_XX.i.t                \
+       gr_max_XX.cc.t                  \
+       gr_max_XX.h.t                   \
+       gr_max_XX.i.t                   \
        gr_multiply_XX.cc.t             \
        gr_multiply_XX.h.t              \
        gr_multiply_XX.i.t              \
index adbceba103a5405b3411086563fac0ead88debfe..ceb8692b40a1154fd6ec82256ffdb3e0dac619bb 100644 (file)
@@ -19,6 +19,9 @@ GENERATED_H = \
        gr_add_vff.h \
        gr_add_vii.h \
        gr_add_vss.h \
+       gr_argmax_fs.h \
+       gr_argmax_is.h \
+       gr_argmax_ss.h \
        gr_chunks_to_symbols_bc.h \
        gr_chunks_to_symbols_bf.h \
        gr_chunks_to_symbols_ic.h \
@@ -29,6 +32,9 @@ GENERATED_H = \
        gr_divide_ff.h \
        gr_divide_ii.h \
        gr_divide_ss.h \
+       gr_max_ff.h \
+       gr_max_ii.h \
+       gr_max_ss.h \
        gr_multiply_cc.h \
        gr_multiply_const_cc.h \
        gr_multiply_const_ff.h \
@@ -103,6 +109,9 @@ GENERATED_I = \
        gr_add_vff.i \
        gr_add_vii.i \
        gr_add_vss.i \
+       gr_argmax_fs.i \
+       gr_argmax_is.i \
+       gr_argmax_ss.i \
        gr_chunks_to_symbols_bc.i \
        gr_chunks_to_symbols_bf.i \
        gr_chunks_to_symbols_ic.i \
@@ -113,6 +122,9 @@ GENERATED_I = \
        gr_divide_ff.i \
        gr_divide_ii.i \
        gr_divide_ss.i \
+       gr_max_ff.i \
+       gr_max_ii.i \
+       gr_max_ss.i \
        gr_multiply_cc.i \
        gr_multiply_const_cc.i \
        gr_multiply_const_ff.i \
@@ -187,6 +199,9 @@ GENERATED_CC = \
        gr_add_vff.cc \
        gr_add_vii.cc \
        gr_add_vss.cc \
+       gr_argmax_fs.cc \
+       gr_argmax_is.cc \
+       gr_argmax_ss.cc \
        gr_chunks_to_symbols_bc.cc \
        gr_chunks_to_symbols_bf.cc \
        gr_chunks_to_symbols_ic.cc \
@@ -197,6 +212,9 @@ GENERATED_CC = \
        gr_divide_ff.cc \
        gr_divide_ii.cc \
        gr_divide_ss.cc \
+       gr_max_ff.cc \
+       gr_max_ii.cc \
+       gr_max_ss.cc \
        gr_multiply_cc.cc \
        gr_multiply_const_cc.cc \
        gr_multiply_const_ff.cc \
index 2ab0586df0a11e78896b48741942eee1950ded9f..aaf15f04ac5e5e0a7e26943d3ed86130c40b1500 100755 (executable)
@@ -59,7 +59,9 @@ others = (
     ('gr_unpacked_to_packed_XX',    ('bb','ss','ii')),
     ('gr_packed_to_unpacked_XX',    ('bb','ss','ii')),
     ('gr_sample_and_hold_XX',       ('bb','ss','ii','ff')),
-    ('gr_peak_detector_XX',         ('ff','ii','ss'))
+    ('gr_peak_detector_XX',         ('ff','ii','ss')),
+    ('gr_argmax_XX',                ('fs','is','ss')),
+    ('gr_max_XX',                   ('ff','ii','ss')),
     )
 
 
index d5f874e6127b43d71f1f0a7d3953ed43673524dc..bab1f03e67bbbad5190721a1696045f6ea31770b 100644 (file)
@@ -19,6 +19,9 @@
 #include <gr_add_vff.h>
 #include <gr_add_vii.h>
 #include <gr_add_vss.h>
+#include <gr_argmax_fs.h>
+#include <gr_argmax_is.h>
+#include <gr_argmax_ss.h>
 #include <gr_chunks_to_symbols_bc.h>
 #include <gr_chunks_to_symbols_bf.h>
 #include <gr_chunks_to_symbols_ic.h>
@@ -29,6 +32,9 @@
 #include <gr_divide_ff.h>
 #include <gr_divide_ii.h>
 #include <gr_divide_ss.h>
+#include <gr_max_ff.h>
+#include <gr_max_ii.h>
+#include <gr_max_ss.h>
 #include <gr_multiply_cc.h>
 #include <gr_multiply_const_cc.h>
 #include <gr_multiply_const_ff.h>
 %include <gr_add_vff.i>
 %include <gr_add_vii.i>
 %include <gr_add_vss.i>
+%include <gr_argmax_fs.i>
+%include <gr_argmax_is.i>
+%include <gr_argmax_ss.i>
 %include <gr_chunks_to_symbols_bc.i>
 %include <gr_chunks_to_symbols_bf.i>
 %include <gr_chunks_to_symbols_ic.i>
 %include <gr_divide_ff.i>
 %include <gr_divide_ii.i>
 %include <gr_divide_ss.i>
+%include <gr_max_ff.i>
+%include <gr_max_ii.i>
+%include <gr_max_ss.i>
 %include <gr_multiply_cc.i>
 %include <gr_multiply_const_cc.i>
 %include <gr_multiply_const_ff.i>
diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t
new file mode 100644 (file)
index 0000000..85c272b
--- /dev/null
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ( size_t vlen )
+{
+       return @SPTR_NAME@ ( new @NAME@(vlen));
+}
+
+@NAME@::@NAME@( size_t vlen)
+       : gr_sync_block ( "@BASE_NAME@",
+                   gr_make_io_signature (1, -1, vlen*sizeof (@I_TYPE@)),
+                   gr_make_io_signature (2, 2, sizeof (@O_TYPE@))),
+       d_vlen(vlen)
+{
+}
+
+
+int
+@NAME@::work( int noutput_items,
+       gr_vector_const_void_star &input_items,
+       gr_vector_void_star &output_items)
+{
+
+       int ninputs = input_items.size ();
+
+       @O_TYPE@ *x_optr = (@O_TYPE@ *) output_items[0];
+       @O_TYPE@ *y_optr = (@O_TYPE@ *) output_items[1];
+
+       for (int i=0; i<noutput_items; i++) {
+
+               @I_TYPE@ max = 0;
+               int x = 0;
+               int y = 0;
+
+               for (int j=0; j < (int) d_vlen; j++ ) {
+                       for (int k=0; k<ninputs; k++) {
+                               if ( ((@I_TYPE@ *) input_items[k])[i*d_vlen + j] > max) {
+                                       max = ((@I_TYPE@ *) input_items[k])[i*d_vlen + j];
+                                       x = j;
+                                       y = k;
+                               }
+                       }
+               }
+
+               *x_optr++ = (@O_TYPE@) x;
+               *y_optr++ = (@O_TYPE@) y;
+       }
+       return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t
new file mode 100644 (file)
index 0000000..ad8b047
--- /dev/null
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+
+class @NAME@ : public gr_sync_block
+{
+  friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+  @NAME@ (size_t vlen);
+  size_t d_vlen;
+
+ public:
+
+  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/gengen/gr_argmax_XX.i.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t
new file mode 100644 (file)
index 0000000..c6c4f43
--- /dev/null
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+  @NAME@ (size_t vlen);
+  size_t d_vlen;
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_max_XX.cc.t
new file mode 100644 (file)
index 0000000..d917036
--- /dev/null
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ( size_t vlen )
+{
+       return @SPTR_NAME@ ( new @NAME@(vlen));
+}
+
+@NAME@::@NAME@( size_t vlen)
+       : gr_sync_block ( "@BASE_NAME@",
+                   gr_make_io_signature (1, -1, vlen*sizeof (@I_TYPE@)),
+                   gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+                  d_vlen(vlen)
+{
+}
+
+int
+@NAME@::work( int noutput_items,
+       gr_vector_const_void_star &input_items,
+       gr_vector_void_star &output_items)
+{
+       @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+       int ninputs = input_items.size ();
+       
+       for (int i=0; i<noutput_items; i++) {
+
+               @I_TYPE@ max = 0;
+               
+               for (int j=0; j < (int) d_vlen; j++ ) {
+                       for (int k=0; k<ninputs; k++) {
+                               if ( ((@I_TYPE@ *) input_items[k])[i*d_vlen + j] > max) {
+                                       max = ((@I_TYPE@*) input_items[k])[i*d_vlen + j];
+                               }
+                       }
+               }
+
+               *optr++ = (@O_TYPE@) max;
+       }
+       return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.h.t b/gnuradio-core/src/lib/gengen/gr_max_XX.h.t
new file mode 100644 (file)
index 0000000..ad8b047
--- /dev/null
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+
+class @NAME@ : public gr_sync_block
+{
+  friend @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+  @NAME@ (size_t vlen);
+  size_t d_vlen;
+
+ public:
+
+  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/gengen/gr_max_XX.i.t b/gnuradio-core/src/lib/gengen/gr_max_XX.i.t
new file mode 100644 (file)
index 0000000..c6c4f43
--- /dev/null
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+  @NAME@ (size_t vlen);
+  size_t d_vlen;
+};
index 175b36b6055465a746d6f2173a2ebbf59dc3b80c..557bf13f9d8ec60236f5a82ee539b95ecdc3af72 100644 (file)
@@ -48,6 +48,7 @@ noinst_PYTHON =                       \
        qa_add_and_friends.py           \
        qa_add_v_and_friends.py         \
        qa_agc.py                       \
+       qa_argmax.py                    \
        qa_basic_flow_graph.py          \
        qa_bin_statistics.py            \
        qa_cma_equalizer.py             \
@@ -73,6 +74,7 @@ noinst_PYTHON =                       \
        qa_interp_fir_filter.py         \
        qa_kludge_copy.py               \
        qa_kludged_imports.py           \
+       qa_max.py                       \
        qa_message.py                   \
        qa_mute.py                      \
        qa_nlog10.py                    \
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py b/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py
new file mode 100644 (file)
index 0000000..767c277
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 math
+
+
+class test_sig_source (gr_unittest.TestCase):
+
+    def setUp (self):
+        self.fg = gr.flow_graph ()
+
+
+    def tearDown (self):
+        self.fg = None
+
+
+    def test_001(self):
+        fg = self.fg
+
+        src1_data = (0,0.2,-0.3,0,12,0)
+        src2_data = (0,0.0,3.0,0,10,0)
+        src3_data = (0,0.0,3.0,0,1,0)
+
+        src1 = gr.vector_source_f (src1_data)
+        s2v1 = gr.stream_to_vector(gr.sizeof_float, len(src1_data))
+        fg.connect( src1, s2v1 )
+
+        src2 = gr.vector_source_f (src2_data)
+        s2v2 = gr.stream_to_vector(gr.sizeof_float, len(src1_data))
+        fg.connect( src2, s2v2 )
+
+        src3 = gr.vector_source_f (src3_data)
+        s2v3 = gr.stream_to_vector(gr.sizeof_float, len(src1_data))
+        fg.connect( src3, s2v3 )
+
+        dst1 = gr.vector_sink_s ()
+        dst2 = gr.vector_sink_s ()
+        argmax = gr.argmax_fs (len(src1_data))
+
+        fg.connect (s2v1, (argmax, 0))
+        fg.connect (s2v2, (argmax, 1))
+        fg.connect (s2v3, (argmax, 2))
+
+        fg.connect ((argmax,0), dst1)
+        fg.connect ((argmax,1), dst2)
+
+        fg.run ()
+        index = dst1.data ()
+        source = dst2.data ()
+        self.assertEqual ( index, (4,))
+        self.assertEqual ( source, (0,))
+
+
+
+if __name__ == '__main__':
+    gr_unittest.main ()
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_max.py b/gnuradio-core/src/python/gnuradio/gr/qa_max.py
new file mode 100644 (file)
index 0000000..b980773
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 math
+
+
+class test_sig_source (gr_unittest.TestCase):
+
+    def setUp (self):
+        self.fg = gr.flow_graph ()
+
+
+    def tearDown (self):
+        self.fg = None
+
+
+    def test_001(self):
+
+        src_data = (0,0.2,-0.3,0,12,0)
+        expected_result = (float(max(src_data)), )
+
+        src = gr.vector_source_f(src_data)
+        s2v = gr.stream_to_vector(gr.sizeof_float, len(src_data))
+        op = gr.max_ff( len(src_data) )
+        dst = gr.vector_sink_f()
+
+
+        self.fg.connect(src, s2v, op, dst)
+        self.fg.run()
+        result_data = dst.data()
+        self.assertEqual(expected_result, result_data)
+
+
+if __name__ == '__main__':
+    gr_unittest.main ()
+