[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3530 - in gnuradio/branches/developers/jcorgan/pager/
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3530 - in gnuradio/branches/developers/jcorgan/pager/gr-pager/src: lib python python/pager |
Date: |
Wed, 13 Sep 2006 12:44:34 -0600 (MDT) |
Author: jcorgan
Date: 2006-09-13 12:44:34 -0600 (Wed, 13 Sep 2006)
New Revision: 3530
Added:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/Makefile.am
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/__init__.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/flex_demod.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/usrp_flex.py
Removed:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/flex_demod.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/usrp_flex.py
Modified:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/Makefile.am
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/Makefile.am
Log:
Create gnuradio.pager namespace (work in progress).
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-13 05:26:20 UTC (rev 3529)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/Makefile.am
2006-09-13 18:44:34 UTC (rev 3530)
@@ -27,8 +27,8 @@
# This usually ends up at:
# ${prefix}/lib/python${python_version}/site-packages/gnuradio/pager
-ourpythondir = $(grpythondir)
-ourlibdir = $(grpyexecdir)
+ourpythondir = $(grpythondir)/pager
+ourlibdir = $(grpyexecdir)/pager
INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS)
Modified:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/Makefile.am
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/Makefile.am
2006-09-13 05:26:20 UTC (rev 3529)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/Makefile.am
2006-09-13 18:44:34 UTC (rev 3530)
@@ -21,6 +21,8 @@
include $(top_srcdir)/Makefile.common
+SUBDIRS = pager
+
EXTRA_DIST = \
run_tests.in
@@ -30,4 +32,4 @@
noinst_PYTHON = \
qa_pager.py
-MOSTLYCLEANFILES = *~ *.pyc *.tmp
\ No newline at end of file
+MOSTLYCLEANFILES = *~ *.pyc *.tmp
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/flex_demod.py
Property changes on:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
*.pyc
Added:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/Makefile.am
===================================================================
---
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/Makefile.am
(rev 0)
+++
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/Makefile.am
2006-09-13 18:44:34 UTC (rev 3530)
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+include $(top_srcdir)/Makefile.common
+
+pagerpythondir = $(grpythondir)/pager
+
+pagerpython_PYTHON = \
+ __init__.py \
+ flex_demod.py \
+ usrp_flex.py
+
+MOSTLYCLEANFILES = *~ *.pyc *.tmp
Added:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/__init__.py
===================================================================
---
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/__init__.py
(rev 0)
+++
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/__init__.py
2006-09-13 18:44:34 UTC (rev 3530)
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+# The presence of this file turns this directory into a Python package
+
+from pgr import *
+from flex_demod import flex_demod
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/flex_demod.py
(from rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/flex_demod.py)
===================================================================
---
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/flex_demod.py
(rev 0)
+++
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/flex_demod.py
2006-09-13 18:44:34 UTC (rev 3530)
@@ -0,0 +1,57 @@
+#
+# 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.
+#
+
+from gnuradio import gr, optfir
+import pgr
+from math import pi
+
+class flex_demod(gr.hier_block):
+ """
+ FLEX protocol demodulation block.
+
+ This block demodulates a band-limited, complex down-converted baseband
+ channel into FLEX protocol frames.
+
+ Flow graph (so far):
+
+ QUAD - Quadrature demodulator converts FSK to baseband amplitudes
+ LPF - Low pass filter to remove noise prior to slicer
+ SLICER - Converts input to one of four symbols (0, 1, 2, 3)
+ DEFRAMER - Syncronizes symbol stream and outputs FLEX codewords
+ ---
+
+ @param fg: flowgraph
+ @param channel_rate: incoming sample rate of the baseband channel
+ @type sample_rate: integer
+ """
+
+ def __init__(self, fg, channel_rate):
+ k = channel_rate/(2*pi*4800) # 4800 Hz max deviation
+ QUAD = gr.quadrature_demod_cf(k)
+
+ taps = optfir.low_pass(1.0, channel_rate, 3200, 6400, 0.1, 60)
+ LPF = gr.fir_filter_fff(1, taps)
+ SLICER = pgr.slicer_fb(.001, .00001) # Attack, decay
+ DEFRAMER = pgr.flex_deframer(channel_rate)
+
+ fg.connect(QUAD, LPF, SLICER, DEFRAMER)
+
+ gr.hier_block.__init__(self, fg, QUAD, DEFRAMER)
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/usrp_flex.py
(from rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/usrp_flex.py)
===================================================================
---
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/usrp_flex.py
(rev 0)
+++
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/usrp_flex.py
2006-09-13 18:44:34 UTC (rev 3530)
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gru, usrp, optfir, eng_notation, blks
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import time, os, sys
+
+# This will force us to make it a package
+from flex_demod import flex_demod
+
+"""
+This example application demonstrates receiving and demodulating the
+FLEX pager protocol.
+
+A receive chain is built up of the following signal processing
+blocks:
+
+USRP - Daughter board source generating complex baseband signal.
+CHAN - Low pass filter to select channel bandwidth
+RFSQL - RF squelch zeroing output when input power below threshold
+AGC - Automatic gain control leveling signal at [-1.0, +1.0]
+FLEX - FLEX pager protocol decoder
+SINK - File sink for decoded output
+
+The following are required command line parameters:
+
+-f FREQ USRP receive frequency
+
+The following are optional command line parameters:
+
+-R SUBDEV Daughter board specification, defaults to first found
+-c FREQ Calibration offset. Gets added to receive frequency.
+ Defaults to 0.0 Hz.
+-g GAIN Daughterboard gain setting. Defaults to mid-range.
+-r RFSQL RF squelch in db. Defaults to -50.0.
+
+Once the program is running, ctrl-break (Ctrl-C) stops operation.
+"""
+
+def make_filename(dir, freq):
+ t = time.strftime('%Y%m%d-%H%M%S')
+ f = 'r%s-%s.dat' % (t, eng_notation.num_to_str(freq))
+ return os.path.join(dir, f)
+
+class usrp_source_c(gr.hier_block):
+ """
+ Create a USRP source object supplying complex floats.
+
+ Selects user supplied subdevice or chooses first available one.
+
+ Calibration value is the offset from the tuned frequency to
+ the actual frequency.
+ """
+ def __init__(self, fg, subdev_spec, decim, gain=None, calibration=0.0):
+ self._decim = decim
+ self._src = usrp.source_c()
+ if subdev_spec is None:
+ subdev_spec = usrp.pick_rx_subdevice(self._src)
+ self._subdev = usrp.selected_subdev(self._src, subdev_spec)
+ self._src.set_mux(usrp.determine_rx_mux_value(self._src, subdev_spec))
+ self._src.set_decim_rate(self._decim)
+
+ # If no gain specified, set to midrange
+ if gain is None:
+ g = self._subdev.gain_range()
+ gain = (g[0]+g[1])/2.0
+
+ self._subdev.set_gain(gain)
+ self._cal = calibration
+
+ gr.hier_block.__init__(self, fg, self._src, self._src)
+
+ def tune(self, freq):
+ result = usrp.tune(self._src, 0, self._subdev, freq+self._cal)
+ # TODO: deal with residual
+
+ def rate(self):
+ return self._src.adc_rate()/self._decim
+
+class app_flow_graph(gr.flow_graph):
+ def __init__(self, options, args):
+ gr.flow_graph.__init__(self)
+ self.options = options
+ self.args = args
+
+ USRP = usrp_source_c(self, # Flow graph
+ options.rx_subdev_spec, # Daugherboard spec
+ 250, # IF decimation ratio gets 256K
if_rate
+ options.gain, # Receiver gain
+ options.calibration) # Frequency offset
+ USRP.tune(options.frequency)
+
+ if_rate = USRP.rate()
+ channel_rate = 32000 # Oversampled by 10 or 20
+ channel_decim = if_rate // channel_rate
+
+ CHAN_taps = optfir.low_pass(1.0, # Filter gain
+ if_rate, # Sample rate
+ 8000, # One sided
modulation bandwidth
+ 10000, # One sided channel
bandwidth
+ 0.1, #
Passband ripple
+ 60) #
Stopband attenuation
+
+ CHAN = gr.freq_xlating_fir_filter_ccf(channel_decim, # Decimation rate
+ CHAN_taps, # Filter taps
+ 0.0, # Offset frequency
+ if_rate) # Sample rate
+
+ RFSQL = gr.pwr_squelch_cc(options.rf_squelch, # Power threshold
+ 125.0/channel_rate, # Time constant
+ channel_rate/20, # 50ms
rise/fall
+ False) # Zero, not gate output
+
+ AGC = gr.agc_cc(1.0/channel_rate, # Time constant
+ 1.0, # Reference power
+ 1.0, # Initial gain
+ 1.0) # Maximum gain
+
+ FLEX = flex_demod(self, 32000)
+
+ SINK = gr.file_sink(4, options.filename)
+
+ self.connect(USRP, CHAN)
+ self.connect(CHAN, RFSQL)
+ self.connect(RFSQL, AGC)
+ self.connect(AGC, FLEX)
+ self.connect(FLEX, SINK)
+
+def main():
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-f", "--frequency", type="eng_float",
+ help="set receive frequency to Hz", metavar="Hz")
+ parser.add_option("-R", "--rx-subdev-spec", type="subdev",
+ help="select USRP Rx side A or B", metavar="SUBDEV")
+ parser.add_option("-c", "--calibration", type="eng_float", default=0.0,
+ help="set frequency offset to Hz", metavar="Hz")
+ parser.add_option("-g", "--gain", type="int", default=None,
+ help="set RF gain", metavar="dB")
+ parser.add_option("-r", "--rf-squelch", type="eng_float", default=-50.0,
+ help="set RF squelch to dB", metavar="dB")
+ parser.add_option("-F", "--filename", default=None)
+ parser.add_option("-D", "--dir", default=None)
+ (options, args) = parser.parse_args()
+
+ if options.frequency < 1e6:
+ options.frequency *= 1e6
+
+ if options.filename is None and options.dir is None:
+ sys.stderr.write('Must specify either -F FILENAME or -D DIR\n')
+ parser.print_help()
+ sys.exit(1)
+
+ if options.filename is None:
+ options.filename = make_filename(options.dir, options.frequency)
+
+ fg = app_flow_graph(options, args)
+ try:
+ fg.run()
+ except KeyboardInterrupt:
+ pass
+
+if __name__ == "__main__":
+ main()
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/usrp_flex.py
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3530 - in gnuradio/branches/developers/jcorgan/pager/gr-pager/src: lib python python/pager,
jcorgan <=