diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-11-13 16:57:22 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-11-15 15:31:59 -0800 |
commit | 03e3a368eb28043cda924397874e572fc8af9c38 (patch) | |
tree | 0368c364f2c530379fb43667e165409f97c43fda | |
parent | a49ec7765c27e3b114fbcac4dbc1c877863886c7 (diff) |
qtgui: Remove the command line plot tools
Note: In gr-utils, we have a version of these tools that don't have Qt4
dependencies (note: they have matplotlib dependencies, though).
None of these tools work with Qt5.
31 files changed, 8 insertions, 3537 deletions
diff --git a/gr-qtgui/apps/CMakeLists.txt b/gr-qtgui/apps/CMakeLists.txt index 6a8e6c51aa..f52f948d45 100644 --- a/gr-qtgui/apps/CMakeLists.txt +++ b/gr-qtgui/apps/CMakeLists.txt @@ -19,42 +19,12 @@ include(GrPython) -GR_PYTHON_INSTALL( - FILES - plot_base.py - plot_psd_base.py - plot_spectrogram_base.py - plot_time_base.py - plot_time_raster_base.py - plot_form.py - plot_constellation_form.py - plot_psd_form.py - plot_spectrogram_form.py - plot_time_form.py - plot_time_raster_form.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/qtgui -) +#GR_PYTHON_INSTALL( + #FILES + #DESTINATION ${GR_PYTHON_DIR}/gnuradio/qtgui +#) -GR_PYTHON_INSTALL( - PROGRAMS - gr_time_plot_c - gr_time_plot_f - gr_time_plot_i - gr_time_plot_s - gr_time_plot_b - gr_time_raster_f - gr_time_raster_b - gr_psd_plot_c - gr_psd_plot_f - gr_psd_plot_i - gr_psd_plot_s - gr_psd_plot_b - gr_spectrogram_plot_c - gr_spectrogram_plot_f - gr_spectrogram_plot_i - gr_spectrogram_plot_s - gr_spectrogram_plot_b - gr_spectrogram_plot - gr_constellation_plot - DESTINATION ${GR_RUNTIME_DIR} -) +#GR_PYTHON_INSTALL( + #PROGRAMS + #DESTINATION ${GR_RUNTIME_DIR} +#) diff --git a/gr-qtgui/apps/gr_constellation_plot b/gr-qtgui/apps/gr_constellation_plot deleted file mode 100755 index 2785cac534..0000000000 --- a/gr-qtgui/apps/gr_constellation_plot +++ /dev/null @@ -1,176 +0,0 @@ -#!/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 __future__ import print_function - -from gnuradio import gr -from gnuradio import blocks -from gnuradio.eng_arg import eng_float, intx -from argparse import ArgumentParser -import os, sys - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4 and gr-qtgui.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_constellation_form import * - from gnuradio.qtgui.plot_base import * -except ImportError: - from plot_constellation_form import * - from plot_base import * - -class my_top_block(gr.top_block): - def __init__(self, filelist, start, nsamples, max_nsamples): - gr.top_block.__init__(self) - - self._filelist = filelist - self._samp_rate = 0 - self._center_freq = 0 - self._start = start - self._max_nsamps = max_nsamples - self._nsigs = len(self._filelist) - self._nsamps = nsamples - self._auto_scale = True - - self._y_min = -20 - self._y_max = 20 - self._y_range = 4 - self._y_value = 2 - self.gui_y_axis = None - - self.qapp = QtGui.QApplication(sys.argv) - - self.skip = blocks.skiphead(gr.sizeof_gr_complex, self._start) - self.gui_snk = qtgui.const_sink_c(self._nsamps, "", self._nsigs) - n = 0 - self.srcs = list() - self._data_min = sys.maxint - self._data_max = -sys.maxint - 1 - for f in filelist: - data,_min,_max = read_samples_c(f, self._start, self._nsamps) - self.srcs.append(blocks.vector_source_c(data)) - - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - # Set default labels based on file names - fname = f.split("/")[-1] - self.gui_snk.set_line_label(n, "{0}".format(fname)) - n += 1 - - self.connect(self.srcs[0], self.skip) - self.connect(self.skip, (self.gui_snk, 0)) - - for i,s in enumerate(self.srcs[1:]): - self.connect(s, (self.gui_snk, i+1)) - - self.gui_snk.enable_menu(False) - - # Get Python Qt references - pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - - def get_gui(self): - return self.pyWin - - def reset(self, newstart, newnsamps): - self.stop() - self.wait() - - self._start = newstart - - for s,f in zip(self.srcs, self._filelist): - data,_min,_max = read_samples_c(f, self._start, newnsamps) - s.set_data(data) - if(len(data) < newnsamps): - newnsamps = len(data) - - self._nsamps = newnsamps - self.gui_snk.set_nsamps(self._nsamps) - - self.start() - - def set_y_axis(self, y_min, y_max): - y_min = -y_max - self.gui_snk.set_y_axis(y_min, y_max) - self.gui_snk.set_x_axis(y_min, y_max) - return y_min, y_max - - def auto_scale(self, state): - if(state > 0): - self.set_y_axis(self._data_min, self._data_max) - self._auto_scale = True - self._y_value = self._data_max - self._y_range = self._data_max - self._data_min - self._y_min = 10*self._data_min - self._y_max = 10*self._data_max - - if(self.gui_y_axis): - self.gui_y_axis(self._data_min, self._data_max) - else: - self._auto_scale = False - - -def main(): - description = "Plots the constellations of a list of files." - parser = ArgumentParser(description=description, - conflict_handler="resolve") - parser.add_argument("-N", "--nsamples", type=int, default=1000000, - help="Set the number of samples to display [default=%(default)r]") - parser.add_argument("-S", "--start", type=int, default=0, - help="Starting sample number [default=%(default)r]") - parser.add_argument("files", nargs="+", metavar='FILE') - args = parser.parse_args() - - filelist = args.files - nsamples = args.nsamples - - # Find the smallest number of samples in all files and use that as - # a maximum value possible. - filesizes = [] - for f in filelist: - if(os.path.exists(f)): - filesizes.append(os.path.getsize(f) // gr.sizeof_gr_complex) - max_nsamples = min(filesizes) - - tb = my_top_block(filelist, args.start, nsamples, max_nsamples); - - main_box = plot_constellation_form(tb, 'GNU Radio Constellation Plot', 10000.0) - for n in range(tb._nsigs): - main_box._style_edit[n].setCurrentIndex(0) - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_psd_plot_b b/gr-qtgui/apps/gr_psd_plot_b deleted file mode 100755 index eb13934972..0000000000 --- a/gr-qtgui/apps/gr_psd_plot_b +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_psd_base as plot_base -except ImportError: - import plot_psd_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class psd_plot_b(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0, auto_scale=True): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_b - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_chars_to_float - self.gui_snk = qtgui.freq_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the PSDs of a list of files. Files are a binary list of bytes." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = psd_plot_b(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average) - - main_box = plot_base.plot_psd_form(tb, 'GNU Radio PSD Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_psd_plot_c b/gr-qtgui/apps/gr_psd_plot_c deleted file mode 100755 index 25c944b59f..0000000000 --- a/gr-qtgui/apps/gr_psd_plot_c +++ /dev/null @@ -1,77 +0,0 @@ -#!/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 import gr -from gnuradio import blocks -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_psd_base as plot_base -except ImportError: - import plot_psd_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class psd_plot_c(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_c - self.dsize = gr.sizeof_gr_complex - self.src_type = blocks.vector_source_c - self.gui_snk = qtgui.freq_sink_c(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the PSDs of a list of files. Files are a binary list of complex floats." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = psd_plot_c(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average) - - main_box = plot_base.plot_psd_form(tb, 'GNU Radio PSD Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_psd_plot_f b/gr-qtgui/apps/gr_psd_plot_f deleted file mode 100755 index 32c13cc1db..0000000000 --- a/gr-qtgui/apps/gr_psd_plot_f +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import blocks -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_psd_base as plot_base -except ImportError: - import plot_psd_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class psd_plot_f(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0, auto_scale=True): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_f - self.dsize = gr.sizeof_float - self.src_type = blocks.vector_source_f - self.gui_snk = qtgui.freq_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the PSDs of a list of files. Files are a binary list of floats." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = psd_plot_f(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average) - - main_box = plot_base.plot_psd_form(tb, 'GNU Radio PSD Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_psd_plot_i b/gr-qtgui/apps/gr_psd_plot_i deleted file mode 100755 index fd7b06ed60..0000000000 --- a/gr-qtgui/apps/gr_psd_plot_i +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_psd_base as plot_base -except ImportError: - import plot_psd_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class psd_plot_i(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0, auto_scale=True): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_i - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_ints_to_float - self.gui_snk = qtgui.freq_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the PSDs of a list of files. Files are a binary list of integers." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = psd_plot_i(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average) - - main_box = plot_base.plot_psd_form(tb, 'GNU Radio PSD Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_psd_plot_s b/gr-qtgui/apps/gr_psd_plot_s deleted file mode 100755 index 03eb1398f2..0000000000 --- a/gr-qtgui/apps/gr_psd_plot_s +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_psd_base as plot_base -except ImportError: - import plot_psd_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class psd_plot_s(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0, auto_scale=True): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_s - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_shorts_to_float - self.gui_snk = qtgui.freq_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the PSDs of a list of files. Files are a binary list of shorts." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = psd_plot_s(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average) - - main_box = plot_base.plot_psd_form(tb, 'GNU Radio PSD Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_spectrogram_plot b/gr-qtgui/apps/gr_spectrogram_plot deleted file mode 100755 index 8a33af12c9..0000000000 --- a/gr-qtgui/apps/gr_spectrogram_plot +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import blocks -from gnuradio import filter -import pmt -from gnuradio.blocks import parse_file_metadata -import sys -import os - -try: - import gnuradio.qtgui.plot_spectrogram_base as plot_base -except ImportError: - import plot_spectrogram_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class spectrogram_plot_c(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - self.read_samples = plot_base.read_samples_c - self.dsize = gr.sizeof_gr_complex - self.src_type = blocks.vector_source_c - self.gui_snk = qtgui.waterfall_sink_c(self._psd_size, - filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq, - self._samp_rate,"Complex Float", - self._nsigs) - self.setup() - -class spectrogram_plot_f(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - self.read_samples = plot_base.read_samples_f - self.dsize = gr.sizeof_float - self.src_type = blocks.vector_source_f - self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, - filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq, - self._samp_rate, - "Float", - self._nsigs) - self.setup() - -class spectrogram_plot_b(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - self.read_samples = plot_base.read_samples_b - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_chars_to_float - self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, - filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq, - self._samp_rate, "Bytes", - self._nsigs) - self.setup() - -class spectrogram_plot_i(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - self.read_samples = plot_base.read_samples_i - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_ints_to_float - self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, - filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "Integers", - self._nsigs) - self.setup() - -class spectrogram_plot_s(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - self.read_samples = plot_base.read_samples_s - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_shorts_to_float - self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, - filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "Shorts", - self._nsigs) - self.setup() - -def read_header(filelist): - filename = filelist[0] + '.hdr' - try: - handle = open(filename,"rb") - except IOError: - return - hdr_start = handle.tell() - header_str = handle.read(parse_file_metadata.HEADER_LENGTH) - if( len(header_str) == 0 ): - return - # String to PMT Conversion - try: - header = pmt.deserialize_str(header_str) - except RuntimeError: - sys.stderr.write("Can't deserialize header: invalid/corrupt data\n") - sys.exit(1) - info = parse_file_metadata.parse_header(header,False) - return info - -def main(): - description = 'Plots the spectrogram (waterfall) of a file with detached header.' - description += ' Assumes header is <input_filename>.hdr' - args = plot_base.setup_options(description) - # Attempt to read the header information - info = read_header(args.files) - # If no header, quit - if not info: - sys.stderr.write('Header not found\n') - sys.exit(1) - - max_nsamples = plot_base.find_max_nsamples(args.files) - srate = info["rx_rate"] - - # Dispatch the proper function - # Complex Types - if(info["cplx"] == True): - if( info["type"] == "float" ): - tb = spectrogram_plot_c(args.files, - args.center_frequency,srate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - else: - sys.stderr.write("Complex File Type " + info["type"]+ " not supported.\n") - # Real Types - else: - if( info["type"] == "bytes" ): - tb = spectrogram_plot_b(args.files, - args.center_frequency,srate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - elif( info["type"] == "int" ): - tb = spectrogram_plot_i(args.files, - args.center_frequency,srate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - elif( info["type"] == "float" ): - tb = spectrogram_plot_f(args.files, - args.center_frequency,srate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - elif( info["type"] == "short" ): - tb = spectrogram_plot_s(args.files, - args.center_frequency,srate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - else: - sys.stderr.write("Real File Type " + info["type"] + " not supported\n") - main_box = plot_base.plot_spectrogram_form(tb, 'GNU Radio Spectrogram Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_spectrogram_plot_b b/gr-qtgui/apps/gr_spectrogram_plot_b deleted file mode 100755 index 1aabf8b334..0000000000 --- a/gr-qtgui/apps/gr_spectrogram_plot_b +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_spectrogram_base as plot_base -except ImportError: - import plot_spectrogram_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class spectrogram_plot_b(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_b - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_chars_to_float - self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the spectrogram (waterfall) of a list of files. Files are a binary list of chars." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = spectrogram_plot_b(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - - main_box = plot_base.plot_spectrogram_form(tb, 'GNU Radio Time Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_spectrogram_plot_c b/gr-qtgui/apps/gr_spectrogram_plot_c deleted file mode 100755 index fbb2e7f53a..0000000000 --- a/gr-qtgui/apps/gr_spectrogram_plot_c +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import blocks -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_spectrogram_base as plot_base -except ImportError: - import plot_spectrogram_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class spectrogram_plot_c(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_c - self.dsize = gr.sizeof_gr_complex - self.src_type = blocks.vector_source_c - self.gui_snk = qtgui.waterfall_sink_c(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the spectrogram (waterfall) of a list of files. Files are a binary list of complex floats." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = spectrogram_plot_c(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - - main_box = plot_base.plot_spectrogram_form(tb, 'GNU Radio Spectrogram Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_spectrogram_plot_f b/gr-qtgui/apps/gr_spectrogram_plot_f deleted file mode 100755 index f3d06bf779..0000000000 --- a/gr-qtgui/apps/gr_spectrogram_plot_f +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import blocks -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_spectrogram_base as plot_base -except ImportError: - import plot_spectrogram_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class spectrogram_plot_f(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_f - self.dsize = gr.sizeof_float - self.src_type = blocks.vector_source_f - self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the spectrogram (waterfall) of a list of files. Files are a binary list of floats." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = spectrogram_plot_f(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - - main_box = plot_base.plot_spectrogram_form(tb, 'GNU Radio Time Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_spectrogram_plot_i b/gr-qtgui/apps/gr_spectrogram_plot_i deleted file mode 100755 index 4a85227771..0000000000 --- a/gr-qtgui/apps/gr_spectrogram_plot_i +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_spectrogram_base as plot_base -except ImportError: - import plot_spectrogram_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class spectrogram_plot_i(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_i - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_ints_to_float - self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the spectrogram (waterfall) of a list of files. Files are a binary list of ints." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = spectrogram_plot_i(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - - main_box = plot_base.plot_spectrogram_form(tb, 'GNU Radio Time Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_spectrogram_plot_s b/gr-qtgui/apps/gr_spectrogram_plot_s deleted file mode 100755 index d0d2a136aa..0000000000 --- a/gr-qtgui/apps/gr_spectrogram_plot_s +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import filter - -try: - import gnuradio.qtgui.plot_spectrogram_base as plot_base -except ImportError: - import plot_spectrogram_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class spectrogram_plot_s(plot_base.plot_base): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - plot_base.plot_base.__init__(self, filelist, fc, samp_rate, - psdsize, start, nsamples, - max_nsamples, avg) - - self.read_samples = plot_base.read_samples_s - self.dsize = gr.sizeof_float - self.src_type = plot_base.source_shorts_to_float - self.gui_snk = qtgui.waterfall_sink_f(self._psd_size, filter.firdes.WIN_BLACKMAN_hARRIS, - self._center_freq, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots the spectrogram (waterfall) of a list of files. Files are a binary list of shorts." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = spectrogram_plot_s(args.files, - args.center_frequency, args.sample_rate, - args.psd_size, - args.start, args.nsamples, max_nsamples, - args.average); - - main_box = plot_base.plot_spectrogram_form(tb, 'GNU Radio Time Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_time_plot_b b/gr-qtgui/apps/gr_time_plot_b deleted file mode 100755 index 06bc432edb..0000000000 --- a/gr-qtgui/apps/gr_time_plot_b +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr - -try: - import gnuradio.qtgui.plot_time_base as plot_base -except ImportError: - import plot_time_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class plot_time_b(plot_base.plot_base): - def __init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale): - plot_base.plot_base.__init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale) - self.read_samples = plot_base.read_samples_b - self.dsize = gr.sizeof_float # already converted - self.src_type = plot_base.source_chars_to_float - self.gui_snk = qtgui.time_sink_f(self._nsamps, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots a list of files on a scope plot. Files are a binary list of chars." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = plot_time_b(args.files, args.sample_rate, - args.start, args.nsamples, max_nsamples, - not args.no_auto_scale) - - main_box = plot_base.plot_time_form(tb, 'GNU Radio Time Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_time_plot_c b/gr-qtgui/apps/gr_time_plot_c deleted file mode 100755 index 7beab0b391..0000000000 --- a/gr-qtgui/apps/gr_time_plot_c +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import blocks - -try: - import gnuradio.qtgui.plot_time_base as plot_base -except ImportError: - import plot_time_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class plot_time_c(plot_base.plot_base): - def __init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale): - plot_base.plot_base.__init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale) - self.read_samples = plot_base.read_samples_c - self.dsize = gr.sizeof_gr_complex - self.src_type = blocks.vector_source_c - self.gui_snk = qtgui.time_sink_c(self._nsamps, self._samp_rate, - "", self._nsigs) - self._nsigs *= 2 # complex plots have real/imag - self.setup() - -def main(): - description = "Plots a list of files on a scope plot. Files are a binary list of complex floats." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = plot_time_c(args.files, args.sample_rate, - args.start, args.nsamples, max_nsamples, - not args.no_auto_scale) - - main_box = plot_base.plot_time_form(tb, 'GNU Radio Time Plot', 10000.0) - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_time_plot_f b/gr-qtgui/apps/gr_time_plot_f deleted file mode 100755 index 4f14b9a8f8..0000000000 --- a/gr-qtgui/apps/gr_time_plot_f +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr -from gnuradio import blocks - -try: - import gnuradio.qtgui.plot_time_base as plot_base -except ImportError: - import plot_time_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class plot_time_f(plot_base.plot_base): - def __init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale): - plot_base.plot_base.__init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale) - self.read_samples = plot_base.read_samples_f - self.dsize = gr.sizeof_float - self.src_type = blocks.vector_source_f - self.gui_snk = qtgui.time_sink_f(self._nsamps, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots a list of files on a scope plot. Files are a binary list of floats." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = plot_time_f(args.files, args.sample_rate, - args.start, args.nsamples, max_nsamples, - not args.no_auto_scale) - - main_box = plot_base.plot_time_form(tb, 'GNU Radio Time Plot', 10000.0) - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_time_plot_i b/gr-qtgui/apps/gr_time_plot_i deleted file mode 100755 index a7118abc38..0000000000 --- a/gr-qtgui/apps/gr_time_plot_i +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr - -try: - import gnuradio.qtgui.plot_time_base as plot_base -except ImportError: - import plot_time_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class plot_time_i(plot_base.plot_base): - def __init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale): - plot_base.plot_base.__init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale) - self.read_samples = plot_base.read_samples_i - self.dsize = gr.sizeof_float # already converted - self.src_type = plot_base.source_ints_to_float - self.gui_snk = qtgui.time_sink_f(self._nsamps, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots a list of files on a scope plot. Files are a binary list of integers." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = plot_time_i(args.files, args.sample_rate, - args.start, args.nsamples, max_nsamples, - not args.no_auto_scale) - - main_box = plot_base.plot_time_form(tb, 'GNU Radio Time Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_time_plot_s b/gr-qtgui/apps/gr_time_plot_s deleted file mode 100755 index 98033ce9e8..0000000000 --- a/gr-qtgui/apps/gr_time_plot_s +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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 import gr - -try: - import gnuradio.qtgui.plot_time_base as plot_base -except ImportError: - import plot_time_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class plot_time_s(plot_base.plot_base): - def __init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale): - plot_base.plot_base.__init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale) - self.read_samples = plot_base.read_samples_s - self.dsize = gr.sizeof_float # already converted - self.src_type = plot_base.source_shorts_to_float - self.gui_snk = qtgui.time_sink_f(self._nsamps, self._samp_rate, - "", self._nsigs) - self.setup() - -def main(): - description = "Plots a list of files on a scope plot. Files are a binary list of shorts." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = plot_time_s(args.files, args.sample_rate, - args.start, args.nsamples, max_nsamples, - not args.no_auto_scale) - - main_box = plot_base.plot_time_form(tb, 'GNU Radio Time Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_time_raster_b b/gr-qtgui/apps/gr_time_raster_b deleted file mode 100755 index ba3f9c961c..0000000000 --- a/gr-qtgui/apps/gr_time_raster_b +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 import gr -from gnuradio import blocks - -try: - import gnuradio.qtgui.plot_time_raster_base as plot_base -except ImportError: - import plot_time_raster_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class plot_time_raster_b(plot_base.plot_base): - def __init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - nrows, ncols, - auto_scale): - plot_base.plot_base.__init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale) - self._nrows = nrows - self._ncols = ncols - self.read_samples = plot_base.read_samples_b - self.dsize = gr.sizeof_char - self.src_type = blocks.vector_source_b - self.gui_snk = qtgui.time_raster_sink_b(self._samp_rate, self._nrows, self._ncols, - [], [], "", self._nsigs) - self.setup() - -def main(): - description = "Plots a list of files on a scope plot. Files are a binary list of chars." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = plot_time_raster_b(args.files, args.sample_rate, - args.start, args.nsamples, max_nsamples, - args.nrows, args.ncols, - not args.no_auto_scale) - - main_box = plot_base.plot_time_raster_form(tb, 'GNU Radio Time Plot') - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/gr_time_raster_f b/gr-qtgui/apps/gr_time_raster_f deleted file mode 100755 index 6d9c20ee99..0000000000 --- a/gr-qtgui/apps/gr_time_raster_f +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 import gr -from gnuradio import blocks - -try: - import gnuradio.qtgui.plot_time_raster_base as plot_base -except ImportError: - import plot_time_raster_base as plot_base - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." - sys.exit(1) - -class plot_time_raster_f(plot_base.plot_base): - def __init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - nrows, ncols, - auto_scale): - plot_base.plot_base.__init__(self, filelist, samp_rate, - start, nsamples, max_nsamples, - auto_scale) - self._nrows = nrows - self._ncols = ncols - self.read_samples = plot_base.read_samples_f - self.dsize = gr.sizeof_float - self.src_type = blocks.vector_source_f - self.gui_snk = qtgui.time_raster_sink_f(self._samp_rate, self._nrows, self._ncols, - [], [], "", self._nsigs) - self.setup() - -def main(): - description = "Plots a list of files on a scope plot. Files are a binary list of floats." - args = plot_base.setup_options(description) - - max_nsamples = plot_base.find_max_nsamples(args.files) - - tb = plot_time_raster_f(args.files, args.sample_rate, - args.start, args.nsamples, max_nsamples, - args.nrows, args.ncols, - not args.no_auto_scale) - - main_box = plot_base.plot_time_raster_form(tb, 'GNU Radio Time Plot', 10000.0) - main_box.show() - - tb.run() - tb.qapp.exec_() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-qtgui/apps/plot_base.py b/gr-qtgui/apps/plot_base.py deleted file mode 100644 index 46f85ab8f5..0000000000 --- a/gr-qtgui/apps/plot_base.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import division -from __future__ import unicode_literals - -from gnuradio import gr, blocks -import os, sys - -os.environ['GR_CONF_CONTROLPORT_ON'] = 'False' - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4 and gr-qtgui.") - sys.exit(1) - -import numpy - -try: - from gnuradio.qtgui.plot_constellation_form import * - from gnuradio.qtgui.plot_psd_form import * - from gnuradio.qtgui.plot_spectrogram_form import * - from gnuradio.qtgui.plot_time_form import * - from gnuradio.qtgui.plot_time_raster_form import * -except ImportError: - from plot_constellation_form import * - from plot_psd_form import * - from plot_spectrogram_form import * - from plot_time_form import * - from plot_time_raster_form import * - -def read_samples(filename, start, in_size, min_size, dtype, dtype_size): - # Read in_size number of samples from file - fhandle = open(filename, 'r') - fhandle.seek(start*dtype_size, 0) - data = numpy.fromfile(fhandle, dtype=dtype, count=in_size) - data_min = 1.1*data.min() - data_max = 1.1*data.max() - data = data.tolist() - fhandle.close() - - if(min_size > 0): - if(len(data) < in_size): - print("Warning: read in {0} samples but asked for {1} samples.".format( - len(data), in_size)) - else: - # If we have to, append 0's to create min_size samples of data - if(len(data) < min_size): - data += (min_size - len(data)) * [dtype(0)] - - - return data, data_min, data_max - -def read_samples_f(filename, start, in_size, min_size=0): - return read_samples(filename, start, in_size, min_size, - numpy.float32, gr.sizeof_float) - -def read_samples_i(filename, start, in_size, min_size=0): - return read_samples(filename, start, in_size, min_size, - numpy.int32, gr.sizeof_int) - -def read_samples_s(filename, start, in_size, min_size=0): - return read_samples(filename, start, in_size, min_size, - numpy.int16, gr.sizeof_short) - -def read_samples_b(filename, start, in_size, min_size=0): - d,mn,mx = read_samples(filename, start, in_size, min_size, - numpy.int8, gr.sizeof_char) - - # Bit of a hack since we want to read the data as signed ints, but - # the blocks.vector_source_b will only accept unsigned. We read in as - # signed, do our min/max and things on that, then convert here. - d = numpy.array(d, dtype=numpy.uint8).tolist() - return d,mn,mx - -def read_samples_c(filename, start, in_size, min_size=0): - # Complex samples are handled differently - fhandle = open(filename, 'r') - fhandle.seek(start*gr.sizeof_gr_complex, 0) - data = numpy.fromfile(fhandle, dtype=numpy.complex64, count=in_size) - data_min = 1.1*float(min(data.real.min(), data.imag.min())) - data_max = 1.1*float(max(data.real.max(), data.imag.max())) - data = data.tolist() - fhandle.close() - - if(min_size > 0): - if(len(data) < in_size): - print("Warning: read in {0} samples but asked for {1} samples.".format( - len(data), in_size)) - else: - # If we have to, append 0's to create min_size samples of data - if(len(data) < min_size): - data += (min_size - len(data)) * [complex(0,0)] - - return data, data_min, data_max - -class source_ints_to_float(gr.hier_block2): - def __init__(self, data): - gr.hier_block2.__init__(self, "ints_to_floats", - gr.io_signature(0, 0, 0), - gr.io_signature(1, 1, gr.sizeof_float)) - self.src = blocks.vector_source_i(data) - self.cvt = blocks.int_to_float() - self.connect(self.src, self.cvt, self) - - def set_data(self, data): - self.src.set_data(data) - -class source_shorts_to_float(gr.hier_block2): - def __init__(self, data): - gr.hier_block2.__init__(self, "shorts_to_floats", - gr.io_signature(0, 0, 0), - gr.io_signature(1, 1, gr.sizeof_float)) - self.src = blocks.vector_source_s(data) - self.cvt = blocks.short_to_float() - self.connect(self.src, self.cvt, self) - - def set_data(self, data): - self.src.set_data(data) - -class source_chars_to_float(gr.hier_block2): - def __init__(self, data): - gr.hier_block2.__init__(self, "chars_to_floats", - gr.io_signature(0, 0, 0), - gr.io_signature(1, 1, gr.sizeof_float)) - self.src = blocks.vector_source_b(data) - self.cvt = blocks.char_to_float() - self.connect(self.src, self.cvt, self) - - def set_data(self, data): - self.src.set_data(data) - -def find_max_nsamples(filelist): - # Find the smallest number of samples in all files and use that as - # a maximum value possible. - filesizes = [] - for f in filelist: - if(os.path.exists(f)): - filesizes.append(os.path.getsize(f) / gr.sizeof_gr_complex) - max_nsamples = min(filesizes) - return max_nsamples diff --git a/gr-qtgui/apps/plot_constellation_form.py b/gr-qtgui/apps/plot_constellation_form.py deleted file mode 100644 index 81cb76e233..0000000000 --- a/gr-qtgui/apps/plot_constellation_form.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import division -from __future__ import unicode_literals - -import sys -from gnuradio import filter - -try: - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_from import plot_form -except ImportError: - from plot_form import plot_form - -class plot_constellation_form(plot_form): - def __init__(self, top_block, title='', scale=1): - plot_form.__init__(self, top_block, title, scale) - - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() - self.right_col_layout.addLayout(self.right_col_form) - self.layout.addLayout(self.right_col_layout, 1,4,1,1) - - # Constellation resizing scales x and y together. - # Set the bar to go from 0.001 to max - self.ybar.setMinimum(1) - self.ybar.setMaximum(self._pos_scale*self.top_block._y_max) - self.ybar.setSingleStep(self._pos_scale*(max(self.top_block._y_range / 10, 0.010))) - self.ybar.setPageStep(self._pos_scale*(max(self.top_block._y_range / 2, 0.010))) - - self.auto_scale = QtGui.QCheckBox("Auto Scale", self) - if(self.top_block._auto_scale): - self.auto_scale.setChecked(self.top_block._auto_scale) - self.set_auto_scale(self.top_block._auto_scale) - self.connect(self.auto_scale, QtCore.SIGNAL("stateChanged(int)"), - self.set_auto_scale) - self.right_col_layout.addWidget(self.auto_scale) - - self.ybar.setValue(1000*self.top_block._y_value) - - self.add_line_control(self.right_col_layout) - - def set_auto_scale(self, state): - if(state): - self.top_block.auto_scale(True) - else: - self.top_block.auto_scale(False) - - def update_samp_rate(self): - pass - diff --git a/gr-qtgui/apps/plot_form.py b/gr-qtgui/apps/plot_form.py deleted file mode 100644 index af262b97c3..0000000000 --- a/gr-qtgui/apps/plot_form.py +++ /dev/null @@ -1,406 +0,0 @@ -#!/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 __future__ import print_function -from __future__ import division -from __future__ import unicode_literals - -try: - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4.") - sys.exit(1) - -import numpy - -class plot_form(QtGui.QWidget): - def __init__(self, top_block, title='', scale=1): - QtGui.QWidget.__init__(self, None) - - self._start = 0 - self._end = 0 - self._y_min = 0 - self._y_max = 0 - self._pos_scale = scale - - self.top_block = top_block - self.top_block.gui_y_axis = self.gui_y_axis - - self.setWindowTitle(title) - - self.layout = QtGui.QGridLayout(self) - self.layout.addWidget(top_block.get_gui(), 1,2,1,2) - - # Create a save action - self.save_act = QtGui.QAction("Save", self) - self.save_act.setShortcut(QtGui.QKeySequence.Save) - self.connect(self.save_act, QtCore.SIGNAL("triggered()"), - self.save_figure) - - # Create an exit action - self.exit_act = QtGui.QAction("Exit", self) - self.exit_act.setShortcut(QtGui.QKeySequence.Close) - self.connect(self.exit_act, QtCore.SIGNAL("triggered()"), - self.close) - - # Create a menu for the window - self.menu = QtGui.QToolBar("Menu", self) - self.menu.addAction(self.save_act) - self.menu.addAction(self.exit_act) - - self.layout.addWidget(self.menu, 0,0,1,4) - - self.left_col_form = QtGui.QFormLayout() - self.layout.addLayout(self.left_col_form, 1,0,1,1) - self.layout.setColumnStretch(0, 0) - self.layout.setColumnStretch(2, 1) - - # Create Edit boxes for X-axis start/stop - self.size_val = QtGui.QIntValidator(0, top_block._max_nsamps, self) - - self.start_edit = QtGui.QLineEdit(self) - self.start_edit.setMinimumWidth(100) - self.start_edit.setMaximumWidth(100) - self.start_edit.setText(QtCore.QString("%1").arg(top_block._start)) - self.start_edit.setValidator(self.size_val) - self.left_col_form.addRow("Start:", self.start_edit) - self.connect(self.start_edit, QtCore.SIGNAL("returnPressed()"), - self.update_xaxis_pos) - - end = top_block._start + top_block._nsamps - self.end_edit = QtGui.QLineEdit(self) - self.end_edit.setMinimumWidth(100) - self.end_edit.setMaximumWidth(100) - self.end_edit.setText(QtCore.QString("%1").arg(end)) - self.end_edit.setValidator(self.size_val) - self.left_col_form.addRow("End:", self.end_edit) - self.connect(self.end_edit, QtCore.SIGNAL("returnPressed()"), - self.update_xaxis_pos) - - # Create a slider to move the position in the file - self.posbar = QtGui.QSlider(QtCore.Qt.Horizontal, self) - self.posbar.setMaximum(self.top_block._max_nsamps) - self.posbar.setPageStep(self.top_block._nsamps) - self.connect(self.posbar, QtCore.SIGNAL("valueChanged(int)"), - self.update_xaxis_slider) - self.layout.addWidget(self.posbar, 2,2,1,1) - - # Create Edit boxes for Y-axis min/max - self.y_max_edit = QtGui.QLineEdit(self) - self.y_max_edit.setMinimumWidth(100) - self.y_max_edit.setMaximumWidth(100) - self.left_col_form.addRow("Y Max:", self.y_max_edit) - self.connect(self.y_max_edit, QtCore.SIGNAL("editingFinished()"), - self.update_yaxis_pos) - - self.y_min_edit = QtGui.QLineEdit(self) - self.y_min_edit.setMinimumWidth(100) - self.y_min_edit.setMaximumWidth(100) - self.left_col_form.addRow("Y Min:", self.y_min_edit) - self.connect(self.y_min_edit, QtCore.SIGNAL("editingFinished()"), - self.update_yaxis_pos) - - self.grid_check = QtGui.QCheckBox("Grid", self) - self.connect(self.grid_check, QtCore.SIGNAL("stateChanged(int)"), - self.set_grid_check) - self.left_col_form.addWidget(self.grid_check) - - # Create a slider to move the plot's y-axis offset - _ymax = numpy.int32(min(numpy.iinfo(numpy.int32).max, self.top_block._y_max)) - _ymin = numpy.int32(max(numpy.iinfo(numpy.int32).min, self.top_block._y_min)) - _yrng = numpy.int32(min(numpy.iinfo(numpy.int32).max, self.top_block._y_range)) - _yval = numpy.int32(min(numpy.iinfo(numpy.int32).max, self.top_block._y_value)) - self.ybar = QtGui.QSlider(QtCore.Qt.Vertical, self) - self.ybar.setMinimum(self._pos_scale*_ymin) - self.ybar.setMaximum(self._pos_scale*_ymax) - self.ybar.setSingleStep(self._pos_scale*(_yrng / 10)) - self.ybar.setPageStep(self._pos_scale*(_yrng / 2)) - self.ybar.setValue(self._pos_scale*_ymax) - self.connect(self.ybar, QtCore.SIGNAL("valueChanged(int)"), - self.update_yaxis_slider) - self.layout.addWidget(self.ybar, 1,1,1,1) - - self.gui_y_axis(top_block._y_value-top_block._y_range, top_block._y_value) - - # Create an edit box for the Sample Rate - sr = top_block._samp_rate - self.samp_rate_edit = QtGui.QLineEdit(self) - self.samp_rate_edit.setMinimumWidth(100) - self.samp_rate_edit.setMaximumWidth(100) - self.samp_rate_edit.setText(QtCore.QString("%1").arg(sr)) - self.left_col_form.addRow("Sample Rate:", self.samp_rate_edit) - self.connect(self.samp_rate_edit, QtCore.SIGNAL("returnPressed()"), - self.update_samp_rate) - - # Create an edit box for the center frequency - freq = top_block._center_freq - self.freq_edit = QtGui.QLineEdit(self) - self.freq_edit.setMinimumWidth(100) - self.freq_edit.setMaximumWidth(100) - self.freq_edit.setText(QtCore.QString("%1").arg(freq)) - self.left_col_form.addRow("Frequency:", self.freq_edit) - self.connect(self.freq_edit, QtCore.SIGNAL("returnPressed()"), - self.update_samp_rate) - - self.resize(1000, 500) - - def add_line_control(self, layout): - self._line_tabs = QtGui.QTabWidget() - - self._line_pages = [] - self._line_forms = [] - self._label_edit = [] - self._size_edit = [] - self._color_edit = [] - self._style_edit = [] - self._marker_edit = [] - self._alpha_edit = [] - for n in range(self.top_block._nsigs): - self._line_pages.append(QtGui.QDialog()) - self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1])) - - label = self.top_block.gui_snk.line_label(n) - self._label_edit.append(QtGui.QLineEdit(self)) - self._label_edit[-1].setMinimumWidth(125) - self._label_edit[-1].setMaximumWidth(125) - self._label_edit[-1].setText(QtCore.QString("%1").arg(label)) - self._line_forms[-1].addRow("Label:", self._label_edit[-1]) - self.connect(self._label_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_label) - - width_val = QtGui.QIntValidator(1, 20, self) - self._size_edit.append(QtGui.QLineEdit(self)) - self._size_edit[-1].setValidator(width_val) - self._size_edit[-1].setMinimumWidth(100) - self._size_edit[-1].setMaximumWidth(100) - self._size_edit[-1].setText(QtCore.QString("%1").arg(1)) - self._line_forms[-1].addRow("Width:", self._size_edit[-1]) - self.connect(self._size_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_size) - - color = self.top_block.gui_snk.line_color(n) - self._color_edit.append(QtGui.QLineEdit(self)) - self._color_edit[-1].setMinimumWidth(100) - self._color_edit[-1].setMaximumWidth(100) - self._color_edit[-1].setText(QtCore.QString("%1").arg(color)) - self._line_forms[-1].addRow("Color:", self._color_edit[-1]) - self.connect(self._color_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_color) - - self._qtstyles = {"None": QtCore.Qt.NoPen, - "Solid": QtCore.Qt.SolidLine, - "Dash": QtCore.Qt.DashLine, - "Dot": QtCore.Qt.DotLine, - "DashDot": QtCore.Qt.DashDotLine, - "DashDotDot": QtCore.Qt.DashDotDotLine} - self._style_edit.append(QtGui.QComboBox(self)) - self._style_edit[-1].addItems(["None", "Solid", "Dash", - "Dot", "DashDot", "DashDotDot"]) - self._style_edit[-1].setCurrentIndex(1) - self._line_forms[-1].addRow("Style:", self._style_edit[-1]) - self.connect(self._style_edit[-1], - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_line_style) - - # A bit dangerous, this. If QWT ever changes the lineup, - # we will have to adjust this, too. But we also can't - # really rely on PyQwt right now. - self._qwtmarkers = {"None": -1, - "Circle": 0, - "Rectangle": 1, - "Diamond": 2, - "Triangle": 3, - "Down Triangle": 4, - "Left Triangle": 6, - "Right Triangle": 7, - "Cross": 8, - "X-Cross": 9, - "Horiz. Line": 10, - "Vert. Line": 11, - "Star 1": 12, - "Star 2": 13, - "Hexagon": 14} - self._marker_edit.append(QtGui.QComboBox(self)) - self._marker_edit[-1].addItems(["None", "Circle", "Rectangle", "Diamond", - "Triangle", "Down Triangle", "Left Triangle", - "Right Triangle", "Cross", "X-Cross", - "Horiz. Line", "Vert. Line", "Star 1", - "Star 2", "Hexagon"]) - self._line_forms[-1].addRow("Marker:", self._marker_edit[-1]) - self.connect(self._marker_edit[-1], - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_line_marker) - - alpha_val = QtGui.QDoubleValidator(0, 1.0, 2, self) - alpha_val.setTop(1.0) - alpha = self.top_block.gui_snk.line_alpha(n) - self._alpha_edit.append(QtGui.QLineEdit(self)) - self._alpha_edit[-1].setMinimumWidth(50) - self._alpha_edit[-1].setMaximumWidth(100) - self._alpha_edit[-1].setText(QtCore.QString("%1").arg(alpha)) - self._alpha_edit[-1].setValidator(alpha_val) - self._line_forms[-1].addRow("Alpha:", self._alpha_edit[-1]) - self.connect(self._alpha_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_alpha) - - self._line_tabs.addTab(self._line_pages[-1], "{0}".format(label)) - - layout.addWidget(self._line_tabs) - - def update_line_label(self): - index = self._line_tabs.currentIndex() - label = self._label_edit[index].text() - self._line_tabs.setTabText(index, label) - self.top_block.gui_snk.set_line_label(index, str(label)) - - def update_line_size(self): - index = self._line_tabs.currentIndex() - width = self._size_edit[index].text().toUInt()[0] - self.top_block.gui_snk.set_line_width(index, width) - self.update_line_alpha() - - def update_line_color(self): - index = self._line_tabs.currentIndex() - color = str(self._color_edit[index].text()) - self.top_block.gui_snk.set_line_color(index, color) - self.update_line_alpha() - - def update_line_style(self, s_index): - index = self._line_tabs.currentIndex() - style_str = self._style_edit[index].itemText(s_index) - style = self._qtstyles[str(style_str)] - self.top_block.gui_snk.set_line_style(index, int(style)) - - def update_line_marker(self, m_index): - index = self._line_tabs.currentIndex() - marker_str = self._marker_edit[index].itemText(m_index) - marker = self._qwtmarkers[str(marker_str)] - self.top_block.gui_snk.set_line_marker(index, int(marker)) - - def update_line_alpha(self): - index = self._line_tabs.currentIndex() - alpha = self._alpha_edit[index].text().toDouble()[0] - self.top_block.gui_snk.set_line_alpha(index, alpha) - - def update_xaxis_pos(self): - newstart = self.start_edit.text().toUInt()[0] - newend = self.end_edit.text().toUInt()[0] - if(newstart != self._start or newend != self._end): - if(newend < newstart): - QtGui.QMessageBox.information( - self, "Warning", - "End sample is less than start sample.", - QtGui.QMessageBox.Ok); - else: - newnsamps = newend - newstart - self.top_block.reset(newstart, newnsamps) - self._start = newstart - self._end = newend - self.posbar.setPageStep(self.top_block._nsamps) - self.posbar.setValue(self._start) - - def update_xaxis_slider(self, value): - self._start = value - self._end = value + self.posbar.pageStep() - - self.start_edit.setText("{0}".format(self._start)) - self.end_edit.setText("{0}".format(self._end)) - - if(value != self.top_block._max_nsamps): - self.top_block.reset(self._start, self.posbar.pageStep()) - - def update_yaxis_pos(self): - if(not self.top_block._auto_scale): - newmin = self.y_min_edit.text().toDouble()[0] - newmax = self.y_max_edit.text().toDouble()[0] - if(newmin != self._y_min or newmax != self._y_max): - self._y_min = newmin - self._y_max = newmax - self.top_block._y_range = newmax - newmin - self.top_block.set_y_axis(self._y_min, self._y_max) - self.ybar.setValue(self._y_max*self._pos_scale) - else: - self.y_min_edit.setText("{0:.2f}".format(self._y_min)) - self.y_max_edit.setText("{0:.2f}".format(self._y_max)) - - def update_yaxis_slider(self, value): - if(not self.top_block._auto_scale): - value = value / self._pos_scale - self.top_block._y_value = value - self._y_min = value - self.top_block._y_range - self._y_max = value - - ret = self.top_block.set_y_axis(self._y_min, self._y_max) - if(ret): - self._y_min = ret[0] - self._y_max = ret[1] - - self.gui_y_axis(self._y_min, self._y_max) - else: - self.ybar.setValue(self._y_max*self._pos_scale) - - def update_samp_rate(self): - sr = self.samp_rate_edit.text().toDouble()[0] - fr = self.freq_edit.text().toDouble()[0] - self.top_block.gui_snk.set_frequency_range(fr, sr) - self.top_block._samp_rate = sr - self.top_block.reset(self.top_block._start, - self.top_block._nsamps) - - def gui_y_axis(self, ymin, ymax): - self.y_min_edit.setText("{0:.2f}".format(ymin)) - self.y_max_edit.setText("{0:.2f}".format(ymax)) - self._y_min = ymin - self._y_max = ymax - self.ybar.setValue(self._pos_scale*ymax) - - def set_grid_check(self, state): - if(state): - self.top_block.gui_snk.enable_grid(True) - else: - self.top_block.gui_snk.enable_grid(False) - - def save_figure(self): - qpix = QtGui.QPixmap.grabWidget(self.top_block.pyWin) - types = "JPEG file (*.jpg);;" + \ - "Portable Network Graphics file (*.png);;" + \ - "Bitmap file (*.bmp);;" + \ - "TIFF file (*.tiff)" - filebox = QtGui.QFileDialog(self, "Save Image", "./", types) - filebox.setViewMode(QtGui.QFileDialog.Detail) - if(filebox.exec_()): - filename = filebox.selectedFiles()[0] - filetype = filebox.selectedNameFilter() - else: - return - - if(filetype.contains(".jpg")): - qpix.save(filename, "JPEG"); - elif(filetype.contains(".png")): - qpix.save(filename, "PNG"); - elif(filetype.contains(".bmp")): - qpix.save(filename, "BMP"); - elif(filetype.contains(".tiff")): - qpix.save(filename, "TIFF"); - else: - qpix.save(filename, "JPEG"); diff --git a/gr-qtgui/apps/plot_psd_base.py b/gr-qtgui/apps/plot_psd_base.py deleted file mode 100644 index f174d796df..0000000000 --- a/gr-qtgui/apps/plot_psd_base.py +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import unicode_literals - -from gnuradio import gr, blocks -from gnuradio.eng_arg import eng_float, intx -from argparse import ArgumentParser -import os, sys - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4 and gr-qtgui.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_form import * - from gnuradio.qtgui.plot_base import * -except ImportError: - from plot_form import * - from plot_base import * - -class plot_base(gr.top_block): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - gr.top_block.__init__(self) - - self._filelist = filelist - self._center_freq = fc - self._samp_rate = samp_rate - self._psd_size = psdsize - self._start = start - self._max_nsamps = max_nsamples - self._nsigs = len(self._filelist) - self._avg = avg - self._nsamps = nsamples - self._auto_scale = False - - self._y_min = -200 - self._y_max = 400 - self._y_range = 130 - self._y_value = 10 - - self._is_setup = False - - self.qapp = QtGui.QApplication(sys.argv) - - def setup(self): - self.skip = blocks.skiphead(self.dsize, self._start) - - n = 0 - self.srcs = list() - self._data_min = sys.maxsize - self._data_max = -sys.maxsize - 1 - for f in self._filelist: - data,_min,_max = self.read_samples(f, self._start, - self._nsamps, self._psd_size) - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - self.srcs.append(self.src_type(data)) - - # Set default labels based on file names - fname = f.split("/")[-1] - self.gui_snk.set_line_label(n, "{0}".format(fname)) - n += 1 - - self.connect(self.srcs[0], self.skip) - self.connect(self.skip, (self.gui_snk, 0)) - - for i,s in enumerate(self.srcs[1:]): - self.connect(s, (self.gui_snk, i+1)) - - self.gui_snk.set_update_time(0) - self.gui_snk.enable_menu(False) - - # Get Python Qt references - pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - - self._is_setup = True - - def is_setup(self): - return self._is_setup - - def set_y_axis(self, y_min, y_max): - self.gui_snk.set_y_axis(y_min, y_max) - return y_min, y_max - - def get_gui(self): - if(self.is_setup()): - return self.pyWin - else: - return None - - def reset(self, newstart, newnsamps): - self.stop() - self.wait() - - self._start = newstart - - self._data_min = sys.maxsize - self._data_max = -sys.maxsize - 1 - for s,f in zip(self.srcs, self._filelist): - data,_min,_max = self.read_samples(f, self._start, newnsamps, self._psd_size) - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - s.set_data(data) - - self.start() - -def setup_options(desc): - parser = ArgumentParser(description=desc, conflict_handler="resolve") - parser.add_argument("-N", "--nsamples", type=int, default=1000000, - help="Set the number of samples to display [default=prints entire file]") - parser.add_argument("-S", "--start", type=int, default=0, - help="Starting sample number [default=%(default)r]") - parser.add_argument("-L", "--psd-size", type=int, default=2048, - help="Set the FFT size of the PSD [default=%(default)r]") - parser.add_argument("-f", "--center-frequency", type=eng_float, default=0.0, - help="Set the center frequency of the signal [default=%(default)r]") - parser.add_argument("-r", "--sample-rate", type=eng_float, default=1.0, - help="Set the sample rate of the signal [default=%(default)r]") - parser.add_argument("-a", "--average", type=float, default=1.0, - help="Set amount of averaging (smaller=more averaging) [default=%(default)r]") - parser.add_argument("files", nargs='+', metavar='FILE', - help="Complex samples") - args = parser.parse_args() - - return args diff --git a/gr-qtgui/apps/plot_psd_form.py b/gr-qtgui/apps/plot_psd_form.py deleted file mode 100644 index 93166f4faf..0000000000 --- a/gr-qtgui/apps/plot_psd_form.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import unicode_literals - -import sys -from gnuradio import filter - -try: - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_from import plot_form -except ImportError: - from plot_form import plot_form - -class plot_psd_form(plot_form): - def __init__(self, top_block, title=''): - plot_form.__init__(self, top_block, title) - - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() - self.right_col_layout.addLayout(self.right_col_form) - self.layout.addLayout(self.right_col_layout, 1,4,1,1) - - self.psd_size_val = QtGui.QIntValidator(0, 2**18, self) - self.psd_size_edit = QtGui.QLineEdit(self) - self.psd_size_edit.setMinimumWidth(50) - self.psd_size_edit.setMaximumWidth(100) - self.psd_size_edit.setText(QtCore.QString("%1").arg(top_block._psd_size)) - self.psd_size_edit.setValidator(self.psd_size_val) - self.right_col_form.addRow("FFT:", self.psd_size_edit) - self.connect(self.psd_size_edit, QtCore.SIGNAL("returnPressed()"), - self.update_psd_size) - - self.psd_win_combo = QtGui.QComboBox(self) - self.psd_win_combo.addItems(["None", "Hamming", "Hann", "Blackman", - "Rectangular", "Kaiser", "Blackman-harris"]) - self.psd_win_combo.setCurrentIndex(self.top_block.gui_snk.fft_window()+1) - self.right_col_form.addRow("Window:", self.psd_win_combo) - self.connect(self.psd_win_combo, - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_psd_win) - - self.psd_avg_val = QtGui.QDoubleValidator(0, 1.0, 4, self) - self.psd_avg_edit = QtGui.QLineEdit(self) - self.psd_avg_edit.setMinimumWidth(50) - self.psd_avg_edit.setMaximumWidth(100) - self.psd_avg_edit.setText(QtCore.QString("%1").arg(top_block._avg)) - self.psd_avg_edit.setValidator(self.psd_avg_val) - self.right_col_form.addRow("Average:", self.psd_avg_edit) - self.connect(self.psd_avg_edit, QtCore.SIGNAL("returnPressed()"), - self.update_psd_avg) - - self.add_line_control(self.right_col_layout) - - def update_psd_size(self): - newpsdsize = self.psd_size_edit.text().toInt()[0] - if(newpsdsize != self.top_block._psd_size): - self.top_block.gui_snk.set_fft_size(newpsdsize) - self.top_block._psd_size = newpsdsize - self.top_block.reset(self.top_block._start, - self.top_block._nsamps) - - def update_psd_win(self, index): - self.top_block.gui_snk.set_fft_window(index-1) - self.top_block.reset(self.top_block._start, - self.top_block._nsamps) - - def update_psd_avg(self): - newpsdavg = self.psd_avg_edit.text().toDouble()[0] - if(newpsdavg != self.top_block._avg): - self.top_block.gui_snk.set_fft_average(newpsdavg) - self.top_block._avg = newpsdavg - self.top_block.reset(self.top_block._start, - self.top_block._nsamps) - diff --git a/gr-qtgui/apps/plot_spectrogram_base.py b/gr-qtgui/apps/plot_spectrogram_base.py deleted file mode 100644 index 0ebd385e70..0000000000 --- a/gr-qtgui/apps/plot_spectrogram_base.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import division -from __future__ import unicode_literals - -from gnuradio import gr, blocks -from gnuradio.eng_arg import eng_float, intx -from argparse import ArgumentParser -import os, sys - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4 and gr-qtgui.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_form import * - from gnuradio.qtgui.plot_base import * -except ImportError: - from plot_form import * - from plot_base import * - -class plot_base(gr.top_block): - def __init__(self, filelist, fc, samp_rate, psdsize, start, - nsamples, max_nsamples, avg=1.0): - gr.top_block.__init__(self) - - self._filelist = filelist - self._center_freq = fc - self._samp_rate = samp_rate - self._psd_size = psdsize - self._start = start - self._max_nsamps = max_nsamples - self._nsigs = len(self._filelist) - self._avg = avg - self._nsamps = nsamples - self._auto_scale = False - - self._y_min = -200 - self._y_max = 400 - self._y_range = 130 - self._y_value = 10 - - self._is_setup = False - - self.qapp = QtGui.QApplication(sys.argv) - - def setup(self): - self.skip = blocks.skiphead(self.dsize, self._start) - - n = 0 - self.srcs = list() - self._data_min = sys.maxsize - self._data_max = -sys.maxsize - 1 - for f in self._filelist: - data,_min,_max = self.read_samples(f, self._start, - self._nsamps, self._psd_size) - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - self.srcs.append(self.src_type(data)) - - # Set default labels based on file names - fname = f.split("/")[-1] - self.gui_snk.set_line_label(n, "{0}".format(fname)) - n += 1 - - self.connect(self.srcs[0], self.skip) - self.connect(self.skip, (self.gui_snk, 0)) - - for i,s in enumerate(self.srcs[1:]): - self.connect(s, (self.gui_snk, i+1)) - - self.gui_snk.set_update_time(0); - self.gui_snk.set_time_per_fft(self._psd_size / self._samp_rate) - self.gui_snk.enable_menu(False) - self.gui_snk.set_fft_average(self._avg) - - # Get Python Qt references - pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - - self._is_setup = True - - def is_setup(self): - return self._is_setup - - def set_y_axis(self, y_min, y_max): - self.gui_snk.set_intensity_range(y_min, y_max) - return y_min, y_max - - def get_gui(self): - if(self.is_setup()): - return self.pyWin - else: - return None - - def reset(self, newstart, newnsamps): - self.stop() - self.wait() - self.gui_snk.clear_data() - self.gui_snk.set_time_per_fft(self._psd_size / self._samp_rate) - - self._start = newstart - self._nsamps = newnsamps - - self._data_min = sys.maxsize - self._data_max = -sys.maxsize - 1 - for s,f in zip(self.srcs, self._filelist): - data,_min,_max = self.read_samples(f, self._start, newnsamps, self._psd_size) - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - s.set_data(data) - - self.start() - -def setup_options(desc): - parser = ArgumentParser(description=desc, conflict_handler="resolve") - parser.add_argument("-N", "--nsamples", type=int, default=1000000, - help="Set the number of samples to display [default=%(default)r]") - parser.add_argument("-S", "--start", type=int, default=0, - help="Starting sample number [default=%(default)r]") - parser.add_argument("-L", "--psd-size", type=int, default=2048, - help="Set the FFT size of the PSD [default=%(default)r]") - parser.add_argument("-f", "--center-frequency", type=eng_float, default=0.0, - help="Set the center frequency of the signal [default=%(default)r]") - parser.add_argument("-r", "--sample-rate", type=eng_float, default=1.0, - help="Set the sample rate of the signal [default=%(default)r]") - parser.add_argument("-a", "--average", type=float, default=1.0, - help="Set amount of averaging (smaller=more averaging) [default=%(default)r]") - parser.add_argument('files', nargs='+', metavar='FILE', - help="File with complex samples") - args = parser.parse_args() - - return args - diff --git a/gr-qtgui/apps/plot_spectrogram_form.py b/gr-qtgui/apps/plot_spectrogram_form.py deleted file mode 100644 index 6d1b17de67..0000000000 --- a/gr-qtgui/apps/plot_spectrogram_form.py +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import unicode_literals - -import sys -from gnuradio import filter - -try: - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_from import plot_form -except ImportError: - from plot_form import plot_form - -class plot_spectrogram_form(plot_form): - def __init__(self, top_block, title=''): - plot_form.__init__(self, top_block, title) - - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() - self.right_col_layout.addLayout(self.right_col_form) - self.layout.addLayout(self.right_col_layout, 1,4,1,1) - - self.psd_size_val = QtGui.QIntValidator(0, 2**18, self) - self.psd_size_edit = QtGui.QLineEdit(self) - self.psd_size_edit.setMinimumWidth(50) - self.psd_size_edit.setMaximumWidth(100) - self.psd_size_edit.setText(QtCore.QString("%1").arg(top_block._psd_size)) - self.psd_size_edit.setValidator(self.psd_size_val) - self.right_col_form.addRow("FFT Size:", self.psd_size_edit) - self.connect(self.psd_size_edit, QtCore.SIGNAL("returnPressed()"), - self.update_psd_size) - - self.psd_win_combo = QtGui.QComboBox(self) - self.psd_win_combo.addItems(["None", "Hamming", "Hann", "Blackman", - "Rectangular", "Kaiser", "Blackman-harris"]) - self.psd_win_combo.setCurrentIndex(self.top_block.gui_snk.fft_window()+1) - self.right_col_form.addRow("Window:", self.psd_win_combo) - self.connect(self.psd_win_combo, - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_psd_win) - - self.psd_avg_val = QtGui.QDoubleValidator(0, 1.0, 4, self) - self.psd_avg_edit = QtGui.QLineEdit(self) - self.psd_avg_edit.setMinimumWidth(50) - self.psd_avg_edit.setMaximumWidth(100) - self.psd_avg_edit.setText(QtCore.QString("%1").arg(top_block._avg)) - self.psd_avg_edit.setValidator(self.psd_avg_val) - self.right_col_form.addRow("Average:", self.psd_avg_edit) - self.connect(self.psd_avg_edit, QtCore.SIGNAL("returnPressed()"), - self.update_psd_avg) - - self.autoscale_button = QtGui.QPushButton("Auto Scale", self) - self.autoscale_button.setMaximumWidth(100) - self.right_col_layout.addWidget(self.autoscale_button) - self.connect(self.autoscale_button, QtCore.SIGNAL("clicked()"), - self.spectrogram_auto_scale) - - self.add_spectrogram_control(self.right_col_layout) - - def update_psd_size(self): - newpsdsize = self.psd_size_edit.text().toInt()[0] - if(newpsdsize != self.top_block._psd_size): - self.top_block.gui_snk.set_fft_size(newpsdsize) - self.top_block._psd_size = newpsdsize - self.top_block.reset(self.top_block._start, - self.top_block._nsamps) - - def update_psd_win(self, index): - self.top_block.gui_snk.set_fft_window(index-1) - self.top_block.reset(self.top_block._start, - self.top_block._nsamps) - - def update_psd_avg(self): - newpsdavg = self.psd_avg_edit.text().toDouble()[0] - if(newpsdavg != self.top_block._avg): - self.top_block.gui_snk.set_fft_average(newpsdavg) - self.top_block._avg = newpsdavg - self.top_block.reset(self.top_block._start, - self.top_block._nsamps) - - def add_spectrogram_control(self, layout): - self._line_tabs = QtGui.QTabWidget() - - self._line_pages = [] - self._line_forms = [] - self._label_edit = [] - self._size_edit = [] - self._color_edit = [] - self._style_edit = [] - self._marker_edit = [] - self._alpha_edit = [] - for n in range(self.top_block._nsigs): - self._line_pages.append(QtGui.QDialog()) - self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1])) - - label = self.top_block.gui_snk.line_label(n) - self._label_edit.append(QtGui.QLineEdit(self)) - self._label_edit[-1].setMinimumWidth(125) - self._label_edit[-1].setMaximumWidth(125) - self._label_edit[-1].setText(QtCore.QString("%1").arg(label)) - self._line_forms[-1].addRow("Label:", self._label_edit[-1]) - self.connect(self._label_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_label) - - self._qtcolormaps = ["Multi Color", "White Hot", - "Black Hot", "Incandescent"] - self._color_edit.append(QtGui.QComboBox(self)) - self._color_edit[-1].addItems(self._qtcolormaps) - self._line_forms[-1].addRow("Color Map:", self._color_edit[-1]) - self.connect(self._color_edit[-1], - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_color_map) - - alpha_val = QtGui.QDoubleValidator(0, 1.0, 2, self) - alpha_val.setTop(1.0) - alpha = self.top_block.gui_snk.line_alpha(n) - self._alpha_edit.append(QtGui.QLineEdit(self)) - self._alpha_edit[-1].setMinimumWidth(50) - self._alpha_edit[-1].setMaximumWidth(100) - self._alpha_edit[-1].setText(QtCore.QString("%1").arg(alpha)) - self._alpha_edit[-1].setValidator(alpha_val) - self._line_forms[-1].addRow("Alpha:", self._alpha_edit[-1]) - self.connect(self._alpha_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_alpha) - - self._line_tabs.addTab(self._line_pages[-1], "{0}".format(label)) - - layout.addWidget(self._line_tabs) - - def update_color_map(self, c_index): - index = self._line_tabs.currentIndex() - self.top_block.gui_snk.set_color_map(index, c_index) - self.update_line_alpha() - - def spectrogram_auto_scale(self): - self.top_block.gui_snk.auto_scale() - _min = self.top_block.gui_snk.min_intensity(0) - _max = self.top_block.gui_snk.max_intensity(0) - if(self.gui_y_axis): - self.gui_y_axis(_min, _max) diff --git a/gr-qtgui/apps/plot_time_base.py b/gr-qtgui/apps/plot_time_base.py deleted file mode 100644 index efce0950a0..0000000000 --- a/gr-qtgui/apps/plot_time_base.py +++ /dev/null @@ -1,180 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import unicode_literals - -from gnuradio import gr, blocks -from gnuradio.eng_arg import eng_float, intx -from argparse import ArgumentParser -import os, sys - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4 and gr-qtgui.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_form import * - from gnuradio.qtgui.plot_base import * -except ImportError: - from plot_form import * - from plot_base import * - -class plot_base(gr.top_block): - def __init__(self, filelist, samp_rate, start, - nsamples, max_nsamples, - auto_scale): - gr.top_block.__init__(self) - - self._filelist = filelist - self._samp_rate = samp_rate - self._center_freq = 0 - self._start = start - self._max_nsamps = max_nsamples - self._nsigs = len(self._filelist) - self._auto_scale = auto_scale - self._nsamps = nsamples - self._is_setup = False - - self._y_min = -20 - self._y_max = 20 - self._y_range = 2 - self._y_value = 1 - self.gui_y_axis = None - - self.qapp = QtGui.QApplication(sys.argv) - - def setup(self): - self.skip = blocks.skiphead(self.dsize, self._start) - - n = 0 - self.srcs = list() - self._data_min = sys.maxsize - self._data_max = -sys.maxsize - 1 - for f in self._filelist: - data,_min,_max = self.read_samples(f, self._start, self._nsamps) - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - self.srcs.append(self.src_type(data)) - - # Set default labels based on file names - fname = f.split("/")[-1] - if(type(self.gui_snk) == qtgui.time_sink_c_sptr): - self.gui_snk.set_line_label(n, "Re{{{0}}}".format(fname)) - self.gui_snk.set_line_label(n+1, "Im{{{0}}}".format(fname)) - n += 2 - else: - self.gui_snk.set_line_label(n, "{0}".format(fname)) - n += 1 - - self.connect(self.srcs[0], self.skip) - self.connect(self.skip, (self.gui_snk, 0)) - - for i,s in enumerate(self.srcs[1:]): - self.connect(s, (self.gui_snk, i+1)) - - self.gui_snk.set_update_time(0) - self.gui_snk.enable_menu(False) - self.auto_scale(self._auto_scale) - - # Get Python Qt references - pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - - self._is_setup = True - - def is_setup(self): - return self._is_setup - - def set_y_axis(self, y_min, y_max): - self.gui_snk.set_y_axis(y_min, y_max) - return y_min, y_max - - def get_gui(self): - if(self.is_setup()): - return self.pyWin - else: - return None - - def reset(self, newstart, newnsamps): - self.stop() - self.wait() - - self._start = newstart - - self._data_min = sys.maxsize - self._data_max = -sys.maxsize - 1 - for s,f in zip(self.srcs, self._filelist): - data,_min,_max = self.read_samples(f, self._start, newnsamps) - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - s.set_data(data) - if(len(data) < newnsamps): - newnsamps = len(data) - - self.auto_scale(self._auto_scale) - - self._nsamps = newnsamps - self.gui_snk.set_nsamps(self._nsamps) - - self.start() - - def auto_scale(self, state): - if(state > 0): - self.gui_snk.set_y_axis(self._data_min, self._data_max) - self._auto_scale = True - self._y_value = self._data_max - self._y_range = self._data_max - self._data_min - self._y_min = 10*self._data_min - self._y_max = 10*self._data_max - - if(self.gui_y_axis): - self.gui_y_axis(self._data_min, self._data_max) - else: - self._auto_scale = False - -def setup_options(desc): - parser = ArgumentParser(description=desc, conflict_handler="resolve") - parser.add_argument("-N", "--nsamples", type=int, default=1000000, - help="Set the number of samples to display [default=%(default)r]") - parser.add_argument("-S", "--start", type=int, default=0, - help="Starting sample number [default=%(default)r]") - parser.add_argument("-r", "--sample-rate", type=eng_float, default=1.0, - help="Set the sample rate of the signal [default=%(default)r]") - parser.add_argument("--no-auto-scale", action="store_true", - help="Do not auto-scale the plot [default=%(default)r]") - parser.add_argument("files", nargs='+', metavar="FILE", - help="File with complex samples") - args = parser.parse_args() - - return args - diff --git a/gr-qtgui/apps/plot_time_form.py b/gr-qtgui/apps/plot_time_form.py deleted file mode 100644 index 0a16aa6241..0000000000 --- a/gr-qtgui/apps/plot_time_form.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import unicode_literals - -import sys -from gnuradio import filter - -try: - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_from import plot_form -except ImportError: - from plot_form import plot_form - -class plot_time_form(plot_form): - def __init__(self, top_block, title='', scale=1): - plot_form.__init__(self, top_block, title, scale) - - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() - self.right_col_layout.addLayout(self.right_col_form) - self.layout.addLayout(self.right_col_layout, 1,4,1,1) - - self.auto_scale = QtGui.QCheckBox("Auto Scale", self) - if(self.top_block._auto_scale): - self.auto_scale.setChecked(self.top_block._auto_scale) - self.connect(self.auto_scale, QtCore.SIGNAL("stateChanged(int)"), - self.set_auto_scale) - self.right_col_layout.addWidget(self.auto_scale) - - self.stem = QtGui.QCheckBox("Stem", self) - self.connect(self.stem, QtCore.SIGNAL("stateChanged(int)"), - self.enable_stem) - self.right_col_layout.addWidget(self.stem) - - self.add_line_control(self.right_col_layout) - - def set_auto_scale(self, state): - if(state): - self.top_block.auto_scale(True) - else: - self.top_block.auto_scale(False) - - def enable_stem(self, state): - self.top_block.gui_snk.enable_stem_plot(state) - if(state): - index = self._qwtmarkers['Circle']+1 - else: - index = self._qwtmarkers['None']+1 - for n in range(self.top_block._nsigs): - self._marker_edit[n].setCurrentIndex(index) - - def update_samp_rate(self): - sr = self.samp_rate_edit.text().toDouble()[0] - self.top_block.gui_snk.set_samp_rate(sr) - diff --git a/gr-qtgui/apps/plot_time_raster_base.py b/gr-qtgui/apps/plot_time_raster_base.py deleted file mode 100644 index 9ce859ae95..0000000000 --- a/gr-qtgui/apps/plot_time_raster_base.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import unicode_literals - -from gnuradio import gr, blocks -from gnuradio.eng_arg import eng_float, intx -from argparse import ArgumentParser -import os, sys - -try: - from gnuradio import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4 and gr-qtgui.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_form import * - from gnuradio.qtgui.plot_base import * -except ImportError: - from plot_form import * - from plot_base import * - -class plot_base(gr.top_block): - def __init__(self, filelist, samp_rate, start, - nsamples, max_nsamples, - auto_scale): - gr.top_block.__init__(self) - - self._filelist = filelist - self._samp_rate = samp_rate - self._center_freq = 0 - self._start = start - self._max_nsamps = max_nsamples - self._nsigs = len(self._filelist) - self._auto_scale = auto_scale - self._nsamps = nsamples - self._is_setup = False - - self._y_min = -20 - self._y_max = 20 - self._y_range = 2 - self._y_value = 1 - self.gui_y_axis = None - - self.qapp = QtGui.QApplication(sys.argv) - - def setup(self): - self.skip = blocks.skiphead(self.dsize, self._start) - - n = 0 - self.srcs = list() - self._data_min = sys.maxsize - self._data_max = -sys.maxsize - 1 - for f in self._filelist: - data,_min,_max = self.read_samples(f, self._start, self._nsamps) - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - self.srcs.append(self.src_type(data)) - - # Set default labels based on file names - fname = f.split("/")[-1] - #self.gui_snk.set_line_label(n, "{0}".format(fname)) - n += 1 - - self.connect(self.srcs[0], self.skip) - self.connect(self.skip, (self.gui_snk, 0)) - - for i,s in enumerate(self.srcs[1:]): - self.connect(s, (self.gui_snk, i+1)) - - self.gui_snk.set_update_time(0) - self.gui_snk.enable_menu(False) - self.auto_scale(self._auto_scale) - - # Get Python Qt references - pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - - self._is_setup = True - - def is_setup(self): - return self._is_setup - - def set_y_axis(self, y_min, y_max): - if(not self._auto_scale): - self.gui_snk.set_intensity_range(y_min, y_max) - return y_min, y_max - else: - return None - - def get_gui(self): - if(self.is_setup()): - return self.pyWin - else: - return None - - def reset(self, newstart, newnsamps): - self.stop() - self.wait() - - self._start = newstart - - self._data_min = sys.maxsize - self._data_max = -sys.maxsize - 1 - for s,f in zip(self.srcs, self._filelist): - data,_min,_max = self.read_samples(f, self._start, newnsamps) - if(_min < self._data_min): - self._data_min = _min - if(_max > self._data_max): - self._data_max = _max - - s.set_data(data) - if(len(data) < newnsamps): - newnsamps = len(data) - - self.auto_scale(self._auto_scale) - self._nsamps = newnsamps - self.start() - - def auto_scale(self, state): - if(state > 0): - self.gui_snk.set_intensity_range(self._data_min, self._data_max) - self._auto_scale = True - self._y_value = self._data_max - self._y_range = self._data_max - self._data_min - self._y_min = 10*self._data_min - self._y_max = 10*self._data_max - - if(self.gui_y_axis): - self.gui_y_axis(self._data_min, self._data_max) - else: - self._auto_scale = False - -def setup_options(desc): - parser = ArgumentParser(description=desc, conflict_handler="resolve") - parser.add_argument("-N", "--nsamples", type=int, default=1000000, - help="Set the number of samples to display [default=%(default)r]") - parser.add_argument("-S", "--start", type=int, default=0, - help="Starting sample number [default=%(default)r]") - parser.add_argument("-C", "--ncols", type=int, default=100, - help="Number of columns [default=%(default)r]") - parser.add_argument("-R", "--nrows", type=int, default=100, - help="Number of rows [default=%(default)r]") - parser.add_argument("-r", "--sample-rate", type=eng_float, default=1.0, - help="Set the sample rate of the signal [default=%(default)r]") - parser.add_argument("--no-auto-scale", action="store_true", - help="Do not auto-scale the plot [default=%(default)r]") - parser.add_argument("files", nargs="+", metavar="FILE", - help="Input files with complex samples") - args = parser.parse_args() - - return args - diff --git a/gr-qtgui/apps/plot_time_raster_form.py b/gr-qtgui/apps/plot_time_raster_form.py deleted file mode 100644 index fd27d9574d..0000000000 --- a/gr-qtgui/apps/plot_time_raster_form.py +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 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 __future__ import print_function -from __future__ import unicode_literals - -import sys, math -from gnuradio import filter - -try: - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print("Error: Program requires PyQt4.") - sys.exit(1) - -try: - from gnuradio.qtgui.plot_from import plot_form -except ImportError: - from plot_form import plot_form - -class plot_time_raster_form(plot_form): - def __init__(self, top_block, title='', scale=1): - plot_form.__init__(self, top_block, title, scale) - - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() - self.right_col_layout.addLayout(self.right_col_form) - self.layout.addLayout(self.right_col_layout, 1,4,1,1) - - self.auto_scale = QtGui.QCheckBox("Auto Scale", self) - if(self.top_block._auto_scale): - self.auto_scale.setChecked(self.top_block._auto_scale) - self.connect(self.auto_scale, QtCore.SIGNAL("stateChanged(int)"), - self.set_auto_scale) - self.right_col_layout.addWidget(self.auto_scale) - - self.ncols_edit = QtGui.QLineEdit(self) - self.ncols_edit.setMinimumWidth(100) - self.ncols_edit.setMaximumWidth(100) - self.ncols_edit.setText(QtCore.QString("%1").arg(top_block._ncols)) - self.right_col_form.addRow("Num. Cols.", self.ncols_edit) - self.connect(self.ncols_edit, QtCore.SIGNAL("returnPressed()"), - self.ncols_update) - - self.nrows_edit = QtGui.QLineEdit(self) - self.nrows_edit.setMinimumWidth(100) - self.nrows_edit.setMaximumWidth(100) - self.nrows_edit.setText(QtCore.QString("%1").arg(top_block._nrows)) - self.right_col_form.addRow("Num. Rows.", self.nrows_edit) - self.connect(self.nrows_edit, QtCore.SIGNAL("returnPressed()"), - self.nrows_update) - - - self.add_raster_control(self.right_col_layout) - - def add_raster_control(self, layout): - self._line_tabs = QtGui.QTabWidget() - - self._line_pages = [] - self._line_forms = [] - self._label_edit = [] - self._size_edit = [] - self._color_edit = [] - self._style_edit = [] - self._marker_edit = [] - self._alpha_edit = [] - for n in range(self.top_block._nsigs): - self._line_pages.append(QtGui.QDialog()) - self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1])) - - label = self.top_block.gui_snk.line_label(n) - self._label_edit.append(QtGui.QLineEdit(self)) - self._label_edit[-1].setMinimumWidth(125) - self._label_edit[-1].setMaximumWidth(125) - self._label_edit[-1].setText(QtCore.QString("%1").arg(label)) - self._line_forms[-1].addRow("Label:", self._label_edit[-1]) - self.connect(self._label_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_label) - - self._qtcolormaps = ["Multi Color", "White Hot", - "Black Hot", "Incandescent"] - self._color_edit.append(QtGui.QComboBox(self)) - self._color_edit[-1].addItems(self._qtcolormaps) - self._color_edit[-1].setCurrentIndex(1) - self._line_forms[-1].addRow("Color Map:", self._color_edit[-1]) - self.connect(self._color_edit[-1], - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_color_map) - - alpha_val = QtGui.QDoubleValidator(0, 1.0, 2, self) - alpha_val.setTop(1.0) - alpha = self.top_block.gui_snk.line_alpha(n) - self._alpha_edit.append(QtGui.QLineEdit(self)) - self._alpha_edit[-1].setMinimumWidth(50) - self._alpha_edit[-1].setMaximumWidth(100) - self._alpha_edit[-1].setText(QtCore.QString("%1").arg(alpha)) - self._alpha_edit[-1].setValidator(alpha_val) - self._line_forms[-1].addRow("Alpha:", self._alpha_edit[-1]) - self.connect(self._alpha_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_alpha) - - self._line_tabs.addTab(self._line_pages[-1], "{0}".format(label)) - - layout.addWidget(self._line_tabs) - - def update_color_map(self, c_index): - index = self._line_tabs.currentIndex() - self.top_block.gui_snk.set_color_map(index, c_index) - self.update_line_alpha() - - def set_auto_scale(self, state): - if(state): - self.top_block.auto_scale(True) - else: - self.top_block.auto_scale(False) - - def update_samp_rate(self): - sr = self.samp_rate_edit.text().toDouble()[0] - self.top_block.gui_snk.set_samp_rate(sr) - - nsamps = int(math.ceil((self.top_block._nrows+1)*self.top_block._ncols)) - self.top_block.reset(self._start, nsamps) - - def ncols_update(self): - n = self.ncols_edit.text().toDouble()[0] - self.top_block.gui_snk.set_num_cols(n) - self.top_block._ncols = n - - nsamps = int(math.ceil((self.top_block._nrows+1)*n)) - self.top_block.reset(self._start, nsamps) - - def nrows_update(self): - n = self.nrows_edit.text().toInt()[0] - self.top_block.gui_snk.set_num_rows(n) - self.top_block._nrows = n - - nsamps = int(math.ceil(self.top_block._ncols*(n+1))) - self.top_block.reset(self._start, nsamps) |