summaryrefslogtreecommitdiff
path: root/gr-trellis
diff options
context:
space:
mode:
authorTom Rondeau2011-09-23 17:20:46 -0400
committerTom Rondeau2011-09-23 17:20:46 -0400
commitc802032c0198c872ee09b1ec93ce7531f654715c (patch)
tree957a783d036aa9b84693ba0d8ce3bf0312052c5c /gr-trellis
parent801465fe8dbac9905ac74aeb5c3dc308d3328d98 (diff)
downloadgnuradio-c802032c0198c872ee09b1ec93ce7531f654715c.tar.gz
gnuradio-c802032c0198c872ee09b1ec93ce7531f654715c.tar.bz2
gnuradio-c802032c0198c872ee09b1ec93ce7531f654715c.zip
trellis: fixed import statements; fixed test_cpm to convert numpy stuff to types GNU Radio blocks can handle.
Diffstat (limited to 'gr-trellis')
-rwxr-xr-xgr-trellis/src/examples/fsm_utils.py7
-rwxr-xr-xgr-trellis/src/examples/test_cpm.py15
2 files changed, 16 insertions, 6 deletions
diff --git a/gr-trellis/src/examples/fsm_utils.py b/gr-trellis/src/examples/fsm_utils.py
index e3426637c..e9243f899 100755
--- a/gr-trellis/src/examples/fsm_utils.py
+++ b/gr-trellis/src/examples/fsm_utils.py
@@ -26,10 +26,15 @@ import math
import sys
import operator
import numpy
-import scipy.linalg
from gnuradio import trellis
+try:
+ import scipy.linalg
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
######################################################################
diff --git a/gr-trellis/src/examples/test_cpm.py b/gr-trellis/src/examples/test_cpm.py
index ec432d4ff..b5bdaae44 100755
--- a/gr-trellis/src/examples/test_cpm.py
+++ b/gr-trellis/src/examples/test_cpm.py
@@ -13,10 +13,15 @@ from gnuradio.gr import firdes
from grc_gnuradio import blks2 as grc_blks2
import math
import numpy
-import scipy.stats
import fsm_utils
from gnuradio import trellis
+try:
+ import scipy.stats
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
def run_test(seed,blocksize):
tb = gr.top_block()
@@ -83,7 +88,7 @@ def run_test(seed,blocksize):
##################################################
# Blocks
##################################################
- random_source_x_0 = gr.vector_source_b(data, False)
+ random_source_x_0 = gr.vector_source_b(data.tolist(), False)
gr_chunks_to_symbols_xx_0 = gr.chunks_to_symbols_bf((-1, 1), 1)
gr_interp_fir_filter_xxx_0 = gr.interp_fir_filter_fff(Q, p)
gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*h*(1.0/Q))
@@ -96,9 +101,9 @@ def run_test(seed,blocksize):
# only works for N=2, do it manually for N>2...
gr_fir_filter_xxx_0_0 = gr.fir_filter_ccc(Q, MF[0].conjugate())
gr_fir_filter_xxx_0_0_0 = gr.fir_filter_ccc(Q, MF[1].conjugate())
- gr_streams_to_stream_0 = gr.streams_to_stream(gr.sizeof_gr_complex*1, N)
- gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, N*(1+0))
- viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, N, constellation, trellis.TRELLIS_EUCLIDEAN)
+ gr_streams_to_stream_0 = gr.streams_to_stream(gr.sizeof_gr_complex*1, int(N))
+ gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, int(N*(1+0)))
+ viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, int(N), constellation, trellis.TRELLIS_EUCLIDEAN)
gr_vector_sink_x_0 = gr.vector_sink_b()