[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9265 - in gnuradio/branches/developers/jblum/glwxgui/
From: |
jblum |
Subject: |
[Commit-gnuradio] r9265 - in gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python: . plotter |
Date: |
Wed, 13 Aug 2008 13:30:38 -0600 (MDT) |
Author: jblum
Date: 2008-08-13 13:30:37 -0600 (Wed, 13 Aug 2008)
New Revision: 9265
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/constants.py
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/fft_window.py
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/fftsink_gl.py
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/number_window.py
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/plotter_base.py
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scopesink_gl.py
Log:
scope frame rate and mouse motion updates with timestamps
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/constants.py
===================================================================
--- gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/constants.py
2008-08-13 03:07:06 UTC (rev 9264)
+++ gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/constants.py
2008-08-13 19:30:37 UTC (rev 9265)
@@ -43,7 +43,6 @@
REF_LEVEL_KEY = 'ref_level'
RUNNING_KEY = 'running'
SAMPLE_RATE_KEY = 'sample_rate'
-SCOPE_NUM_SAMPLES_KEY = 'scope_num_samples'
SCOPE_TRIGGER_CHANNEL_KEY = 'scope_trigger_channel'
SCOPE_TRIGGER_LEVEL_KEY = 'scope_trigger_level'
SCOPE_TRIGGER_MODE_KEY = 'scope_trigger_mode'
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/fft_window.py
===================================================================
---
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/fft_window.py
2008-08-13 03:07:06 UTC (rev 9264)
+++
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/fft_window.py
2008-08-13 19:30:37 UTC (rev 9265)
@@ -36,6 +36,7 @@
SLIDER_STEPS = 100
AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP = -3, 0
DEFAULT_WIN_SIZE = (600, 300)
+DEFAULT_FRAME_RATE = 30
DIV_LEVELS = (1, 2, 5, 10, 20)
FFT_PLOT_COLOR_SPEC = (0, 0, 1)
PEAK_VALS_COLOR_SPEC = (0, 1, 0)
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/fftsink_gl.py
===================================================================
---
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/fftsink_gl.py
2008-08-13 03:07:06 UTC (rev 9264)
+++
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/fftsink_gl.py
2008-08-13 19:30:37 UTC (rev 9265)
@@ -46,7 +46,7 @@
ref_level=50,
sample_rate=1,
fft_size=512,
- fft_rate=gr.prefs().get_long('wxgui', 'fft_rate', 30),
+ fft_rate=gr.prefs().get_long('wxgui', 'fft_rate',
fft_window.DEFAULT_FRAME_RATE),
average=False,
avg_alpha=None,
title='',
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/number_window.py
===================================================================
---
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/number_window.py
2008-08-13 03:07:06 UTC (rev 9264)
+++
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/number_window.py
2008-08-13 19:30:37 UTC (rev 9265)
@@ -34,7 +34,7 @@
NEG_INF = float('-inf')
SLIDER_STEPS = 100
AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP = -3, 0
-DEFAULT_NUMBER_RATE = 2
+DEFAULT_NUMBER_RATE = 5
DEFAULT_WIN_SIZE = (300, 300)
DEFAULT_GAUGE_RANGE = 1000
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/plotter_base.py
===================================================================
---
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/plotter_base.py
2008-08-13 03:07:06 UTC (rev 9264)
+++
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/plotter_base.py
2008-08-13 19:30:37 UTC (rev 9265)
@@ -25,6 +25,7 @@
import threading
import gltext
import math
+import time
BACKGROUND_COLOR_SPEC = (1, 0.976, 1, 1) #creamy white
GRID_LINE_COLOR_SPEC = (0, 0, 0) #black
@@ -55,6 +56,7 @@
self.changed(False)
self._gl_init_flag = False
self._resized_flag = True
+ self._update_ts = 0
self.Bind(wx.EVT_PAINT, self._on_paint)
self.Bind(wx.EVT_SIZE, self._on_size)
@@ -95,7 +97,13 @@
self.unlock()
self.draw()
- def update(self): wx.PostEvent(self, wx.PaintEvent())
+ def update(self):
+ """!
+ Force a paint event.
+ Record the timestamp.
+ """
+ wx.PostEvent(self, wx.PaintEvent())
+ self._update_ts = time.time()
def clear(self): glClear(GL_COLOR_BUFFER_BIT)
@@ -134,7 +142,8 @@
"""
self.lock()
self._mouse_coordinate = event.GetPosition()
- self.update()
+ #update based on last known update time
+ if time.time() - self._update_ts > 0.03: self.update()
self.unlock()
def _on_leave_window(self, event):
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
===================================================================
---
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
2008-08-13 03:07:06 UTC (rev 9264)
+++
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
2008-08-13 19:30:37 UTC (rev 9265)
@@ -252,7 +252,6 @@
scope_trigger_level_key,
scope_trigger_mode_key,
scope_trigger_channel_key,
- scope_num_samples_key,
msg_key,
):
pubsub.pubsub.__init__(self)
@@ -265,13 +264,12 @@
autorange = v_scale is None
self.autorange_ts = 0
if v_scale is None: v_scale = 1
- self.frame_counter = 0
+ self.frame_rate_ts = 0
self._init = False #HACK
#scope keys
self.scope_trigger_level_key = scope_trigger_level_key
self.scope_trigger_mode_key = scope_trigger_mode_key
self.scope_trigger_channel_key = scope_trigger_channel_key
- self.scope_num_samples_key = scope_num_samples_key
#init panel and plot
wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
self.plotter = plotter.channel_plotter(self)
@@ -307,8 +305,6 @@
self._register_set_prop(self, TRIGGER_LEVEL_KEY, None)
#register events
self.ext_controller.subscribe(msg_key, self.handle_msg)
- self.ext_controller.subscribe(sample_rate_key,
self.update_decim)
- self.subscribe(FRAME_RATE_KEY, self.update_decim)
for key in (
T_PER_DIV_KEY, X_PER_DIV_KEY, Y_PER_DIV_KEY,
T_OFF_KEY, X_OFF_KEY, Y_OFF_KEY,
@@ -316,10 +312,11 @@
SCOPE_XY_MODE_KEY,
SCOPE_X_CHANNEL_KEY,
SCOPE_Y_CHANNEL_KEY,
+ AUTORANGE_KEY,
+ AC_COUPLE_KEY,
): self.subscribe(key, self.update_grid)
#initial update, dont do this here, wait for handle_msg #HACK
#self.update_grid()
- #self.update_decim()
def handle_msg(self, msg):
"""!
@@ -329,6 +326,8 @@
@param msg the time domain data as a character array
"""
if not self[RUNNING_KEY]: return
+ #check time elapsed
+ if time.time() - self.frame_rate_ts < 1.0/self[FRAME_RATE_KEY]:
return
#convert to floating point numbers
samples = numpy.fromstring(msg, numpy.float32)
samps_per_ch = len(samples)/self.num_inputs
@@ -336,10 +335,9 @@
if not self._init: #HACK
self._init = True
self.update_grid()
- self.update_decim()
- if self.frame_counter == 0: #decimate
- self.handle_samples()
- self.frame_counter = (self.frame_counter + 1)%self.decim
+ #handle samples
+ self.handle_samples()
+ self.frame_rate_ts = time.time()
def handle_samples(self):
"""!
@@ -410,15 +408,20 @@
#number of samples to scale to the screen
num_samps =
int(self[T_PER_DIV_KEY]*self[T_DIVS_KEY]*self.ext_controller[self.sample_rate_key])
#handle num samps out of bounds
- #bad, can take 110% CPU
- #while num_samps > len(samples): samples =
numpy.concatenate((samples, samples))
- if num_samps < 2: num_samps = 0
- #plot samples
- self.plotter.set_waveform(
- channel='Ch%d'%(i+1),
- samples=samples[:num_samps],
- color_spec=CHANNEL_COLOR_SPECS[i],
- )
+ if num_samps > len(samples):
+ self.set_t_per_div(
+
common.get_clean_decr(self[T_PER_DIV_KEY]))
+ elif num_samps < 2:
+ self.set_t_per_div(
+
common.get_clean_incr(self[T_PER_DIV_KEY]))
+ num_samps = 0
+ else:
+ #plot samples
+ self.plotter.set_waveform(
+ channel='Ch%d'%(i+1),
+ samples=samples[:num_samps],
+
color_spec=CHANNEL_COLOR_SPECS[i],
+ )
#turn XY channel off
self.plotter.set_waveform(
channel='XY',
@@ -428,13 +431,6 @@
#update the plotter
self.plotter.update()
- def update_decim(self, *args):
- """!
- Update the frame decimation when the frame rate or sample rate
changes.
- """
- decim =
self.ext_controller[self.sample_rate_key]/self.ext_controller[self.scope_num_samples_key]/self[FRAME_RATE_KEY]
- self.decim = max(1, int(decim))
-
def update_grid(self, *args):
"""!
Update the grid to reflect the current settings:
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scopesink_gl.py
===================================================================
---
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scopesink_gl.py
2008-08-13 03:07:06 UTC (rev 9264)
+++
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scopesink_gl.py
2008-08-13 19:30:37 UTC (rev 9265)
@@ -88,7 +88,6 @@
scope.set_trigger_mode(mode)
self.controller.subscribe(SCOPE_TRIGGER_MODE_KEY,
set_trigger_mode)
self.controller.subscribe(SCOPE_TRIGGER_CHANNEL_KEY,
scope.set_trigger_channel)
- self.controller.publish(SCOPE_NUM_SAMPLES_KEY,
scope.get_samples_per_output_record)
#start input watcher
def setter(p, k, x): # lambdas can't have assignments :(
p[k] = x
@@ -109,7 +108,6 @@
scope_trigger_level_key=SCOPE_TRIGGER_LEVEL_KEY,
scope_trigger_mode_key=SCOPE_TRIGGER_MODE_KEY,
scope_trigger_channel_key=SCOPE_TRIGGER_CHANNEL_KEY,
- scope_num_samples_key=SCOPE_NUM_SAMPLES_KEY,
msg_key=MSG_KEY,
)
#register callbacks from window for external use
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9265 - in gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python: . plotter,
jblum <=