[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3557 - in gnuradio/branches/developers/eb/digital-wip
From: |
eb |
Subject: |
[Commit-gnuradio] r3557 - in gnuradio/branches/developers/eb/digital-wip: gnuradio-core/src/python/gnuradio/blksimpl gnuradio-examples/python/gmsk2 |
Date: |
Sat, 16 Sep 2006 23:23:17 -0600 (MDT) |
Author: eb
Date: 2006-09-16 23:23:16 -0600 (Sat, 16 Sep 2006)
New Revision: 3557
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/blksimpl/gmsk.py
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/blksimpl/pkt.py
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/benchmark_rx.py
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/benchmark_tx.py
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/transmit_path.py
Log:
work-in-progress: benchmark_tx works with gmsk
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/blksimpl/gmsk.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/blksimpl/gmsk.py
2006-09-17 04:53:40 UTC (rev 3556)
+++
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/blksimpl/gmsk.py
2006-09-17 05:23:16 UTC (rev 3557)
@@ -61,7 +61,7 @@
self._bt = bt
if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2:
- raise TypeError, ("samples_per_symbol must be an integer >= 2, is
%d" % samples_per_symbol)
+ raise TypeError, ("samples_per_symbol must be an integer >= 2, is
%r" % (samples_per_symbol,))
ntaps = 4 * samples_per_symbol # up to 3 bits in
filter at once
sensitivity = (pi / 2) / samples_per_symbol # phase change per bit
= pi / 2
@@ -100,7 +100,7 @@
def bits_per_symbol(self=None): # staticmethod that's also callable on
an instance
return 1
- bits_per_baud = staticmethod(bits_per_symbol) # make it a static
method.
+ bits_per_symbol = staticmethod(bits_per_symbol) # make it a static
method.
def extract_kwargs_from_options(options):
@@ -128,7 +128,7 @@
def _print_verbage(self):
- print "bits per symbol = %d" % self.bits_per_baud()
+ print "bits per symbol = %d" % self.bits_per_symbol()
print "Gaussian filter bt = %.2f" % self._bt
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/blksimpl/pkt.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/blksimpl/pkt.py
2006-09-17 04:53:40 UTC (rev 3556)
+++
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/blksimpl/pkt.py
2006-09-17 05:23:16 UTC (rev 3557)
@@ -82,7 +82,7 @@
# print "original_payload =", string_to_hex_list(payload)
pkt = packet_utils.make_packet(payload,
self._modulator.samples_per_symbol(),
- self._modulator.bits_per_baud(),
+ self._modulator.bits_per_symbol(),
self._access_code,
self._pad_for_usrp)
#print "pkt =", string_to_hex_list(pkt)
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/benchmark_rx.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/benchmark_rx.py
2006-09-17 04:53:40 UTC (rev 3556)
+++
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/benchmark_rx.py
2006-09-17 05:23:16 UTC (rev 3557)
@@ -42,7 +42,7 @@
def __init__(self, demod_class, rx_callback, options):
gr.flow_graph.__init__(self)
- self.rxpath = receive_path(self, demod_class, rx_callback, options)
+ self.rxpath = receive_path(self, demod_class, options, rx_callback)
# /////////////////////////////////////////////////////////////////////////////
# main
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/benchmark_tx.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/benchmark_tx.py
2006-09-17 04:53:40 UTC (rev 3556)
+++
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/benchmark_tx.py
2006-09-17 05:23:16 UTC (rev 3557)
@@ -38,9 +38,9 @@
class my_graph(gr.flow_graph):
- def __init__(self, modulator, options):
+ def __init__(self, modulator_class, options):
gr.flow_graph.__init__(self)
- self.txpath = transmit_path(self, modulator, options)
+ self.txpath = transmit_path(self, modulator_class, options)
# /////////////////////////////////////////////////////////////////////////////
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/transmit_path.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/transmit_path.py
2006-09-17 04:53:40 UTC (rev 3556)
+++
gnuradio/branches/developers/eb/digital-wip/gnuradio-examples/python/gmsk2/transmit_path.py
2006-09-17 05:23:16 UTC (rev 3557)
@@ -23,6 +23,8 @@
from gnuradio import usrp
from gnuradio import eng_notation
+import copy
+
# from current dir
from pick_bitrate import pick_tx_bitrate
@@ -31,28 +33,35 @@
# /////////////////////////////////////////////////////////////////////////////
class transmit_path(gr.hier_block):
- def __init__(self, fg, modulator, options):
+ def __init__(self, fg, modulator_class, options):
'''
See below for what options should hold
'''
- self._verbose = options.verbose
- self._tx_freq = options.tx_freq # tranmitter's center
frequency
- self._gain = options.gain # transmitter's
digital gain
- self._tx_subdev_spec = options.tx_subdev_spec # daughterboard to use
- self._bitrate = options.bitrate # desired bit rate
- self._interp = options.interp # interpolating rate
for the USRP (prelim)
- self._spb = options.spb # desired samples/baud
- self._fusb_block_size = options.fusb_block_size # usb info for USRP
- self._fusb_nblocks = options.fusb_nblocks # usb info for USRP
+ options = copy.copy(options) # make a copy so we can destructively
modify
- self._modulator = modulator # the modulator we are
using
+ self._verbose = options.verbose
+ self._tx_freq = options.tx_freq # tranmitter's
center frequency
+ self._gain = options.gain # transmitter's
digital gain
+ self._tx_subdev_spec = options.tx_subdev_spec # daughterboard to
use
+ self._bitrate = options.bitrate # desired bit rate
+ self._interp = options.interp # interpolating
rate for the USRP (prelim)
+ self._samples_per_symbol = options.samples_per_symbol # desired
samples/baud
+ self._fusb_block_size = options.fusb_block_size # usb info for USRP
+ self._fusb_nblocks = options.fusb_nblocks # usb info for USRP
+
+ self._modulator_class = modulator_class # the modulator_class
we are using
- # Set up USRP sink; also adjusts interp, spb, and bitrate
+ # Set up USRP sink; also adjusts interp, samples_per_symbol, and
bitrate
self._setup_usrp_sink()
+ # copy the final answers back into options for use by modulator
+ options.samples_per_symbol = self._samples_per_symbol
+ options.bitrate = self._bitrate
+ options.interp = self._interp
+
# Get mod_kwargs
- mod_kwargs = self._modulator.extract_kwargs_from_options(options)
+ mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
# Set center frequency of USRP
ok = self.set_freq(self._tx_freq)
@@ -63,7 +72,7 @@
# transmitter
self.packet_transmitter = \
blks.mod_pkts(fg,
- self._modulator(fg, **mod_kwargs),
+ self._modulator_class(fg, **mod_kwargs),
access_code=None,
msgq_limit=4,
pad_for_usrp=True)
@@ -94,7 +103,10 @@
fusb_nblocks=self._fusb_nblocks)
dac_rate = self.u.dac_rate();
- self.set_bitrate(dac_rate)
+ # determine best set of bitrate, samples_per_symbol, and interp from
desired info
+ (self._bitrate, self._samples_per_symbol, self._interp) = \
+ pick_tx_bitrate(self._bitrate,
self._modulator_class.bits_per_symbol(),
+ self._samples_per_symbol, self._interp, dac_rate)
self.u.set_interp_rate(self._interp)
@@ -104,15 +116,6 @@
self.u.set_mux(usrp.determine_tx_mux_value(self.u,
self._tx_subdev_spec))
self.subdev = usrp.selected_subdev(self.u, self._tx_subdev_spec)
- def set_bitrate(self, dac_rate):
- """
- determine best set of bitrate, spb, and interp from desired info
- @param dac_rate: DAC rate of USRP
- @type dac_rate: int
- """
- (self._bitrate, self._spb, self._interp) = \
- pick_tx_bitrate(self._bitrate, self._modulator.bits_per_baud(), \
- self._spb, self._interp, dac_rate)
def set_freq(self, target_freq):
"""
@@ -154,8 +157,8 @@
def bitrate(self):
return self._bitrate
- def spb(self):
- return self._spb
+ def samples_per_symbol(self):
+ return self._samples_per_symbol
def interp(self):
return self._interp
@@ -171,9 +174,9 @@
tx_grp.add_option("", "--tx-freq", type="eng_float", default=None,
help="set transmit frequency to FREQ
[default=%default]", metavar="FREQ")
tx_grp.add_option("-r", "--bitrate", type="eng_float", default=None,
- help="specify bitrate. spb and interp will be
derived.")
- tx_grp.add_option("-S", "--spb", type="int", default=None,
- help="set samples/baud [default=%default]")
+ help="specify bitrate. samples-per-symbol and
interp will be derived.")
+ tx_grp.add_option("-S", "--samples-per-symbol", type="int",
default=None,
+ help="set samples/symbol [default=%default]")
tx_grp.add_option("-i", "--interp", type="intx", default=None,
help="set fpga interpolation rate to INTERP
[default=%default]")
tx_grp.add_option("-g", "--gain", type="eng_float", default=100.0,
@@ -185,10 +188,10 @@
"""
Prints information about the transmit path
"""
- print "Using TX d'board %s" % (self.subdev.side_and_name(),)
- print "modulation: %s" % (self._modulator.__name__)
- print "bitrate: %sb/sec" %
(eng_notation.num_to_str(self._bitrate))
- print "samples/symbol: %3d" % (self._spb)
- print "interp: %3d" % (self._interp)
- print "Tx Frequency: %s" % (eng_notation.num_to_str(self._tx_freq))
+ print "Using TX d'board %s" % (self.subdev.side_and_name(),)
+ print "modulation: %s" % (self._modulator_class.__name__)
+ print "bitrate: %sb/s" %
(eng_notation.num_to_str(self._bitrate))
+ print "samples/symbol: %3d" % (self._samples_per_symbol)
+ print "interp: %3d" % (self._interp)
+ print "Tx Frequency: %s" %
(eng_notation.num_to_str(self._tx_freq))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3557 - in gnuradio/branches/developers/eb/digital-wip: gnuradio-core/src/python/gnuradio/blksimpl gnuradio-examples/python/gmsk2,
eb <=