summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/sphinx/source/digital/index.rst5
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/hier_block2.py4
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/top_block.py6
-rw-r--r--gr-digital/include/digital_constellation.h29
-rw-r--r--gr-digital/python/bpsk.py106
-rw-r--r--gr-digital/python/cpm.py61
-rw-r--r--gr-digital/python/generic_mod_demod.py95
-rw-r--r--gr-digital/python/gmsk.py72
-rw-r--r--gr-digital/python/psk.py47
-rw-r--r--gr-digital/python/qam.py45
-rw-r--r--gr-digital/python/qpsk.py89
-rw-r--r--gr-digital/python/utils/mod_codes.py1
12 files changed, 287 insertions, 273 deletions
diff --git a/docs/sphinx/source/digital/index.rst b/docs/sphinx/source/digital/index.rst
index 5208216cce..14c84fe4bb 100644
--- a/docs/sphinx/source/digital/index.rst
+++ b/docs/sphinx/source/digital/index.rst
@@ -101,8 +101,6 @@ Modulation Utilties
:nosignatures:
gnuradio.digital.utils.gray_code.gray_code
- gnuradio.digital.utils.mod_codes.GRAY_CODE
- gnuradio.digital.utils.mod_codes.NO_CODE
gnuradio.digital.modulation_utils.add_type_1_constellation
gnuradio.digital.modulation_utils.add_type_1_demod
gnuradio.digital.modulation_utils.add_type_1_mod
@@ -110,6 +108,9 @@ Modulation Utilties
gnuradio.digital.modulation_utils.type_1_demods
gnuradio.digital.modulation_utils.type_1_mods
+.. gnuradio.digital.utils.mod_codes.GRAY_CODE
+.. gnuradio.digital.utils.mod_codes.NO_CODE
+
Packet Utilities
----------------
diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
index 0c45f1691d..bf7f26794f 100644
--- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
+++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
@@ -31,7 +31,9 @@ from gnuradio_core import hier_block2_swig
#
class hier_block2(object):
"""
- Python wrapper around the C++ hierarchical block implementation.
+ Subclass this to create a python hierarchical block.
+
+ This is a python wrapper around the C++ hierarchical block implementation.
Provides convenience functions and allows proper Python subclassing.
"""
diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py
index 43af8073b6..c2937659f6 100644
--- a/gnuradio-core/src/python/gnuradio/gr/top_block.py
+++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py
@@ -85,6 +85,12 @@ class _top_block_waiter(_threading.Thread):
# method in gr_top_block
#
class top_block(object):
+ """
+ Top-level hierarchical block representing a flow-graph.
+
+ This is a python wrapper around the C++ implementation to allow
+ python subclassing.
+ """
def __init__(self, name="top_block"):
self._tb = top_block_swig(name)
diff --git a/gr-digital/include/digital_constellation.h b/gr-digital/include/digital_constellation.h
index a72bfb74c5..09a1e5fad4 100644
--- a/gr-digital/include/digital_constellation.h
+++ b/gr-digital/include/digital_constellation.h
@@ -209,6 +209,19 @@ class DIGITAL_API digital_constellation_sector : public digital_constellation
/* digital_constellation_rect */
/************************************************************/
+class digital_constellation_rect;
+typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr;
+
+// public constructor
+DIGITAL_API digital_constellation_rect_sptr
+digital_make_constellation_rect (std::vector<gr_complex> constellation,
+ std::vector<unsigned int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors,
+ unsigned int imag_sectors,
+ float width_real_sectors,
+ float width_imag_sectors);
+
/*!
* \brief Rectangular digital constellation
* \ingroup digital
@@ -223,20 +236,6 @@ class DIGITAL_API digital_constellation_sector : public digital_constellation
* Works for any generic constellation provided sectors are not too
* large.
*/
-
-class digital_constellation_rect;
-typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_rect_sptr
-digital_make_constellation_rect (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors);
-
class DIGITAL_API digital_constellation_rect : public digital_constellation_sector
{
public:
@@ -288,7 +287,7 @@ digital_make_constellation_psk (std::vector<gr_complex> constellation,
unsigned int n_sectors);
/*!
- * \brief digital_constellation_psk
+ * \brief Digital Constellation for PSK.
* \ingroup digital
*
* Constellation space is divided into pie slices sectors.
diff --git a/gr-digital/python/bpsk.py b/gr-digital/python/bpsk.py
index 9f2354003c..bee6cb0034 100644
--- a/gr-digital/python/bpsk.py
+++ b/gr-digital/python/bpsk.py
@@ -28,6 +28,7 @@ from cmath import exp
from gnuradio import gr
from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod
+from gnuradio.digital.generic_mod_demod import shared_mod_args, shared_demod_args
import digital_swig
import modulation_utils
@@ -43,50 +44,51 @@ def bpsk_constellation():
# /////////////////////////////////////////////////////////////////////////////
class bpsk_mod(generic_mod):
+ """
+ Hierarchical block for RRC-filtered BPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+
+ Args:
+ mod_code: Argument is not used. It exists purely to simplify generation of the block in grc.
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, mod_code=None, differential=False, *args, **kwargs):
- """
- Hierarchical block for RRC-filtered BPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
-
- 'mod_code' argument is not used.
- It exists purely to simplify generation of the block in grc.
- """
-
constellation = digital_swig.constellation_bpsk()
super(bpsk_mod, self).__init__(constellation=constellation,
differential=differential, *args, **kwargs)
-
+
+
# /////////////////////////////////////////////////////////////////////////////
# BPSK demodulator
#
# /////////////////////////////////////////////////////////////////////////////
class bpsk_demod(generic_demod):
+ """
+ Hierarchical block for RRC-filtered BPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Argument is not used. It exists purely to simplify generation of the block in grc.
+ differential: whether to use differential encoding (boolean)
+ """
+ # See generic_demod for additional arguments
+ __doc__ += shared_demod_args
def __init__(self, mod_code=None, differential=False, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered BPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
-
- 'mod_code' argument is not used.
- It exists purely to simplify generation of the block in grc.
- """
-
constellation = digital_swig.constellation_bpsk()
super(bpsk_demod, self).__init__(constellation=constellation,
differential=differential, *args, **kwargs)
-
+#bpsk_demod.__doc__ += shared_demod_args
# /////////////////////////////////////////////////////////////////////////////
@@ -101,23 +103,22 @@ def dbpsk_constellation():
# /////////////////////////////////////////////////////////////////////////////
class dbpsk_mod(bpsk_mod):
+ """
+ Hierarchical block for RRC-filtered DBPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Argument is not used. It exists purely to simplify generation of the block in grc.
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, mod_code=None, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered DBPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
-
- 'mod_code' argument is not used.
- It exists purely to simplify generation of the block in grc.
- """
-
super(dbpsk_mod, self).__init__(differential=True,
*args, **kwargs)
+#dbpsk_mod.__doc__ += shared_mod_args
# /////////////////////////////////////////////////////////////////////////////
# DBPSK demodulator
@@ -125,23 +126,22 @@ class dbpsk_mod(bpsk_mod):
# /////////////////////////////////////////////////////////////////////////////
class dbpsk_demod(bpsk_demod):
+ """
+ Hierarchical block for RRC-filtered DBPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Argument is not used. It exists purely to simplify generation of the block in grc.
+ """
+ # See generic_demod for additional arguments
+ __doc__ += shared_demod_args
def __init__(self, mod_code=None, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered DBPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
-
- 'mod_code' argument is not used.
- It exists purely to simplify generation of the block in grc.
- """
-
super(dbpsk_demod, self).__init__(differential=True,
*args, **kwargs)
+#dbpsk_demod.__doc__ += shared_demod_args
#
# Add these to the mod/demod registry
diff --git a/gr-digital/python/cpm.py b/gr-digital/python/cpm.py
index f11832b626..194eb71a81 100644
--- a/gr-digital/python/cpm.py
+++ b/gr-digital/python/cpm.py
@@ -49,6 +49,31 @@ _def_log = False
# /////////////////////////////////////////////////////////////////////////////
class cpm_mod(gr.hier_block2):
+ """
+ Hierarchical block for Continuous Phase modulation.
+
+ The input is a byte stream (unsigned char) representing packed
+ bits and the output is the complex modulated signal at baseband.
+
+ See Proakis for definition of generic CPM signals:
+ s(t)=exp(j phi(t))
+ phi(t)= 2 pi h int_0^t f(t') dt'
+ f(t)=sum_k a_k g(t-kT)
+ (normalizing assumption: int_0^infty g(t) dt = 1/2)
+
+ Args:
+ samples_per_symbol: samples per baud >= 2 (integer)
+ bits_per_symbol: bits per symbol (integer)
+ h_numerator: numerator of modulation index (integer)
+ h_denominator: denominator of modulation index (numerator and denominator must be relative primes) (integer)
+ cpm_type: supported types are: 0=CPFSK, 1=GMSK, 2=RC, 3=GENERAL (integer)
+ bt: bandwidth symbol time product for GMSK (float)
+ symbols_per_pulse: shaping pulse duration in symbols (integer)
+ generic_taps: define a generic CPM pulse shape (sum = samples_per_symbol/2) (list/array of floats)
+ verbose: Print information about modulator? (boolean)
+ debug: Print modulation data to files? (boolean)
+ """
+
def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
bits_per_symbol=_def_bits_per_symbol,
@@ -60,42 +85,6 @@ class cpm_mod(gr.hier_block2):
generic_taps=_def_generic_taps,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for Continuous Phase
- modulation.
-
- The input is a byte stream (unsigned char)
- representing packed bits and the
- output is the complex modulated signal at baseband.
-
- See Proakis for definition of generic CPM signals:
- s(t)=exp(j phi(t))
- phi(t)= 2 pi h int_0^t f(t') dt'
- f(t)=sum_k a_k g(t-kT)
- (normalizing assumption: int_0^infty g(t) dt = 1/2)
-
- @param samples_per_symbol: samples per baud >= 2
- @type samples_per_symbol: integer
- @param bits_per_symbol: bits per symbol
- @type bits_per_symbol: integer
- @param h_numerator: numerator of modulation index
- @type h_numerator: integer
- @param h_denominator: denominator of modulation index (numerator and denominator must be relative primes)
- @type h_denominator: integer
- @param cpm_type: supported types are: 0=CPFSK, 1=GMSK, 2=RC, 3=GENERAL
- @type cpm_type: integer
- @param bt: bandwidth symbol time product for GMSK
- @type bt: float
- @param symbols_per_pulse: shaping pulse duration in symbols
- @type symbols_per_pulse: integer
- @param generic_taps: define a generic CPM pulse shape (sum = samples_per_symbol/2)
- @type generic_taps: array of floats
-
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param debug: Print modulation data to files?
- @type debug: bool
- """
gr.hier_block2.__init__(self, "cpm_mod",
gr.io_signature(1, 1, gr.sizeof_char), # Input signature
diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index 105c6fe8ff..6f27092429 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -74,6 +74,21 @@ def add_common_options(parser):
# /////////////////////////////////////////////////////////////////////////////
class generic_mod(gr.hier_block2):
+ """
+ Hierarchical block for RRC-filtered differential generic modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation: determines the modulation type (gnuradio.digital.digital_constellation)
+ samples_per_symbol: samples per baud >= 2 (float)
+ differential: whether to use differential encoding (boolean)
+ pre_diff_code: whether to use apply a pre-differential mapping (boolean)
+ excess_bw: Root-raised cosine filter excess bandwidth (float)
+ verbose: Print information about modulator? (boolean)
+ log: Log modulation data to files? (boolean)
+ """
def __init__(self, constellation,
differential=_def_differential,
@@ -82,27 +97,6 @@ class generic_mod(gr.hier_block2):
excess_bw=_def_excess_bw,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for RRC-filtered differential generic modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- @param constellation: determines the modulation type
- @type constellation: gnuradio.digital.gr_constellation
- @param samples_per_symbol: samples per baud >= 2
- @type samples_per_symbol: float
- @param differential: whether to use differential encoding
- @type differential: boolean
- @param pre_diff_code: whether to use apply a pre-differential mapping
- @type pre_diff_code: boolean
- @param excess_bw: Root-raised cosine filter excess bandwidth
- @type excess_bw: float
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param log: Log modulation data to files?
- @type log: bool
- """
gr.hier_block2.__init__(self, "generic_mod",
gr.io_signature(1, 1, gr.sizeof_char), # Input signature
@@ -210,6 +204,24 @@ class generic_mod(gr.hier_block2):
# /////////////////////////////////////////////////////////////////////////////
class generic_demod(gr.hier_block2):
+ """
+ Hierarchical block for RRC-filtered differential generic demodulation.
+
+ The input is the complex modulated signal at baseband.
+ The output is a stream of bits packed 1 bit per byte (LSB)
+
+ Args:
+ constellation: determines the modulation type (gnuradio.digital.digital_constellation)
+ samples_per_symbol: samples per baud >= 2 (float)
+ differential: whether to use differential encoding (boolean)
+ pre_diff_code: whether to use apply a pre-differential mapping (boolean)
+ excess_bw: Root-raised cosine filter excess bandwidth (float)
+ freq_bw: loop filter lock-in bandwidth (float)
+ timing_bw: timing recovery loop lock-in bandwidth (float)
+ phase_bw: phase recovery loop bandwidth (float)
+ verbose: Print information about modulator? (boolean)
+ log: Log modulation data to files? (boolean)
+ """
def __init__(self, constellation,
differential=_def_differential,
@@ -221,33 +233,6 @@ class generic_demod(gr.hier_block2):
phase_bw=_def_phase_bw,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for RRC-filtered differential generic demodulation.
-
- The input is the complex modulated signal at baseband.
- The output is a stream of bits packed 1 bit per byte (LSB)
-
- @param constellation: determines the modulation type
- @type constellation: gnuradio.digital.gr_constellation
- @param samples_per_symbol: samples per symbol >= 2
- @type samples_per_symbol: float
- @param differential: whether to use differential encoding
- @type differential: boolean
- @param pre_diff_code: whether to use apply a pre-differential mapping
- @type pre_diff_code: boolean
- @param excess_bw: Root-raised cosine filter excess bandwidth
- @type excess_bw: float
- @param freq_bw: loop filter lock-in bandwidth
- @type freq_bw: float
- @param timing_bw: timing recovery loop lock-in bandwidth
- @type timing_bw: float
- @param phase_bw: phase recovery loop bandwidth
- @type phase_bw: float
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param debug: Print modualtion data to files?
- @type debug: bool
- """
gr.hier_block2.__init__(self, "generic_demod",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
@@ -394,3 +379,17 @@ class generic_demod(gr.hier_block2):
return extract_kwargs_from_options_for_class(cls, options)
extract_kwargs_from_options=classmethod(extract_kwargs_from_options)
+shared_demod_args = """ samples_per_symbol: samples per baud >= 2 (float)
+ excess_bw: Root-raised cosine filter excess bandwidth (float)
+ freq_bw: loop filter lock-in bandwidth (float)
+ timing_bw: timing recovery loop lock-in bandwidth (float)
+ phase_bw: phase recovery loop bandwidth (float)
+ verbose: Print information about modulator? (boolean)
+ log: Log modulation data to files? (boolean)
+"""
+
+shared_mod_args = """ samples_per_symbol: samples per baud >= 2 (float)
+ excess_bw: Root-raised cosine filter excess bandwidth (float)
+ verbose: Print information about modulator? (boolean)
+ log: Log modulation data to files? (boolean)
+"""
diff --git a/gr-digital/python/gmsk.py b/gr-digital/python/gmsk.py
index 2c9be056c2..d7b547d012 100644
--- a/gr-digital/python/gmsk.py
+++ b/gr-digital/python/gmsk.py
@@ -53,28 +53,25 @@ _def_omega_relative_limit = 0.005
# /////////////////////////////////////////////////////////////////////////////
class gmsk_mod(gr.hier_block2):
+ """
+ Hierarchical block for Gaussian Minimum Shift Key (GMSK)
+ modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ samples_per_symbol: samples per baud >= 2 (integer)
+ bt: Gaussian filter bandwidth * symbol time (float)
+ verbose: Print information about modulator? (boolean)
+ debug: Print modulation data to files? (boolean)
+ """
def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
bt=_def_bt,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for Gaussian Minimum Shift Key (GMSK)
- modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- @param samples_per_symbol: samples per baud >= 2
- @type samples_per_symbol: integer
- @param bt: Gaussian filter bandwidth * symbol time
- @type bt: float
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param debug: Print modualtion data to files?
- @type debug: bool
- """
gr.hier_block2.__init__(self, "gmsk_mod",
gr.io_signature(1, 1, gr.sizeof_char), # Input signature
@@ -166,7 +163,23 @@ class gmsk_mod(gr.hier_block2):
# /////////////////////////////////////////////////////////////////////////////
class gmsk_demod(gr.hier_block2):
-
+ """
+ Hierarchical block for Gaussian Minimum Shift Key (GMSK)
+ demodulation.
+
+ The input is the complex modulated signal at baseband.
+ The output is a stream of bits packed 1 bit per byte (the LSB)
+
+ Args:
+ samples_per_symbol: samples per baud (integer)
+ verbose: Print information about modulator? (boolean)
+ log: Print modualtion data to files? (boolean)
+ gain_mu: controls rate of mu adjustment (float)
+ mu: fractional delay [0.0, 1.0] (float)
+ omega_relative_limit: sets max variation in omega (float)
+ freq_error: bit rate error as a fraction (float)
+ """
+
def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
gain_mu=_def_gain_mu,
@@ -175,31 +188,6 @@ class gmsk_demod(gr.hier_block2):
freq_error=_def_freq_error,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for Gaussian Minimum Shift Key (GMSK)
- demodulation.
-
- The input is the complex modulated signal at baseband.
- The output is a stream of bits packed 1 bit per byte (the LSB)
-
- @param samples_per_symbol: samples per baud
- @type samples_per_symbol: integer
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param log: Print modualtion data to files?
- @type log: bool
-
- Clock recovery parameters. These all have reasonble defaults.
-
- @param gain_mu: controls rate of mu adjustment
- @type gain_mu: float
- @param mu: fractional delay [0.0, 1.0]
- @type mu: float
- @param omega_relative_limit: sets max variation in omega
- @type omega_relative_limit: float, typically 0.000200 (200 ppm)
- @param freq_error: bit rate error as a fraction
- @param float
- """
gr.hier_block2.__init__(self, "gmsk_demod",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
diff --git a/gr-digital/python/psk.py b/gr-digital/python/psk.py
index 4b35447278..1816ffb4ba 100644
--- a/gr-digital/python/psk.py
+++ b/gr-digital/python/psk.py
@@ -30,6 +30,7 @@ import digital_swig
import modulation_utils
from utils import mod_codes, gray_code
from generic_mod_demod import generic_mod, generic_demod
+from generic_mod_demod import shared_mod_args, shared_demod_args
# Default number of points in constellation.
_def_constellation_points = 4
@@ -81,21 +82,24 @@ def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code,
# /////////////////////////////////////////////////////////////////////////////
class psk_mod(generic_mod):
+ """
+ Hierarchical block for RRC-filtered PSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation_points: Number of constellation points (must be a power of two) (integer).
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, constellation_points=_def_constellation_points,
mod_code=_def_mod_code,
differential=_def_differential,
*args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered PSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
- """
-
constellation = psk_constellation(constellation_points, mod_code, differential)
super(psk_mod, self).__init__(constellation, differential, *args, **kwargs)
@@ -106,20 +110,23 @@ class psk_mod(generic_mod):
class psk_demod(generic_demod):
+ """
+ Hierarchical block for RRC-filtered PSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation_points: Number of constellation points (must be a power of two) (integer).
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, constellation_points=_def_constellation_points,
mod_code=_def_mod_code,
differential=_def_differential,
*args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered PSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
-
constellation = psk_constellation(constellation_points, mod_code, differential)
super(psk_demod, self).__init__(constellation, differential, *args, **kwargs)
diff --git a/gr-digital/python/qam.py b/gr-digital/python/qam.py
index 0635fda75e..aafa5725d9 100644
--- a/gr-digital/python/qam.py
+++ b/gr-digital/python/qam.py
@@ -27,6 +27,7 @@ from math import pi, sqrt, log
from gnuradio import gr
from generic_mod_demod import generic_mod, generic_demod
+from generic_mod_demod import shared_mod_args, shared_demod_args
from utils.gray_code import gray_code
from utils import mod_codes
import modulation_utils
@@ -180,21 +181,25 @@ def qam_constellation(constellation_points=_def_constellation_points,
# /////////////////////////////////////////////////////////////////////////////
class qam_mod(generic_mod):
+ """
+ Hierarchical block for RRC-filtered QAM modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation_points: Number of constellation points (must be a power of four) (integer).
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, constellation_points=_def_constellation_points,
differential=_def_differential,
mod_code=_def_mod_code,
*args, **kwargs):
- """
- Hierarchical block for RRC-filtered QAM modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
- """
-
constellation = qam_constellation(constellation_points, differential, mod_code)
# We take care of the gray coding in the constellation generation so it doesn't
# need to be done in the block.
@@ -207,20 +212,24 @@ class qam_mod(generic_mod):
# /////////////////////////////////////////////////////////////////////////////
class qam_demod(generic_demod):
+ """
+ Hierarchical block for RRC-filtered QAM modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation_points: Number of constellation points (must be a power of four) (integer).
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_demod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, constellation_points=_def_constellation_points,
differential=_def_differential,
mod_code=_def_mod_code,
*args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered QAM modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
constellation = qam_constellation(constellation_points, differential, mod_code)
# We take care of the gray coding in the constellation generation so it doesn't
# need to be done in the block.
diff --git a/gr-digital/python/qpsk.py b/gr-digital/python/qpsk.py
index 2fdeabd40f..60f791af7f 100644
--- a/gr-digital/python/qpsk.py
+++ b/gr-digital/python/qpsk.py
@@ -27,6 +27,7 @@ Demodulation is not included since the generic_mod_demod
from gnuradio import gr
from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod
+from gnuradio.digital.generic_mod_demod import shared_mod_args, shared_demod_args
from utils import mod_codes
import digital_swig
import modulation_utils
@@ -39,6 +40,9 @@ _def_mod_code = mod_codes.GRAY_CODE
# /////////////////////////////////////////////////////////////////////////////
def qpsk_constellation(mod_code=_def_mod_code):
+ """
+ Creates a QPSK constellation.
+ """
if mod_code != mod_codes.GRAY_CODE:
raise ValueError("This QPSK mod/demod works only for gray-coded constellations.")
return digital_swig.constellation_qpsk()
@@ -48,18 +52,20 @@ def qpsk_constellation(mod_code=_def_mod_code):
# /////////////////////////////////////////////////////////////////////////////
class qpsk_mod(generic_mod):
-
- def __init__(self, mod_code=_def_mod_code, differential=False, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered QPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
- """
+ """
+ Hierarchical block for RRC-filtered QPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
+ def __init__(self, mod_code=_def_mod_code, differential=False, *args, **kwargs):
pre_diff_code = True
if not differential:
constellation = digital_swig.constellation_qpsk()
@@ -83,19 +89,21 @@ class qpsk_mod(generic_mod):
# /////////////////////////////////////////////////////////////////////////////
class qpsk_demod(generic_demod):
+ """
+ Hierarchical block for RRC-filtered QPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_demod_args
def __init__(self, mod_code=_def_mod_code, differential=False,
*args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered QPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
-
pre_diff_code = True
if not differential:
constellation = digital_swig.constellation_qpsk()
@@ -128,16 +136,19 @@ def dqpsk_constellation(mod_code=_def_mod_code):
# /////////////////////////////////////////////////////////////////////////////
class dqpsk_mod(qpsk_mod):
+ """
+ Hierarchical block for RRC-filtered DQPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, mod_code=_def_mod_code, *args, **kwargs):
- """
- Hierarchical block for RRC-filtered DQPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
- """
super(dqpsk_mod, self).__init__(mod_code, differential=True,
*args, **kwargs)
@@ -147,17 +158,19 @@ class dqpsk_mod(qpsk_mod):
# /////////////////////////////////////////////////////////////////////////////
class dqpsk_demod(qpsk_demod):
+ """
+ Hierarchical block for RRC-filtered DQPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_demod_args
def __init__(self, mod_code=_def_mod_code, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered DQPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
super(dqpsk_demod, self).__init__(mod_code, differential=True,
*args, **kwargs)
diff --git a/gr-digital/python/utils/mod_codes.py b/gr-digital/python/utils/mod_codes.py
index caacda5cc6..f55fe41b8b 100644
--- a/gr-digital/python/utils/mod_codes.py
+++ b/gr-digital/python/utils/mod_codes.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+# Constants used to represent what coding to use.
GRAY_CODE = 'gray'
SET_PARTITION_CODE = 'set-partition'
NO_CODE = 'none'