summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/utils/gr_plot_const.py
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/utils/gr_plot_const.py')
-rwxr-xr-xgnuradio-core/src/utils/gr_plot_const.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/gnuradio-core/src/utils/gr_plot_const.py b/gnuradio-core/src/utils/gr_plot_const.py
index bbcbb85cc..9ec75ddb9 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()