diff options
author | Andrej Rode <mail@andrejro.de> | 2018-06-23 23:41:42 +0200 |
---|---|---|
committer | Andrej Rode <mail@andrejro.de> | 2018-06-24 00:03:35 +0200 |
commit | 167a6152bad060fc53dd29e0fa79ef83eff1be5b (patch) | |
tree | a01049672d9d7d1bf3d295ed96698a323941f8e8 /gr-digital/python/digital/generic_mod_demod.py | |
parent | 3c8e6008b092287246234001db7cf1a4038300da (diff) | |
parent | fcd002b6ac82e1e0c1224e24506410ff0833e1aa (diff) |
Merge branch 'python3_fix' into next
Manual merge conflict resolution has been applied to following
conflicts:
* Typos:
* gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
* gr-blocks/python/blocks/qa_wavfile.py
* gr-filter/examples/gr_filtdes_api.py
* grc/blocks/parameter.xml
* gr-uhd/python/uhd/__init__.py
* ValueError -> RuntimeError:
* gr-blocks/python/blocks/qa_hier_block2.py
* relative Imports & other Py3k:
* gr-digital/python/digital/psk_constellations.py
* gr-digital/python/digital/qam_constellations.py
* gr-digital/python/digital/test_soft_decisions.py
* gr-digital/python/digital/gfsk.py
* SequenceCompleter:
* gr-utils/python/modtool/modtool_add.py
* gr-utils/python/modtool/modtool_rename.py
* gr-utils/python/modtool/modtool_rm.py
* Updated API on next:
* gr-blocks/grc/blocks_file_source.xml
* gr-blocks/python/blocks/qa_file_source_sink.py
* gr-qtgui/grc/qtgui_time_sink_x.xml
* GRC Py3k Updates:
* grc/core/Block.py
* grc/core/Constants.py
* grc/core/Platform.py
* grc/core/utils/odict.py
* grc/gui/Actions.py
* grc/gui/Block.py
* grc/gui/Executor.py
* grc/gui/Port.py
Diffstat (limited to 'gr-digital/python/digital/generic_mod_demod.py')
-rw-r--r-- | gr-digital/python/digital/generic_mod_demod.py | 68 |
1 files changed, 29 insertions, 39 deletions
diff --git a/gr-digital/python/digital/generic_mod_demod.py b/gr-digital/python/digital/generic_mod_demod.py index b26966fbcf..2a0d2c44ce 100644 --- a/gr-digital/python/digital/generic_mod_demod.py +++ b/gr-digital/python/digital/generic_mod_demod.py @@ -19,32 +19,22 @@ # Boston, MA 02110-1301, USA. # -# See gnuradio-examples/python/digital for examples - """ Generic modulation and demodulation. """ -from gnuradio import gr -from modulation_utils import extract_kwargs_from_options_for_class -from utils import mod_codes -import digital_swig as digital -import math +# See gnuradio-examples/python/digital for examples -try: - from gnuradio import blocks -except ImportError: - import blocks_swig as blocks +from __future__ import print_function +from __future__ import absolute_import +from __future__ import unicode_literals -try: - from gnuradio import filter -except ImportError: - import filter_swig as filter +from gnuradio import gr, blocks, filter, analog +from .modulation_utils import extract_kwargs_from_options_for_class +from .utils import mod_codes +from . import digital_swig as digital +import math -try: - from gnuradio import analog -except ImportError: - import analog_swig as analog # default values (used in __init__ and add_options) _def_samples_per_symbol = 2 @@ -113,9 +103,9 @@ class generic_mod(gr.hier_block2): verbose=_def_verbose, log=_def_log): - gr.hier_block2.__init__(self, "generic_mod", - gr.io_signature(1, 1, gr.sizeof_char), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature + gr.hier_block2.__init__(self, "generic_mod", + gr.io_signature(1, 1, gr.sizeof_char), # Input signature + gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature self._constellation = constellation self._samples_per_symbol = samples_per_symbol @@ -125,7 +115,7 @@ class generic_mod(gr.hier_block2): self.pre_diff_code = pre_diff_code and self._constellation.apply_pre_diff_code() if self._samples_per_symbol < 2: - raise TypeError, ("sps must be >= 2, is %f" % self._samples_per_symbol) + raise TypeError("sps must be >= 2, is %f" % self._samples_per_symbol) arity = pow(2,self.bits_per_symbol()) @@ -153,7 +143,7 @@ class generic_mod(gr.hier_block2): self.rrc_filter = filter.pfb_arb_resampler_ccf(self._samples_per_symbol, self.rrc_taps) - # Connect + # Connect self._blocks = [self, self.bytes2chunks] if self.pre_diff_code: self._blocks.append(self.symbol_mapper) @@ -191,12 +181,12 @@ class generic_mod(gr.hier_block2): def _print_verbage(self): - print "\nModulator:" - print "bits per symbol: %d" % self.bits_per_symbol() - print "RRC roll-off factor: %.2f" % self._excess_bw + print("\nModulator:") + print("bits per symbol: %d" % self.bits_per_symbol()) + print("RRC roll-off factor: %.2f" % self._excess_bw) def _setup_logging(self): - print "Modulation logging turned on." + print("Modulation logging turned on.") self.connect(self.bytes2chunks, blocks.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b")) if self.pre_diff_code: @@ -249,9 +239,9 @@ class generic_demod(gr.hier_block2): verbose=_def_verbose, log=_def_log): - gr.hier_block2.__init__(self, "generic_demod", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_char)) # Output signature + gr.hier_block2.__init__(self, "generic_demod", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_char)) # Output signature self._constellation = constellation self._samples_per_symbol = samples_per_symbol @@ -263,7 +253,7 @@ class generic_demod(gr.hier_block2): self._differential = differential if self._samples_per_symbol < 2: - raise TypeError, ("sps must be >= 2, is %d" % self._samples_per_symbol) + raise TypeError("sps must be >= 2, is %d" % self._samples_per_symbol) # Only apply a predifferential coding if the constellation also supports it. self.pre_diff_code = pre_diff_code and self._constellation.apply_pre_diff_code() @@ -328,15 +318,15 @@ class generic_demod(gr.hier_block2): return self._constellation.bits_per_symbol() def _print_verbage(self): - print "\nDemodulator:" - print "bits per symbol: %d" % self.bits_per_symbol() - print "RRC roll-off factor: %.2f" % self._excess_bw - print "FLL bandwidth: %.2e" % self._freq_bw - print "Timing bandwidth: %.2e" % self._timing_bw - print "Phase bandwidth: %.2e" % self._phase_bw + print("\nDemodulator:") + print("bits per symbol: %d" % self.bits_per_symbol()) + print("RRC roll-off factor: %.2f" % self._excess_bw) + print("FLL bandwidth: %.2e" % self._freq_bw) + print("Timing bandwidth: %.2e" % self._timing_bw) + print("Phase bandwidth: %.2e" % self._phase_bw) def _setup_logging(self): - print "Modulation logging turned on." + print("Modulation logging turned on.") self.connect(self.agc, blocks.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc")) self.connect((self.freq_recov, 0), |