[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3486 - in gnuradio/branches/developers/jcorgan/pager/
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3486 - in gnuradio/branches/developers/jcorgan/pager/gr-pager/src: lib python |
Date: |
Mon, 4 Sep 2006 19:38:14 -0600 (MDT) |
Author: jcorgan
Date: 2006-09-04 19:38:14 -0600 (Mon, 04 Sep 2006)
New Revision: 3486
Added:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr.i
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pgr.py
Removed:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager.i
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager_slicer_ff.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager_slicer_ff.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pager.py
Modified:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/Makefile.am
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/flex_demod.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/usrp_flex.py
Log:
Reorganization of name space and change to _fb for slicer.
Property changes on: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
.deps
.libs
pager.cc
pager.py
*.pyc
+ Makefile
Makefile.in
.deps
.libs
pgr.cc
pgr.py
*.pyc
Modified:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/Makefile.am
2006-09-04 21:02:16 UTC (rev 3485)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/Makefile.am
2006-09-05 01:38:14 UTC (rev 3486)
@@ -23,7 +23,7 @@
SUBDIRS =
-# Install this stuff so that it ends up as the gnuradio.pager module
+# Install this stuff so that it ends up as the gnuradio.pgr module
# This usually ends up at:
# ${prefix}/lib/python${python_version}/site-packages/gnuradio/pager
@@ -42,43 +42,43 @@
$(GNURADIO_I)
LOCAL_IFILES = \
- $(top_srcdir)/gr-pager/src/lib/pager.i
+ $(top_srcdir)/gr-pager/src/lib/pgr.i
# These files are built by SWIG. The first is the C++ glue.
# The second is the python wrapper that loads the _howto shared library
# and knows how to call our extensions.
BUILT_SOURCES = \
- pager.cc \
- pager.py
+ pgr.cc \
+ pgr.py
-# This gets pager.py installed in the right place
+# This gets pgr.py installed in the right place
ourpython_PYTHON = \
- pager.py
+ pgr.py
-ourlib_LTLIBRARIES = _pager.la
+ourlib_LTLIBRARIES = _pgr.la
# These are the source files that go into the shared library
-_pager_la_SOURCES = \
- pager.cc \
- pager_slicer_ff.cc \
+_pgr_la_SOURCES = \
+ pgr.cc \
+ pgr_slicer_fb.cc \
# Additional source modules here
# magic flags
-_pager_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version
+_pgr_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version
# link the library against the c++ standard library
-_pager_la_LIBADD = \
+_pgr_la_LIBADD = \
$(PYTHON_LDFLAGS) \
$(GNURADIO_CORE_LIBS) \
-lstdc++
-pager.cc pager.py: $(ALL_IFILES)
- $(SWIG) $(SWIGPYTHONARGS) -module pager -o pager.cc $(LOCAL_IFILES)
+pgr.cc pgr.py: $(ALL_IFILES)
+ $(SWIG) $(SWIGPYTHONARGS) -module pgr -o pgr.cc $(LOCAL_IFILES)
# These headers get installed in ${prefix}/include/gnuradio
grinclude_HEADERS = \
- pager_slicer_ff.h
+ pgr_slicer_fb.h
# Additional header files here
# These swig headers get installed in ${prefix}/include/gnuradio/swig
Deleted: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager.i
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager_slicer_ff.cc
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager_slicer_ff.h
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr.i (from
rev 3485, gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager.i)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr.i
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr.i
2006-09-05 01:38:14 UTC (rev 3486)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2005,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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+%feature("autodoc","1");
+%include "exception.i"
+%import "gnuradio.i"
+
+%{
+#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
+#include "pgr_slicer_fb.h"
+#include <stdexcept>
+%}
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(pgr,slicer_fb);
+
+pgr_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta);
+
+class pgr_slicer_fb : public gr_sync_block
+{
+private:
+ pgr_slicer_fb(float alpha, float beta);
+
+public:
+};
+
+// ----------------------------------------------------------------
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.cc
(from rev 3485,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager_slicer_ff.cc)
===================================================================
---
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.cc
(rev 0)
+++
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.cc
2006-09-05 01:38:14 UTC (rev 3486)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004,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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pgr_slicer_fb.h>
+#include <gr_io_signature.h>
+
+pgr_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta)
+{
+ return pgr_slicer_fb_sptr(new pgr_slicer_fb(alpha, beta));
+}
+
+pgr_slicer_fb::pgr_slicer_fb(float alpha, float beta) :
+ gr_sync_block ("slicer_fb",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(unsigned char)))
+{
+ d_alpha = alpha;
+ d_beta = beta;
+ d_max = 0.0;
+ d_hi = 0.0;
+ d_avg = 0.0;
+ d_lo = 0.0;
+ d_min = 0.0;
+}
+
+// Tracks average, minimum, and peak, then converts input into one of:
+//
+// [0, 1, 2, 3]
+unsigned char pgr_slicer_fb::slice(float sample)
+{
+ unsigned char decision;
+
+ // Update DC level and remove
+ d_avg = d_avg*(1.0-d_alpha)+sample*d_alpha;
+ sample -= d_avg;
+
+ if (sample > 0) {
+ if (sample > d_hi) { // In max region
+ d_max = d_max*(1.0-d_alpha) + sample*d_alpha;
+ decision = 3;
+ }
+ else {
+ d_max -= (d_max-d_avg)*d_beta; // decay otherwise
+ decision = 2;
+ }
+ }
+ else {
+ if (sample < d_lo) { // In min region
+ d_min = d_min*(1.0-d_alpha) + sample*d_alpha;
+ decision = 0;
+ }
+ else {
+ d_min -= (d_min-d_avg)*d_beta; // decay otherwise
+ decision = 1;
+ }
+ }
+
+ d_hi = d_max*2.0/3.0;
+ d_lo = d_min*2.0/3.0;
+
+ fprintf(stderr, "%f %d\n", sample, decision);
+ return decision;
+}
+
+int pgr_slicer_fb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *iptr = (float *) input_items[0];
+ unsigned char *optr = (unsigned char *) output_items[0];
+
+ int size = noutput_items;
+
+ for (int i = 0; i < size; i++)
+ *optr++ = slice(*iptr++);
+
+ return noutput_items;
+}
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.h
(from rev 3485,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pager_slicer_ff.h)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.h
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.h
2006-09-05 01:38:14 UTC (rev 3486)
@@ -0,0 +1,58 @@
+/*
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_PGR_SLICER_FB_H
+#define INCLUDED_PGR_SLICER_FB_H
+
+#include <gr_sync_block.h>
+
+class pgr_slicer_fb;
+typedef boost::shared_ptr<pgr_slicer_fb> pgr_slicer_fb_sptr;
+
+pgr_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta);
+
+/*!
+ * \brief slicer description
+ * \ingroup block
+ */
+class pgr_slicer_fb : public gr_sync_block
+{
+private:
+ friend pgr_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta);
+ pgr_slicer_fb(float alpha, float beta);
+
+ unsigned char slice(float sample);
+
+ float d_alpha; // Attack constant
+ float d_beta; // Decay constant
+ float d_max; // Maximum value for symbol comparison
+ float d_hi; // High side decision boundary
+ float d_avg; // Average value for DC offset subtraction
+ float d_lo; // Low side decision boundary
+ float d_min; // Minimum value for symbol comparison
+
+public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_PGR_SLICER_FB_H */
Property changes on:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
run_tests
+ Makefile
Makefile.in
run_tests
*.pyc
Modified:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/flex_demod.py
===================================================================
---
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/flex_demod.py
2006-09-04 21:02:16 UTC (rev 3485)
+++
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/flex_demod.py
2006-09-05 01:38:14 UTC (rev 3486)
@@ -20,7 +20,7 @@
#
from gnuradio import gr, optfir
-import pager
+import pgr
from math import pi
class flex_demod(gr.hier_block):
@@ -34,7 +34,7 @@
QUAD - Quadrature demodulator converts FSK to baseband amplitudes
LPF - Low pass filter to remove noise prior to slicer
- SLICER - Limits values to four values (-1.0, -0.333, 0.333, 1.0)
+ SLICER - Converts input to one of four symbols (0, 1, 2, 3)
---
@param fg: flowgraph
@@ -48,7 +48,7 @@
taps = optfir.low_pass(1.0, channel_rate, 3200, 6400, 0.1, 60)
LPF = gr.fir_filter_fff(1, taps)
- SLICER = pager.slicer_ff(.001, .00001) # Attack, decay
+ SLICER = pgr.slicer_fb(.001, .00001) # Attack, decay
fg.connect(QUAD, LPF, SLICER)
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pager.py
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pgr.py (from
rev 3483,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pager.py)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pgr.py
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pgr.py
2006-09-05 01:38:14 UTC (rev 3486)
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import pgr
+
+class qa_pgr(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.fg = gr.flow_graph ()
+
+ def tearDown (self):
+ self.fg = None
+
+if __name__ == '__main__':
+ gr_unittest.main ()
Modified:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/usrp_flex.py
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/usrp_flex.py
2006-09-04 21:02:16 UTC (rev 3485)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/usrp_flex.py
2006-09-05 01:38:14 UTC (rev 3486)
@@ -118,7 +118,7 @@
FLEX = flex_demod(self, 32000)
- SINK = gr.file_sink(gr.sizeof_float, options.filename)
+ SINK = gr.file_sink(gr.sizeof_char, options.filename)
self.connect(USRP, CHAN, RFSQL, AGC, FLEX, SINK)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3486 - in gnuradio/branches/developers/jcorgan/pager/gr-pager/src: lib python,
jcorgan <=