[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 110/148: bug fix for waterfall plotter, it
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 110/148: bug fix for waterfall plotter, it seems that numpy choose changed |
Date: |
Mon, 15 Aug 2016 00:47:31 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
nwest pushed a commit to annotated tag old_usrp_devel_udp
in repository gnuradio.
commit bd817562bdb6dce8113dba9ded06fac6b0026b3d
Author: Josh Blum <address@hidden>
Date: Sat Dec 26 22:43:29 2009 -0500
bug fix for waterfall plotter,
it seems that numpy choose changed
---
gr-wxgui/src/python/plotter/waterfall_plotter.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/gr-wxgui/src/python/plotter/waterfall_plotter.py
b/gr-wxgui/src/python/plotter/waterfall_plotter.py
index d32b0ca..f83e27e 100644
--- a/gr-wxgui/src/python/plotter/waterfall_plotter.py
+++ b/gr-wxgui/src/python/plotter/waterfall_plotter.py
@@ -26,6 +26,7 @@ import common
import numpy
import gltext
import math
+import struct
LEGEND_LEFT_PAD = 7
LEGEND_NUM_BLOCKS = 256
@@ -37,6 +38,9 @@ MIN_PADDING = 0, 60, 0, 0 #top, right, bottom, left
ceil_log2 = lambda x: 2**int(math.ceil(math.log(x)/math.log(2)))
+pack_color = lambda x: struct.pack('BBBB', *x)
+unpack_color = lambda s: struct.unpack('BBBB', s)
+
def _get_rbga(red_pts, green_pts, blue_pts, alpha_pts=[(0, 0), (1, 0)]):
"""
Get an array of 256 rgba values where each index maps to a color.
@@ -53,10 +57,10 @@ def _get_rbga(red_pts, green_pts, blue_pts, alpha_pts=[(0,
0), (1, 0)]):
#linear interpolation
if x <= x2: return float(y1 - y2)/(x1 - x2)*(x - x1) +
y1
raise Exception
- return [numpy.array(map(
+ return [pack_color(map(
lambda pw: int(255*_fcn(i/255.0, pw)),
(red_pts, green_pts, blue_pts, alpha_pts),
- ), numpy.uint8).tostring() for i in range(0, 256)
+ )) for i in range(0, 256)
]
COLORS = {
@@ -179,8 +183,8 @@ class waterfall_plotter(grid_plotter_base):
block_height = float(legend_height)/LEGEND_NUM_BLOCKS
x = self.width - self.padding_right + LEGEND_LEFT_PAD
for i in range(LEGEND_NUM_BLOCKS):
- color =
COLORS[self._color_mode][int(255*i/float(LEGEND_NUM_BLOCKS-1))]
- GL.glColor4f(*map(lambda c: ord(c)/255.0, color))
+ color =
unpack_color(COLORS[self._color_mode][int(255*i/float(LEGEND_NUM_BLOCKS-1))])
+ GL.glColor4f(*numpy.array(color)/255.0)
y = self.height - (i+1)*block_height -
self.padding_bottom
self._draw_rect(x, y, LEGEND_WIDTH, block_height)
#draw rectangle around color scale border
@@ -261,7 +265,7 @@ class waterfall_plotter(grid_plotter_base):
samples = numpy.clip(samples, 0, 255) #clip
samples = numpy.array(samples, numpy.uint8)
#convert the samples to RGBA data
- data = numpy.choose(samples,
COLORS[self._color_mode]).tostring()
+ data = ''.join([COLORS[self._color_mode][sample] for sample in
samples])
self._buffer.append(data)
self._waterfall_cache.changed(True)
self.unlock()
- [Commit-gnuradio] [gnuradio] 104/148: barebones udp support. Compiles, but untested., (continued)
- [Commit-gnuradio] [gnuradio] 104/148: barebones udp support. Compiles, but untested., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 130/148: should fix the endless packet bug, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 106/148: proper time sync to pps, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 119/148: better debug pins, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 114/148: Merge branch 'wip/usrp2' of http://gnuradio.org/git/matt into wip/usrp2, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 116/148: actually connect the ports -- why this isn't flagged as an error I'll never know, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 134/148: remove time_sync and master_timer., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 136/148: Added set time and set time at next pps. Removed the old sync pps commands, they dont make sense to use anymore., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 107/148: added missing vrt includes and libs to makefiles, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 129/148: yet another typo, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 110/148: bug fix for waterfall plotter, it seems that numpy choose changed,
git <=
- [Commit-gnuradio] [gnuradio] 138/148: speed up timing by ignoring the too_early error. We'll need to FIXME this later, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 126/148: add debug pins to find the problem with lost eof in the udp core, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 90/148: corrected some vrt header logic in tx samples, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 133/148: allow setting time immediately in cases where there is no external pps input, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 139/148: Merge branch 'usrp2_vrt' of http://gnuradio.org/git/matt into usrp2_vrt, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 109/148: Expanded the usrp props structure into something that can describe any kind of usrp: ethernet, udp, usb... and the various transport arguments., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 135/148: moved around regs, added a bit to allow for alternate PPS source, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 127/148: typo, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 132/148: allow processor to read back vrt time over readback mux, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 137/148: Fixed and tested setting the usrp2 time and start rx streaming at. Added a demo app to apps called rx_timed_samples.cc to test this. Fixed the gr-usrp2 module to reflect the recent usrp2 api changes. Changed the way the firmware calls stop_rx_cmd, fixed issue with packets kept in the buffer after stop., git, 2016/08/14