[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9208 - in gnuradio/branches/features/experimental-gui
From: |
jblum |
Subject: |
[Commit-gnuradio] r9208 - in gnuradio/branches/features/experimental-gui: . plotter |
Date: |
Thu, 7 Aug 2008 21:51:52 -0600 (MDT) |
Author: jblum
Date: 2008-08-07 21:51:51 -0600 (Thu, 07 Aug 2008)
New Revision: 9208
Modified:
gnuradio/branches/features/experimental-gui/plotter/channel_plotter.py
gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
gnuradio/branches/features/experimental-gui/waterfall_window.py
Log:
pointer label linear interpolation
Modified: gnuradio/branches/features/experimental-gui/plotter/channel_plotter.py
===================================================================
--- gnuradio/branches/features/experimental-gui/plotter/channel_plotter.py
2008-08-08 00:11:45 UTC (rev 9207)
+++ gnuradio/branches/features/experimental-gui/plotter/channel_plotter.py
2008-08-08 03:51:51 UTC (rev 9208)
@@ -24,6 +24,7 @@
from OpenGL.GL import *
import numpy
import gltext
+import math
POINT_LABEL_FONT_SIZE = 8
POINT_LABEL_COLOR_SPEC = (1, 1, .5)
@@ -186,9 +187,13 @@
samples = self._channels[channel][0]
num_samps = len(samples)
if not num_samps: continue
- if isinstance(samples, tuple): continue
+ if isinstance(samples, tuple): continue
+ #linear interpolation
x_index = x_scalar*(num_samps-1)
- label_str += '\n%s: %g %s'%(channel, samples[x_index],
self.y_units)
+ x_index_low = int(math.floor(x_index))
+ x_index_high = int(math.ceil(x_index))
+ y_value = (samples[x_index_high] -
samples[x_index_low])*(x_index - x_index_low) + samples[x_index_low]
+ label_str += '\n%s: %g %s'%(channel, y_value,
self.y_units)
txt = gltext.Text(label_str, font_size=POINT_LABEL_FONT_SIZE)
w, h = txt.get_size()
#draw rect + text
Modified:
gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
===================================================================
--- gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
2008-08-08 00:11:45 UTC (rev 9207)
+++ gnuradio/branches/features/experimental-gui/plotter/waterfall_plotter.py
2008-08-08 03:51:51 UTC (rev 9208)
@@ -46,9 +46,8 @@
"""
def _fcn(x, pw):
for (x1, y1), (x2, y2) in zip(pw, pw[1:]):
- m = float(y1 - y2)/(x1 - x2)
- b = y1 - m*x1
- if x <= x2: return m*x + b
+ #linear interpolation
+ if x <= x2: return float(y1 - y2)/(x1 - x2)*(x - x1) +
y1
raise Exception
return [numpy.array(map(
lambda pw: int(255*_fcn(i/255.0, pw)),
Modified: gnuradio/branches/features/experimental-gui/waterfall_window.py
===================================================================
--- gnuradio/branches/features/experimental-gui/waterfall_window.py
2008-08-08 00:11:45 UTC (rev 9207)
+++ gnuradio/branches/features/experimental-gui/waterfall_window.py
2008-08-08 03:51:51 UTC (rev 9208)
@@ -126,10 +126,10 @@
max(self.parent[DYNAMIC_RANGE_KEY] - 10,
MIN_DYNAMIC_RANGE))
def _on_incr_ref_level(self, event):
self.parent.set_ref_level(
- self.parent[REF_LEVEL_KEY] +
self.parent[DYNAMIC_RANGE_KEY]/10)
+ self.parent[REF_LEVEL_KEY] +
self.parent[DYNAMIC_RANGE_KEY]*.1)
def _on_decr_ref_level(self, event):
self.parent.set_ref_level(
- self.parent[REF_LEVEL_KEY] -
self.parent[DYNAMIC_RANGE_KEY]/10)
+ self.parent[REF_LEVEL_KEY] -
self.parent[DYNAMIC_RANGE_KEY]*.1)
def _on_incr_num_lines(self, event):
self.parent.ext_controller[self.parent.decimation_key] += 1
def _on_decr_num_lines(self, event):
@@ -215,7 +215,7 @@
#get the noise floor (averge the smallest samples)
noise_floor =
numpy.average(numpy.sort(self.samples)[:len(self.samples)/2])
#padding
- noise_floor -= abs(noise_floor)/2
+ noise_floor -= abs(noise_floor)*.5
peak_level += abs(peak_level)*.1
#set the range and level
self.set_ref_level(noise_floor)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9208 - in gnuradio/branches/features/experimental-gui: . plotter,
jblum <=