[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8906 - gnuradio/branches/features/experimental-gui
From: |
jblum |
Subject: |
[Commit-gnuradio] r8906 - gnuradio/branches/features/experimental-gui |
Date: |
Wed, 16 Jul 2008 14:35:30 -0600 (MDT) |
Author: jblum
Date: 2008-07-16 14:35:26 -0600 (Wed, 16 Jul 2008)
New Revision: 8906
Added:
gnuradio/branches/features/experimental-gui/grc_constsink_test.py
Modified:
gnuradio/branches/features/experimental-gui/constsink.py
Log:
constellation example
Modified: gnuradio/branches/features/experimental-gui/constsink.py
===================================================================
--- gnuradio/branches/features/experimental-gui/constsink.py 2008-07-16
20:12:56 UTC (rev 8905)
+++ gnuradio/branches/features/experimental-gui/constsink.py 2008-07-16
20:35:26 UTC (rev 8906)
@@ -229,8 +229,9 @@
mu=0.5,
gain_mu=0.005,
symbol_rate=1,
- omega_rel=0.005,
+ omega_limit=0.005,
):
+ self.const_size = const_size
#init
gr.hier_block2.__init__(
self,
@@ -261,7 +262,7 @@
gain_mu,
omega,
gain_omega,
- omega_rel,
+ omega_limit,
)
agc = gr.feedforward_agc_cc(16, 1)
msgq = gr.msg_queue(2)
@@ -295,14 +296,6 @@
self.sync.set_omega(self.omega)
def _handle_msg(self, msg):
- itemsize = int(msg.arg1())
- nitems = int(msg.arg2())
- s = msg.to_string()
- # There may be more than one frame in the message.
- # If so, we take only the last one
- if nitems > 1:
- start = itemsize * (nitems - 1)
- s = s[start:start+itemsize]
#convert to complex floating point numbers
- samples = numpy.fromstring(s, numpy.complex64)
+ samples = numpy.fromstring(msg,
numpy.complex64)[:self.const_size] #only take first frame
self.win.plot(samples)
Added: gnuradio/branches/features/experimental-gui/grc_constsink_test.py
===================================================================
--- gnuradio/branches/features/experimental-gui/grc_constsink_test.py
(rev 0)
+++ gnuradio/branches/features/experimental-gui/grc_constsink_test.py
2008-07-16 20:35:26 UTC (rev 8906)
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+##################################################
+# Gnuradio Python Flow Graph
+# Title: untitled
+# Author: unknown
+# Description: gnuradio flow graph
+# Generated: Wed Jul 16 11:38:49 2008
+##################################################
+
+from gnuradio import blks2
+from gnuradio import gr
+from gnuradio.gr import firdes
+import constsink
+from grc_gnuradio import wxgui as grc_wxgui
+import numpy
+import wx
+
+const = (1, -1j, -1, 1j)
+freq_off = 0
+noise = .1
+samp_rate = 50e3
+samples_per_symbol = 4
+
+class const_test(grc_wxgui.top_block_gui):
+
+ def __init__(self, const=const, freq_off=freq_off, noise=noise,
samp_rate=samp_rate, samples_per_symbol=samples_per_symbol):
+ grc_wxgui.top_block_gui.__init__(
+ self,
+ title="GRC - Executing: untitled",
+
icon="/usr/lib/python2.5/site-packages/grc/data/grc-icon-32.png",
+ )
+
+ ##################################################
+ # Variables
+ ##################################################
+ self.freq_off = freq_off
+ _freq_off_control = grc_wxgui.slider_horizontal_control(
+ window=self.GetWin(),
+ callback=self.set_freq_off,
+ label="Frequency Offset",
+ value=freq_off,
+ min=0,
+ max=samp_rate/2,
+ num_steps=100,
+ )
+ self.Add(_freq_off_control)
+ self.noise = noise
+ _noise_control = grc_wxgui.slider_horizontal_control(
+ window=self.GetWin(),
+ callback=self.set_noise,
+ label="Noise Voltage",
+ value=noise,
+ min=0,
+ max=2,
+ num_steps=100,
+ )
+ self.Add(_noise_control)
+ self.samp_rate = samp_rate
+ self.samples_per_symbol = samples_per_symbol
+
+ ##################################################
+ # Blocks
+ ##################################################
+ self.blks2_channel_model = blks2.channel_model(
+ noise_voltage=noise,
+ frequency_offset=freq_off/samp_rate,
+ epsilon=1.0,
+ taps=(1, ),
+ noise_seed=42,
+ )
+ self.gr_chunks_to_symbols_xx = gr.chunks_to_symbols_bc(const, 1)
+ self.gr_interp_fir_filter_xxx =
gr.interp_fir_filter_ccc(samples_per_symbol, ([1]*samples_per_symbol))
+ self.gr_throttle = gr.throttle(gr.sizeof_gr_complex*1,
samp_rate)
+ self.random_source_x =
gr.vector_source_b(numpy.random.randint(0, 4, 1000), True)
+ self.wxgui_constellationsink2 = constsink.const_sink_c(
+ self.GetWin(),
+ title="Constellation Plot",
+ sample_rate=samp_rate,
+ frame_rate=10,
+ #mpsk recv params
+ M=len(const),
+ theta=0,
+ alpha=0.005,
+ fmax=0.06,
+ mu=0.5,
+ gain_mu=0.005,
+ symbol_rate=samp_rate/samples_per_symbol,
+ omega_limit=0.005,
+ )
+ self.Add(self.wxgui_constellationsink2.win)
+
+ ##################################################
+ # Connections
+ ##################################################
+ self.connect((self.random_source_x, 0),
(self.gr_chunks_to_symbols_xx, 0))
+ self.connect((self.gr_chunks_to_symbols_xx, 0),
(self.gr_throttle, 0))
+ self.connect((self.gr_interp_fir_filter_xxx, 0),
(self.blks2_channel_model, 0))
+ self.connect((self.blks2_channel_model, 0),
(self.wxgui_constellationsink2, 0))
+ self.connect((self.gr_throttle, 0),
(self.gr_interp_fir_filter_xxx, 0))
+
+ def set_freq_off(self, freq_off):
+ self.freq_off = freq_off
+
self.blks2_channel_model.set_frequency_offset(self.freq_off/self.samp_rate)
+
+ def set_noise(self, noise):
+ self.noise = noise
+ self.blks2_channel_model.set_noise_voltage(self.noise)
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+ self.wxgui_constellationsink2.set_sample_rate(self.samp_rate)
+
self.blks2_channel_model.set_frequency_offset(self.freq_off/self.samp_rate)
+
+ def set_samples_per_symbol(self, samples_per_symbol):
+ self.samples_per_symbol = samples_per_symbol
+
self.gr_interp_fir_filter_xxx.set_taps(([1]*self.samples_per_symbol))
+
+if __name__ == '__main__':
+ tb = const_test()
+ tb.Run()
+
Property changes on:
gnuradio/branches/features/experimental-gui/grc_constsink_test.py
___________________________________________________________________
Name: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8906 - gnuradio/branches/features/experimental-gui,
jblum <=