diff options
author | Tom Rondeau | 2010-02-26 10:11:39 -0500 |
---|---|---|
committer | Tom Rondeau | 2010-02-26 10:11:39 -0500 |
commit | 598924aa8be0740583d9d32f99269e1e55134b6e (patch) | |
tree | 84a36302acb42c0c1b0e4ca9067f524b5f03688f | |
parent | 93c51f5c02311f89dc6eb47923b34b13038c805c (diff) | |
download | gnuradio-598924aa8be0740583d9d32f99269e1e55134b6e.tar.gz gnuradio-598924aa8be0740583d9d32f99269e1e55134b6e.tar.bz2 gnuradio-598924aa8be0740583d9d32f99269e1e55134b6e.zip |
Fixing a few bugs in handling of real samples per symbol.
4 files changed, 7 insertions, 8 deletions
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py b/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py index 9fae6acca..96cf0144f 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py @@ -83,8 +83,8 @@ class dqpsk2_mod(gr.hier_block2): self._excess_bw = excess_bw self._gray_code = gray_code - if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: - raise TypeError, ("sbp must be an integer >= 2, is %d" % samples_per_symbol) + if samples_per_symbol < 2: + raise TypeError, ("sbp must be >= 2, is %f" % samples_per_symbol) ntaps = 11 * samples_per_symbol @@ -107,7 +107,7 @@ class dqpsk2_mod(gr.hier_block2): # pulse shaping filter nfilts = 32 - ntaps = nfilts * 11 * self._samples_per_symbol # make nfilts filters of ntaps each + ntaps = 11 * int(nfilts * self._samples_per_symbol) # make nfilts filters of ntaps each self.rrc_taps = gr.firdes.root_raised_cosine( nfilts, # gain nfilts, # sampling rate based on 32 filters in resampler diff --git a/gnuradio-examples/python/digital/pick_bitrate2.py b/gnuradio-examples/python/digital/pick_bitrate2.py index 23081117c..92539560c 100644 --- a/gnuradio-examples/python/digital/pick_bitrate2.py +++ b/gnuradio-examples/python/digital/pick_bitrate2.py @@ -68,8 +68,7 @@ def _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol, try: xrate = rate except UnboundLocalError: - print "Requested bitrate out of bounds" - sys.exit(1) + raise ValueError("Requested bitrate out of bounds") samples_per_symbol = converter_rate / bits_per_symbol / rate / bitrate bitrate = converter_rate / bits_per_symbol / xrate / samples_per_symbol @@ -100,7 +99,7 @@ def _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol, raise ValueError(("Invalid rate (rate = %d)" % xrate)) if((samples_per_symbol < _sps_min) or (samples_per_symbol > _sps_max)): raise ValueError(("Invalid samples per symbol (sps = %.2f). Must be in [%.0f, %.0f]." \ - % (xrate, _sps_min, _sps_max))) + % (samples_per_symbol, _sps_min, _sps_max))) return (bitrate, samples_per_symbol, int(xrate)) diff --git a/gnuradio-examples/python/digital/receive_path.py b/gnuradio-examples/python/digital/receive_path.py index 7df945ed0..0024d6941 100644 --- a/gnuradio-examples/python/digital/receive_path.py +++ b/gnuradio-examples/python/digital/receive_path.py @@ -119,7 +119,7 @@ class receive_path(gr.hier_block2): normal.add_option("-r", "--bitrate", type="eng_float", default=100e3, help="specify bitrate [default=%default].") normal.add_option("-v", "--verbose", action="store_true", default=False) - expert.add_option("-S", "--samples-per-symbol", type="int", default=None, + expert.add_option("-S", "--samples-per-symbol", type="float", default=None, help="set samples/symbol [default=%default]") expert.add_option("", "--log", action="store_true", default=False, help="Log all parts of flow graph to files (CAUTION: lots of data)") diff --git a/gnuradio-examples/python/digital/transmit_path.py b/gnuradio-examples/python/digital/transmit_path.py index ba0c434da..86ebf75c3 100644 --- a/gnuradio-examples/python/digital/transmit_path.py +++ b/gnuradio-examples/python/digital/transmit_path.py @@ -99,7 +99,7 @@ class transmit_path(gr.hier_block2): help="set transmitter digital amplitude: 0 <= AMPL < 1 [default=%default]") normal.add_option("-v", "--verbose", action="store_true", default=False) - expert.add_option("-S", "--samples-per-symbol", type="int", default=None, + expert.add_option("-S", "--samples-per-symbol", type="float", default=None, help="set samples/symbol [default=%default]") expert.add_option("", "--log", action="store_true", default=False, help="Log all parts of flow graph to file (CAUTION: lots of data)") |