summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/python
diff options
context:
space:
mode:
authorBen Reynwar2011-01-01 15:31:55 -0700
committerBen Reynwar2011-01-01 15:31:55 -0700
commit493cd2e48eee4850f2ceef20c9dd487b93ea6b9e (patch)
treed6bdc30566e7a90f7ea3a553a0037ea9d41c3e06 /gnuradio-core/src/python
parentee21aaed629cfe9cec2e561c0e3d10374ec80e29 (diff)
downloadgnuradio-493cd2e48eee4850f2ceef20c9dd487b93ea6b9e.tar.gz
gnuradio-493cd2e48eee4850f2ceef20c9dd487b93ea6b9e.tar.bz2
gnuradio-493cd2e48eee4850f2ceef20c9dd487b93ea6b9e.zip
Worked on generic demodulation.
Diffstat (limited to 'gnuradio-core/src/python')
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/generic_mod_demod.py8
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/qam.py49
2 files changed, 18 insertions, 39 deletions
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/generic_mod_demod.py b/gnuradio-core/src/python/gnuradio/blks2impl/generic_mod_demod.py
index 69e11fcb0..60a3fc777 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/generic_mod_demod.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/generic_mod_demod.py
@@ -22,7 +22,7 @@
# See gnuradio-examples/python/digital for examples
"""
-differential BPSK modulation and demodulation.
+Generic modulation and demodulation.
"""
from gnuradio import gr, gru, modulation_utils2
@@ -79,7 +79,7 @@ class generic_mod(gr.hier_block2):
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._constellation = constellation.base()
self._samples_per_symbol = samples_per_symbol
self._excess_bw = excess_bw
@@ -96,7 +96,7 @@ class generic_mod(gr.hier_block2):
self.diffenc = gr.diff_encoder_bb(arity)
- self.chunks2symbols = gr.chunks_to_symbols_bc(self._constellation.constellation())
+ self.chunks2symbols = gr.chunks_to_symbols_bc(self._constellation.points())
# pulse shaping filter
self.rrc_taps = gr.firdes.root_raised_cosine(
@@ -208,7 +208,7 @@ class generic_demod(gr.hier_block2):
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._constellation = constellation.base()
self._samples_per_symbol = samples_per_symbol
self._excess_bw = excess_bw
self._phase_alpha = phase_alpha
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/qam.py b/gnuradio-core/src/python/gnuradio/blks2impl/qam.py
index 9da7ca58e..22d80503b 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/qam.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/qam.py
@@ -32,19 +32,6 @@ from gnuradio.blks2impl.generic_mod_demod import generic_mod, generic_demod
# default values (used in __init__ and add_options)
_def_constellation_points = 16
-_def_samples_per_symbol = 2
-_def_excess_bw = 0.35
-_def_verbose = False
-_def_log = False
-
-# Frequency correction
-_def_freq_alpha = 0.010
-# Symbol timing recovery
-_def_timing_alpha = 0.100
-_def_timing_beta = 0.010
-_def_timing_max_dev = 1.5
-# Fine frequency / Phase correction
-_def_phase_alpha = 0.1
def is_power_of_four(x):
v = log(x)/log(4)
@@ -146,11 +133,7 @@ def make_constellation(m):
class qam_mod(generic_mod):
- def __init__(self, constellation_points=_def_constellation_points,
- samples_per_symbol=_def_samples_per_symbol,
- excess_bw=_def_excess_bw,
- verbose=_def_verbose,
- log=_def_log):
+ def __init__(self, constellation_points=_def_constellation_points, *args, **kwargs):
"""
Hierarchical block for RRC-filtered QAM modulation.
@@ -174,10 +157,13 @@ class qam_mod(generic_mod):
raise ValueError("number of constellation points must be a power of four.")
points = make_constellation(constellation_points)
- constellation = gr.gr_constellation(points)
+ side = int(sqrt(constellation_points))
+ assert(side * side == constellation_points)
+ width = 2.0/(side-1)
+ constellation = gr.constellation_sector(points, side, side, width, width)
+ #constellation = gr.constellation(points)
- super(qam_mod, self).__init__(constellation, samples_per_symbol,
- excess_bw, verbose, log)
+ super(qam_mod, self).__init__(constellation, *args, **kwargs)
def add_options(parser):
"""
@@ -195,15 +181,7 @@ class qam_mod(generic_mod):
class qam_demod(generic_demod):
- def __init__(self, constellation_points=_def_constellation_points,
- samples_per_symbol=_def_samples_per_symbol,
- excess_bw=_def_excess_bw,
- freq_alpha=_def_freq_alpha,
- timing_alpha=_def_timing_alpha,
- timing_max_dev=_def_timing_max_dev,
- phase_alpha=_def_phase_alpha,
- verbose=_def_verbose,
- log=_def_log):
+ def __init__(self, constellation_points=_def_constellation_points, *args, **kwargs):
"""
Hierarchical block for RRC-filtered QAM modulation.
@@ -232,12 +210,13 @@ class qam_demod(generic_demod):
"""
points = make_constellation(constellation_points)
- constellation = gr.gr_constellation(points)
+ side = int(sqrt(constellation_points))
+ assert(side * side == constellation_points)
+ width = 2.0/(side-1)
+ constellation = gr.constellation_sector(points, side, side, width, width)
+ #constellation = gr.constellation(points)
- super(qam_demod, self).__init__(constellation, samples_per_symbol,
- excess_bw, freq_alpha, timing_alpha,
- timing_max_dev, phase_alpha, verbose,
- log)
+ super(qam_demod, self).__init__(constellation, *args, **kwargs)
def add_options(parser):
"""