diff options
author | Tom Rondeau | 2012-04-13 18:36:53 -0400 |
---|---|---|
committer | Tom Rondeau | 2012-04-13 18:36:53 -0400 |
commit | f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 (patch) | |
tree | 7e846386b9eb1676f9a93fc4a1e55916b9accc97 /gr-utils/src | |
parent | 6a1e9783fec6ed827f49db27c171591d30f32933 (diff) | |
download | gnuradio-f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2.tar.gz gnuradio-f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2.tar.bz2 gnuradio-f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2.zip |
Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future.
The sed script was provided by Moritz Fischer.
Diffstat (limited to 'gr-utils/src')
-rwxr-xr-x | gr-utils/src/python/gr_filter_design | 60 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_char | 14 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_const | 38 | ||||
-rw-r--r-- | gr-utils/src/python/gr_plot_fft | 10 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_fft_c | 14 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_fft_f | 14 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_float | 14 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_int | 14 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_iq | 28 | ||||
-rw-r--r-- | gr-utils/src/python/gr_plot_psd | 10 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_psd_c | 12 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_psd_f | 12 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_qt | 42 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_short | 14 | ||||
-rw-r--r-- | gr-utils/src/python/plot_data.py | 26 | ||||
-rwxr-xr-x | gr-utils/src/python/plot_fft_base.py | 30 | ||||
-rwxr-xr-x | gr-utils/src/python/plot_psd_base.py | 36 |
17 files changed, 194 insertions, 194 deletions
diff --git a/gr-utils/src/python/gr_filter_design b/gr-utils/src/python/gr_filter_design index e8703db4f..cc21ea5e7 100755 --- a/gr-utils/src/python/gr_filter_design +++ b/gr-utils/src/python/gr_filter_design @@ -76,9 +76,9 @@ class gr_plot_filter(QtGui.QMainWindow): "High Pass", "Root Raised Cosine", "Gaussian") self.optFilters = ("Low Pass", "Band Pass", "Complex Band Pass", "Band Notch", "High Pass") - + self.set_windowed() - + # Initialize to LPF self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage) @@ -211,19 +211,19 @@ class gr_plot_filter(QtGui.QMainWindow): self.gui.filterTypeWidget.setCurrentWidget(self.gui.gausPage) self.design() - + def changed_filter_design_type(self, design): if(design == "Equiripple"): self.set_equiripple() else: self.set_windowed() - + self.design() def set_equiripple(self): # Stop sending the signal for this function self.gui.filterTypeComboBox.blockSignals(True) - + self.equiripple = True self.gui.lpfPassBandRippleLabel.setVisible(True) self.gui.lpfPassBandRippleEdit.setVisible(True) @@ -252,11 +252,11 @@ class gr_plot_filter(QtGui.QMainWindow): # Tell gui its ok to start sending this signal again self.gui.filterTypeComboBox.blockSignals(False) - + def set_windowed(self): # Stop sending the signal for this function self.gui.filterTypeComboBox.blockSignals(True) - + self.equiripple = False self.gui.lpfPassBandRippleLabel.setVisible(False) self.gui.lpfPassBandRippleEdit.setVisible(False) @@ -332,7 +332,7 @@ class gr_plot_filter(QtGui.QMainWindow): if(ret): tb = sb - pb - + taps = gr.firdes.low_pass_2(gain, fs, pb, tb, atten, wintype) params = {"fs": fs, "gain": gain, "wintype": wintype, @@ -341,7 +341,7 @@ class gr_plot_filter(QtGui.QMainWindow): return (taps, params, ret) else: return ([], [], ret) - + def design_win_bpf(self, fs, gain, wintype): ret = True pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() @@ -417,7 +417,7 @@ class gr_plot_filter(QtGui.QMainWindow): if(r): tb = pb - sb taps = gr.firdes.high_pass_2(gain, fs, pb, tb, - atten, wintype) + atten, wintype) params = {"fs": fs, "gain": gain, "wintype": wintype, "filttype": "hpf", "sbend": sb, "pbstart": pb, "atten": atten, "ntaps": len(taps)} @@ -490,7 +490,7 @@ class gr_plot_filter(QtGui.QMainWindow): return (taps, params, ret) else: return ([], [], ret) - + def design_opt_bpf(self, fs, gain): ret = True pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() @@ -631,15 +631,15 @@ class gr_plot_filter(QtGui.QMainWindow): self.update_phase_curves() if(tab == 3): self.update_group_curves() - + def get_fft(self, fs, taps, Npts): Ts = 1.0/fs fftpts = fftpack.fft(taps, Npts) - self.freq = scipy.arange(0, fs, 1.0/(Npts*Ts)) + self.freq = scipy.arange(0, fs, 1.0/(Npts*Ts)) self.fftdB = 20.0*scipy.log10(abs(fftpts)) self.fftDeg = scipy.unwrap(scipy.angle(fftpts)) self.groupDelay = -scipy.diff(self.fftDeg) - + def update_time_curves(self): ntaps = len(self.taps) if(ntaps > 0): @@ -656,17 +656,17 @@ class gr_plot_filter(QtGui.QMainWindow): 0, ntaps) self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft, ymin, ymax) - + # Set the zoomer base to unzoom to the new axis self.timeZoomer.setZoomBase() - + self.gui.timePlot.replot() - + def update_freq_curves(self): npts = len(self.fftdB) if(npts > 0): self.freqcurve.setData(self.freq, self.fftdB) - + # Reset the x-axis to the new time scale ymax = 1.5 * max(self.fftdB[0:npts/2]) ymin = 1.1 * min(self.fftdB[0:npts/2]) @@ -676,10 +676,10 @@ class gr_plot_filter(QtGui.QMainWindow): xmin, xmax) self.gui.freqPlot.setAxisScale(self.gui.freqPlot.yLeft, ymin, ymax) - + # Set the zoomer base to unzoom to the new axis self.freqZoomer.setZoomBase() - + self.gui.freqPlot.replot() @@ -687,7 +687,7 @@ class gr_plot_filter(QtGui.QMainWindow): npts = len(self.fftDeg) if(npts > 0): self.phasecurve.setData(self.freq, self.fftDeg) - + # Reset the x-axis to the new time scale ymax = 1.5 * max(self.fftDeg[0:npts/2]) ymin = 1.1 * min(self.fftDeg[0:npts/2]) @@ -697,17 +697,17 @@ class gr_plot_filter(QtGui.QMainWindow): xmin, xmax) self.gui.phasePlot.setAxisScale(self.gui.phasePlot.yLeft, ymin, ymax) - + # Set the zoomer base to unzoom to the new axis self.phaseZoomer.setZoomBase() - + self.gui.phasePlot.replot() def update_group_curves(self): npts = len(self.groupDelay) if(npts > 0): self.groupcurve.setData(self.freq, self.groupDelay) - + # Reset the x-axis to the new time scale ymax = 1.5 * max(self.groupDelay[0:npts/2]) ymin = 1.1 * min(self.groupDelay[0:npts/2]) @@ -717,10 +717,10 @@ class gr_plot_filter(QtGui.QMainWindow): xmin, xmax) self.gui.groupPlot.setAxisScale(self.gui.groupPlot.yLeft, ymin, ymax) - + # Set the zoomer base to unzoom to the new axis self.groupZoomer.setZoomBase() - + self.gui.groupPlot.replot() def action_save_dialog(self): @@ -732,7 +732,7 @@ class gr_plot_filter(QtGui.QMainWindow): ("Could not save to file: %s" % filename), "&Ok") return - + csvhandle = csv.writer(handle, delimiter=",") for k in self.params.keys(): csvhandle.writerow([k, self.params[k]]) @@ -743,7 +743,7 @@ class gr_plot_filter(QtGui.QMainWindow): filename = QtGui.QFileDialog.getOpenFileName(self, "Open CSV Filter File", ".", "") if(len(filename) == 0): return - + try: handle = open(filename, "rb") except IOError: @@ -849,9 +849,9 @@ class gr_plot_filter(QtGui.QMainWindow): self.update_freq_curves() self.update_phase_curves() self.update_group_curves() - + self.gui.nTapsEdit.setText(Qt.QString("%1").arg(self.taps.size)) - + def setup_options(): usage="%prog: [options] (input_filename)" diff --git a/gr-utils/src/python/gr_plot_char b/gr-utils/src/python/gr_plot_char index 87a323c9c..a2b93a63c 100755 --- a/gr-utils/src/python/gr_plot_char +++ b/gr-utils/src/python/gr_plot_char @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2007,2008 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 @@ -40,7 +40,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() @@ -55,4 +55,4 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/gr_plot_const b/gr-utils/src/python/gr_plot_const index 8873e5b7e..749ad035b 100755 --- a/gr-utils/src/python/gr_plot_const +++ b/gr-utils/src/python/gr_plot_const @@ -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,11 +53,11 @@ class draw_constellation: 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.95, ("File: %s" % filename), weight="heavy", size=16) self.text_file_pos = figtext(0.10, 0.90, "File Position: ", weight="heavy", size=16) self.text_block = figtext(0.40, 0.90, ("Block Size: %d" % self.block_length), - weight="heavy", size=16) + weight="heavy", size=16) self.text_sr = figtext(0.60, 0.90, ("Sample Rate: %.2f" % self.sample_rate), weight="heavy", size=16) self.make_plots() @@ -90,7 +90,7 @@ class draw_constellation: if(len(iq) > 0): self.reals = scipy.array([r.real for r in iq]) self.imags = scipy.array([i.imag for i in iq]) - + self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))]) return True else: @@ -102,7 +102,7 @@ class draw_constellation: self.hfile.seek(self.sizeof_data*self.start, 1) r = 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.2, 0.4, 0.6]) self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") @@ -141,7 +141,7 @@ class draw_constellation: self.plot_const[0].set_data([self.reals, self.imags]) self.sp_const.axis([-2, 2, -2, 2]) draw() - + def zoom(self, event): newxlim = scipy.array(self.sp_iq.get_xlim()) curxlim = scipy.array(self.xlim) @@ -163,7 +163,7 @@ class draw_constellation: if(find(event.key, forward_valid_keys)): self.step_forward() - + elif(find(event.key, backward_valid_keys)): self.step_backward() @@ -195,16 +195,16 @@ class draw_constellation: r = self.get_data() if(r): self.update_plots() - - + + def mouse_button_callback(self, event): x, y = event.xdata, event.ydata - + if x is not None and y is not None: if(event.inaxes == self.sp_iq): self.indx = searchsorted(self.time, [x]) self.set_trace(self.indx) - + def set_trace(self, indx): self.plot_iq[2].set_data(self.time[indx], self.reals[indx]) @@ -212,13 +212,13 @@ class draw_constellation: self.plot_const[1].set_data(self.reals[indx], self.imags[indx]) draw() - + 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" @@ -231,7 +231,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() @@ -245,6 +245,6 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/gr_plot_fft b/gr-utils/src/python/gr_plot_fft index 6859ea471..434348164 100644 --- a/gr-utils/src/python/gr_plot_fft +++ b/gr-utils/src/python/gr_plot_fft @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2012 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. -# +# from gnuradio.plot_fft_base import plot_fft_base diff --git a/gr-utils/src/python/gr_plot_fft_c b/gr-utils/src/python/gr_plot_fft_c index e4ee9c5a9..43e808d95 100755 --- a/gr-utils/src/python/gr_plot_fft_c +++ b/gr-utils/src/python/gr_plot_fft_c @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2007,2008 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. -# +# from gnuradio.plot_fft_base import plot_fft_base @@ -27,7 +27,7 @@ from gnuradio.plot_fft_base import plot_fft_base def main(): parser = plot_fft_base.setup_options() parser.remove_option("--data-type") - + (options, args) = parser.parse_args () if len(args) != 1: parser.print_help() @@ -41,6 +41,6 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/gr_plot_fft_f b/gr-utils/src/python/gr_plot_fft_f index 66c75a8ff..dee9b17de 100755 --- a/gr-utils/src/python/gr_plot_fft_f +++ b/gr-utils/src/python/gr_plot_fft_f @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2007,2008 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. -# +# from gnuradio.plot_fft_base import plot_fft_base @@ -27,7 +27,7 @@ from gnuradio.plot_fft_base import plot_fft_base def main(): parser = plot_fft_base.setup_options() parser.remove_option("--data-type") - + (options, args) = parser.parse_args () if len(args) != 1: parser.print_help() @@ -41,6 +41,6 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/gr_plot_float b/gr-utils/src/python/gr_plot_float index e5c22a315..22806e48a 100755 --- a/gr-utils/src/python/gr_plot_float +++ b/gr-utils/src/python/gr_plot_float @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2007,2008 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 @@ -40,7 +40,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() @@ -55,4 +55,4 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/gr_plot_int b/gr-utils/src/python/gr_plot_int index b44d4360a..355ddf018 100755 --- a/gr-utils/src/python/gr_plot_int +++ b/gr-utils/src/python/gr_plot_int @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2007,2008 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 @@ -40,7 +40,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() @@ -55,4 +55,4 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/gr_plot_iq b/gr-utils/src/python/gr_plot_iq index 316e60a75..bf8077b6b 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 - + diff --git a/gr-utils/src/python/gr_plot_psd b/gr-utils/src/python/gr_plot_psd index 658e7b297..059ca6b64 100644 --- a/gr-utils/src/python/gr_plot_psd +++ b/gr-utils/src/python/gr_plot_psd @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2012 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. -# +# from gnuradio.plot_psd_base import plot_psd_base diff --git a/gr-utils/src/python/gr_plot_psd_c b/gr-utils/src/python/gr_plot_psd_c index 192f263ec..fff2bff0f 100755 --- a/gr-utils/src/python/gr_plot_psd_c +++ b/gr-utils/src/python/gr_plot_psd_c @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2008 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. -# +# from optparse import OptionParser from gnuradio.plot_psd_base import plot_psd_base @@ -42,6 +42,6 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/gr_plot_psd_f b/gr-utils/src/python/gr_plot_psd_f index fab312645..ec6799479 100755 --- a/gr-utils/src/python/gr_plot_psd_f +++ b/gr-utils/src/python/gr_plot_psd_f @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2008 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. -# +# from optparse import OptionParser from gnuradio.plot_psd_base import plot_psd_base @@ -42,6 +42,6 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/gr_plot_qt b/gr-utils/src/python/gr_plot_qt index 937d0014b..153359f0c 100755 --- a/gr-utils/src/python/gr_plot_qt +++ b/gr-utils/src/python/gr_plot_qt @@ -55,12 +55,12 @@ class SpectrogramData(Qwt.QwtRasterData): def rasterHint(self, rect): return Qt.QSize(self.sp.shape[0], self.sp.shape[1]) - + def copy(self): return self def range(self): - + return Qwt.QwtDoubleInterval(self.sp.min(), self.sp.max()) def value(self, x, y): @@ -77,7 +77,7 @@ class gr_plot_qt(QtGui.QMainWindow): QtGui.QWidget.__init__(self, parent) self.gui = Ui_MainWindow() self.gui.setupUi(self) - + self.filename = None self.block_length = options.block_length self.start = options.start @@ -127,8 +127,8 @@ class gr_plot_qt(QtGui.QMainWindow): self.connect(self.gui.colorComboBox, Qt.SIGNAL("activated (const QString&)"), self.colorComboBoxEdit) - - + + # Set up line style combo box self.line_styles = {"None" : Qwt.QwtSymbol.NoSymbol, "Circle" : Qwt.QwtSymbol.Ellipse, @@ -290,7 +290,7 @@ class gr_plot_qt(QtGui.QMainWindow): def reload_file(self): if(self.filename): self.initialize(self.filename) - + def initialize(self, filename): self.filename = filename self.hfile = open(filename, "r") @@ -308,7 +308,7 @@ class gr_plot_qt(QtGui.QMainWindow): self.init_data_input() self.get_data(self.cur_start, self.cur_stop) self.get_psd() - self.get_specgram() + self.get_specgram() self.gui.plotHBar.setSliderPosition(0) self.gui.plotHBar.setMaximum(self.signal_size-self.block_length) @@ -322,7 +322,7 @@ class gr_plot_qt(QtGui.QMainWindow): self.signal_size = self.hfile.tell()/self.sizeof_data #print "Sizeof File: ", self.signal_size self.hfile.seek(0, os.SEEK_SET) - + def get_data(self, start, end): if(end > start): self.hfile.seek(start*self.sizeof_data, os.SEEK_SET) @@ -365,7 +365,7 @@ class gr_plot_qt(QtGui.QMainWindow): noverlap=self.specfftsize/4.0, window=winpoints, scale_by_freq=False) - + self.iq_spec = 10.0*scipy.log10(abs(iq_spec)) self.spec_f = f self.spec_t = t @@ -379,7 +379,7 @@ class gr_plot_qt(QtGui.QMainWindow): self.specfftsize = fftSize.toInt()[0] self.get_specgram() self.update_specgram_curves() - + def colorComboBoxEdit(self, colorSelection): colorstr = str(colorSelection.toAscii()) color_func = self.color_modes[colorstr] @@ -443,7 +443,7 @@ class gr_plot_qt(QtGui.QMainWindow): tend = self.cur_stop / self.sample_rate self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) - + self.get_data(self.cur_start, self.cur_stop) self.update_time_curves() @@ -456,7 +456,7 @@ class gr_plot_qt(QtGui.QMainWindow): self.set_file_pos_box(self.cur_start, self.cur_stop) except AttributeError: pass - + def file_time_changed(self): tstart = self.gui.fileTimeStartLineEdit.text().toDouble() @@ -548,16 +548,16 @@ class gr_plot_qt(QtGui.QMainWindow): # Set the zoomer base to unzoom to the new axis self.timeZoomer.setZoomBase() - + self.gui.timePlot.replot() - + def update_psd_curves(self): self.psdcurve.setData(self.freq, self.iq_psd) self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom, min(self.freq), max(self.freq)) - + # Set the zoomer base to unzoom to the new axis self.freqZoomer.setZoomBase() @@ -579,10 +579,10 @@ class gr_plot_qt(QtGui.QMainWindow): self.gui.specPlot.setAxisScale(self.gui.specPlot.yLeft, min(self.spec_t), max(self.spec_t)) - self.gui.specPlot.setAxisScale(self.gui.specPlot.yRight, + self.gui.specPlot.setAxisScale(self.gui.specPlot.yRight, self.iq_spec.min(), self.iq_spec.max()) - + # Set the zoomer base to unzoom to the new axis self.specZoomer.setZoomBase() @@ -604,7 +604,7 @@ class gr_plot_qt(QtGui.QMainWindow): self.rcurve.setSymbol(self.rsym) self.icurve.setSymbol(self.isym) self.gui.timePlot.replot() - + def color_black_on_white(self): blue = QtGui.qRgb(0x00, 0x00, 0xFF) red = QtGui.qRgb(0xFF, 0x00, 0x00) @@ -636,7 +636,7 @@ class gr_plot_qt(QtGui.QMainWindow): whiteBrush = Qt.QBrush(Qt.QColor("white")) whiteBrush = Qt.QBrush(Qt.QColor(white)) redBrush = Qt.QBrush(Qt.QColor(red)) - + self.gui.timePlot.setCanvasBackground(QtGui.QColor("black")) self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black")) self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width)) @@ -658,7 +658,7 @@ class gr_plot_qt(QtGui.QMainWindow): whiteBrush = Qt.QBrush(Qt.QColor("white")) greenBrush = Qt.QBrush(Qt.QColor(green)) redBrush = Qt.QBrush(Qt.QColor(red)) - + self.gui.timePlot.setCanvasBackground(QtGui.QColor("black")) self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black")) self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width)) @@ -679,7 +679,7 @@ class gr_plot_qt(QtGui.QMainWindow): whiteBrush = Qt.QBrush(Qt.QColor("white")) blueBrush = Qt.QBrush(Qt.QColor(blue)) redBrush = Qt.QBrush(Qt.QColor(red)) - + self.gui.timePlot.setCanvasBackground(QtGui.QColor("black")) self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black")) self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width)) diff --git a/gr-utils/src/python/gr_plot_short b/gr-utils/src/python/gr_plot_short index 3466e0b7d..702a2a94a 100755 --- a/gr-utils/src/python/gr_plot_short +++ b/gr-utils/src/python/gr_plot_short @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2007,2008 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 @@ -40,7 +40,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() @@ -55,4 +55,4 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/plot_data.py b/gr-utils/src/python/plot_data.py index 15012e589..242ca2a4b 100644 --- a/gr-utils/src/python/plot_data.py +++ b/gr-utils/src/python/plot_data.py @@ -1,23 +1,23 @@ # # 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 @@ -57,7 +57,7 @@ class plot_data: 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_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), weight="heavy", size=self.text_size) @@ -78,7 +78,7 @@ class plot_data: self.manager = get_current_fig_manager() connect('key_press_event', self.click) show() - + def get_data(self, hfile): self.text_file_pos.set_text("File Position: %d" % (hfile.tell()//self.sizeof_data)) try: @@ -88,7 +88,7 @@ class plot_data: else: self.f = scipy.array(f) self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.f))]) - + def make_plots(self): self.sp_f = self.fig.add_subplot(2,1,1, position=[0.075, 0.2, 0.875, 0.6]) self.sp_f.set_title(("Amplitude"), fontsize=self.title_font_size, fontweight="bold") @@ -104,7 +104,7 @@ class plot_data: hf.seek(self.sizeof_data*self.start, 1) self.get_data(hf) - + # Subplot for real and imaginary parts of signal self.plot_f += plot(self.time, self.f, 'o-') maxval = max(maxval, self.f.max()) @@ -126,16 +126,16 @@ class plot_data: minval = min(minval, self.f.min()) self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) - + 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() @@ -156,7 +156,7 @@ class plot_data: else: hf.seek(-hf.tell(),1) self.update_plots() - + def find(item_in, list_search): try: diff --git a/gr-utils/src/python/plot_fft_base.py b/gr-utils/src/python/plot_fft_base.py index 0b5df504b..4afdc3a36 100755 --- a/gr-utils/src/python/plot_fft_base.py +++ b/gr-utils/src/python/plot_fft_base.py @@ -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 @@ -54,7 +54,7 @@ class plot_fft_base: self.fig = figure(1, figsize=(16, 12), 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.35, 0.88, ("Block Size: %d" % self.block_length), @@ -77,7 +77,7 @@ class plot_fft_base: connect('draw_event', self.zoom) connect('key_press_event', self.click) show() - + def get_data(self): self.position = self.hfile.tell()/self.sizeof_data self.text_file_pos.set_text("File Position: %d" % (self.position)) @@ -87,7 +87,7 @@ class plot_fft_base: print "End of File" else: self.iq_fft = self.dofft(self.iq) - + tstep = 1.0 / self.sample_rate #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))]) self.time = scipy.array([tstep*(i) for i in xrange(len(self.iq))]) @@ -107,7 +107,7 @@ class plot_fft_base: Fn = 0.5 * sample_rate freq = scipy.array([-Fn + i*Fs for i in xrange(N)]) return freq - + def make_plots(self): # if specified on the command-line, set file pointer self.hfile.seek(self.sizeof_data*self.start, 1) @@ -125,7 +125,7 @@ class plot_fft_base: self.sp_fft.set_ylabel("Power Spectrum (dBm)", fontsize=self.label_font_size, fontweight="bold") self.get_data() - + self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags self.draw_time() # draw the plot @@ -155,7 +155,7 @@ class plot_fft_base: self.xlim = self.sp_iq.get_xlim() draw() - + def zoom(self, event): newxlim = scipy.array(self.sp_iq.get_xlim()) curxlim = scipy.array(self.xlim) @@ -168,10 +168,10 @@ class plot_fft_base: iq = self.iq[xmin : xmax] time = self.time[xmin : xmax] - + iq_fft = self.dofft(iq) freq = self.calc_freq(time, self.sample_rate) - + self.plot_fft[0].set_data(freq, iq_fft) self.sp_fft.axis([freq.min(), freq.max(), iq_fft.min()-10, iq_fft.max()+10]) @@ -184,7 +184,7 @@ class plot_fft_base: if(find(event.key, forward_valid_keys)): self.step_forward() - + elif(find(event.key, backward_valid_keys)): self.step_backward() @@ -244,6 +244,6 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gr-utils/src/python/plot_psd_base.py b/gr-utils/src/python/plot_psd_base.py index 78eed5f71..fe3c9e12b 100755 --- a/gr-utils/src/python/plot_psd_base.py +++ b/gr-utils/src/python/plot_psd_base.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2007,2008,2010,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 @@ -60,7 +60,7 @@ class plot_psd_base: self.fig = figure(1, figsize=(16, 12), facecolor='w') rcParams['xtick.labelsize'] = self.axis_font_size rcParams['ytick.labelsize'] = self.axis_font_size - + self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), weight="heavy", size=self.text_size) self.text_file_pos = figtext(0.10, 0.92, "File Position: ", @@ -85,7 +85,7 @@ class plot_psd_base: connect('draw_event', self.zoom) connect('key_press_event', self.click) show() - + def get_data(self): self.position = self.hfile.tell()/self.sizeof_data self.text_file_pos.set_text("File Position: %d" % self.position) @@ -101,13 +101,13 @@ class plot_psd_base: tstep = 1.0 / self.sample_rate #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))]) self.time = scipy.array([tstep*(i) for i in xrange(len(self.iq))]) - + self.iq_psd, self.freq = self.dopsd(self.iq) return True else: print "End of File" return False - + def dopsd(self, iq): ''' Need to do this here and plot later so we can do the fftshift ''' overlap = self.psdfftsize/4 @@ -125,7 +125,7 @@ class plot_psd_base: iqdims = [[0.075, 0.2, 0.4, 0.6], [0.075, 0.55, 0.4, 0.3]] psddims = [[0.575, 0.2, 0.4, 0.6], [0.575, 0.55, 0.4, 0.3]] specdims = [0.2, 0.125, 0.6, 0.3] - + # Subplot for real and imaginary parts of signal self.sp_iq = self.fig.add_subplot(2,2,1, position=iqdims[self.dospec]) self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") @@ -139,7 +139,7 @@ class plot_psd_base: self.sp_psd.set_ylabel("Power Spectrum (dBm)", fontsize=self.label_font_size, fontweight="bold") r = self.get_data() - + self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags self.draw_time(self.time, self.iq) # draw the plot @@ -156,7 +156,7 @@ class plot_psd_base: self.sp_spec.set_ylabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") self.draw_spec(self.time, self.iq) - + draw() def draw_time(self, t, iq): @@ -189,9 +189,9 @@ class plot_psd_base: self.draw_spec(self.time, self.iq) self.xlim = scipy.array(self.sp_iq.get_xlim()) # so zoom doesn't get called - + draw() - + def zoom(self, event): newxlim = scipy.array(self.sp_iq.get_xlim()) curxlim = scipy.array(self.xlim) @@ -205,7 +205,7 @@ class plot_psd_base: time = scipy.array(self.time[xmin : xmax]) iq_psd, freq = self.dopsd(iq) - + self.draw_psd(freq, iq_psd) self.xlim = scipy.array(self.sp_iq.get_xlim()) @@ -217,7 +217,7 @@ class plot_psd_base: if(find(event.key, forward_valid_keys)): self.step_forward() - + elif(find(event.key, backward_valid_keys)): self.step_backward() @@ -241,7 +241,7 @@ class plot_psd_base: r = self.get_data() if(r): self.update_plots() - + @staticmethod def setup_options(): usage="%prog: [options] input_filename" @@ -287,6 +287,6 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + |