From f52a5932f178e474b625e86fb85c1c8954334398 Mon Sep 17 00:00:00 2001
From: trondeau <trondeau@221aa14e-8319-0410-a670-987f0aec2ac5>
Date: Wed, 30 Jan 2008 11:36:39 +0000
Subject: Updating and cleaning up plotting code. When plotting
 char/int/short/float you can now specify multiple input files on the command
 line and each are plotted in a different color. Useful when comparing two
 outputs.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7528 221aa14e-8319-0410-a670-987f0aec2ac5
---
 gnuradio-core/src/utils/gr_plot_const.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'gnuradio-core/src/utils/gr_plot_const.py')

diff --git a/gnuradio-core/src/utils/gr_plot_const.py b/gnuradio-core/src/utils/gr_plot_const.py
index bbcbb85cc2..9ec75ddb9a 100755
--- a/gnuradio-core/src/utils/gr_plot_const.py
+++ b/gnuradio-core/src/utils/gr_plot_const.py
@@ -35,6 +35,9 @@ class draw_constellation:
         self.start = options.start
         self.sample_rate = options.sample_rate
 
+        self.datatype = scipy.complex64
+        self.sizeof_data = self.datatype().nbytes    # number of bytes per sample in file
+
         self.axis_font_size = 16
         self.label_font_size = 18
         self.title_font_size = 20
@@ -68,8 +71,8 @@ class draw_constellation:
         show()
 
     def get_data(self):
-        self.text_file_pos.set_text("File Position: %d" % (self.hfile.tell()//8))
-        iq = scipy.fromfile(self.hfile, dtype=scipy.complex64, count=self.block_length)
+        self.text_file_pos.set_text("File Position: %d" % (self.hfile.tell()//self.sizeof_data))
+        iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
         #print "Read in %d items" % len(iq)
         if(len(iq) == 0):
             print "End of File"
@@ -81,7 +84,7 @@ class draw_constellation:
             
     def make_plots(self):
         # if specified on the command-line, set file pointer
-        self.hfile.seek(16*self.start, 1)
+        self.hfile.seek(self.sizeof_data*self.start, 1)
 
         self.get_data()
         
@@ -150,8 +153,8 @@ class draw_constellation:
 
     def step_backward(self):
         # Step back in file position
-        if(self.hfile.tell() >= 16*self.block_length ):
-            self.hfile.seek(-16*self.block_length, 1)
+        if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ):
+            self.hfile.seek(-2*self.sizeof_data*self.block_length, 1)
         else:
             self.hfile.seek(-self.hfile.tell(),1)
         self.get_data()
-- 
cgit v1.2.3