summaryrefslogtreecommitdiff
path: root/gr-utils/src/python/gr_plot_iq
diff options
context:
space:
mode:
Diffstat (limited to 'gr-utils/src/python/gr_plot_iq')
-rwxr-xr-xgr-utils/src/python/gr_plot_iq28
1 files changed, 14 insertions, 14 deletions
diff --git a/gr-utils/src/python/gr_plot_iq b/gr-utils/src/python/gr_plot_iq
index 316e60a757..bf8077b6b4 100755
--- a/gr-utils/src/python/gr_plot_iq
+++ b/gr-utils/src/python/gr_plot_iq
@@ -1,24 +1,24 @@
#!/usr/bin/env python
#
# Copyright 2007,2008,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
try:
import scipy
@@ -53,7 +53,7 @@ class draw_iq:
self.fig = figure(1, figsize=(16, 9), facecolor='w')
rcParams['xtick.labelsize'] = self.axis_font_size
rcParams['ytick.labelsize'] = self.axis_font_size
-
+
self.text_file = figtext(0.10, 0.94, ("File: %s" % filename), weight="heavy", size=self.text_size)
self.text_file_pos = figtext(0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size)
self.text_block = figtext(0.40, 0.88, ("Block Size: %d" % self.block_length),
@@ -86,13 +86,13 @@ class draw_iq:
self.reals = scipy.array([r.real for r in self.iq])
self.imags = scipy.array([i.imag for i in self.iq])
self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))])
-
+
def make_plots(self):
# if specified on the command-line, set file pointer
self.hfile.seek(self.sizeof_data*self.start, 1)
self.get_data()
-
+
# Subplot for real and imaginary parts of signal
self.sp_iq = self.fig.add_subplot(2,1,1, position=[0.075, 0.14, 0.85, 0.67])
self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold")
@@ -111,14 +111,14 @@ class draw_iq:
1.5*max([self.reals.max(), self.imags.max()])])
self.sp_iq.set_xlim(self.time.min(), self.time.max())
draw()
-
+
def click(self, event):
forward_valid_keys = [" ", "down", "right"]
backward_valid_keys = ["up", "left"]
if(find(event.key, forward_valid_keys)):
self.step_forward()
-
+
elif(find(event.key, backward_valid_keys)):
self.step_backward()
@@ -140,14 +140,14 @@ class draw_iq:
self.hfile.seek(-self.hfile.tell(),1)
self.get_data()
self.update_plots()
-
+
def find(item_in, list_search):
try:
return list_search.index(item_in) != None
except ValueError:
return False
-
+
def main():
usage="%prog: [options] input_filename"
description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
@@ -159,7 +159,7 @@ def main():
help="Specify where to start in the file [default=%default]")
parser.add_option("-R", "--sample-rate", type="float", default=1.0,
help="Set the sampler rate of the data [default=%default]")
-
+
(options, args) = parser.parse_args ()
if len(args) != 1:
parser.print_help()
@@ -173,6 +173,6 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
+