[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6345 - in gnuradio/branches/developers/jcorgan/t162:
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r6345 - in gnuradio/branches/developers/jcorgan/t162: debian gnuradio-core/src/python/gnuradio/blks2impl gnuradio-examples/python/digital |
Date: |
Thu, 6 Sep 2007 13:46:41 -0600 (MDT) |
Author: jcorgan
Date: 2007-09-06 13:46:41 -0600 (Thu, 06 Sep 2007)
New Revision: 6345
Modified:
gnuradio/branches/developers/jcorgan/t162/debian/gen-install-files.sh
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/pkt.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_loopback.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/receive_path_lb.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/transmit_path_lb.py
Log:
Converted digital/benchmark_loopback.py and dqpsk.py and dependencies to new
top block code.
Modified: gnuradio/branches/developers/jcorgan/t162/debian/gen-install-files.sh
===================================================================
--- gnuradio/branches/developers/jcorgan/t162/debian/gen-install-files.sh
2007-09-06 19:35:13 UTC (rev 6344)
+++ gnuradio/branches/developers/jcorgan/t162/debian/gen-install-files.sh
2007-09-06 19:46:41 UTC (rev 6345)
@@ -41,7 +41,7 @@
$EXTRACT gnuradio-core/src/python/gnuradio/blks/Makefile grblkspython_PYTHON
>>$NAME
$EXTRACT gnuradio-core/src/python/gnuradio/blks2/Makefile grblks2python_PYTHON
>>$NAME
$EXTRACT gnuradio-core/src/python/gnuradio/blksimpl/Makefile
grblkspython_PYTHON >>$NAME
-$EXTRACT gnuradio-core/src/python/gnuradio/blksimpl2/Makefile
grblkspython_PYTHON >>$NAME
+$EXTRACT gnuradio-core/src/python/gnuradio/blks2impl/Makefile
grblkspython_PYTHON >>$NAME
$EXTRACT gnuradio-core/src/python/gnuradio/gru/Makefile grblkspython_PYTHON
>>$NAME
$EXTRACT gnuradio-core/src/python/gnuradio/gruimpl/Makefile grupython_PYTHON
>>$NAME
$EXTRACT gnuradio-core/src/python/gnuradio/vocoder/Makefile
grvocoderpython_PYTHON >>$NAME
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk.py
2007-09-06 19:35:13 UTC (rev 6344)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk.py
2007-09-06 19:46:41 UTC (rev 6345)
@@ -1,5 +1,5 @@
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -48,9 +48,9 @@
# DQPSK modulator
# /////////////////////////////////////////////////////////////////////////////
-class dqpsk_mod(gr.hier_block):
+class dqpsk_mod(gr.hier_block2):
- def __init__(self, fg,
+ def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
excess_bw=_def_excess_bw,
gray_code=_def_gray_code,
@@ -76,7 +76,10 @@
@type debug: bool
"""
- self._fg = fg
+ gr.hier_block2.__init__(self, "dqpsk_mod",
+ gr.io_signature(1, 1, gr.sizeof_char), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
+
self._samples_per_symbol = samples_per_symbol
self._excess_bw = excess_bw
self._gray_code = gray_code
@@ -120,9 +123,8 @@
self._setup_logging()
# Connect & Initialize base class
- self._fg.connect(self.bytes2chunks, self.symbol_mapper, self.diffenc,
- self.chunks2symbols, self.rrc_filter)
- gr.hier_block.__init__(self, self._fg, self.bytes2chunks,
self.rrc_filter)
+ self.connect(self, self.bytes2chunks, self.symbol_mapper, self.diffenc,
+ self.chunks2symbols, self.rrc_filter, self)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -139,16 +141,16 @@
def _setup_logging(self):
print "Modulation logging turned on."
- self._fg.connect(self.bytes2chunks,
- gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat"))
- self._fg.connect(self.symbol_mapper,
- gr.file_sink(gr.sizeof_char, "tx_graycoder.dat"))
- self._fg.connect(self.diffenc,
- gr.file_sink(gr.sizeof_char, "tx_diffenc.dat"))
- self._fg.connect(self.chunks2symbols,
- gr.file_sink(gr.sizeof_gr_complex,
"tx_chunks2symbols.dat"))
- self._fg.connect(self.rrc_filter,
- gr.file_sink(gr.sizeof_gr_complex,
"tx_rrc_filter.dat"))
+ self.connect(self.bytes2chunks,
+ gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat"))
+ self.connect(self.symbol_mapper,
+ gr.file_sink(gr.sizeof_char, "tx_graycoder.dat"))
+ self.connect(self.diffenc,
+ gr.file_sink(gr.sizeof_char, "tx_diffenc.dat"))
+ self.connect(self.chunks2symbols,
+ gr.file_sink(gr.sizeof_gr_complex,
"tx_chunks2symbols.dat"))
+ self.connect(self.rrc_filter,
+ gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.dat"))
def add_options(parser):
"""
@@ -177,9 +179,9 @@
# Differentially coherent detection of differentially encoded qpsk
# /////////////////////////////////////////////////////////////////////////////
-class dqpsk_demod(gr.hier_block):
+class dqpsk_demod(gr.hier_block2):
- def __init__(self, fg,
+ def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
excess_bw=_def_excess_bw,
costas_alpha=_def_costas_alpha,
@@ -217,7 +219,10 @@
@type debug: bool
"""
- self._fg = fg
+ gr.hier_block2.__init__(self, "dqpsk_demod",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_char)) #
Output signature
+
self._samples_per_symbol = samples_per_symbol
self._excess_bw = excess_bw
self._costas_alpha = costas_alpha
@@ -287,9 +292,8 @@
self._setup_logging()
# Connect & Initialize base class
- self._fg.connect(self.pre_scaler, self.agc, self.rrc_filter,
self.receiver,
- self.diffdec, self.slicer, self.symbol_mapper,
self.unpack)
- gr.hier_block.__init__(self, self._fg, self.pre_scaler, self.unpack)
+ self.connect(self, self.pre_scaler, self.agc, self.rrc_filter,
self.receiver,
+ self.diffdec, self.slicer, self.symbol_mapper,
self.unpack, self)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -313,22 +317,22 @@
def _setup_logging(self):
print "Modulation logging turned on."
- self._fg.connect(self.pre_scaler,
- gr.file_sink(gr.sizeof_gr_complex,
"rx_prescaler.dat"))
- self._fg.connect(self.agc,
- gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat"))
- self._fg.connect(self.rrc_filter,
- gr.file_sink(gr.sizeof_gr_complex,
"rx_rrc_filter.dat"))
- self._fg.connect(self.receiver,
- gr.file_sink(gr.sizeof_gr_complex, "rx_receiver.dat"))
- self._fg.connect(self.diffdec,
- gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat"))
- self._fg.connect(self.slicer,
- gr.file_sink(gr.sizeof_char, "rx_slicer.dat"))
- self._fg.connect(self.symbol_mapper,
- gr.file_sink(gr.sizeof_char, "rx_gray_decoder.dat"))
- self._fg.connect(self.unpack,
- gr.file_sink(gr.sizeof_char, "rx_unpack.dat"))
+ self.connect(self.pre_scaler,
+ gr.file_sink(gr.sizeof_gr_complex, "rx_prescaler.dat"))
+ self.connect(self.agc,
+ gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat"))
+ self.connect(self.rrc_filter,
+ gr.file_sink(gr.sizeof_gr_complex, "rx_rrc_filter.dat"))
+ self.connect(self.receiver,
+ gr.file_sink(gr.sizeof_gr_complex, "rx_receiver.dat"))
+ self.connect(self.diffdec,
+ gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat"))
+ self.connect(self.slicer,
+ gr.file_sink(gr.sizeof_char, "rx_slicer.dat"))
+ self.connect(self.symbol_mapper,
+ gr.file_sink(gr.sizeof_char, "rx_gray_decoder.dat"))
+ self.connect(self.unpack,
+ gr.file_sink(gr.sizeof_char, "rx_unpack.dat"))
def add_options(parser):
"""
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/pkt.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/pkt.py
2007-09-06 19:35:13 UTC (rev 6344)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/pkt.py
2007-09-06 19:46:41 UTC (rev 6345)
@@ -1,5 +1,5 @@
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005, 2006, 2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -28,21 +28,19 @@
# mod/demod with packets as i/o
# /////////////////////////////////////////////////////////////////////////////
-class mod_pkts(gr.hier_block):
+class mod_pkts(gr.hier_block2):
"""
Wrap an arbitrary digital modulator in our packet handling framework.
Send packets by calling send_pkt
"""
- def __init__(self, fg, modulator, access_code=None, msgq_limit=2,
pad_for_usrp=True, use_whitener_offset=False):
+ def __init__(self, modulator, access_code=None, msgq_limit=2,
pad_for_usrp=True, use_whitener_offset=False):
"""
Hierarchical block for sending packets
Packets to be sent are enqueued by calling send_pkt.
The output is the complex modulated signal at baseband.
- @param fg: flow graph
- @type fg: flow graph
@param modulator: instance of modulator class (gr_block or hier_block)
@type modulator: complex baseband out
@param access_code: AKA sync vector
@@ -54,6 +52,11 @@
See gmsk_mod for remaining parameters
"""
+
+ gr.hier_block2.__init__(self, "mod_pkts",
+ gr.io_signature(0, 0, 0), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
+
self._modulator = modulator
self._pad_for_usrp = pad_for_usrp
self._use_whitener_offset = use_whitener_offset
@@ -67,8 +70,7 @@
# accepts messages from the outside world
self._pkt_input = gr.message_source(gr.sizeof_char, msgq_limit)
- fg.connect(self._pkt_input, self._modulator)
- gr.hier_block.__init__(self, fg, None, self._modulator)
+ self.connect(self._pkt_input, self._modulator, self)
def send_pkt(self, payload='', eof=False):
"""
@@ -96,7 +98,7 @@
-class demod_pkts(gr.hier_block):
+class demod_pkts(gr.hier_block2):
"""
Wrap an arbitrary digital demodulator in our packet handling framework.
@@ -104,7 +106,7 @@
app via the callback.
"""
- def __init__(self, fg, demodulator, access_code=None, callback=None,
threshold=-1):
+ def __init__(self, demodulator, access_code=None, callback=None,
threshold=-1):
"""
Hierarchical block for demodulating and deframing packets.
@@ -123,6 +125,10 @@
@type threshold: int
"""
+ gr.hier_block2.__init__(self, "demod_pkts",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(0, 0, 0)) #
Output signature
+
self._demodulator = demodulator
if access_code is None:
access_code = packet_utils.default_access_code
@@ -137,9 +143,8 @@
self.correlator = gr.correlate_access_code_bb(access_code, threshold)
self.framer_sink = gr.framer_sink_1(self._rcvd_pktq)
- fg.connect(self._demodulator, self.correlator, self.framer_sink)
+ self.connect(self, self._demodulator, self.correlator,
self.framer_sink)
- gr.hier_block.__init__(self, fg, self._demodulator, None)
self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_loopback.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_loopback.py
2007-09-06 19:35:13 UTC (rev 6344)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_loopback.py
2007-09-06 19:46:41 UTC (rev 6345)
@@ -32,10 +32,13 @@
from receive_path_lb import receive_path
import fusb_options
-class awgn_channel(gr.hier_block):
- def __init__(self, fg, sample_rate, noise_voltage, frequency_offset,
seed=False):
- self.input = gr.add_const_cc(0) # dummy input device
-
+class awgn_channel(gr.hier_block2):
+ def __init__(self, sample_rate, noise_voltage, frequency_offset,
seed=False):
+
+ gr.hier_block2.__init__(self, "awgn_channel",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
+
# Create the Gaussian noise source
if not seed:
self.noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_voltage)
@@ -51,16 +54,15 @@
self.mixer = gr.multiply_cc()
# Connect the components
- fg.connect(self.input, (self.mixer, 0))
- fg.connect(self.offset, (self.mixer, 1))
- fg.connect(self.mixer, (self.adder, 0))
- fg.connect(self.noise, (self.adder, 1))
+ self.connect(self, (self.mixer, 0))
+ self.connect(self.offset, (self.mixer, 1))
+ self.connect(self.mixer, (self.adder, 0))
+ self.connect(self.noise, (self.adder, 1))
+ self.connect(self.adder, self)
- gr.hier_block.__init__(self, fg, self.input, self.adder)
-
-class my_graph(gr.flow_graph):
+class my_top_block(gr.top_block):
def __init__(self, mod_class, demod_class, rx_callback, options):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
channelon = True;
@@ -71,12 +73,12 @@
noise_power = power_in_signal/SNR
noise_voltage = math.sqrt(noise_power)
- self.txpath = transmit_path(self, mod_class, options)
+ self.txpath = transmit_path(mod_class, options)
self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate)
- self.rxpath = receive_path(self, demod_class, rx_callback, options)
+ self.rxpath = receive_path(demod_class, rx_callback, options)
if channelon:
- self.channel = awgn_channel(self, options.sample_rate,
noise_voltage,
+ self.channel = awgn_channel(options.sample_rate, noise_voltage,
frequency_offset, options.seed)
if options.discontinuous:
@@ -121,7 +123,7 @@
# print payload[2:len(payload)]
def send_pkt(payload='', eof=False):
- return fg.txpath.send_pkt(payload, eof)
+ return tb.txpath.send_pkt(payload, eof)
mods = modulation_utils.type_1_mods()
@@ -171,8 +173,8 @@
print "Warning: failed to enable realtime scheduling"
# Create an instance of a hierarchical block
- fg = my_graph(mods[options.modulation], demods[options.modulation],
rx_callback, options)
- fg.start()
+ tb = my_top_block(mods[options.modulation], demods[options.modulation],
rx_callback, options)
+ tb.start()
# generate and send packets
nbytes = int(1e6 * options.megabytes)
@@ -187,7 +189,7 @@
send_pkt(eof=True)
- fg.wait()
+ tb.wait()
if __name__ == '__main__':
try:
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/receive_path_lb.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/receive_path_lb.py
2007-09-06 19:35:13 UTC (rev 6344)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/receive_path_lb.py
2007-09-06 19:46:41 UTC (rev 6345)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gru, blks
+from gnuradio import gr, gru, blks2
from gnuradio import eng_notation
import copy
import sys
@@ -29,8 +29,12 @@
# receive path
# /////////////////////////////////////////////////////////////////////////////
-class receive_path(gr.hier_block):
- def __init__(self, fg, demod_class, rx_callback, options):
+class receive_path(gr.hier_block2):
+ def __init__(self, demod_class, rx_callback, options):
+ gr.hier_block2.__init__(self, "receive_path",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(0, 0, 0)) #
Output signature
+
options = copy.copy(options) # make a copy so we can destructively
modify
@@ -55,11 +59,10 @@
# receiver
self.packet_receiver = \
- blks.demod_pkts(fg,
- self._demod_class(fg, **demod_kwargs),
- access_code=None,
- callback=self._rx_callback,
- threshold=-1)
+ blks2.demod_pkts(self._demod_class(**demod_kwargs),
+ access_code=None,
+ callback=self._rx_callback,
+ threshold=-1)
# Carrier Sensing Blocks
alpha = 0.001
@@ -70,14 +73,15 @@
if self._verbose:
self._print_verbage()
+ # connect block input to channel filter
+ self.connect(self, self.channel_filter)
+
# connect the channel input filter to the carrier power detector
- fg.connect(self.channel_filter, self.probe)
+ self.connect(self.channel_filter, self.probe)
# connect channel filter to the packet receiver
- fg.connect(self.channel_filter, self.packet_receiver)
+ self.connect(self.channel_filter, self.packet_receiver)
- gr.hier_block.__init__(self, fg, self.channel_filter, None)
-
def bitrate(self):
return self._bitrate
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/transmit_path_lb.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/transmit_path_lb.py
2007-09-06 19:35:13 UTC (rev 6344)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/transmit_path_lb.py
2007-09-06 19:46:41 UTC (rev 6345)
@@ -1,5 +1,5 @@
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005, 2006, 2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -19,7 +19,7 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gru, blks
+from gnuradio import gr, gru, blks2
from gnuradio import eng_notation
import copy
@@ -29,11 +29,14 @@
# transmit path
# /////////////////////////////////////////////////////////////////////////////
-class transmit_path(gr.hier_block):
- def __init__(self, fg, modulator_class, options):
+class transmit_path(gr.hier_block2):
+ def __init__(self, modulator_class, options):
'''
See below for what options should hold
'''
+ gr.hier_block2.__init__(self, "transmit_path",
+ gr.io_signature(0, 0, 0), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
options = copy.copy(options) # make a copy so we can destructively
modify
@@ -48,12 +51,14 @@
mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
# transmitter
+ print self._modulator_class
+ print mod_kwargs
+ modulator = self._modulator_class(**mod_kwargs)
self.packet_transmitter = \
- blks.mod_pkts(fg,
- self._modulator_class(fg, **mod_kwargs),
- access_code=None,
- msgq_limit=4,
- pad_for_usrp=True)
+ blks2.mod_pkts(modulator,
+ access_code=None,
+ msgq_limit=4,
+ pad_for_usrp=True)
self.amp = gr.multiply_const_cc(1)
self.set_tx_amplitude(self._tx_amplitude)
@@ -63,10 +68,8 @@
self._print_verbage()
# Connect components in the flowgraph
- fg.connect(self.packet_transmitter, self.amp)
+ self.connect(self.packet_transmitter, self.amp, self)
- gr.hier_block.__init__(self, fg, None, self.amp)
-
def set_tx_amplitude(self, ampl):
"""
Sets the transmit amplitude sent to the USRP
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6345 - in gnuradio/branches/developers/jcorgan/t162: debian gnuradio-core/src/python/gnuradio/blks2impl gnuradio-examples/python/digital,
jcorgan <=