summaryrefslogtreecommitdiff
path: root/gr-digital/python/digital
diff options
context:
space:
mode:
authorJiří Pinkava <j-pi@seznam.cz>2016-06-28 13:14:38 +0200
committerJiří Pinkava <j-pi@seznam.cz>2016-06-28 13:14:54 +0200
commit2013f22b4e2203f88f482ff545aaafee35c72494 (patch)
tree29d8dce5ca93452c17c21bacb6a939b55df3d492 /gr-digital/python/digital
parent3b2566122d89a1c23460f8d1f3e558b872666612 (diff)
simplify application of staticmethod in .py
Diffstat (limited to 'gr-digital/python/digital')
-rw-r--r--gr-digital/python/digital/cpm.py6
-rw-r--r--gr-digital/python/digital/generic_mod_demod.py6
-rw-r--r--gr-digital/python/digital/gfsk.py17
-rw-r--r--gr-digital/python/digital/gmsk.py17
-rw-r--r--gr-digital/python/digital/ofdm.py6
5 files changed, 19 insertions, 33 deletions
diff --git a/gr-digital/python/digital/cpm.py b/gr-digital/python/digital/cpm.py
index b27fb098f5..322c3f0bfc 100644
--- a/gr-digital/python/digital/cpm.py
+++ b/gr-digital/python/digital/cpm.py
@@ -204,23 +204,21 @@ class cpm_mod(gr.hier_block2):
self.connect(self.fmmod,
blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
-
+ @staticmethod
def add_options(parser):
"""
Adds CPM modulation-specific options to the standard parser
"""
parser.add_option("", "--bt", type="float", default=_def_bt,
help="set bandwidth-time product [default=%default] (GMSK)")
- add_options=staticmethod(add_options)
-
+ @staticmethod
def extract_kwargs_from_options(options):
"""
Given command line options, create dictionary suitable for passing to __init__
"""
return modulation_utils.extract_kwargs_from_options(cpm_mod.__init__,
('self',), options)
- extract_kwargs_from_options=staticmethod(extract_kwargs_from_options)
diff --git a/gr-digital/python/digital/generic_mod_demod.py b/gr-digital/python/digital/generic_mod_demod.py
index f34994fa7b..1b8e1149c9 100644
--- a/gr-digital/python/digital/generic_mod_demod.py
+++ b/gr-digital/python/digital/generic_mod_demod.py
@@ -175,12 +175,12 @@ class generic_mod(gr.hier_block2):
def bits_per_symbol(self): # static method that's also callable on an instance
return self._constellation.bits_per_symbol()
+ @staticmethod
def add_options(parser):
"""
Adds generic modulation options to the standard parser
"""
add_common_options(parser)
- add_options=staticmethod(add_options)
def extract_kwargs_from_options(cls, options):
"""
@@ -324,7 +324,7 @@ class generic_demod(gr.hier_block2):
def samples_per_symbol(self):
return self._samples_per_symbol
- def bits_per_symbol(self): # staticmethod that's also callable on an instance
+ def bits_per_symbol(self):
return self._constellation.bits_per_symbol()
def _print_verbage(self):
@@ -372,6 +372,7 @@ class generic_demod(gr.hier_block2):
self.connect(self.unpack,
blocks.file_sink(gr.sizeof_char, "rx_unpack.8b"))
+ @staticmethod
def add_options(parser):
"""
Adds generic demodulation options to the standard parser
@@ -385,7 +386,6 @@ class generic_demod(gr.hier_block2):
help="set phase tracking loop lock-in bandwidth [default=%default]")
parser.add_option("", "--timing-bw", type="float", default=_def_timing_bw,
help="set timing symbol sync loop gain lock-in bandwidth [default=%default]")
- add_options=staticmethod(add_options)
def extract_kwargs_from_options(cls, options):
"""
diff --git a/gr-digital/python/digital/gfsk.py b/gr-digital/python/digital/gfsk.py
index 6ba007ca0f..3569ffe6cf 100644
--- a/gr-digital/python/digital/gfsk.py
+++ b/gr-digital/python/digital/gfsk.py
@@ -133,10 +133,9 @@ class gfsk_mod(gr.hier_block2):
def samples_per_symbol(self):
return self._samples_per_symbol
+ @staticmethod
def bits_per_symbol(self=None): # staticmethod that's also callable on an instance
return 1
- bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method.
-
def _print_verbage(self):
print "bits per symbol = %d" % self.bits_per_symbol()
@@ -152,24 +151,21 @@ class gfsk_mod(gr.hier_block2):
self.connect(self.fmmod,
blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
-
+ @staticmethod
def add_options(parser):
"""
Adds GFSK modulation-specific options to the standard parser
"""
parser.add_option("", "--bt", type="float", default=_def_bt,
help="set bandwidth-time product [default=%default] (GFSK)")
- add_options=staticmethod(add_options)
-
+ @staticmethod
def extract_kwargs_from_options(options):
"""
Given command line options, create dictionary suitable for passing to __init__
"""
return modulation_utils.extract_kwargs_from_options(gfsk_mod.__init__,
('self',), options)
- extract_kwargs_from_options=staticmethod(extract_kwargs_from_options)
-
# /////////////////////////////////////////////////////////////////////////////
@@ -255,10 +251,9 @@ class gfsk_demod(gr.hier_block2):
def samples_per_symbol(self):
return self._samples_per_symbol
+ @staticmethod
def bits_per_symbol(self=None): # staticmethod that's also callable on an instance
return 1
- bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method.
-
def _print_verbage(self):
print "bits per symbol = %d" % self.bits_per_symbol()
@@ -278,6 +273,7 @@ class gfsk_demod(gr.hier_block2):
self.connect(self.slicer,
blocks.file_sink(gr.sizeof_char, "slicer.dat"))
+ @staticmethod
def add_options(parser):
"""
Adds GFSK demodulation-specific options to the standard parser
@@ -290,15 +286,14 @@ class gfsk_demod(gr.hier_block2):
help="M&M clock recovery omega relative limit [default=%default] (GFSK/PSK)")
parser.add_option("", "--freq-error", type="float", default=_def_freq_error,
help="M&M clock recovery frequency error [default=%default] (GFSK)")
- add_options=staticmethod(add_options)
+ @staticmethod
def extract_kwargs_from_options(options):
"""
Given command line options, create dictionary suitable for passing to __init__
"""
return modulation_utils.extract_kwargs_from_options(gfsk_demod.__init__,
('self',), options)
- extract_kwargs_from_options=staticmethod(extract_kwargs_from_options)
#
diff --git a/gr-digital/python/digital/gmsk.py b/gr-digital/python/digital/gmsk.py
index 284f85f333..e7a92a95db 100644
--- a/gr-digital/python/digital/gmsk.py
+++ b/gr-digital/python/digital/gmsk.py
@@ -123,10 +123,9 @@ class gmsk_mod(gr.hier_block2):
def samples_per_symbol(self):
return self._samples_per_symbol
+ @staticmethod
def bits_per_symbol(self=None): # staticmethod that's also callable on an instance
return 1
- bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method.
-
def _print_verbage(self):
print "bits per symbol = %d" % self.bits_per_symbol()
@@ -142,24 +141,21 @@ class gmsk_mod(gr.hier_block2):
self.connect(self.fmmod,
blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
-
+ @staticmethod
def add_options(parser):
"""
Adds GMSK modulation-specific options to the standard parser
"""
parser.add_option("", "--bt", type="float", default=_def_bt,
help="set bandwidth-time product [default=%default] (GMSK)")
- add_options=staticmethod(add_options)
-
+ @staticmethod
def extract_kwargs_from_options(options):
"""
Given command line options, create dictionary suitable for passing to __init__
"""
return modulation_utils.extract_kwargs_from_options(gmsk_mod.__init__,
('self',), options)
- extract_kwargs_from_options=staticmethod(extract_kwargs_from_options)
-
# /////////////////////////////////////////////////////////////////////////////
@@ -239,10 +235,9 @@ class gmsk_demod(gr.hier_block2):
def samples_per_symbol(self):
return self._samples_per_symbol
+ @staticmethod
def bits_per_symbol(self=None): # staticmethod that's also callable on an instance
return 1
- bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method.
-
def _print_verbage(self):
print "bits per symbol = %d" % self.bits_per_symbol()
@@ -262,6 +257,7 @@ class gmsk_demod(gr.hier_block2):
self.connect(self.slicer,
blocks.file_sink(gr.sizeof_char, "slicer.dat"))
+ @staticmethod
def add_options(parser):
"""
Adds GMSK demodulation-specific options to the standard parser
@@ -274,15 +270,14 @@ class gmsk_demod(gr.hier_block2):
help="M&M clock recovery omega relative limit [default=%default] (GMSK/PSK)")
parser.add_option("", "--freq-error", type="float", default=_def_freq_error,
help="M&M clock recovery frequency error [default=%default] (GMSK)")
- add_options=staticmethod(add_options)
+ @staticmethod
def extract_kwargs_from_options(options):
"""
Given command line options, create dictionary suitable for passing to __init__
"""
return modulation_utils.extract_kwargs_from_options(gmsk_demod.__init__,
('self',), options)
- extract_kwargs_from_options=staticmethod(extract_kwargs_from_options)
#
diff --git a/gr-digital/python/digital/ofdm.py b/gr-digital/python/digital/ofdm.py
index fdb23703f9..563b70ad00 100644
--- a/gr-digital/python/digital/ofdm.py
+++ b/gr-digital/python/digital/ofdm.py
@@ -146,6 +146,7 @@ class ofdm_mod(gr.hier_block2):
msg = gr.message_from_string(pkt)
self._pkt_input.msgq().insert_tail(msg)
+ @staticmethod
def add_options(normal, expert):
"""
Adds OFDM-specific options to the Options Parser
@@ -158,8 +159,6 @@ class ofdm_mod(gr.hier_block2):
help="set the number of occupied FFT bins [default=%default]")
expert.add_option("", "--cp-length", type="intx", default=128,
help="set the number of bits in the cyclic prefix [default=%default]")
- # Make a static method to call before instantiation
- add_options = staticmethod(add_options)
def _print_verbage(self):
"""
@@ -267,6 +266,7 @@ class ofdm_demod(gr.hier_block2):
self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
+ @staticmethod
def add_options(normal, expert):
"""
Adds OFDM-specific options to the Options Parser
@@ -281,8 +281,6 @@ class ofdm_demod(gr.hier_block2):
help="set the number of bits in the cyclic prefix [default=%default]")
expert.add_option("", "--snr", type="float", default=30.0,
help="SNR estimate [default=%default]")
- # Make a static method to call before instantiation
- add_options = staticmethod(add_options)
def _print_verbage(self):
"""