[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8962 - gnuradio/branches/features/experimental-gui
From: |
jblum |
Subject: |
[Commit-gnuradio] r8962 - gnuradio/branches/features/experimental-gui |
Date: |
Mon, 21 Jul 2008 14:23:03 -0600 (MDT) |
Author: jblum
Date: 2008-07-21 14:23:01 -0600 (Mon, 21 Jul 2008)
New Revision: 8962
Modified:
gnuradio/branches/features/experimental-gui/const_controller.py
gnuradio/branches/features/experimental-gui/const_gui.py
gnuradio/branches/features/experimental-gui/const_streamer.py
gnuradio/branches/features/experimental-gui/const_top_block.py
gnuradio/branches/features/experimental-gui/fft_controller.py
gnuradio/branches/features/experimental-gui/grc_constsink_test.py
gnuradio/branches/features/experimental-gui/plotter.py
gnuradio/branches/features/experimental-gui/usrp_const.py
Log:
constellation usrp gui shows
Modified: gnuradio/branches/features/experimental-gui/const_controller.py
===================================================================
--- gnuradio/branches/features/experimental-gui/const_controller.py
2008-07-21 15:49:50 UTC (rev 8961)
+++ gnuradio/branches/features/experimental-gui/const_controller.py
2008-07-21 20:23:01 UTC (rev 8962)
@@ -82,14 +82,18 @@
# External control interface. These properties, when set by an external
# caller, result in the correct top block methods being invoked.
self.add_listener('decim', self.set_decim)
- self.add_listener('gain', lambda x: self._tb.set_gain(x))
- self.add_listener('freq', lambda x: self._tb.set_freq(x))
- self.add_listener('costas_alpha', lambda x:
self._tb.set_costas_alpha(x))
- self.add_listener('costas_max', lambda x: self._tb.set_costas_max(x))
+ self.add_listener('gain', self._tb.set_gain)
+ self.add_listener('freq', self._tb.set_freq)
+ #self.add_listener('costas_alpha', self._tb.set_costas_alpha)
+ #self.add_listener('costas_max', self._tb.set_costas_max)
# Set providers for application properties
- self.set_provider('sample_rate', lambda: self._tb.sample_rate())
+ self.set_provider('sample_rate', self._tb.sample_rate)
+ #temp!!!
+ self['costas_alpha'] = .5
+ self['costas_beta'] = .5
+
# The controller is a thread. This is not required but convenient here.
self.setDaemon(1)
self._keep_running = True
Modified: gnuradio/branches/features/experimental-gui/const_gui.py
===================================================================
--- gnuradio/branches/features/experimental-gui/const_gui.py 2008-07-21
15:49:50 UTC (rev 8961)
+++ gnuradio/branches/features/experimental-gui/const_gui.py 2008-07-21
20:23:01 UTC (rev 8962)
@@ -19,7 +19,6 @@
# Boston, MA 02110-1301, USA.
#
-# This requires GRC installed (temporary for demo purposes)
from wxgui_app import wxgui_app
from const_window import const_window
@@ -34,10 +33,16 @@
wxgui_app.__init__(self, controller=controller, title=title)
self._win = const_window(parent=self.GetWin(),
- controller=controller,
- size=(600, 300),
- title=title)
-
+ controller=controller,
+ size=(600, 300),
+ title=title,
+ msg_key='const',
+ alpha_key='costas_alpha',
+ beta_key='costas_beta',
+ gain_mu_key='costas_alpha',
+ gain_omega_key='costas_beta',
+ )
+
self.Add(self._win)
def run(self):
Modified: gnuradio/branches/features/experimental-gui/const_streamer.py
===================================================================
--- gnuradio/branches/features/experimental-gui/const_streamer.py
2008-07-21 15:49:50 UTC (rev 8961)
+++ gnuradio/branches/features/experimental-gui/const_streamer.py
2008-07-21 20:23:01 UTC (rev 8962)
@@ -29,20 +29,20 @@
particular frame size and rate.
"""
def __init__(self,
- sample_rate,
+ sample_rate,
bit_rate,
- order=2,
+ order=2,
frame_size=1024,
- frame_rate=30,
- costas_alpha=0.1,
+ frame_rate=30,
+ costas_alpha=0.1,
costas_max=0.05,
mm_alpha=0.005,
mm_max=0.05):
- """!
+ """!
Create a const_streamer.
- @param sample_rate Incoming sample rate
+ @param sample_rate Incoming sample rate
@param bit_rate Modulated bit rate/sec
- @param order Constellation order (BPSK=2, QPSK=4,
default is 2)
+ @param order Constellation order (BPSK=2, QPSK=4,
default is 2)
@param frame_size Number of constellation points to plot at
a time
@param frame_rate Number of frames/sec to create (default is
30)
@param costas_alpha Costas loop 1st order gain constant
(default is 0.1)
@@ -51,15 +51,15 @@
@param mm_max Maximum timing offset in bits/sample
(default is 0.05)
"""
- gr.hier_block2.__init__(self, "const_streamer",
- gr.io_signature(1, 1, gr.sizeof_gr_complex),
# Input signature
- gr.io_signature(1, 1,
gr.sizeof_gr_complex*frame_size)) # Output signature
+ gr.hier_block2.__init__(self, "const_streamer",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
# Input signature
+ gr.io_signature(1, 1,
gr.sizeof_gr_complex*frame_size)) # Output signature
- # Costas frequency/phase recovery loop
+ # Costas frequency/phase recovery loop
# Critically damped 2nd order PLL
costas_beta = 0.25*costas_alpha*costas_alpha
costas_min = -costas_max
- self._costas = gr.costas_loop_cc(costas_alpha,
+ self._costas = gr.costas_loop_cc(costas_alpha,
costas_beta,
costas_max,
costas_min,
@@ -68,20 +68,20 @@
# Timing recovery loop
# Critically damped 2nd order DLL
mm_freq = float(sample_rate)/bit_rate
- mm_beta = 0.25*mm_alpha*mm_alpha
+ mm_beta = 0.25*mm_alpha*mm_alpha
mu=0.5 # Center of bit
- self._retime = gr.clock_recovery_mm_cc(mm_freq, # omega,
+ self._retime = gr.clock_recovery_mm_cc(mm_freq, # omega,
mm_beta, # gain_omega
mu,
mm_alpha, # gain_mu,
mm_max) # omega_limit
- # Scale to unity power
- self._agc = gr.agc_cc(1e-6);
+ # Scale to unity power
+ self._agc = gr.agc_cc(1e-6);
- self._decim =
blks2.stream_to_vector_decimator(item_size=gr.sizeof_gr_complex,
- sample_rate=bit_rate,
- vec_rate=frame_rate,
- vec_len=frame_size)
-
- self.connect(self, self._costas, self._retime, self._agc, self._decim,
self)
+ self._decim =
blks2.stream_to_vector_decimator(item_size=gr.sizeof_gr_complex,
+ sample_rate=bit_rate,
+ vec_rate=frame_rate,
+ vec_len=frame_size)
+
+ self.connect(self, self._costas, self._retime, self._agc, self._decim,
self)
Modified: gnuradio/branches/features/experimental-gui/const_top_block.py
===================================================================
--- gnuradio/branches/features/experimental-gui/const_top_block.py
2008-07-21 15:49:50 UTC (rev 8961)
+++ gnuradio/branches/features/experimental-gui/const_top_block.py
2008-07-21 20:23:01 UTC (rev 8962)
@@ -31,37 +31,37 @@
for external retrieval.
"""
def __init__(self,
- order=2,
+ order=2,
frame_size=1024,
- frame_rate=30,
- which=0,
- decim=16,
- width_8=False,
- no_hb=False,
- subdev_spec=None,
- gain=None,
- freq=None,
- antenna=None,
+ frame_rate=30,
+ which=0,
+ decim=16,
+ width_8=False,
+ no_hb=False,
+ subdev_spec=None,
+ gain=None,
+ freq=None,
+ antenna=None,
bit_rate=None,
- costas_alpha=0.1,
+ costas_alpha=0.1,
costas_max=0.05,
mm_alpha=0.005,
mm_max=0.05
):
- """!
+ """!
Create a const_top_block.
- @param order Constellation order (BPSK=2, QPSK=4,
default is 2)
+ @param order Constellation order (BPSK=2, QPSK=4,
default is 2)
@param frame_size Number of constellation points to plot at
a time
@param frame_rate Number of frames/sec to create (default is
30)
- @param which USRP # on USB bus (default is 0)
- @param decim Receive sample rate decimation (default is
16)
- @param width_8 Use 8-bit instead of 16-bit samples
(default is False)
- @param no_hb Don't use half-band filter (default is
False)
+ @param which USRP # on USB bus (default is 0)
+ @param decim Receive sample rate decimation
(default is 16)
+ @param width_8 Use 8-bit instead of 16-bit samples
(default is False)
+ @param no_hb Don't use half-band filter (default is
False)
@param subdev_spec Daughterboard selection (default is first
found)
- @param gain Daughterboard RX gain (default is mid-range)
- @param freq Daughterboard RX frequency (default is
mid-range)
- @param antenna Daughterboard RX antenna (default is
board-default)
+ @param gain Daughterboard RX gain (default is
mid-range)
+ @param freq Daughterboard RX frequency (default is
mid-range)
+ @param antenna Daughterboard RX antenna (default is
board-default)
@param bit_rate Modulated bit rate/sec (default equivalent
to 2 samples/bit)
@param costas_alpha Costas loop 1st order gain constant
(default is 0.1)
@param costas_max Costas loop maximum offset, rad/sample
(default is 0.05)
@@ -69,51 +69,51 @@
@param mm_max Maximum timing offset in bits/sample
(default is 0.05)
"""
- gr.top_block.__init__(self, "const_top_block")
+ gr.top_block.__init__(self, "const_top_block")
- # Source of samples
- self._u = simple_usrp.source_c(which=which,
- decim=decim,
- width_8=width_8,
- no_hb=no_hb,
- subdev_spec=subdev_spec,
- gain=gain,
- freq=freq,
- antenna=antenna)
+ # Source of samples
+ self._u = simple_usrp.source_c(which=which,
+ decim=decim,
+ width_8=width_8,
+ no_hb=no_hb,
+ subdev_spec=subdev_spec,
+ gain=gain,
+ freq=freq,
+ antenna=antenna)
- # TODO: make this a configuration matched filter
- # for now assume square pulses
- self._filt = gr.fir_filter_ccf(1,
[1.0,]*int(self._u.sample_rate()/bit_rate))
+ # TODO: make this a configuration matched filter
+ # for now assume square pulses
+ self._filt = gr.fir_filter_ccf(1,
[1.0,]*int(self._u.sample_rate()/bit_rate))
- self._const =
const_streamer.const_streamer(sample_rate=self._u.sample_rate(),
- bit_rate=bit_rate,
- order=order,
- frame_size=frame_size,
- frame_rate=frame_rate,
- costas_alpha=costas_alpha,
- costas_max=costas_max,
- mm_alpha=mm_alpha,
- mm_max=mm_max)
+ self._const =
const_streamer.const_streamer(sample_rate=self._u.sample_rate(),
+ bit_rate=bit_rate,
+ order=order,
+ frame_size=frame_size,
+ frame_rate=frame_rate,
+ costas_alpha=costas_alpha,
+ costas_max=costas_max,
+ mm_alpha=mm_alpha,
+ mm_max=mm_max)
- self._msgq = gr.msg_queue(2)
- self._sink = gr.message_sink(gr.sizeof_gr_complex*frame_size,
self._msgq, True)
-
- self.connect(self._u, self._filt, self._const, self._sink)
+ self._msgq = gr.msg_queue(2)
+ self._sink = gr.message_sink(gr.sizeof_gr_complex*frame_size,
self._msgq, True)
+
+ self.connect(self._u, self._filt, self._const, self._sink)
# "Setters", which are called externally to affect flowgraph operation
def set_gain(self, gain):
- return self._u.set_gain(gain)
-
+ return self._u.set_gain(gain)
+
def set_freq(self, freq):
- return self._u.set_freq(freq)
-
+ return self._u.set_freq(freq)
+
def set_decim(self, decim):
- self._u.set_decim(decim)
- self._const.set_sample_rate(self._u.sample_rate())
+ self._u.set_decim(decim)
+ self._const.set_sample_rate(self._u.sample_rate())
# Getters, which are called externally to get information about the
flowgraph
def queue(self):
- return self._msgq
+ return self._msgq
def sample_rate(self):
return self._u.sample_rate()
Modified: gnuradio/branches/features/experimental-gui/fft_controller.py
===================================================================
--- gnuradio/branches/features/experimental-gui/fft_controller.py
2008-07-21 15:49:50 UTC (rev 8961)
+++ gnuradio/branches/features/experimental-gui/fft_controller.py
2008-07-21 20:23:01 UTC (rev 8962)
@@ -76,15 +76,15 @@
# External control interface. These properties, when set by an external
# caller, result in the correct top block methods being invoked.
self.add_listener('decim', self.set_decim)
- self.add_listener('gain', lambda x: self._tb.set_gain(x))
- self.add_listener('freq', lambda x: self._tb.set_freq(x))
- self.add_listener('avg_alpha', lambda x: self._tb.set_avg_alpha(x))
- self.add_listener('average', lambda x: self._tb.set_average(x))
+ self.add_listener('gain', self._tb.set_gain)
+ self.add_listener('freq', self._tb.set_freq)
+ self.add_listener('avg_alpha', self._tb.set_avg_alpha)
+ self.add_listener('average', self._tb.set_average)
# Set providers for application properties
- self.set_provider('sample_rate', lambda: self._tb.sample_rate())
- self.set_provider('average', lambda: self._tb.average())
- self.set_provider('avg_alpha', lambda: self._tb.avg_alpha())
+ self.set_provider('sample_rate', self._tb.sample_rate)
+ self.set_provider('average', self._tb.average)
+ self.set_provider('avg_alpha', self._tb.avg_alpha)
# The controller is a thread. This is not required but convenient here.
self.setDaemon(1)
Modified: gnuradio/branches/features/experimental-gui/grc_constsink_test.py
===================================================================
--- gnuradio/branches/features/experimental-gui/grc_constsink_test.py
2008-07-21 15:49:50 UTC (rev 8961)
+++ gnuradio/branches/features/experimental-gui/grc_constsink_test.py
2008-07-21 20:23:01 UTC (rev 8962)
@@ -69,7 +69,8 @@
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_fir_filter_xxx = gr.fir_filter_ccc(1,
([1]*samples_per_symbol))
+ self.gr_repeat = gr.repeat(gr.sizeof_gr_complex*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(
@@ -94,10 +95,14 @@
##################################################
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))
+ self.connect((self.gr_throttle, 0), (self.gr_repeat, 0))
+ self.connect((self.gr_repeat, 0), (self.gr_fir_filter_xxx, 0))
+ self.connect((self.gr_fir_filter_xxx, 0),
(self.blks2_channel_model, 0))
+ def set_const(self, const):
+ self.const = const
+
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)
@@ -113,7 +118,7 @@
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))
+ self.gr_fir_filter_xxx.set_taps(([1]*self.samples_per_symbol))
if __name__ == '__main__':
tb = const_test()
Modified: gnuradio/branches/features/experimental-gui/plotter.py
===================================================================
--- gnuradio/branches/features/experimental-gui/plotter.py 2008-07-21
15:49:50 UTC (rev 8961)
+++ gnuradio/branches/features/experimental-gui/plotter.py 2008-07-21
20:23:01 UTC (rev 8962)
@@ -72,7 +72,7 @@
#check if gl was initialized
if not self._gl_init_flag:
glClearColor(*BACKGROUND_COLOR_SPEC)
- glEnableClientState(GL_VERTEX_ARRAY)
+ self._gl_init()
self._gl_init_flag = True
#check for a change in window size
if self._resized_flag:
@@ -96,7 +96,6 @@
Create a new grid plotter.
"""
self.semaphore = threading.Semaphore(1)
- self.grid_compiled_list_id = wx.NewId()
self.channels = dict()
#store title and unit strings
self.set_legend(False)
@@ -109,6 +108,13 @@
self.set_x_grid(-1, 1, 1)
self.set_y_grid(-1, 1, 1)
_plotter_base.__init__(self, parent)
+
+ def _gl_init(self):
+ """!
+ Run gl initialization tasks.
+ """
+ glEnableClientState(GL_VERTEX_ARRAY)
+ self.grid_compiled_list_id = glGenLists(1)
def set_legend(self, legend):
"""!
@@ -240,10 +246,10 @@
if marker == '+': #TODO slow, slow, slow
points_4 = numpy.array(zip(points, points,
points, points))
points_4 = points_4 + .01*numpy.array([
- ((self.x_max-self.x_min), 0),
- (-(self.x_max-self.x_min), 0),
- (0, (self.y_max-self.y_min)),
- (0, -(self.y_max-self.y_min)),
+ (self.x_max-self.x_min, 0),
+ (self.x_min-self.x_max, 0),
+ (0, self.y_max-self.y_min),
+ (0, self.y_min-self.y_max),
]
)
points = points_4.reshape(len(points)*4, 2)
Modified: gnuradio/branches/features/experimental-gui/usrp_const.py
===================================================================
--- gnuradio/branches/features/experimental-gui/usrp_const.py 2008-07-21
15:49:50 UTC (rev 8961)
+++ gnuradio/branches/features/experimental-gui/usrp_const.py 2008-07-21
20:23:01 UTC (rev 8962)
@@ -109,19 +109,19 @@
# program, an interactive shell, or anything that knows what to
# do with the controller properties.
#
- #gui = const_gui(controller)
- #gui.run()
+ gui = const_gui(controller)
+ gui.run()
# TEMPORARY
- f = open('const.dat', 'wb')
- def writer(frame):
- f.write(frame)
- controller.add_listener('const', writer)
+ #f = open('const.dat', 'wb')
+ #def writer(frame):
+ # f.write(frame)
+ #controller.add_listener('const', writer)
- controller.on_init()
- try:
- raw_input("Press return to stop.")
- except KeyboardInterrupt:
- pass
+ #controller.on_init()
+ #try:
+ #raw_input("Press return to stop.")
+ #except KeyboardInterrupt:
+ #pass
- controller.on_exit()
+ #controller.on_exit()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8962 - gnuradio/branches/features/experimental-gui,
jblum <=