[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5172 - gnuradio/branches/developers/jcorgan/hb/gnurad
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r5172 - gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder |
Date: |
Fri, 27 Apr 2007 19:05:48 -0600 (MDT) |
Author: jcorgan
Date: 2007-04-27 19:05:47 -0600 (Fri, 27 Apr 2007)
New Revision: 5172
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/Makefile.am
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/sounder_rx.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/sounder_tx.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sink.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_source.py
Log:
Converted hier2 sounder example to new API.
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/Makefile.am
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/Makefile.am
2007-04-28 01:03:34 UTC (rev 5171)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/Makefile.am
2007-04-28 01:05:47 UTC (rev 5172)
@@ -27,4 +27,4 @@
sounder_rx.py \
sounder_tx.py
-MOSTLYCLEANFILES = *.pyc *~
+MOSTLYCLEANFILES = *.pyc *~ *.dat
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/sounder_rx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/sounder_rx.py
2007-04-28 01:03:34 UTC (rev 5171)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/sounder_rx.py
2007-04-28 01:05:47 UTC (rev 5172)
@@ -50,6 +50,4 @@
print "Using PN sequence of degree", self._degree, "length",
self._length
print "Sequence repetition rate is", n2s(self._rep_rate), "per sec"
- self.define_component("corr", gr.pn_correlator_cc(self._degree))
- self.connect("self", 0, "corr", 0)
- self.connect("corr", 0, "self", 0)
+ self.connect(self, gr.pn_correlator_cc(self._degree), self)
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/sounder_tx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/sounder_tx.py
2007-04-28 01:03:34 UTC (rev 5171)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/sounder_tx.py
2007-04-28 01:05:47 UTC (rev 5172)
@@ -42,5 +42,4 @@
self._length = 2**degree-1
# Connect PN source to block output
- self.define_component("glfsr", gr.glfsr_source_f(degree))
- self.connect("glfsr", 0, "self", 0)
+ self.connect(gr.glfsr_source_f(degree), self)
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sink.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sink.py
2007-04-28 01:03:34 UTC (rev 5171)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sink.py
2007-04-28 01:05:47 UTC (rev 5172)
@@ -46,11 +46,8 @@
self.set_if_rate(if_rate)
self.set_calibration(calibration)
self.tune(freq)
+ self.connect(self, self._u)
- self.define_component("usrp", self._u)
- self.connect("self", 0, "usrp", 0)
-
-
def set_subdev(self, subdev_spec):
if subdev_spec is None:
subdev_spec = self.pick_subdevice()
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
2007-04-28 01:03:34 UTC (rev 5171)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
2007-04-28 01:05:47 UTC (rev 5172)
@@ -28,12 +28,9 @@
n2s = eng_notation.num_to_str
-class usrp_sounder_rx(gr.hier_block2):
+class usrp_sounder_rx(gr.top_block):
def __init__(self, options):
- gr.hier_block2.__init__(self, "usrp_sounder_rx",
- gr.io_signature(0,0,0),
- gr.io_signature(0,0,0))
-
+ gr.top_block.__init__(self, "usrp_sounder_rx")
self._options = options
self._u = usrp_source_c(0,
self._options.rx_subdev_spec,
@@ -50,22 +47,14 @@
samples = 100 * self._length**2
- self.define_component("usrp", self._u)
- self.define_component("head", gr.head(gr.sizeof_gr_complex, samples))
- self.define_component("rx", self._receiver)
- self.define_component("c2m", gr.complex_to_mag())
- self.define_component("s2v", gr.stream_to_vector(gr.sizeof_float,
self._length))
- self.define_component("lpf",
gr.single_pole_iir_filter_ff(self._options.alpha, self._length))
- self.define_component("v2s", gr.vector_to_stream(gr.sizeof_float,
self._length))
- self.define_component("sink", gr.file_sink(gr.sizeof_float,
"impulse.dat"))
+ head = gr.head(gr.sizeof_gr_complex, samples)
+ c2m = gr.complex_to_mag()
+ s2v = gr.stream_to_vector(gr.sizeof_float, self._length)
+ lpf = gr.single_pole_iir_filter_ff(self._options.alpha, self._length)
+ v2s = gr.vector_to_stream(gr.sizeof_float, self._length)
+ sink = gr.file_sink(gr.sizeof_float, "impulse.dat")
- self.connect("usrp", 0, "head", 0)
- self.connect("head", 0, "rx", 0)
- self.connect("rx", 0, "c2m", 0)
- self.connect("c2m", 0, "s2v", 0)
- self.connect("s2v", 0, "lpf", 0)
- self.connect("lpf", 0, "v2s", 0)
- self.connect("v2s", 0, "sink", 0)
+ self.connect(self._u, head, self._receiver, c2m, s2v, lpf, v2s, sink)
if self._options.verbose:
print "Chip rate is", n2s(self._options.chip_rate), "chips/sec"
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
2007-04-28 01:03:34 UTC (rev 5171)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
2007-04-28 01:05:47 UTC (rev 5172)
@@ -28,16 +28,12 @@
n2s = eng_notation.num_to_str
-class usrp_sounder_tx(gr.hier_block2):
+class usrp_sounder_tx(gr.top_block):
def __init__(self, subdev_spec, freq, cal, verbose, degree, chip_rate,
amplitude):
# Call hierarchical block constructor
# Top-level blocks have no inputs or outputs
- gr.hier_block2.__init__(self,
- "usrp_sounder_tx", # Block typename
- gr.io_signature(0,0,0), # Input signature
- gr.io_signature(0,0,0)) # Output signature
-
+ gr.top_block.__init__(self, "usrp_sounder_tx")
self._freq = freq
self._cal = cal
self._verbose = verbose
@@ -46,12 +42,12 @@
self._amplitude = amplitude
self._u = usrp_sink_c(0, subdev_spec, chip_rate, self._freq,
self._cal, self._verbose)
- self.define_component("usrp", self._u)
self._chip_rate = self._u._if_rate
self._max_time = float(self._length)/self._chip_rate
- self.define_component("pn", sounder_tx(self._degree, self._chip_rate,
self._verbose))
- self.define_component("gain", gr.multiply_const_ff(amplitude));
- self.define_component("f2c", gr.float_to_complex())
+ self._pn = sounder_tx(self._degree, self._chip_rate, self._verbose)
+ self._gain = gr.multiply_const_ff(amplitude)
+ self._f2c = gr.float_to_complex()
+ self.connect(self._pn, self._gain, self._f2c, self._u)
if self._verbose:
print "Chip rate is", n2s(self._chip_rate), "chips/sec"
@@ -60,11 +56,6 @@
print "Maximum measurable impulse response is",
n2s(self._max_time), "sec"
print "Output amplitude is", amplitude
- # Ultimately this will be
- # self.connect("pn gain f2c usrp")
- self.connect("pn", 0, "gain", 0)
- self.connect("gain", 0, "f2c", 0)
- self.connect("f2c", 0, "usrp", 0)
def main():
parser = OptionParser(option_class=eng_option)
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_source.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_source.py
2007-04-28 01:03:34 UTC (rev 5171)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder/usrp_source.py
2007-04-28 01:05:47 UTC (rev 5172)
@@ -47,10 +47,8 @@
self.set_gain(gain)
self.set_calibration(calibration)
self.tune(freq)
+ self.connect(self._u, self)
- self.define_component("usrp", self._u)
- self.connect("usrp", 0, "self", 0)
-
def set_subdev(self, subdev_spec):
if subdev_spec is None:
subdev_spec = self.pick_subdevice()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5172 - gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/sounder,
jcorgan <=