diff options
26 files changed, 4202 insertions, 73 deletions
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py index b1b3dfcab..e40d9636a 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py @@ -24,7 +24,7 @@ from gnuradio import gr class pfb_arb_resampler_ccf(gr.hier_block2): ''' - Convinience wrapper for the polyphase filterbank arbitrary resampler. + Convenience wrapper for the polyphase filterbank arbitrary resampler. The block takes a single complex stream in and outputs a single complex stream out. As such, it requires no extra glue to handle the input/output @@ -45,6 +45,5 @@ class pfb_arb_resampler_ccf(gr.hier_block2): self.connect(self, self.pfb) self.connect(self.pfb, self) - - - + def set_taps(self, taps): + self.pfb.set_taps(taps) diff --git a/gnuradio-core/src/python/gnuradio/optfir.py b/gnuradio-core/src/python/gnuradio/optfir.py index 06a0eea61..aee1d2a0c 100644 --- a/gnuradio-core/src/python/gnuradio/optfir.py +++ b/gnuradio-core/src/python/gnuradio/optfir.py @@ -27,7 +27,7 @@ For a great intro to how all this stuff works, see section 6.6 of and Barrie W. Jervis, Adison-Wesley, 1993. ISBN 0-201-54413-X. ''' -import math +import math, cmath from gnuradio import gr remez = gr.remez @@ -56,8 +56,10 @@ def low_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db, ## Builds a band pass filter. # @param gain Filter gain in the passband (linear) # @param Fs Sampling rate (sps) -# @param freq1 End of stop band (in Hz) -# @param freq2 Start of pass band (in Hz) +# @param freq_sb1 End of stop band (in Hz) +# @param freq_pb1 Start of pass band (in Hz) +# @param freq_pb2 End of pass band (in Hz) +# @param freq_sb2 Start of stop band (in Hz) # @param passband_ripple_db Pass band ripple in dB (should be small, < 1) # @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) # @param nextra_taps Extra taps to use in the filter (default=2) @@ -75,6 +77,60 @@ def band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2, taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass") return taps + +## Builds a band pass filter with complex taps by making an LPF and +# spinning it up to the right center frequency +# @param gain Filter gain in the passband (linear) +# @param Fs Sampling rate (sps) +# @param freq_sb1 End of stop band (in Hz) +# @param freq_pb1 Start of pass band (in Hz) +# @param freq_pb2 End of pass band (in Hz) +# @param freq_sb2 Start of stop band (in Hz) +# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) +# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) +# @param nextra_taps Extra taps to use in the filter (default=2) +def complex_band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2, + passband_ripple_db, stopband_atten_db, + nextra_taps=2): + center_freq = (freq_pb2 + freq_pb1) / 2.0 + lp_pb = (freq_pb2 - center_freq)/1.0 + lp_sb = freq_sb2 - center_freq + lptaps = low_pass(gain, Fs, lp_pb, lp_sb, passband_ripple_db, + stopband_atten_db, nextra_taps) + spinner = [cmath.exp(2j*cmath.pi*center_freq/Fs*i) for i in xrange(len(lptaps))] + taps = [s*t for s,t in zip(spinner, lptaps)] + return taps + + +## Builds a band reject filter +# spinning it up to the right center frequency +# @param gain Filter gain in the passband (linear) +# @param Fs Sampling rate (sps) +# @param freq_pb1 End of pass band (in Hz) +# @param freq_sb1 Start of stop band (in Hz) +# @param freq_sb2 End of stop band (in Hz) +# @param freq_pb2 Start of pass band (in Hz) +# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) +# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) +# @param nextra_taps Extra taps to use in the filter (default=2) +def band_reject (gain, Fs, freq_pb1, freq_sb1, freq_sb2, freq_pb2, + passband_ripple_db, stopband_atten_db, + nextra_taps=2): + passband_dev = passband_ripple_to_dev (passband_ripple_db) + stopband_dev = stopband_atten_to_dev (stopband_atten_db) + desired_ampls = (gain, 0, gain) + desired_freqs = [freq_pb1, freq_sb1, freq_sb2, freq_pb2] + desired_ripple = [passband_dev, stopband_dev, passband_dev] + (n, fo, ao, w) = remezord (desired_freqs, desired_ampls, + desired_ripple, Fs) + # Make sure we use an odd number of taps + if((n+nextra_taps)%2 == 1): + n += 1 + # The remezord typically under-estimates the filter order, so add 2 taps by default + taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass") + return taps + + ## Builds a high pass filter. # @param gain Filter gain in the passband (linear) # @param Fs Sampling rate (sps) diff --git a/gnuradio-examples/python/pfb/Makefile.am b/gnuradio-examples/python/pfb/Makefile.am index 4aa9248ea..0b91d0a2d 100644 --- a/gnuradio-examples/python/pfb/Makefile.am +++ b/gnuradio-examples/python/pfb/Makefile.am @@ -29,3 +29,6 @@ dist_ourdata_SCRIPTS = \ decimate.py \ interpolate.py \ fmtest.py + +dist_ourdata_DATA = \ + resampler_demo.grc diff --git a/gnuradio-examples/python/pfb/resampler_demo.grc b/gnuradio-examples/python/pfb/resampler_demo.grc new file mode 100644 index 000000000..468636a5c --- /dev/null +++ b/gnuradio-examples/python/pfb/resampler_demo.grc @@ -0,0 +1,598 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Sun Aug 23 11:39:47 2009</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>resampler_demo</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value></value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1280, 1024</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>import</key> + <param> + <key>id</key> + <value>import_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>import</key> + <value>import math</value> + </param> + <param> + <key>_coordinate</key> + <value>(11, 59)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>rs_taps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value> + </param> + <param> + <key>_coordinate</key> + <value>(273, 154)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_const_vxx</key> + <param> + <key>id</key> + <value>adder</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>const</key> + <value>-1.0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(227, 303)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>throttle</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(227, 493)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_fftsink2</key> + <param> + <key>id</key> + <value>orig_fft</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Original Spectrum</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>baseband_freq</key> + <value>0</value> + </param> + <param> + <key>y_per_div</key> + <value>10</value> + </param> + <param> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>30</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>30</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>False</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 3</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(409, 289)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>wxgui_fftsink2</key> + <param> + <key>id</key> + <value>resamp_fft</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Resampled Spectrum</value> + </param> + <param> + <key>samp_rate</key> + <value>new_rate</value> + </param> + <param> + <key>baseband_freq</key> + <value>0</value> + </param> + <param> + <key>y_per_div</key> + <value>10</value> + </param> + <param> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>30</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>30</value> + </param> + <param> + <key>peak_hold</key> + <value>True</value> + </param> + <param> + <key>average</key> + <value>False</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>grid_pos</key> + <value>2, 0, 1, 3</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(640, 256)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>gr_sig_source_x</key> + <param> + <key>id</key> + <value>tri_source</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>waveform</key> + <value>gr.GR_TRI_WAVE</value> + </param> + <param> + <key>freq</key> + <value>0.05</value> + </param> + <param> + <key>amp</key> + <value>2.0</value> + </param> + <param> + <key>offset</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(21, 271)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_frequency_modulator_fc</key> + <param> + <key>id</key> + <value>fm_mod</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>sensitivity</key> + <value>math.pi</value> + </param> + <param> + <key>_coordinate</key> + <value>(411, 493)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blks2_pfb_arb_resampler_ccf</key> + <param> + <key>id</key> + <value>resampler</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>rate</key> + <value>float(new_rate)/samp_rate</value> + </param> + <param> + <key>taps</key> + <value>rs_taps</value> + </param> + <param> + <key>size</key> + <value>nphases</value> + </param> + <param> + <key>_coordinate</key> + <value>(641, 477)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>nphases</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>32</value> + </param> + <param> + <key>_coordinate</key> + <value>(185, 153)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_static_text</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Sample Rate</value> + </param> + <param> + <key>value</key> + <value>44100</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>formatter</key> + <value>None</value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(179, 14)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_static_text</key> + <param> + <key>id</key> + <value>new_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Resampled Rate</value> + </param> + <param> + <key>value</key> + <value>48000</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>formatter</key> + <value>None</value> + </param> + <param> + <key>grid_pos</key> + <value>0, 1, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(328, 15)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_static_text</key> + <param> + <key>id</key> + <value>frac_bw</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Fractional Bandwidth</value> + </param> + <param> + <key>value</key> + <value>0.45</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>formatter</key> + <value>lambda x: "%0.2f"%x</value> + </param> + <param> + <key>grid_pos</key> + <value>0,2,1,1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(473, 14)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>tri_source</source_block_id> + <sink_block_id>adder</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>adder</source_block_id> + <sink_block_id>throttle</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>resampler</source_block_id> + <sink_block_id>resamp_fft</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fm_mod</source_block_id> + <sink_block_id>resampler</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>fm_mod</source_block_id> + <sink_block_id>orig_fft</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>throttle</source_block_id> + <sink_block_id>fm_mod</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-utils/src/python/Makefile.am b/gr-utils/src/python/Makefile.am index 65cbd536c..59ca215a7 100644 --- a/gr-utils/src/python/Makefile.am +++ b/gr-utils/src/python/Makefile.am @@ -23,12 +23,16 @@ include $(top_srcdir)/Makefile.common EXTRA_DIST = \ $(bin_SCRIPTS) \ - README.plot + README.plot \ + pyqt_plot.ui \ + pyqt_filter.ui ourpythondir = $(grpythondir) ourpython_PYTHON = \ - plot_data.py + plot_data.py \ + pyqt_plot.py \ + pyqt_filter.py bin_SCRIPTS = \ gr_plot_char.py \ @@ -43,6 +47,8 @@ bin_SCRIPTS = \ gr_plot_int.py \ gr_plot_iq.py \ gr_plot_short.py \ + gr_plot_qt.py \ + gr_filter_design.py \ lsusrp \ qr_fft.py \ usrp_fft.py \ @@ -57,3 +63,4 @@ bin_SCRIPTS = \ usrp2_rx_cfile.py \ usrp2_siggen.py \ usrp2_siggen_gui.py + diff --git a/gr-utils/src/python/gr_filter_design.py b/gr-utils/src/python/gr_filter_design.py new file mode 100755 index 000000000..bf83cf69f --- /dev/null +++ b/gr-utils/src/python/gr_filter_design.py @@ -0,0 +1,673 @@ +#!/usr/bin/env python + +import sys, os +from optparse import OptionParser +from gnuradio import gr, blks2, eng_notation + +try: + import scipy + from scipy import fftpack +except ImportError: + print "Please install SciPy to run this script (http://www.scipy.org/)" + raise SystemExit, 1 + +try: + from PyQt4 import Qt, QtCore, QtGui +except ImportError: + print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)" + raise SystemExit, 1 + +try: + import PyQt4.Qwt5 as Qwt +except ImportError: + print "Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)" + raise SystemExit, 1 + +try: + from pyqt_filter import Ui_MainWindow +except ImportError: + print "Could not import from pyqt_filter. Please build with \"pyuic4 pyqt_filter.ui -o pyqt_filter.py\"" + raise SystemExit, 1 + + +class gr_plot_filter(QtGui.QMainWindow): + def __init__(self, qapp, options): + QtGui.QWidget.__init__(self, None) + self.gui = Ui_MainWindow() + self.gui.setupUi(self) + + self.connect(self.gui.filterTypeComboBox, + Qt.SIGNAL("currentIndexChanged(const QString&)"), + self.changed_filter_type) + self.connect(self.gui.filterDesignTypeComboBox, + Qt.SIGNAL("currentIndexChanged(const QString&)"), + self.changed_filter_design_type) + + self.connect(self.gui.designButton, + Qt.SIGNAL("released()"), + self.design) + + self.connect(self.gui.tabGroup, + Qt.SIGNAL("currentChanged(int)"), + self.tab_changed) + + self.connect(self.gui.nfftEdit, + Qt.SIGNAL("textEdited(QString)"), + self.nfft_edit_changed) + + self.gui.designButton.setShortcut(QtCore.Qt.Key_Return) + + self.taps = [] + self.fftdB = [] + self.fftDeg = [] + self.groupDelay = [] + self.nfftpts = int(10000) + self.gui.nfftEdit.setText(Qt.QString("%1").arg(self.nfftpts)) + + self.firFilters = ("Low Pass", "Band Pass", "Complex Band Pass", "Band Notch", + "High Pass", "Root Raised Cosine", "Gaussian") + self.optFilters = ("Low Pass", "Band Pass", "Complex Band Pass", + "Band Notch", "High Pass") + + self.set_windowed() + + # Initialize to LPF + self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage) + + # Set Axis labels + self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.xBottom, + "Frequency (Hz)") + self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.yLeft, + "Magnitude (dB)") + self.gui.timePlot.setAxisTitle(self.gui.timePlot.xBottom, + "Tap number") + self.gui.timePlot.setAxisTitle(self.gui.timePlot.yLeft, + "Amplitude") + self.gui.phasePlot.setAxisTitle(self.gui.phasePlot.xBottom, + "Frequency (Hz)") + self.gui.phasePlot.setAxisTitle(self.gui.phasePlot.yLeft, + "Phase (Radians)") + self.gui.groupPlot.setAxisTitle(self.gui.groupPlot.xBottom, + "Frequency (Hz)") + self.gui.groupPlot.setAxisTitle(self.gui.groupPlot.yLeft, + "Delay (sec)") + + # Set up plot curves + self.rcurve = Qwt.QwtPlotCurve("Real") + self.rcurve.attach(self.gui.timePlot) + self.icurve = Qwt.QwtPlotCurve("Imag") + self.icurve.attach(self.gui.timePlot) + + self.freqcurve = Qwt.QwtPlotCurve("PSD") + self.freqcurve.attach(self.gui.freqPlot) + + self.phasecurve = Qwt.QwtPlotCurve("Phase") + self.phasecurve.attach(self.gui.phasePlot) + + self.groupcurve = Qwt.QwtPlotCurve("Group Delay") + self.groupcurve.attach(self.gui.groupPlot) + + # Create zoom functionality for the plots + self.timeZoomer = Qwt.QwtPlotZoomer(self.gui.timePlot.xBottom, + self.gui.timePlot.yLeft, + Qwt.QwtPicker.PointSelection, + Qwt.QwtPicker.AlwaysOn, + self.gui.timePlot.canvas()) + + self.freqZoomer = Qwt.QwtPlotZoomer(self.gui.freqPlot.xBottom, + self.gui.freqPlot.yLeft, + Qwt.QwtPicker.PointSelection, + Qwt.QwtPicker.AlwaysOn, + self.gui.freqPlot.canvas()) + + self.phaseZoomer = Qwt.QwtPlotZoomer(self.gui.phasePlot.xBottom, + self.gui.phasePlot.yLeft, + Qwt.QwtPicker.PointSelection, + Qwt.QwtPicker.AlwaysOn, + self.gui.phasePlot.canvas()) + + self.groupZoomer = Qwt.QwtPlotZoomer(self.gui.groupPlot.xBottom, + self.gui.groupPlot.yLeft, + Qwt.QwtPicker.PointSelection, + Qwt.QwtPicker.AlwaysOn, + self.gui.groupPlot.canvas()) + + # Set up pen for colors and line width + blue = QtGui.qRgb(0x00, 0x00, 0xFF) + blueBrush = Qt.QBrush(Qt.QColor(blue)) + red = QtGui.qRgb(0xFF, 0x00, 0x00) + redBrush = Qt.QBrush(Qt.QColor(red)) + self.freqcurve.setPen(Qt.QPen(blueBrush, 2)) + self.rcurve.setPen(Qt.QPen(blueBrush, 2)) + self.icurve.setPen(Qt.QPen(redBrush, 2)) + self.phasecurve.setPen(Qt.QPen(blueBrush, 2)) + self.groupcurve.setPen(Qt.QPen(blueBrush, 2)) + + # Set up validators for edit boxes + self.intVal = Qt.QIntValidator(None) + self.dblVal = Qt.QDoubleValidator(None) + self.gui.nfftEdit.setValidator(self.intVal) + self.gui.sampleRateEdit.setValidator(self.dblVal) + self.gui.filterGainEdit.setValidator(self.dblVal) + self.gui.endofLpfPassBandEdit.setValidator(self.dblVal) + self.gui.startofLpfStopBandEdit.setValidator(self.dblVal) + self.gui.lpfStopBandAttenEdit.setValidator(self.dblVal) + self.gui.lpfPassBandRippleEdit.setValidator(self.dblVal) + self.gui.startofBpfPassBandEdit.setValidator(self.dblVal) + self.gui.endofBpfPassBandEdit.setValidator(self.dblVal) + self.gui.bpfTransitionEdit.setValidator(self.dblVal) + self.gui.bpfStopBandAttenEdit.setValidator(self.dblVal) + self.gui.bpfPassBandRippleEdit.setValidator(self.dblVal) + self.gui.startofBnfStopBandEdit.setValidator(self.dblVal) + self.gui.endofBnfStopBandEdit.setValidator(self.dblVal) + self.gui.bnfTransitionEdit.setValidator(self.dblVal) + self.gui.bnfStopBandAttenEdit.setValidator(self.dblVal) + self.gui.bnfPassBandRippleEdit.setValidator(self.dblVal) + self.gui.endofHpfStopBandEdit.setValidator(self.dblVal) + self.gui.startofHpfPassBandEdit.setValidator(self.dblVal) + self.gui.hpfStopBandAttenEdit.setValidator(self.dblVal) + self.gui.hpfPassBandRippleEdit.setValidator(self.dblVal) + self.gui.rrcSymbolRateEdit.setValidator(self.dblVal) + self.gui.rrcAlphaEdit.setValidator(self.dblVal) + self.gui.rrcNumTapsEdit.setValidator(self.dblVal) + self.gui.gausSymbolRateEdit.setValidator(self.dblVal) + self.gui.gausBTEdit.setValidator(self.dblVal) + self.gui.gausNumTapsEdit.setValidator(self.dblVal) + + self.gui.nTapsEdit.setText("0") + + self.filterWindows = {"Hamming Window" : gr.firdes.WIN_HAMMING, + "Hann Window" : gr.firdes.WIN_HANN, + "Blackman Window" : gr.firdes.WIN_BLACKMAN, + "Rectangular Window" : gr.firdes.WIN_RECTANGULAR, + "Kaiser Window" : gr.firdes.WIN_KAISER, + "Blackman-harris Window" : gr.firdes.WIN_BLACKMAN_hARRIS} + + self.show() + + def changed_filter_type(self, ftype): + strftype = str(ftype.toAscii()) + if(ftype == "Low Pass"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage) + elif(ftype == "Band Pass"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage) + elif(ftype == "Complex Band Pass"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage) + elif(ftype == "Band Notch"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbnfPage) + elif(ftype == "High Pass"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.firhpfPage) + elif(ftype == "Root Raised Cosine"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.rrcPage) + elif(ftype == "Gaussian"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.gausPage) + + self.design() + + def changed_filter_design_type(self, design): + if(design == "Equiripple"): + self.set_equiripple() + else: + self.set_windowed() + + self.design() + + def set_equiripple(self): + # Stop sending the signal for this function + self.gui.filterTypeComboBox.blockSignals(True) + + self.equiripple = True + self.gui.lpfPassBandRippleLabel.setVisible(True) + self.gui.lpfPassBandRippleEdit.setVisible(True) + self.gui.bpfPassBandRippleLabel.setVisible(True) + self.gui.bpfPassBandRippleEdit.setVisible(True) + self.gui.bnfPassBandRippleLabel.setVisible(True) + self.gui.bnfPassBandRippleEdit.setVisible(True) + self.gui.hpfPassBandRippleLabel.setVisible(True) + self.gui.hpfPassBandRippleEdit.setVisible(True) + + # Save current type and repopulate the combo box for + # filters this window type can handle + currenttype = self.gui.filterTypeComboBox.currentText() + items = self.gui.filterTypeComboBox.count() + for i in xrange(items): + self.gui.filterTypeComboBox.removeItem(0) + self.gui.filterTypeComboBox.addItems(self.optFilters) + + # If the last filter type was valid for this window type, + # go back to it; otherwise, reset + try: + index = self.optFilters.index(currenttype) + self.gui.filterTypeComboBox.setCurrentIndex(index) + except ValueError: + pass + + # Tell gui its ok to start sending this signal again + self.gui.filterTypeComboBox.blockSignals(False) + + def set_windowed(self): + # Stop sending the signal for this function + self.gui.filterTypeComboBox.blockSignals(True) + + self.equiripple = False + self.gui.lpfPassBandRippleLabel.setVisible(False) + self.gui.lpfPassBandRippleEdit.setVisible(False) + self.gui.bpfPassBandRippleLabel.setVisible(False) + self.gui.bpfPassBandRippleEdit.setVisible(False) + self.gui.bnfPassBandRippleLabel.setVisible(False) + self.gui.bnfPassBandRippleEdit.setVisible(False) + self.gui.hpfPassBandRippleLabel.setVisible(False) + self.gui.hpfPassBandRippleEdit.setVisible(False) + + # Save current type and repopulate the combo box for + # filters this window type can handle + currenttype = self.gui.filterTypeComboBox.currentText() + items = self.gui.filterTypeComboBox.count() + for i in xrange(items): + self.gui.filterTypeComboBox.removeItem(0) + self.gui.filterTypeComboBox.addItems(self.firFilters) + + # If the last filter type was valid for this window type, + # go back to it; otherwise, reset + try: + index = self.optFilters.index(currenttype) + self.gui.filterTypeComboBox.setCurrentIndex(index) + except ValueError: + pass + + # Tell gui its ok to start sending this signal again + self.gui.filterTypeComboBox.blockSignals(False) + + def design(self): + ret = True + fs,r = self.gui.sampleRateEdit.text().toDouble() + ret = r and ret + gain,r = self.gui.filterGainEdit.text().toDouble() + ret = r and ret + + if(ret): + winstr = str(self.gui.filterDesignTypeComboBox.currentText().toAscii()) + ftype = str(self.gui.filterTypeComboBox.currentText().toAscii()) + + if(winstr == "Equiripple"): + designer = {"Low Pass" : self.design_opt_lpf, + "Band Pass" : self.design_opt_bpf, + "Complex Band Pass" : self.design_opt_cbpf, + "Band Notch" : self.design_opt_bnf, + "High Pass" : self.design_opt_hpf} + taps,r = designer[ftype](fs, gain) + + else: + designer = {"Low Pass" : self.design_win_lpf, + "Band Pass" : self.design_win_bpf, + "Complex Band Pass" : self.design_win_cbpf, + "Band Notch" : self.design_win_bnf, + "High Pass" : self.design_win_hpf, + "Root Raised Cosine" : self.design_win_rrc, + "Gaussian" : self.design_win_gaus} + wintype = self.filterWindows[winstr] + taps,r = designer[ftype](fs, gain, wintype) + + if(r): + self.taps = scipy.array(taps) + self.get_fft(fs, self.taps, self.nfftpts) + self.update_time_curves() + self.update_freq_curves() + self.update_phase_curves() + self.update_group_curves() + + self.gui.nTapsEdit.setText(Qt.QString("%1").arg(self.taps.size)) + + + # Filter design functions using a window + def design_win_lpf(self, fs, gain, wintype): + ret = True + pb,r = self.gui.endofLpfPassBandEdit.text().toDouble() + ret = r and ret + sb,r = self.gui.startofLpfStopBandEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.lpfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(ret): + tb = sb - pb + + taps = gr.firdes.low_pass_2(gain, fs, pb, tb, + atten, wintype) + return (taps, ret) + else: + return ([], ret) + + def design_win_bpf(self, fs, gain, wintype): + ret = True + pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() + ret = r and ret + pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bpfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(r): + taps = gr.firdes.band_pass_2(gain, fs, pb1, pb2, tb, + atten, wintype) + return (taps,r) + else: + return ([],r) + + def design_win_cbpf(self, fs, gain, wintype): + ret = True + pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() + ret = r and ret + pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bpfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(r): + taps = gr.firdes.complex_band_pass_2(gain, fs, pb1, pb2, tb, + atten, wintype) + return (taps,r) + else: + return ([],r) + + def design_win_bnf(self, fs, gain, wintype): + ret = True + pb1,r = self.gui.startofBnfStopBandEdit.text().toDouble() + ret = r and ret + pb2,r = self.gui.endofBnfStopBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bnfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bnfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(r): + taps = gr.firdes.band_reject_2(gain, fs, pb1, pb2, tb, + atten, wintype) + return (taps,r) + else: + return ([],r) + + def design_win_hpf(self, fs, gain, wintype): + ret = True + sb,r = self.gui.endofHpfStopBandEdit.text().toDouble() + ret = r and ret + pb,r = self.gui.startofHpfPassBandEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.hpfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(r): + tb = pb - sb + taps = gr.firdes.high_pass_2(gain, fs, pb, tb, + atten, wintype) + return (taps,r) + else: + return ([],r) + + def design_win_rrc(self, fs, gain, wintype): + ret = True + sr,r = self.gui.rrcSymbolRateEdit.text().toDouble() + ret = r and ret + alpha,r = self.gui.rrcAlphaEdit.text().toDouble() + ret = r and ret + ntaps,r = self.gui.rrcNumTapsEdit.text().toInt() + ret = r and ret + + if(r): + taps = gr.firdes.root_raised_cosine(gain, fs, sr, + alpha, ntaps) + return (taps,r) + else: + return ([],r) + + def design_win_gaus(self, fs, gain, wintype): + ret = True + sr,r = self.gui.gausSymbolRateEdit.text().toDouble() + ret = r and ret + bt,r = self.gui.gausBTEdit.text().toDouble() + ret = r and ret + ntaps,r = self.gui.gausNumTapsEdit.text().toInt() + ret = r and ret + + if(r): + spb = fs / sr + taps = gr.firdes.gaussian(gain, spb, bt, ntaps) + return (taps,r) + else: + return ([],r) + + # Design Functions for Equiripple Filters + def design_opt_lpf(self, fs, gain): + ret = True + pb,r = self.gui.endofLpfPassBandEdit.text().toDouble() + ret = r and ret + sb,r = self.gui.startofLpfStopBandEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.lpfStopBandAttenEdit.text().toDouble() + ret = r and ret + ripple,r = self.gui.lpfPassBandRippleEdit.text().toDouble() + ret = r and ret + + if(ret): + taps = blks2.optfir.low_pass(gain, fs, pb, sb, + ripple, atten) + return (taps, ret) + else: + return ([], ret) + + def design_opt_bpf(self, fs, gain): + ret = True + pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() + ret = r and ret + pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bpfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() + ret = r and ret + ripple,r = self.gui.bpfPassBandRippleEdit.text().toDouble() + ret = r and ret + + if(r): + sb1 = pb1 - tb + sb2 = pb2 + tb + taps = blks2.optfir.band_pass(gain, fs, sb1, pb1, pb2, sb2, + ripple, atten) + return (taps,r) + else: + return ([],r) + + def design_opt_cbpf(self, fs, gain): + ret = True + pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() + ret = r and ret + pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bpfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() + ret = r and ret + ripple,r = self.gui.bpfPassBandRippleEdit.text().toDouble() + ret = r and ret + + if(r): + sb1 = pb1 - tb + sb2 = pb2 + tb + taps = blks2.optfir.complex_band_pass(gain, fs, sb1, pb1, pb2, sb2, + ripple, atten) + return (taps,r) + else: + return ([],r) + + def design_opt_bnf(self, fs, gain): + ret = True + sb1,r = self.gui.startofBnfStopBandEdit.text().toDouble() + ret = r and ret + sb2,r = self.gui.endofBnfStopBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bnfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bnfStopBandAttenEdit.text().toDouble() + ret = r and ret + ripple,r = self.gui.bnfPassBandRippleEdit.text().toDouble() + ret = r and ret + + if(r): + pb1 = sb1 - tb + pb2 = sb2 + tb + taps = blks2.optfir.band_reject(gain, fs, pb1, sb1, sb2, pb2, + ripple, atten) + return (taps,r) + else: + return ([],r) + + def design_opt_hpf(self, fs, gain): + ret = True + sb,r = self.gui.endofHpfStopBandEdit.text().toDouble() + ret = r and ret + pb,r = self.gui.startofHpfPassBandEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.hpfStopBandAttenEdit.text().toDouble() + ret = r and ret + ripple,r = self.gui.hpfPassBandRippleEdit.text().toDouble() + ret = r and ret + + if(r): + taps = blks2.optfir.high_pass(gain, fs, sb, pb, + atten, ripple) + return (taps,r) + else: + return ([],r) + + def nfft_edit_changed(self, nfft): + infft,r = nfft.toInt() + if(r and (infft != self.nfftpts)): + self.nfftpts = infft + self.update_freq_curves() + + def tab_changed(self, tab): + if(tab == 0): + self.update_freq_curves() + if(tab == 1): + self.update_time_curves() + if(tab == 2): + self.update_phase_curves() + if(tab == 3): + self.update_group_curves() + + def get_fft(self, fs, taps, Npts): + Ts = 1.0/fs + fftpts = fftpack.fft(taps, Npts) + self.freq = scipy.arange(0, fs, 1.0/(Npts*Ts)) + self.fftdB = 20.0*scipy.log10(abs(fftpts)) + self.fftDeg = scipy.unwrap(scipy.angle(fftpts)) + self.groupDelay = -scipy.diff(self.fftDeg) + + def update_time_curves(self): + ntaps = len(self.taps) + if(ntaps > 0): + if(type(self.taps[0]) == scipy.complex128): + self.rcurve.setData(scipy.arange(ntaps), self.taps.real) + self.icurve.setData(scipy.arange(ntaps), self.taps.imag) + else: + self.rcurve.setData(scipy.arange(ntaps), self.taps) + + # Reset the x-axis to the new time scale + ymax = 1.5 * max(self.taps) + ymin = 1.5 * min(self.taps) + self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom, + 0, ntaps) + self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft, + ymin, ymax) + + # Set the zoomer base to unzoom to the new axis + self.timeZoomer.setZoomBase() + + self.gui.timePlot.replot() + + def update_freq_curves(self): + npts = len(self.fftdB) + if(npts > 0): + self.freqcurve.setData(self.freq, self.fftdB) + + # Reset the x-axis to the new time scale + ymax = 1.5 * max(self.fftdB[0:npts/2]) + ymin = 1.1 * min(self.fftdB[0:npts/2]) + xmax = self.freq[npts/2] + xmin = self.freq[0] + self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom, + xmin, xmax) + self.gui.freqPlot.setAxisScale(self.gui.freqPlot.yLeft, + ymin, ymax) + + # Set the zoomer base to unzoom to the new axis + self.freqZoomer.setZoomBase() + + self.gui.freqPlot.replot() + + + def update_phase_curves(self): + npts = len(self.fftDeg) + if(npts > 0): + self.phasecurve.setData(self.freq, self.fftDeg) + + # Reset the x-axis to the new time scale + ymax = 1.5 * max(self.fftDeg[0:npts/2]) + ymin = 1.1 * min(self.fftDeg[0:npts/2]) + xmax = self.freq[npts/2] + xmin = self.freq[0] + self.gui.phasePlot.setAxisScale(self.gui.phasePlot.xBottom, + xmin, xmax) + self.gui.phasePlot.setAxisScale(self.gui.phasePlot.yLeft, + ymin, ymax) + + # Set the zoomer base to unzoom to the new axis + self.phaseZoomer.setZoomBase() + + self.gui.phasePlot.replot() + + def update_group_curves(self): + npts = len(self.groupDelay) + if(npts > 0): + self.groupcurve.setData(self.freq, self.groupDelay) + + # Reset the x-axis to the new time scale + ymax = 1.5 * max(self.groupDelay[0:npts/2]) + ymin = 1.1 * min(self.groupDelay[0:npts/2]) + xmax = self.freq[npts/2] + xmin = self.freq[0] + self.gui.groupPlot.setAxisScale(self.gui.groupPlot.xBottom, + xmin, xmax) + self.gui.groupPlot.setAxisScale(self.gui.groupPlot.yLeft, + ymin, ymax) + + # Set the zoomer base to unzoom to the new axis + self.groupZoomer.setZoomBase() + + self.gui.groupPlot.replot() + + +def setup_options(): + usage="%prog: [options] (input_filename)" + description = "" + + parser = OptionParser(conflict_handler="resolve", + usage=usage, description=description) + return parser + +def main(args): + parser = setup_options() + (options, args) = parser.parse_args () + + app = Qt.QApplication(args) + gplt = gr_plot_filter(app, options) + app.exec_() + +if __name__ == '__main__': + main(sys.argv) + diff --git a/gr-utils/src/python/gr_plot_qt.py b/gr-utils/src/python/gr_plot_qt.py new file mode 100755 index 000000000..a5e3463c8 --- /dev/null +++ b/gr-utils/src/python/gr_plot_qt.py @@ -0,0 +1,643 @@ +#!/usr/bin/env python + +try: + import scipy + from scipy import fftpack +except ImportError: + print "Please install SciPy to run this script (http://www.scipy.org/)" + raise SystemExit, 1 + +import sys, os +from PyQt4 import Qt, QtCore, QtGui +import PyQt4.Qwt5 as Qwt +from matplotlib import mlab +from optparse import OptionParser +from gnuradio import eng_notation + +from pyqt_plot import Ui_MainWindow + +class SpectrogramData(Qwt.QwtRasterData): + + def __init__(self, f, t): + Qwt.QwtArrayData.__init__(self, Qt.QRectF(0, 0, 0, 0)) + self.sp = scipy.array([[0], [0]]) + + def set_data(self, xfreq, ytime, data): + self.sp = data + self.freq = xfreq + self.time = ytime + boundingBox = Qt.QRectF(self.freq.min(), self.time.min(), + self.freq.max() - self.freq.min(), + self.time.max() - self.time.min()) + self.setBoundingRect(boundingBox) + + def rasterHint(self, rect): + return Qt.QSize(self.sp.shape[0], self.sp.shape[1]) + + def copy(self): + return self + + def range(self): + + return Qwt.QwtDoubleInterval(self.sp.min(), self.sp.max()) + + def value(self, x, y): + f = int(self.freq.searchsorted(x)) + t = int(self.time.searchsorted(y)) + return self.sp[f][t-1] + + +class gr_plot_qt(QtGui.QMainWindow): + def __init__(self, qapp, filename, options, parent=None): + QtGui.QWidget.__init__(self, parent) + self.gui = Ui_MainWindow() + self.gui.setupUi(self) + + self.block_length = options.block_length + self.start = options.start + self.sample_rate = options.sample_rate + self.psdfftsize = options.psd_size + self.specfftsize = options.spec_size + self.winfunc = scipy.blackman + self.sizeof_data = 8 + self.datatype = scipy.complex64 + self.iq = list() + self.time = list() + + # Set up basic plot attributes + self.gui.timePlot.setAxisTitle(self.gui.timePlot.xBottom, "Time (sec)") + self.gui.timePlot.setAxisTitle(self.gui.timePlot.yLeft, "Amplitude (V)") + self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.xBottom, "Frequency (Hz)") + self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.yLeft, "Magnitude (dB)") + self.gui.specPlot.setAxisTitle(self.gui.specPlot.xBottom, "Frequency (Hz)") + self.gui.specPlot.setAxisTitle(self.gui.specPlot.yLeft, "Time (sec)") + + # Set up FFT size combo box + self.fftsizes = ["128", "256", "512", "1024", "2048", + "4096", "8192", "16384", "32768"] + self.gui.psdFFTComboBox.addItems(self.fftsizes) + self.gui.specFFTComboBox.addItems(self.fftsizes) + pos = self.gui.psdFFTComboBox.findText(Qt.QString("%1").arg(self.psdfftsize)) + self.gui.psdFFTComboBox.setCurrentIndex(pos) + pos = self.gui.specFFTComboBox.findText(Qt.QString("%1").arg(self.specfftsize)) + self.gui.specFFTComboBox.setCurrentIndex(pos) + + self.connect(self.gui.psdFFTComboBox, + Qt.SIGNAL("activated (const QString&)"), + self.psdFFTComboBoxEdit) + self.connect(self.gui.specFFTComboBox, + Qt.SIGNAL("activated (const QString&)"), + self.specFFTComboBoxEdit) + + # Set up color scheme box + self.color_modes = {"Black on White" : self.color_black_on_white, + "White on Black" : self.color_white_on_black, + "Blue on Black" : self.color_blue_on_black, + "Green on Black" : self.color_green_on_black} + self.gui.colorComboBox.addItems(self.color_modes.keys()) + pos = self.gui.colorComboBox.findText("Blue on Black") + self.gui.colorComboBox.setCurrentIndex(pos) + self.connect(self.gui.colorComboBox, + Qt.SIGNAL("activated (const QString&)"), + self.colorComboBoxEdit) + + + # Create zoom functionality for the plots + self.timeZoomer = Qwt.QwtPlotZoomer(self.gui.timePlot.xBottom, + self.gui.timePlot.yLeft, + Qwt.QwtPicker.PointSelection, + Qwt.QwtPicker.AlwaysOn, + self.gui.timePlot.canvas()) + + self.freqZoomer = Qwt.QwtPlotZoomer(self.gui.freqPlot.xBottom, + self.gui.freqPlot.yLeft, + Qwt.QwtPicker.PointSelection, + Qwt.QwtPicker.AlwaysOn, + self.gui.freqPlot.canvas()) + + self.specZoomer = Qwt.QwtPlotZoomer(self.gui.specPlot.xBottom, + self.gui.specPlot.yLeft, + Qwt.QwtPicker.PointSelection, + Qwt.QwtPicker.AlwaysOn, + self.gui.specPlot.canvas()) + + self.picker = Qwt.QwtPlotPicker(self.gui.timePlot.xBottom, + self.gui.timePlot.yLeft, + Qwt.QwtPicker.PointSelection, + Qwt.QwtPlotPicker.CrossRubberBand, + Qwt.QwtPicker.AlwaysOn, + self.gui.timePlot.canvas()) + self.picker.connect(self.picker, + Qt.SIGNAL('selected(const QwtDoublePoint&)'), + self.clickMe) + + # Set up action when tab is changed + self.connect(self.gui.tabGroup, + Qt.SIGNAL("currentChanged (int)"), + self.tabChanged) + + # Add a legend to the Time plot + legend_real = Qwt.QwtLegend() + self.gui.timePlot.insertLegend(legend_real) + + # Set up slider + self.gui.plotHBar.setSingleStep(1) + self.gui.plotHBar.setPageStep(self.block_length) + self.gui.plotHBar.setMinimum(0) + self.gui.plotHBar.setMaximum(self.block_length) + self.connect(self.gui.plotHBar, + Qt.SIGNAL("valueChanged(int)"), + self.sliderMoved) + + # Connect Open action to Open Dialog box + self.connect(self.gui.action_open, + Qt.SIGNAL("activated()"), + self.open_file) + + # Set up file position boxes to update current figure + self.connect(self.gui.filePosStartLineEdit, + Qt.SIGNAL("editingFinished()"), + self.file_position_changed) + self.connect(self.gui.filePosStopLineEdit, + Qt.SIGNAL("editingFinished()"), + self.file_position_changed) + self.connect(self.gui.filePosLengthLineEdit, + Qt.SIGNAL("editingFinished()"), + self.file_length_changed) + + self.connect(self.gui.fileTimeStartLineEdit, + Qt.SIGNAL("editingFinished()"), + self.file_time_changed) + self.connect(self.gui.fileTimeStopLineEdit, + Qt.SIGNAL("editingFinished()"), + self.file_time_changed) + self.connect(self.gui.fileTimeLengthLineEdit, + Qt.SIGNAL("editingFinished()"), + self.file_time_length_changed) + + self.rcurve = Qwt.QwtPlotCurve("Real") + self.icurve = Qwt.QwtPlotCurve("Imaginary") + + self.icurve.attach(self.gui.timePlot) + self.rcurve.attach(self.gui.timePlot) + + self.psdcurve = Qwt.QwtPlotCurve("PSD") + self.psdcurve.attach(self.gui.freqPlot) + + # Set up specTab plot as a spectrogram + self.specdata = SpectrogramData(range(0, 10), range(0, 10)) + + colorMap = Qwt.QwtLinearColorMap(Qt.Qt.darkCyan, Qt.Qt.red) + colorMap.addColorStop(0.1, Qt.Qt.cyan) + colorMap.addColorStop(0.6, Qt.Qt.green) + colorMap.addColorStop(0.95, Qt.Qt.yellow) + + self.spec = Qwt.QwtPlotSpectrogram() + self.spec.setColorMap(colorMap) + self.spec.attach(self.gui.specPlot) + self.spec.setDisplayMode(Qwt.QwtPlotSpectrogram.ImageMode, True) + self.spec.setData(self.specdata) + + self.rightAxis = self.gui.specPlot.axisWidget(Qwt.QwtPlot.yRight) + self.rightAxis.setTitle("Magnitude (dBm)") + self.rightAxis.setColorBarEnabled(True) + self.rightAxis.setColorMap(self.spec.data().range(), + self.spec.colorMap()) + self.gui.specPlot.enableAxis(Qwt.QwtPlot.yRight) + + # Set up initial color scheme + self.color_modes["Blue on Black"]() + + # Connect a signal for when the sample rate changes + self.set_sample_rate(self.sample_rate) + self.connect(self.gui.sampleRateLineEdit, + Qt.SIGNAL("editingFinished()"), + self.sample_rate_changed) + + if(filename is not None): + self.initialize(filename) + + self.show() + + def open_file(self): + filename = Qt.QFileDialog.getOpenFileName(self, "Open", ".") + if(filename != ""): + print filename + self.initialize(filename) + + def initialize(self, filename): + self.hfile = open(filename, "r") + + self.setWindowTitle(("GNU Radio File Plot Utility: %s" % filename)) + + self.gui.filePosStartLineEdit.setText("0") + self.gui.filePosStopLineEdit.setText("0") + self.gui.fileTimeStartLineEdit.setText("0") + self.gui.fileTimeStopLineEdit.setText("0") + + self.cur_start = 0 + self.cur_stop = self.block_length + + self.init_data_input() + self.get_data(self.cur_start, self.cur_stop) + self.get_psd() + self.get_specgram() + self.gui.plotHBar.setSliderPosition(0) + self.gui.plotHBar.setMaximum(self.signal_size) + + + self.update_time_curves() + self.update_psd_curves() + self.update_specgram_curves() + + def init_data_input(self): + self.hfile.seek(0, os.SEEK_END) + self.signal_size = self.hfile.tell()/self.sizeof_data + print "Sizeof File: ", self.signal_size + self.hfile.seek(0, os.SEEK_SET) + + def get_data(self, start, end): + if(end > start): + self.hfile.seek(start*self.sizeof_data, os.SEEK_SET) + self.position = start + try: + iq = scipy.fromfile(self.hfile, dtype=self.datatype, + count=end-start) + + if(len(iq) < (end-start)): + end = len(iq) + self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(end)) + self.gui.plotHBar.setMaximum(end) + self.gui.plotHBar.setSingleStep(end) + self.file_length_changed() + + tstep = 1.0 / self.sample_rate + self.iq = iq + self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))] + + self.set_file_pos_box(start, end) + except MemoryError: + pass + else: + # Do we want to do anything about this? + pass + + def get_psd(self): + winpoints = self.winfunc(self.psdfftsize) + iq_psd, freq = mlab.psd(self.iq, Fs=self.sample_rate, + NFFT=self.psdfftsize, + noverlap=self.psdfftsize/4.0, + window=winpoints, + scale_by_freq=False) + + self.iq_psd = 10.0*scipy.log10(abs(fftpack.fftshift(iq_psd))) + self.freq = freq - self.sample_rate/2.0 + + def get_specgram(self): + winpoints = self.winfunc(self.specfftsize) + iq_spec, f, t = mlab.specgram(self.iq, Fs=self.sample_rate, + NFFT=self.specfftsize, + noverlap=self.specfftsize/4.0, + window=winpoints, + scale_by_freq=False) + + self.iq_spec = 10.0*scipy.log10(abs(iq_spec)) + self.spec_f = f + self.spec_t = t + + def clickMe(self, qPoint): + print qPoint.x() + + def psdFFTComboBoxEdit(self, fftSize): + self.psdfftsize = fftSize.toInt()[0] + self.get_psd() + self.update_psd_curves() + + def specFFTComboBoxEdit(self, fftSize): + self.specfftsize = fftSize.toInt()[0] + self.get_specgram() + self.update_specgram_curves() + + def colorComboBoxEdit(self, colorSelection): + colorstr = str(colorSelection.toAscii()) + color_func = self.color_modes[colorstr] + color_func() + + def sliderMoved(self, value): + pos_start = value + pos_end = value + self.gui.plotHBar.pageStep() + + self.get_data(pos_start, pos_end) + self.get_psd() + self.get_specgram() + self.update_time_curves() + self.update_psd_curves() + self.update_specgram_curves() + + def set_sample_rate(self, sr): + self.sample_rate = sr + srstr = eng_notation.num_to_str(self.sample_rate) + self.gui.sampleRateLineEdit.setText(Qt.QString("%1").arg(srstr)) + + def sample_rate_changed(self): + srstr = self.gui.sampleRateLineEdit.text().toAscii() + self.sample_rate = eng_notation.str_to_num(srstr) + self.set_file_pos_box(self.cur_start, self.cur_stop) + self.get_data(self.cur_start, self.cur_stop) + self.get_psd() + self.get_specgram() + self.update_time_curves() + self.update_psd_curves() + self.update_specgram_curves() + + def set_file_pos_box(self, start, end): + tstart = start / self.sample_rate + tend = end / self.sample_rate + + self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(start)) + self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(end)) + self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(end-start)) + + self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) + self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) + self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tend-tstart)) + + def file_position_changed(self): + start = self.gui.filePosStartLineEdit.text().toInt() + end = self.gui.filePosStopLineEdit.text().toInt() + if((start[1] == True) and (end[1] == True)): + self.cur_start = start[0] + self.cur_stop = end[0] + + tstart = self.cur_start / self.sample_rate + tend = self.cur_stop / self.sample_rate + self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) + self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) + + self.get_data(self.cur_start, self.cur_stop) + + self.update_time_curves() + self.update_psd_curves() + self.update_specgram_curves() + + # If there's a non-digit character, reset box + else: + self.set_file_pos_box(self.cur_start, self.cur_stop) + + def file_time_changed(self): + tstart = self.gui.fileTimeStartLineEdit.text().toDouble() + tstop = self.gui.fileTimeStopLineEdit.text().toDouble() + if((tstart[1] == True) and (tstop[1] == True)): + self.cur_start = int(tstart[0] * self.sample_rate) + self.cur_stop = int(tstop[0] * self.sample_rate) + self.get_data(self.cur_start, self.cur_stop) + + self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(self.cur_start)) + self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(self.cur_stop)) + + self.update_time_curves() + self.update_psd_curves() + self.update_specgram_curves() + # If there's a non-digit character, reset box + else: + self.set_file_pos_box(self.cur_start, self.cur_stop) + + def file_length_changed(self): + start = self.gui.filePosStartLineEdit.text().toInt() + length = self.gui.filePosLengthLineEdit.text().toInt() + + if((start[1] == True) and (length[1] == True)): + self.cur_start = start[0] + self.block_length = length[0] + self.cur_stop = self.cur_start + self.block_length + + tstart = self.cur_start / self.sample_rate + tend = self.cur_stop / self.sample_rate + tlen = self.block_length / self.sample_rate + self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) + self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) + self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen)) + + self.gui.plotHBar.setPageStep(self.block_length) + + self.get_data(self.cur_start, self.cur_stop) + self.get_psd() + self.get_specgram() + + self.update_time_curves() + self.update_psd_curves() + self.update_specgram_curves() + # If there's a non-digit character, reset box + else: + self.set_file_pos_box(self.cur_start, self.cur_stop) + + def file_time_length_changed(self): + tstart = self.gui.fileTimeStartLineEdit.text().toDouble() + tlength = self.gui.fileTimeLengthLineEdit.text().toDouble() + if((tstart[1] == True) and (tlength[1] == True)): + self.cur_start = int(tstart[0] * self.sample_rate) + self.block_length = int(tlength[0] * self.sample_rate) + self.cur_stop = self.cur_start + self.block_length + + tstart = self.cur_start / self.sample_rate + tend = self.cur_stop / self.sample_rate + tlen = self.block_length / self.sample_rate + self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) + self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) + self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen)) + + self.get_data(self.cur_start, self.cur_stop) + self.get_psd() + self.get_specgram() + + self.update_time_curves() + self.update_psd_curves() + self.update_specgram_curves() + # If there's a non-digit character, reset box + else: + self.set_file_pos_box(self.cur_start, self.cur_stop) + + + def update_time_curves(self): + self.icurve.setData(self.time, self.iq.imag) + self.rcurve.setData(self.time, self.iq.real) + + # Reset the x-axis to the new time scale + iqmax = 1.5 * max(max(self.iq.real), max(self.iq.imag)) + iqmin = 1.5 * min(min(self.iq.real), min(self.iq.imag)) + self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom, + min(self.time), + max(self.time)) + self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft, + iqmin, + iqmax) + + # Set the zoomer base to unzoom to the new axis + self.timeZoomer.setZoomBase() + + self.gui.timePlot.replot() + + def update_psd_curves(self): + self.psdcurve.setData(self.freq, self.iq_psd) + + self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom, + min(self.freq), + max(self.freq)) + + # Set the zoomer base to unzoom to the new axis + self.freqZoomer.setZoomBase() + + self.gui.freqPlot.replot() + + def update_specgram_curves(self): + # We don't have to reset the data for the speccurve here + # since this is taken care of in the SpectrogramData class + self.specdata.set_data(self.spec_f, self.spec_t, self.iq_spec) + + # Set the color map based on the new data + self.rightAxis.setColorMap(self.spec.data().range(), + self.spec.colorMap()) + + # Set the new axis base; include right axis for the intenisty color bar + self.gui.specPlot.setAxisScale(self.gui.specPlot.xBottom, + min(self.spec_f), + max(self.spec_f)) + self.gui.specPlot.setAxisScale(self.gui.specPlot.yLeft, + min(self.spec_t), + max(self.spec_t)) + self.gui.specPlot.setAxisScale(self.gui.specPlot.yRight, + self.iq_spec.min(), + self.iq_spec.max()) + + # Set the zoomer base to unzoom to the new axis + self.specZoomer.setZoomBase() + + self.gui.specPlot.replot() + + def tabChanged(self, index): + self.gui.timePlot.replot() + self.gui.freqPlot.replot() + + def color_black_on_white(self): + blue = QtGui.qRgb(0x00, 0x00, 0xFF) + red = QtGui.qRgb(0xFF, 0x00, 0x00) + + blackBrush = Qt.QBrush(Qt.QColor("black")) + blueBrush = Qt.QBrush(Qt.QColor(blue)) + redBrush = Qt.QBrush(Qt.QColor(red)) + + self.gui.timePlot.setCanvasBackground(Qt.QColor("white")) + self.gui.freqPlot.setCanvasBackground(Qt.QColor("white")) + self.picker.setTrackerPen(Qt.QPen(blackBrush, 2)) + self.timeZoomer.setTrackerPen(Qt.QPen(blackBrush, 2)) + self.timeZoomer.setRubberBandPen(Qt.QPen(blackBrush, 2)) + self.freqZoomer.setTrackerPen(Qt.QPen(blackBrush, 2)) + self.freqZoomer.setRubberBandPen(Qt.QPen(blackBrush, 2)) + self.psdcurve.setPen(Qt.QPen(blueBrush, 1)) + self.rcurve.setPen(Qt.QPen(blueBrush, 2)) + self.icurve.setPen(Qt.QPen(redBrush, 2)) + + self.gui.timePlot.replot() + self.gui.freqPlot.replot() + + def color_white_on_black(self): + white = QtGui.qRgb(0xFF, 0xFF, 0xFF) + red = QtGui.qRgb(0xFF, 0x00, 0x00) + + whiteBrush = Qt.QBrush(Qt.QColor("white")) + whiteBrush = Qt.QBrush(Qt.QColor(white)) + redBrush = Qt.QBrush(Qt.QColor(red)) + + self.gui.timePlot.setCanvasBackground(QtGui.QColor("black")) + self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black")) + self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2)) + self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2)) + self.psdcurve.setPen(Qt.QPen(whiteBrush, 1)) + self.rcurve.setPen(Qt.QPen(whiteBrush, 2)) + self.icurve.setPen(Qt.QPen(redBrush, 2)) + + self.gui.timePlot.replot() + self.gui.freqPlot.replot() + + + def color_green_on_black(self): + green = QtGui.qRgb(0x00, 0xFF, 0x00) + red = QtGui.qRgb(0xFF, 0x00, 0x50) + + whiteBrush = Qt.QBrush(Qt.QColor("white")) + greenBrush = Qt.QBrush(Qt.QColor(green)) + redBrush = Qt.QBrush(Qt.QColor(red)) + + self.gui.timePlot.setCanvasBackground(QtGui.QColor("black")) + self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black")) + self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2)) + self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2)) + self.psdcurve.setPen(Qt.QPen(greenBrush, 1)) + self.rcurve.setPen(Qt.QPen(greenBrush, 2)) + self.icurve.setPen(Qt.QPen(redBrush, 2)) + + self.gui.timePlot.replot() + self.gui.freqPlot.replot() + + def color_blue_on_black(self): + blue = QtGui.qRgb(0x00, 0x00, 0xFF) + red = QtGui.qRgb(0xFF, 0x00, 0x00) + + whiteBrush = Qt.QBrush(Qt.QColor("white")) + blueBrush = Qt.QBrush(Qt.QColor(blue)) + redBrush = Qt.QBrush(Qt.QColor(red)) + + self.gui.timePlot.setCanvasBackground(QtGui.QColor("black")) + self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black")) + self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2)) + self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2)) + self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2)) + self.psdcurve.setPen(Qt.QPen(blueBrush, 1)) + self.rcurve.setPen(Qt.QPen(blueBrush, 2)) + self.icurve.setPen(Qt.QPen(redBrush, 2)) + + self.gui.timePlot.replot() + self.gui.freqPlot.replot() + +def setup_options(): + usage="%prog: [options] (input_filename)" + description = "" + + parser = OptionParser(conflict_handler="resolve", usage=usage, description=description) + parser.add_option("-B", "--block-length", type="int", default=8192, + help="Specify the block size [default=%default]") + parser.add_option("-s", "--start", type="int", default=0, + help="Specify where to start in the file [default=%default]") + parser.add_option("-R", "--sample-rate", type="float", default=1.0, + help="Set the sampler rate of the data [default=%default]") + parser.add_option("", "--psd-size", type="int", default=2048, + help="Set the size of the PSD FFT [default=%default]") + parser.add_option("", "--spec-size", type="int", default=2048, + help="Set the size of the spectrogram FFT [default=%default]") + + return parser + +def main(args): + parser = setup_options() + (options, args) = parser.parse_args () + + if(len(args) == 1): + filename = args[0] + else: + filename = None + + app = Qt.QApplication(args) + gplt = gr_plot_qt(app, filename, options) + app.exec_() + +if __name__ == '__main__': + main(sys.argv) + diff --git a/gr-utils/src/python/pyqt_filter.py b/gr-utils/src/python/pyqt_filter.py new file mode 100644 index 000000000..12ad183b0 --- /dev/null +++ b/gr-utils/src/python/pyqt_filter.py @@ -0,0 +1,426 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'pyqt_filter.ui' +# +# Created: Tue Aug 25 11:13:57 2009 +# by: PyQt4 UI code generator 4.4.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(1124, 696) + self.centralwidget = QtGui.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout = QtGui.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.filterFrame = QtGui.QFrame(self.centralwidget) + self.filterFrame.setMinimumSize(QtCore.QSize(300, 0)) + self.filterFrame.setMaximumSize(QtCore.QSize(300, 16777215)) + self.filterFrame.setFrameShape(QtGui.QFrame.StyledPanel) + self.filterFrame.setFrameShadow(QtGui.QFrame.Raised) + self.filterFrame.setObjectName("filterFrame") + self.verticalLayout = QtGui.QVBoxLayout(self.filterFrame) + self.verticalLayout.setObjectName("verticalLayout") + self.filterTypeComboBox = QtGui.QComboBox(self.filterFrame) + self.filterTypeComboBox.setObjectName("filterTypeComboBox") + self.filterTypeComboBox.addItem(QtCore.QString()) + self.filterTypeComboBox.addItem(QtCore.QString()) + self.filterTypeComboBox.addItem(QtCore.QString()) + self.filterTypeComboBox.addItem(QtCore.QString()) + self.filterTypeComboBox.addItem(QtCore.QString()) + self.filterTypeComboBox.addItem(QtCore.QString()) + self.filterTypeComboBox.addItem(QtCore.QString()) + self.verticalLayout.addWidget(self.filterTypeComboBox) + self.filterDesignTypeComboBox = QtGui.QComboBox(self.filterFrame) + self.filterDesignTypeComboBox.setObjectName("filterDesignTypeComboBox") + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.verticalLayout.addWidget(self.filterDesignTypeComboBox) + self.globalParamsLayout = QtGui.QFormLayout() + self.globalParamsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.globalParamsLayout.setObjectName("globalParamsLayout") + self.sampleRateLabel = QtGui.QLabel(self.filterFrame) + self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 30)) + self.sampleRateLabel.setObjectName("sampleRateLabel") + self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.sampleRateEdit = QtGui.QLineEdit(self.filterFrame) + self.sampleRateEdit.setMaximumSize(QtCore.QSize(16777215, 30)) + self.sampleRateEdit.setObjectName("sampleRateEdit") + self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) + self.filterGainLabel = QtGui.QLabel(self.filterFrame) + self.filterGainLabel.setObjectName("filterGainLabel") + self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filterGainLabel) + self.filterGainEdit = QtGui.QLineEdit(self.filterFrame) + self.filterGainEdit.setObjectName("filterGainEdit") + self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit) + self.verticalLayout.addLayout(self.globalParamsLayout) + self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame) + self.filterTypeWidget.setObjectName("filterTypeWidget") + self.firlpfPage = QtGui.QWidget() + self.firlpfPage.setObjectName("firlpfPage") + self.formLayout = QtGui.QFormLayout(self.firlpfPage) + self.formLayout.setObjectName("formLayout") + self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage) + self.endofLpfPassBandLabel.setObjectName("endofLpfPassBandLabel") + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel) + self.endofLpfPassBandEdit = QtGui.QLineEdit(self.firlpfPage) + self.endofLpfPassBandEdit.setObjectName("endofLpfPassBandEdit") + self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit) + self.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage) + self.startofLpfStopBandLabel.setObjectName("startofLpfStopBandLabel") + self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel) + self.startofLpfStopBandEdit = QtGui.QLineEdit(self.firlpfPage) + self.startofLpfStopBandEdit.setObjectName("startofLpfStopBandEdit") + self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit) + self.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage) + self.lpfStopBandAttenLabel.setObjectName("lpfStopBandAttenLabel") + self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel) + self.lpfStopBandAttenEdit = QtGui.QLineEdit(self.firlpfPage) + self.lpfStopBandAttenEdit.setObjectName("lpfStopBandAttenEdit") + self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit) + self.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage) + self.lpfPassBandRippleEdit.setObjectName("lpfPassBandRippleEdit") + self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit) + self.lpfPassBandRippleLabel = QtGui.QLabel(self.firlpfPage) + self.lpfPassBandRippleLabel.setObjectName("lpfPassBandRippleLabel") + self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel) + self.filterTypeWidget.addWidget(self.firlpfPage) + self.firbpfPage = QtGui.QWidget() + self.firbpfPage.setObjectName("firbpfPage") + self.formLayout_2 = QtGui.QFormLayout(self.firbpfPage) + self.formLayout_2.setObjectName("formLayout_2") + self.startofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage) + self.startofBpfPassBandLabel.setObjectName("startofBpfPassBandLabel") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel) + self.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage) + self.startofBpfPassBandEdit.setObjectName("startofBpfPassBandEdit") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit) + self.endofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage) + self.endofBpfPassBandLabel.setObjectName("endofBpfPassBandLabel") + self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel) + self.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage) + self.endofBpfPassBandEdit.setObjectName("endofBpfPassBandEdit") + self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit) + self.bpfStopBandAttenEdit = QtGui.QLineEdit(self.firbpfPage) + self.bpfStopBandAttenEdit.setObjectName("bpfStopBandAttenEdit") + self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit) + self.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage) + self.bpfStopBandAttenLabel.setObjectName("bpfStopBandAttenLabel") + self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel) + self.bpfTransitionLabel = QtGui.QLabel(self.firbpfPage) + self.bpfTransitionLabel.setObjectName("bpfTransitionLabel") + self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel) + self.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage) + self.bpfTransitionEdit.setObjectName("bpfTransitionEdit") + self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit) + self.bpfPassBandRippleEdit = QtGui.QLineEdit(self.firbpfPage) + self.bpfPassBandRippleEdit.setObjectName("bpfPassBandRippleEdit") + self.formLayout_2.setWidget(4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit) + self.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage) + self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel") + self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel) + self.filterTypeWidget.addWidget(self.firbpfPage) + self.firbnfPage = QtGui.QWidget() + self.firbnfPage.setObjectName("firbnfPage") + self.formLayout_5 = QtGui.QFormLayout(self.firbnfPage) + self.formLayout_5.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_5.setObjectName("formLayout_5") + self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) + self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel") + self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel) + self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage) + self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit") + self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit) + self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) + self.endofBnfStopBandLabel.setObjectName("endofBnfStopBandLabel") + self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel) + self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage) + self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit") + self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit) + self.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage) + self.bnfTransitionLabel.setObjectName("bnfTransitionLabel") + self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel) + self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage) + self.bnfTransitionEdit.setObjectName("bnfTransitionEdit") + self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit) + self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage) + self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel") + self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel) + self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage) + self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit") + self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit) + self.bnfPassBandRippleLabel = QtGui.QLabel(self.firbnfPage) + self.bnfPassBandRippleLabel.setObjectName("bnfPassBandRippleLabel") + self.formLayout_5.setWidget(4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel) + self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage) + self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit") + self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit) + self.filterTypeWidget.addWidget(self.firbnfPage) + self.firhpfPage = QtGui.QWidget() + self.firhpfPage.setObjectName("firhpfPage") + self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage) + self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_3.setObjectName("formLayout_3") + self.endofHpfStopBandLabel = QtGui.QLabel(self.firhpfPage) + self.endofHpfStopBandLabel.setObjectName("endofHpfStopBandLabel") + self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel) + self.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage) + self.endofHpfStopBandEdit.setObjectName("endofHpfStopBandEdit") + self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit) + self.startofHpfPassBandLabel = QtGui.QLabel(self.firhpfPage) + self.startofHpfPassBandLabel.setObjectName("startofHpfPassBandLabel") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel) + self.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage) + self.startofHpfPassBandEdit.setObjectName("startofHpfPassBandEdit") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit) + self.hpfStopBandAttenLabel = QtGui.QLabel(self.firhpfPage) + self.hpfStopBandAttenLabel.setObjectName("hpfStopBandAttenLabel") + self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel) + self.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage) + self.hpfStopBandAttenEdit.setObjectName("hpfStopBandAttenEdit") + self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit) + self.hpfPassBandRippleLabel = QtGui.QLabel(self.firhpfPage) + self.hpfPassBandRippleLabel.setObjectName("hpfPassBandRippleLabel") + self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel) + self.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage) + self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit") + self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit) + self.filterTypeWidget.addWidget(self.firhpfPage) + self.rrcPage = QtGui.QWidget() + self.rrcPage.setObjectName("rrcPage") + self.formLayout_6 = QtGui.QFormLayout(self.rrcPage) + self.formLayout_6.setObjectName("formLayout_6") + self.rrcSymbolRateLabel = QtGui.QLabel(self.rrcPage) + self.rrcSymbolRateLabel.setObjectName("rrcSymbolRateLabel") + self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel) + self.rrcAlphaLabel = QtGui.QLabel(self.rrcPage) + self.rrcAlphaLabel.setObjectName("rrcAlphaLabel") + self.formLayout_6.setWidget(1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel) + self.rrcNumTapsLabel = QtGui.QLabel(self.rrcPage) + self.rrcNumTapsLabel.setObjectName("rrcNumTapsLabel") + self.formLayout_6.setWidget(2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel) + self.rrcSymbolRateEdit = QtGui.QLineEdit(self.rrcPage) + self.rrcSymbolRateEdit.setObjectName("rrcSymbolRateEdit") + self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit) + self.rrcAlphaEdit = QtGui.QLineEdit(self.rrcPage) + self.rrcAlphaEdit.setObjectName("rrcAlphaEdit") + self.formLayout_6.setWidget(1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit) + self.rrcNumTapsEdit = QtGui.QLineEdit(self.rrcPage) + self.rrcNumTapsEdit.setObjectName("rrcNumTapsEdit") + self.formLayout_6.setWidget(2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit) + self.filterTypeWidget.addWidget(self.rrcPage) + self.gausPage = QtGui.QWidget() + self.gausPage.setObjectName("gausPage") + self.formLayout_7 = QtGui.QFormLayout(self.gausPage) + self.formLayout_7.setObjectName("formLayout_7") + self.gausSymbolRateLabel = QtGui.QLabel(self.gausPage) + self.gausSymbolRateLabel.setObjectName("gausSymbolRateLabel") + self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel) + self.gausSymbolRateEdit = QtGui.QLineEdit(self.gausPage) + self.gausSymbolRateEdit.setObjectName("gausSymbolRateEdit") + self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit) + self.gausBTLabel = QtGui.QLabel(self.gausPage) + self.gausBTLabel.setObjectName("gausBTLabel") + self.formLayout_7.setWidget(1, QtGui.QFormLayout.LabelRole, self.gausBTLabel) + self.gausBTEdit = QtGui.QLineEdit(self.gausPage) + self.gausBTEdit.setObjectName("gausBTEdit") + self.formLayout_7.setWidget(1, QtGui.QFormLayout.FieldRole, self.gausBTEdit) + self.gausNumTapsLabel = QtGui.QLabel(self.gausPage) + self.gausNumTapsLabel.setObjectName("gausNumTapsLabel") + self.formLayout_7.setWidget(2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel) + self.gausNumTapsEdit = QtGui.QLineEdit(self.gausPage) + self.gausNumTapsEdit.setObjectName("gausNumTapsEdit") + self.formLayout_7.setWidget(2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit) + self.filterTypeWidget.addWidget(self.gausPage) + self.verticalLayout.addWidget(self.filterTypeWidget) + self.filterPropsBox = QtGui.QGroupBox(self.filterFrame) + self.filterPropsBox.setObjectName("filterPropsBox") + self.formLayout_8 = QtGui.QFormLayout(self.filterPropsBox) + self.formLayout_8.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_8.setObjectName("formLayout_8") + self.nTapsLabel = QtGui.QLabel(self.filterPropsBox) + self.nTapsLabel.setMinimumSize(QtCore.QSize(150, 0)) + self.nTapsLabel.setObjectName("nTapsLabel") + self.formLayout_8.setWidget(1, QtGui.QFormLayout.LabelRole, self.nTapsLabel) + self.nTapsEdit = QtGui.QLabel(self.filterPropsBox) + self.nTapsEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.nTapsEdit.setFrameShape(QtGui.QFrame.Box) + self.nTapsEdit.setFrameShadow(QtGui.QFrame.Raised) + self.nTapsEdit.setObjectName("nTapsEdit") + self.formLayout_8.setWidget(1, QtGui.QFormLayout.FieldRole, self.nTapsEdit) + self.verticalLayout.addWidget(self.filterPropsBox) + self.sysParamsBox = QtGui.QGroupBox(self.filterFrame) + self.sysParamsBox.setObjectName("sysParamsBox") + self.formLayout_4 = QtGui.QFormLayout(self.sysParamsBox) + self.formLayout_4.setObjectName("formLayout_4") + self.nfftEdit = QtGui.QLineEdit(self.sysParamsBox) + self.nfftEdit.setObjectName("nfftEdit") + self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.nfftEdit) + self.nfftLabel = QtGui.QLabel(self.sysParamsBox) + self.nfftLabel.setMinimumSize(QtCore.QSize(150, 0)) + self.nfftLabel.setObjectName("nfftLabel") + self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.nfftLabel) + self.verticalLayout.addWidget(self.sysParamsBox) + self.designButton = QtGui.QPushButton(self.filterFrame) + self.designButton.setMinimumSize(QtCore.QSize(0, 0)) + self.designButton.setMaximumSize(QtCore.QSize(200, 16777215)) + self.designButton.setAutoDefault(True) + self.designButton.setDefault(True) + self.designButton.setObjectName("designButton") + self.verticalLayout.addWidget(self.designButton) + self.gridLayout.addWidget(self.filterFrame, 1, 0, 1, 1) + self.tabGroup = QtGui.QTabWidget(self.centralwidget) + self.tabGroup.setMinimumSize(QtCore.QSize(800, 0)) + self.tabGroup.setObjectName("tabGroup") + self.freqTab = QtGui.QWidget() + self.freqTab.setObjectName("freqTab") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.freqPlot = Qwt5.QwtPlot(self.freqTab) + self.freqPlot.setObjectName("freqPlot") + self.horizontalLayout_2.addWidget(self.freqPlot) + self.tabGroup.addTab(self.freqTab, "") + self.timeTab = QtGui.QWidget() + self.timeTab.setObjectName("timeTab") + self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab) + self.horizontalLayout.setObjectName("horizontalLayout") + self.timePlot = Qwt5.QwtPlot(self.timeTab) + self.timePlot.setObjectName("timePlot") + self.horizontalLayout.addWidget(self.timePlot) + self.tabGroup.addTab(self.timeTab, "") + self.phaseTab = QtGui.QWidget() + self.phaseTab.setObjectName("phaseTab") + self.horizontalLayout_3 = QtGui.QHBoxLayout(self.phaseTab) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.phasePlot = Qwt5.QwtPlot(self.phaseTab) + self.phasePlot.setObjectName("phasePlot") + self.horizontalLayout_3.addWidget(self.phasePlot) + self.tabGroup.addTab(self.phaseTab, "") + self.groupTab = QtGui.QWidget() + self.groupTab.setObjectName("groupTab") + self.horizontalLayout_4 = QtGui.QHBoxLayout(self.groupTab) + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.groupPlot = Qwt5.QwtPlot(self.groupTab) + self.groupPlot.setObjectName("groupPlot") + self.horizontalLayout_4.addWidget(self.groupPlot) + self.tabGroup.addTab(self.groupTab, "") + self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtGui.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 24)) + self.menubar.setObjectName("menubar") + self.menu_File = QtGui.QMenu(self.menubar) + self.menu_File.setObjectName("menu_File") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtGui.QStatusBar(MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + self.action_open = QtGui.QAction(MainWindow) + self.action_open.setObjectName("action_open") + self.action_exit = QtGui.QAction(MainWindow) + self.action_exit.setObjectName("action_exit") + self.menu_File.addAction(self.action_exit) + self.menubar.addAction(self.menu_File.menuAction()) + + self.retranslateUi(MainWindow) + self.filterTypeWidget.setCurrentIndex(0) + self.tabGroup.setCurrentIndex(0) + QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + MainWindow.setTabOrder(self.filterTypeComboBox, self.filterDesignTypeComboBox) + MainWindow.setTabOrder(self.filterDesignTypeComboBox, self.sampleRateEdit) + MainWindow.setTabOrder(self.sampleRateEdit, self.filterGainEdit) + MainWindow.setTabOrder(self.filterGainEdit, self.endofLpfPassBandEdit) + MainWindow.setTabOrder(self.endofLpfPassBandEdit, self.startofLpfStopBandEdit) + MainWindow.setTabOrder(self.startofLpfStopBandEdit, self.lpfStopBandAttenEdit) + MainWindow.setTabOrder(self.lpfStopBandAttenEdit, self.lpfPassBandRippleEdit) + MainWindow.setTabOrder(self.lpfPassBandRippleEdit, self.startofBpfPassBandEdit) + MainWindow.setTabOrder(self.startofBpfPassBandEdit, self.endofBpfPassBandEdit) + MainWindow.setTabOrder(self.endofBpfPassBandEdit, self.bpfTransitionEdit) + MainWindow.setTabOrder(self.bpfTransitionEdit, self.bpfStopBandAttenEdit) + MainWindow.setTabOrder(self.bpfStopBandAttenEdit, self.bpfPassBandRippleEdit) + MainWindow.setTabOrder(self.bpfPassBandRippleEdit, self.startofBnfStopBandEdit) + MainWindow.setTabOrder(self.startofBnfStopBandEdit, self.endofBnfStopBandEdit) + MainWindow.setTabOrder(self.endofBnfStopBandEdit, self.bnfTransitionEdit) + MainWindow.setTabOrder(self.bnfTransitionEdit, self.bnfStopBandAttenEdit) + MainWindow.setTabOrder(self.bnfStopBandAttenEdit, self.bnfPassBandRippleEdit) + MainWindow.setTabOrder(self.bnfPassBandRippleEdit, self.endofHpfStopBandEdit) + MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit) + MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit) + MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit) + MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit) + MainWindow.setTabOrder(self.rrcSymbolRateEdit, self.rrcAlphaEdit) + MainWindow.setTabOrder(self.rrcAlphaEdit, self.rrcNumTapsEdit) + MainWindow.setTabOrder(self.rrcNumTapsEdit, self.gausSymbolRateEdit) + MainWindow.setTabOrder(self.gausSymbolRateEdit, self.gausBTEdit) + MainWindow.setTabOrder(self.gausBTEdit, self.gausNumTapsEdit) + MainWindow.setTabOrder(self.gausNumTapsEdit, self.nfftEdit) + MainWindow.setTabOrder(self.nfftEdit, self.designButton) + MainWindow.setTabOrder(self.designButton, self.tabGroup) + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "GNU Radio Filter Design Tool", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Low Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Band Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Complex Band Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Band Notch", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "High Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Root Raised Cosine", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Gaussian", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Hamming Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Hann Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Blackman Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Rectangular Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "Kaiser Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Blackman-harris Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Equiripple", None, QtGui.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.filterGainLabel.setText(QtGui.QApplication.translate("MainWindow", "Filter Gain", None, QtGui.QApplication.UnicodeUTF8)) + self.endofLpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofLpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.lpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.lpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofHpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofHpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.hpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.hpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcAlphaLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) + self.gausSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.gausBTLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) + self.gausNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) + self.filterPropsBox.setTitle(QtGui.QApplication.translate("MainWindow", "Filter Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.nTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps:", None, QtGui.QApplication.UnicodeUTF8)) + self.sysParamsBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.nfftLabel.setText(QtGui.QApplication.translate("MainWindow", "Num FFT points", None, QtGui.QApplication.UnicodeUTF8)) + self.designButton.setText(QtGui.QApplication.translate("MainWindow", "Design", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.phaseTab), QtGui.QApplication.translate("MainWindow", "Phase", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.groupTab), QtGui.QApplication.translate("MainWindow", "Group Delay", None, QtGui.QApplication.UnicodeUTF8)) + self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) + self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8)) + self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) + self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) + +from PyQt4 import Qwt5 diff --git a/gr-utils/src/python/pyqt_filter.ui b/gr-utils/src/python/pyqt_filter.ui new file mode 100644 index 000000000..9b31112e8 --- /dev/null +++ b/gr-utils/src/python/pyqt_filter.ui @@ -0,0 +1,676 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>1124</width> + <height>696</height> + </rect> + </property> + <property name="windowTitle" > + <string>GNU Radio Filter Design Tool</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QGridLayout" name="gridLayout" > + <item row="1" column="0" > + <widget class="QFrame" name="filterFrame" > + <property name="minimumSize" > + <size> + <width>300</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>300</width> + <height>16777215</height> + </size> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="QComboBox" name="filterTypeComboBox" > + <item> + <property name="text" > + <string>Low Pass</string> + </property> + </item> + <item> + <property name="text" > + <string>Band Pass</string> + </property> + </item> + <item> + <property name="text" > + <string>Complex Band Pass</string> + </property> + </item> + <item> + <property name="text" > + <string>Band Notch</string> + </property> + </item> + <item> + <property name="text" > + <string>High Pass</string> + </property> + </item> + <item> + <property name="text" > + <string>Root Raised Cosine</string> + </property> + </item> + <item> + <property name="text" > + <string>Gaussian</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QComboBox" name="filterDesignTypeComboBox" > + <item> + <property name="text" > + <string>Hamming Window</string> + </property> + </item> + <item> + <property name="text" > + <string>Hann Window</string> + </property> + </item> + <item> + <property name="text" > + <string>Blackman Window</string> + </property> + </item> + <item> + <property name="text" > + <string>Rectangular Window</string> + </property> + </item> + <item> + <property name="text" > + <string>Kaiser Window</string> + </property> + </item> + <item> + <property name="text" > + <string>Blackman-harris Window</string> + </property> + </item> + <item> + <property name="text" > + <string>Equiripple</string> + </property> + </item> + </widget> + </item> + <item> + <layout class="QFormLayout" name="globalParamsLayout" > + <property name="fieldGrowthPolicy" > + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="sampleRateLabel" > + <property name="maximumSize" > + <size> + <width>16777215</width> + <height>30</height> + </size> + </property> + <property name="text" > + <string>Sample Rate (sps)</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="sampleRateEdit" > + <property name="maximumSize" > + <size> + <width>16777215</width> + <height>30</height> + </size> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="filterGainLabel" > + <property name="text" > + <string>Filter Gain</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="filterGainEdit" /> + </item> + </layout> + </item> + <item> + <widget class="QStackedWidget" name="filterTypeWidget" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="firlpfPage" > + <layout class="QFormLayout" name="formLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="endofLpfPassBandLabel" > + <property name="text" > + <string>End of Pass Band (Hz)</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="endofLpfPassBandEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="startofLpfStopBandLabel" > + <property name="text" > + <string>Start of Stop Band (Hz)</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="startofLpfStopBandEdit" /> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="lpfStopBandAttenLabel" > + <property name="text" > + <string>Stop Band Attenuation (dB)</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="lpfStopBandAttenEdit" /> + </item> + <item row="3" column="1" > + <widget class="QLineEdit" name="lpfPassBandRippleEdit" /> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="lpfPassBandRippleLabel" > + <property name="text" > + <string>Pass Band Ripple (dB)</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="firbpfPage" > + <layout class="QFormLayout" name="formLayout_2" > + <item row="0" column="0" > + <widget class="QLabel" name="startofBpfPassBandLabel" > + <property name="text" > + <string>Start of Pass Band (Hz)</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="startofBpfPassBandEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="endofBpfPassBandLabel" > + <property name="text" > + <string>End of Pass Band (Hz)</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="endofBpfPassBandEdit" /> + </item> + <item row="3" column="1" > + <widget class="QLineEdit" name="bpfStopBandAttenEdit" /> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="bpfStopBandAttenLabel" > + <property name="text" > + <string>Stop Band Attenuation (dB)</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="bpfTransitionLabel" > + <property name="text" > + <string>Transition Width (Hz)</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="bpfTransitionEdit" /> + </item> + <item row="4" column="1" > + <widget class="QLineEdit" name="bpfPassBandRippleEdit" /> + </item> + <item row="4" column="0" > + <widget class="QLabel" name="bpfPassBandRippleLabel" > + <property name="text" > + <string>Pass Band Ripple (dB)</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="firbnfPage" > + <layout class="QFormLayout" name="formLayout_5" > + <property name="fieldGrowthPolicy" > + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="startofBnfStopBandLabel" > + <property name="text" > + <string>Start of Stop Band (Hz)</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="startofBnfStopBandEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="endofBnfStopBandLabel" > + <property name="text" > + <string>End of Stop Band (Hz)</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="endofBnfStopBandEdit" /> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="bnfTransitionLabel" > + <property name="text" > + <string>Transition Width (Hz)</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="bnfTransitionEdit" /> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="bnfStopBandAttenLabel" > + <property name="text" > + <string>Stop Band Attenuation (dB)</string> + </property> + </widget> + </item> + <item row="3" column="1" > + <widget class="QLineEdit" name="bnfStopBandAttenEdit" /> + </item> + <item row="4" column="0" > + <widget class="QLabel" name="bnfPassBandRippleLabel" > + <property name="text" > + <string>Pass Band Ripple (dB)</string> + </property> + </widget> + </item> + <item row="4" column="1" > + <widget class="QLineEdit" name="bnfPassBandRippleEdit" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="firhpfPage" > + <layout class="QFormLayout" name="formLayout_3" > + <property name="fieldGrowthPolicy" > + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="endofHpfStopBandLabel" > + <property name="text" > + <string>End of Stop Band (Hz)</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="endofHpfStopBandEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="startofHpfPassBandLabel" > + <property name="text" > + <string>Start of Pass Band (Hz)</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="startofHpfPassBandEdit" /> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="hpfStopBandAttenLabel" > + <property name="text" > + <string>Stop Band Attenuation (dB)</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="hpfStopBandAttenEdit" /> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="hpfPassBandRippleLabel" > + <property name="text" > + <string>Pass Band Ripple (dB)</string> + </property> + </widget> + </item> + <item row="3" column="1" > + <widget class="QLineEdit" name="hpfPassBandRippleEdit" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="rrcPage" > + <layout class="QFormLayout" name="formLayout_6" > + <item row="0" column="0" > + <widget class="QLabel" name="rrcSymbolRateLabel" > + <property name="text" > + <string>Symbol Rate (sps)</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="rrcAlphaLabel" > + <property name="text" > + <string>Roll-off Factor</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="rrcNumTapsLabel" > + <property name="text" > + <string>Number of Taps</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="rrcSymbolRateEdit" /> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="rrcAlphaEdit" /> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="rrcNumTapsEdit" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="gausPage" > + <layout class="QFormLayout" name="formLayout_7" > + <item row="0" column="0" > + <widget class="QLabel" name="gausSymbolRateLabel" > + <property name="text" > + <string>Symbol Rate (sps)</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="gausSymbolRateEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="gausBTLabel" > + <property name="text" > + <string>Roll-off Factor</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="gausBTEdit" /> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="gausNumTapsLabel" > + <property name="text" > + <string>Number of Taps</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="gausNumTapsEdit" /> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="QGroupBox" name="filterPropsBox" > + <property name="title" > + <string>Filter Properties</string> + </property> + <layout class="QFormLayout" name="formLayout_8" > + <property name="fieldGrowthPolicy" > + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="1" column="0" > + <widget class="QLabel" name="nTapsLabel" > + <property name="minimumSize" > + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text" > + <string>Number of Taps:</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLabel" name="nTapsEdit" > + <property name="maximumSize" > + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="frameShape" > + <enum>QFrame::Box</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <property name="text" > + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="sysParamsBox" > + <property name="title" > + <string>System Parameters</string> + </property> + <layout class="QFormLayout" name="formLayout_4" > + <item row="1" column="1" > + <widget class="QLineEdit" name="nfftEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="nfftLabel" > + <property name="minimumSize" > + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text" > + <string>Num FFT points</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QPushButton" name="designButton" > + <property name="minimumSize" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>200</width> + <height>16777215</height> + </size> + </property> + <property name="text" > + <string>Design</string> + </property> + <property name="autoDefault" > + <bool>true</bool> + </property> + <property name="default" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="1" > + <widget class="QTabWidget" name="tabGroup" > + <property name="minimumSize" > + <size> + <width>800</width> + <height>0</height> + </size> + </property> + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="freqTab" > + <attribute name="title" > + <string>Frequency Domain</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_2" > + <item> + <widget class="QwtPlot" name="freqPlot" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="timeTab" > + <attribute name="title" > + <string>Time Domain</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout" > + <item> + <widget class="QwtPlot" name="timePlot" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="phaseTab" > + <attribute name="title" > + <string>Phase</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_3" > + <item> + <widget class="QwtPlot" name="phasePlot" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="groupTab" > + <attribute name="title" > + <string>Group Delay</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_4" > + <item> + <widget class="QwtPlot" name="groupPlot" /> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>1124</width> + <height>24</height> + </rect> + </property> + <widget class="QMenu" name="menu_File" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="action_exit" /> + </widget> + <addaction name="menu_File" /> + </widget> + <widget class="QStatusBar" name="statusbar" /> + <action name="action_open" > + <property name="text" > + <string>&Open</string> + </property> + <property name="shortcut" > + <string>Ctrl+O</string> + </property> + </action> + <action name="action_exit" > + <property name="text" > + <string>E&xit</string> + </property> + </action> + </widget> + <customwidgets> + <customwidget> + <class>QwtPlot</class> + <extends>QFrame</extends> + <header>qwt_plot.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>filterTypeComboBox</tabstop> + <tabstop>filterDesignTypeComboBox</tabstop> + <tabstop>sampleRateEdit</tabstop> + <tabstop>filterGainEdit</tabstop> + <tabstop>endofLpfPassBandEdit</tabstop> + <tabstop>startofLpfStopBandEdit</tabstop> + <tabstop>lpfStopBandAttenEdit</tabstop> + <tabstop>lpfPassBandRippleEdit</tabstop> + <tabstop>startofBpfPassBandEdit</tabstop> + <tabstop>endofBpfPassBandEdit</tabstop> + <tabstop>bpfTransitionEdit</tabstop> + <tabstop>bpfStopBandAttenEdit</tabstop> + <tabstop>bpfPassBandRippleEdit</tabstop> + <tabstop>startofBnfStopBandEdit</tabstop> + <tabstop>endofBnfStopBandEdit</tabstop> + <tabstop>bnfTransitionEdit</tabstop> + <tabstop>bnfStopBandAttenEdit</tabstop> + <tabstop>bnfPassBandRippleEdit</tabstop> + <tabstop>endofHpfStopBandEdit</tabstop> + <tabstop>startofHpfPassBandEdit</tabstop> + <tabstop>hpfStopBandAttenEdit</tabstop> + <tabstop>hpfPassBandRippleEdit</tabstop> + <tabstop>rrcSymbolRateEdit</tabstop> + <tabstop>rrcAlphaEdit</tabstop> + <tabstop>rrcNumTapsEdit</tabstop> + <tabstop>gausSymbolRateEdit</tabstop> + <tabstop>gausBTEdit</tabstop> + <tabstop>gausNumTapsEdit</tabstop> + <tabstop>nfftEdit</tabstop> + <tabstop>designButton</tabstop> + <tabstop>tabGroup</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>action_exit</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel" > + <x>399</x> + <y>347</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/gr-utils/src/python/pyqt_plot.py b/gr-utils/src/python/pyqt_plot.py new file mode 100644 index 000000000..74c43c3eb --- /dev/null +++ b/gr-utils/src/python/pyqt_plot.py @@ -0,0 +1,206 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'pyqt_plot.ui' +# +# Created: Tue Aug 25 18:18:14 2009 +# by: PyQt4 UI code generator 4.4.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(927, 696) + self.centralwidget = QtGui.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout = QtGui.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.plotHBar = QtGui.QScrollBar(self.centralwidget) + self.plotHBar.setOrientation(QtCore.Qt.Horizontal) + self.plotHBar.setObjectName("plotHBar") + self.gridLayout.addWidget(self.plotHBar, 2, 0, 1, 2) + self.tabGroup = QtGui.QTabWidget(self.centralwidget) + self.tabGroup.setObjectName("tabGroup") + self.timeTab = QtGui.QWidget() + self.timeTab.setObjectName("timeTab") + self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab) + self.horizontalLayout.setObjectName("horizontalLayout") + self.timePlot = Qwt5.QwtPlot(self.timeTab) + self.timePlot.setObjectName("timePlot") + self.horizontalLayout.addWidget(self.timePlot) + self.tabGroup.addTab(self.timeTab, "") + self.freqTab = QtGui.QWidget() + self.freqTab.setObjectName("freqTab") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.fftPropBox = QtGui.QGroupBox(self.freqTab) + self.fftPropBox.setMinimumSize(QtCore.QSize(160, 0)) + self.fftPropBox.setObjectName("fftPropBox") + self.formLayout_4 = QtGui.QFormLayout(self.fftPropBox) + self.formLayout_4.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_4.setObjectName("formLayout_4") + self.psdFFTComboBox = QtGui.QComboBox(self.fftPropBox) + self.psdFFTComboBox.setMinimumSize(QtCore.QSize(96, 0)) + self.psdFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215)) + self.psdFFTComboBox.setObjectName("psdFFTComboBox") + self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.psdFFTComboBox) + self.psdFFTSizeLabel = QtGui.QLabel(self.fftPropBox) + self.psdFFTSizeLabel.setObjectName("psdFFTSizeLabel") + self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.psdFFTSizeLabel) + self.horizontalLayout_2.addWidget(self.fftPropBox) + self.freqPlot = Qwt5.QwtPlot(self.freqTab) + self.freqPlot.setObjectName("freqPlot") + self.horizontalLayout_2.addWidget(self.freqPlot) + self.tabGroup.addTab(self.freqTab, "") + self.specTab = QtGui.QWidget() + self.specTab.setObjectName("specTab") + self.horizontalLayout_3 = QtGui.QHBoxLayout(self.specTab) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.groupBox = QtGui.QGroupBox(self.specTab) + self.groupBox.setObjectName("groupBox") + self.formLayout_3 = QtGui.QFormLayout(self.groupBox) + self.formLayout_3.setObjectName("formLayout_3") + self.specFFTLabel = QtGui.QLabel(self.groupBox) + self.specFFTLabel.setObjectName("specFFTLabel") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.specFFTLabel) + self.specFFTComboBox = QtGui.QComboBox(self.groupBox) + self.specFFTComboBox.setMinimumSize(QtCore.QSize(96, 0)) + self.specFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215)) + self.specFFTComboBox.setObjectName("specFFTComboBox") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.specFFTComboBox) + self.horizontalLayout_3.addWidget(self.groupBox) + self.specPlot = Qwt5.QwtPlot(self.specTab) + self.specPlot.setObjectName("specPlot") + self.horizontalLayout_3.addWidget(self.specPlot) + self.tabGroup.addTab(self.specTab, "") + self.gridLayout.addWidget(self.tabGroup, 1, 0, 1, 1) + self.filePosBox = QtGui.QGroupBox(self.centralwidget) + self.filePosBox.setMinimumSize(QtCore.QSize(0, 120)) + self.filePosBox.setObjectName("filePosBox") + self.formLayoutWidget_2 = QtGui.QWidget(self.filePosBox) + self.formLayoutWidget_2.setGeometry(QtCore.QRect(0, 20, 160, 92)) + self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") + self.filePosLayout = QtGui.QFormLayout(self.formLayoutWidget_2) + self.filePosLayout.setObjectName("filePosLayout") + self.filePosStartLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.filePosStartLabel.setObjectName("filePosStartLabel") + self.filePosLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel) + self.filePosStartLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.filePosStartLineEdit.setObjectName("filePosStartLineEdit") + self.filePosLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit) + self.filePosStopLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.filePosStopLabel.setObjectName("filePosStopLabel") + self.filePosLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel) + self.filePosStopLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.filePosStopLineEdit.setObjectName("filePosStopLineEdit") + self.filePosLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit) + self.filePosLengthLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.filePosLengthLabel.setObjectName("filePosLengthLabel") + self.filePosLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel) + self.filePosLengthLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.filePosLengthLineEdit.setObjectName("filePosLengthLineEdit") + self.filePosLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit) + self.formLayoutWidget_4 = QtGui.QWidget(self.filePosBox) + self.formLayoutWidget_4.setGeometry(QtCore.QRect(180, 20, 231, 92)) + self.formLayoutWidget_4.setObjectName("formLayoutWidget_4") + self.fileTimeLayout = QtGui.QFormLayout(self.formLayoutWidget_4) + self.fileTimeLayout.setObjectName("fileTimeLayout") + self.fileTimeStartLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.fileTimeStartLabel.setObjectName("fileTimeStartLabel") + self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel) + self.fileTimeStartLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.fileTimeStartLineEdit.setObjectName("fileTimeStartLineEdit") + self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit) + self.fileTimeStopLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.fileTimeStopLabel.setObjectName("fileTimeStopLabel") + self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel) + self.fileTimeStopLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.fileTimeStopLineEdit.setObjectName("fileTimeStopLineEdit") + self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit) + self.fileTimeLengthLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.fileTimeLengthLabel.setObjectName("fileTimeLengthLabel") + self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel) + self.fileTimeLengthLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.fileTimeLengthLineEdit.setObjectName("fileTimeLengthLineEdit") + self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit) + self.sysGroupBox = QtGui.QGroupBox(self.filePosBox) + self.sysGroupBox.setGeometry(QtCore.QRect(530, 0, 200, 120)) + self.sysGroupBox.setMinimumSize(QtCore.QSize(200, 0)) + self.sysGroupBox.setObjectName("sysGroupBox") + self.formLayoutWidget_3 = QtGui.QWidget(self.sysGroupBox) + self.formLayoutWidget_3.setGeometry(QtCore.QRect(0, 20, 191, 91)) + self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") + self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_3) + self.formLayout_2.setObjectName("formLayout_2") + self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget_3) + self.sampleRateLabel.setObjectName("sampleRateLabel") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.sampleRateLineEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.sampleRateLineEdit.setMinimumSize(QtCore.QSize(0, 0)) + self.sampleRateLineEdit.setObjectName("sampleRateLineEdit") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit) + self.displayGroupBox = QtGui.QGroupBox(self.filePosBox) + self.displayGroupBox.setGeometry(QtCore.QRect(730, 0, 170, 120)) + self.displayGroupBox.setMinimumSize(QtCore.QSize(170, 0)) + self.displayGroupBox.setObjectName("displayGroupBox") + self.verticalLayoutWidget = QtGui.QWidget(self.displayGroupBox) + self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 20, 160, 91)) + self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") + self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget) + self.verticalLayout.setObjectName("verticalLayout") + self.colorComboBox = QtGui.QComboBox(self.verticalLayoutWidget) + self.colorComboBox.setObjectName("colorComboBox") + self.verticalLayout.addWidget(self.colorComboBox) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout.addItem(spacerItem) + self.gridLayout.addWidget(self.filePosBox, 3, 0, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtGui.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 927, 24)) + self.menubar.setObjectName("menubar") + self.menu_File = QtGui.QMenu(self.menubar) + self.menu_File.setObjectName("menu_File") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtGui.QStatusBar(MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + self.action_open = QtGui.QAction(MainWindow) + self.action_open.setObjectName("action_open") + self.action_exit = QtGui.QAction(MainWindow) + self.action_exit.setObjectName("action_exit") + self.menu_File.addAction(self.action_open) + self.menu_File.addAction(self.action_exit) + self.menubar.addAction(self.menu_File.menuAction()) + + self.retranslateUi(MainWindow) + self.tabGroup.setCurrentIndex(0) + QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.fftPropBox.setTitle(QtGui.QApplication.translate("MainWindow", "FFT Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.psdFFTSizeLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Spectrogram Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.specFFTLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.specTab), QtGui.QApplication.translate("MainWindow", "Spectrogram", None, QtGui.QApplication.UnicodeUTF8)) + self.filePosBox.setTitle(QtGui.QApplication.translate("MainWindow", "File Position", None, QtGui.QApplication.UnicodeUTF8)) + self.filePosStartLabel.setText(QtGui.QApplication.translate("MainWindow", "Start", None, QtGui.QApplication.UnicodeUTF8)) + self.filePosStopLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop", None, QtGui.QApplication.UnicodeUTF8)) + self.filePosLengthLabel.setText(QtGui.QApplication.translate("MainWindow", "Length", None, QtGui.QApplication.UnicodeUTF8)) + self.fileTimeStartLabel.setText(QtGui.QApplication.translate("MainWindow", "time start (sec)", None, QtGui.QApplication.UnicodeUTF8)) + self.fileTimeStopLabel.setText(QtGui.QApplication.translate("MainWindow", "time stop (sec)", None, QtGui.QApplication.UnicodeUTF8)) + self.fileTimeLengthLabel.setText(QtGui.QApplication.translate("MainWindow", "time length (sec)", None, QtGui.QApplication.UnicodeUTF8)) + self.sysGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate", None, QtGui.QApplication.UnicodeUTF8)) + self.displayGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Display Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) + self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8)) + self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) + self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) + +from PyQt4 import Qwt5 diff --git a/gr-utils/src/python/pyqt_plot.ui b/gr-utils/src/python/pyqt_plot.ui new file mode 100644 index 000000000..19a62adf5 --- /dev/null +++ b/gr-utils/src/python/pyqt_plot.ui @@ -0,0 +1,389 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>927</width> + <height>696</height> + </rect> + </property> + <property name="windowTitle" > + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QGridLayout" name="gridLayout" > + <item row="2" column="0" colspan="2" > + <widget class="QScrollBar" name="plotHBar" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QTabWidget" name="tabGroup" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="timeTab" > + <attribute name="title" > + <string>Time Domain</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout" > + <item> + <widget class="QwtPlot" name="timePlot" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="freqTab" > + <attribute name="title" > + <string>Frequency Domain</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_2" > + <item> + <widget class="QGroupBox" name="fftPropBox" > + <property name="minimumSize" > + <size> + <width>160</width> + <height>0</height> + </size> + </property> + <property name="title" > + <string>FFT Properties</string> + </property> + <layout class="QFormLayout" name="formLayout_4" > + <property name="fieldGrowthPolicy" > + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="1" > + <widget class="QComboBox" name="psdFFTComboBox" > + <property name="minimumSize" > + <size> + <width>96</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>96</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="psdFFTSizeLabel" > + <property name="text" > + <string>FFT Size</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QwtPlot" name="freqPlot" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="specTab" > + <attribute name="title" > + <string>Spectrogram</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_3" > + <item> + <widget class="QGroupBox" name="groupBox" > + <property name="title" > + <string>Spectrogram Properties</string> + </property> + <layout class="QFormLayout" name="formLayout_3" > + <item row="1" column="0" > + <widget class="QLabel" name="specFFTLabel" > + <property name="text" > + <string>FFT Size</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QComboBox" name="specFFTComboBox" > + <property name="minimumSize" > + <size> + <width>96</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>96</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QwtPlot" name="specPlot" /> + </item> + </layout> + <zorder>specPlot</zorder> + <zorder>groupBox</zorder> + </widget> + </widget> + </item> + <item row="3" column="0" > + <widget class="QGroupBox" name="filePosBox" > + <property name="minimumSize" > + <size> + <width>0</width> + <height>120</height> + </size> + </property> + <property name="title" > + <string>File Position</string> + </property> + <widget class="QWidget" name="formLayoutWidget_2" > + <property name="geometry" > + <rect> + <x>0</x> + <y>20</y> + <width>160</width> + <height>92</height> + </rect> + </property> + <layout class="QFormLayout" name="filePosLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="filePosStartLabel" > + <property name="text" > + <string>Start</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="filePosStartLineEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="filePosStopLabel" > + <property name="text" > + <string>Stop</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="filePosStopLineEdit" /> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="filePosLengthLabel" > + <property name="text" > + <string>Length</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="filePosLengthLineEdit" /> + </item> + </layout> + </widget> + <widget class="QWidget" name="formLayoutWidget_4" > + <property name="geometry" > + <rect> + <x>180</x> + <y>20</y> + <width>231</width> + <height>92</height> + </rect> + </property> + <layout class="QFormLayout" name="fileTimeLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="fileTimeStartLabel" > + <property name="text" > + <string>time start (sec)</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="fileTimeStartLineEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="fileTimeStopLabel" > + <property name="text" > + <string>time stop (sec)</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="fileTimeStopLineEdit" /> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="fileTimeLengthLabel" > + <property name="text" > + <string>time length (sec)</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="fileTimeLengthLineEdit" /> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="sysGroupBox" > + <property name="geometry" > + <rect> + <x>530</x> + <y>0</y> + <width>200</width> + <height>120</height> + </rect> + </property> + <property name="minimumSize" > + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="title" > + <string>System Properties</string> + </property> + <widget class="QWidget" name="formLayoutWidget_3" > + <property name="geometry" > + <rect> + <x>0</x> + <y>20</y> + <width>191</width> + <height>91</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout_2" > + <item row="0" column="0" > + <widget class="QLabel" name="sampleRateLabel" > + <property name="text" > + <string>Sample Rate</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="sampleRateLineEdit" > + <property name="minimumSize" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QGroupBox" name="displayGroupBox" > + <property name="geometry" > + <rect> + <x>730</x> + <y>0</y> + <width>170</width> + <height>120</height> + </rect> + </property> + <property name="minimumSize" > + <size> + <width>170</width> + <height>0</height> + </size> + </property> + <property name="title" > + <string>Display Properties</string> + </property> + <widget class="QWidget" name="verticalLayoutWidget" > + <property name="geometry" > + <rect> + <x>0</x> + <y>20</y> + <width>160</width> + <height>91</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="QComboBox" name="colorComboBox" /> + </item> + <item> + <spacer name="verticalSpacer" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>927</width> + <height>24</height> + </rect> + </property> + <widget class="QMenu" name="menu_File" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="action_open" /> + <addaction name="action_exit" /> + </widget> + <addaction name="menu_File" /> + </widget> + <widget class="QStatusBar" name="statusbar" /> + <action name="action_open" > + <property name="text" > + <string>&Open</string> + </property> + <property name="shortcut" > + <string>Ctrl+O</string> + </property> + </action> + <action name="action_exit" > + <property name="text" > + <string>E&xit</string> + </property> + </action> + </widget> + <customwidgets> + <customwidget> + <class>QwtPlot</class> + <extends>QFrame</extends> + <header>qwt_plot.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections> + <connection> + <sender>action_exit</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel" > + <x>399</x> + <y>347</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am index fbd8f4bb4..caae6ce75 100644 --- a/grc/blocks/Makefile.am +++ b/grc/blocks/Makefile.am @@ -45,6 +45,7 @@ dist_ourdata_DATA = \ blks2_ofdm_mod.xml \ blks2_packet_decoder.xml \ blks2_packet_encoder.xml \ + blks2_pfb_arb_resampler.xml \ blks2_qamx_demod.xml \ blks2_qamx_mod.xml \ blks2_rational_resampler_xxx.xml \ diff --git a/grc/blocks/blks2_pfb_arb_resampler.xml b/grc/blocks/blks2_pfb_arb_resampler.xml new file mode 100644 index 000000000..062b0dd98 --- /dev/null +++ b/grc/blocks/blks2_pfb_arb_resampler.xml @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Polyphase Arbitrary Resampler +################################################### + --> +<block> + <name>Polyphase Resampler</name> + <key>blks2_pfb_arb_resampler_ccf</key> + <import>from gnuradio import blks2</import> + <import>from gnuradio.gr import firdes</import> + <make>blks2.pfb_arb_resampler_ccf( + $rate, + $taps, + $size, +)</make> + <callback>set_taps($taps)</callback> + <param> + <name>Resample Rate</name> + <key>rate</key> + <type>real</type> + </param> + <param> + <name>Taps</name> + <key>taps</key> + <type>real_vector</type> + </param> + <param> + <name>Size (# phases)</name> + <key>size</key> + <value>32</value> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>complex</type> + </sink> + <source> + <name>out</name> + <type>complex</type> + </source> +</block> diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 2cedb45a2..5b45466f5 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -176,6 +176,8 @@ <!-- Filter banks --> <block>blks2_synthesis_filterbank</block> <block>blks2_analysis_filterbank</block> + <!-- Polyphase filers --> + <block>blks2_pfb_arb_resampler_ccf</block> <!-- Other filters --> <block>gr_single_pole_iir_filter_xx</block> <block>gr_hilbert_fc</block> diff --git a/gruel/src/include/gruel/Makefile.am b/gruel/src/include/gruel/Makefile.am index 9f50cb619..67dd12995 100644 --- a/gruel/src/include/gruel/Makefile.am +++ b/gruel/src/include/gruel/Makefile.am @@ -31,11 +31,12 @@ gruelinclude_HEADERS = \ msg_accepter.h \ msg_accepter_msgq.h \ msg_queue.h \ + msg_passing.h \ pmt.h \ pmt_pool.h \ pmt_serial_tags.h \ + pmt_sugar.h \ realtime.h \ - send.h \ sys_pri.h \ thread_body_wrapper.h \ thread_group.h \ diff --git a/gruel/src/include/gruel/msg_accepter.h b/gruel/src/include/gruel/msg_accepter.h index 3afd6dde0..70ac846f5 100644 --- a/gruel/src/include/gruel/msg_accepter.h +++ b/gruel/src/include/gruel/msg_accepter.h @@ -22,6 +22,7 @@ #define INCLUDED_GRUEL_MSG_ACCEPTER_H #include <gruel/pmt.h> +#include <boost/shared_ptr.hpp> namespace gruel { @@ -44,6 +45,8 @@ namespace gruel { virtual void post(pmt::pmt_t msg) = 0; }; + typedef boost::shared_ptr<msg_accepter> msg_accepter_sptr; + } /* namespace gruel */ #endif /* INCLUDED_GRUEL_MSG_ACCEPTER_H */ diff --git a/gruel/src/include/gruel/msg_passing.h b/gruel/src/include/gruel/msg_passing.h new file mode 100644 index 000000000..ebbeca815 --- /dev/null +++ b/gruel/src/include/gruel/msg_passing.h @@ -0,0 +1,111 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#ifndef INCLUDED_GRUEL_MSG_PASSING_H +#define INCLUDED_GRUEL_MSG_PASSING_H + +/*! + * \brief Include this header to use the message passing features + */ + +#include <gruel/pmt.h> +#include <gruel/msg_accepter.h> + + +namespace gruel { + + /*! + * \brief send message to msg_accepter + * + * \param accepter is the target of the send. + * \param msg is the message to send. It's usually a pmt tuple. + * + * Sending a message is an asynchronous operation. The \p send + * call will not wait for the message either to arrive at the + * destination or to be received. + * + * \returns msg + */ + static inline pmt::pmt_t + send(msg_accepter_sptr accepter, const pmt::pmt_t &msg) + { + accepter->post(msg); + return msg; + } + + /*! + * \brief send message to msg_accepter + * + * \param accepter is the target of the send. + * \param msg is the message to send. It's usually a pmt tuple. + * + * Sending a message is an asynchronous operation. The \p send + * call will not wait for the message either to arrive at the + * destination or to be received. + * + * \returns msg + */ + static inline pmt::pmt_t + send(msg_accepter *accepter, const pmt::pmt_t &msg) + { + accepter->post(msg); + return msg; + } + + /*! + * \brief send message to msg_accepter + * + * \param accepter is the target of the send. + * \param msg is the message to send. It's usually a pmt tuple. + * + * Sending a message is an asynchronous operation. The \p send + * call will not wait for the message either to arrive at the + * destination or to be received. + * + * \returns msg + */ + static inline pmt::pmt_t + send(msg_accepter &accepter, const pmt::pmt_t &msg) + { + accepter.post(msg); + return msg; + } + + /*! + * \brief send message to msg_accepter + * + * \param accepter is the target of the send. precond: pmt_is_msg_accepter(accepter) + * \param msg is the message to send. It's usually a pmt tuple. + * + * Sending a message is an asynchronous operation. The \p send + * call will not wait for the message either to arrive at the + * destination or to be received. + * + * \returns msg + */ + static inline pmt::pmt_t + send(pmt::pmt_t accepter, const pmt::pmt_t &msg) + { + return send(pmt_msg_accepter_ref(accepter), msg); + } + +} /* namespace gruel */ + +#endif /* INCLUDED_GRUEL_MSG_PASSING_H */ diff --git a/gruel/src/include/gruel/pmt.h b/gruel/src/include/gruel/pmt.h index 240359301..3188aad1d 100644 --- a/gruel/src/include/gruel/pmt.h +++ b/gruel/src/include/gruel/pmt.h @@ -24,6 +24,7 @@ #define INCLUDED_PMT_H #include <boost/intrusive_ptr.hpp> +#include <boost/shared_ptr.hpp> #include <boost/any.hpp> #include <complex> #include <string> @@ -31,6 +32,10 @@ #include <iosfwd> #include <stdexcept> +namespace gruel { + class msg_accepter; +}; + /*! * This file defines a polymorphic type and the operations on it. * @@ -299,6 +304,33 @@ void pmt_vector_set(pmt_t vector, size_t k, pmt_t obj); //! Store \p fill in every position of \p vector void pmt_vector_fill(pmt_t vector, pmt_t fill); +/* + * ------------------------------------------------------------------------ + * Binary Large Objects (BLOBs) + * + * Handy for passing around uninterpreted chunks of memory. + * ------------------------------------------------------------------------ + */ + +//! Return true if \p x is a blob, othewise false. +bool pmt_is_blob(pmt_t x); + +/*! + * \brief Make a blob given a pointer and length in bytes + * + * \param buf is the pointer to data to use to create blob + * \param len is the size of the data in bytes. + * + * The data is copied into the blob. + */ +pmt_t pmt_make_blob(const void *buf, size_t len); + +//! Return a pointer to the blob's data +const void *pmt_blob_data(pmt_t blob); + +//! Return the blob's length in bytes +size_t pmt_blob_length(pmt_t blob); + /*! * <pre> * ------------------------------------------------------------------------ @@ -484,6 +516,20 @@ void pmt_any_set(pmt_t obj, const boost::any &any); /* * ------------------------------------------------------------------------ + * msg_accepter -- pmt representation of gruel::msg_accepter + * ------------------------------------------------------------------------ + */ +//! Return true if \p obj is a msg_accepter +bool pmt_is_msg_accepter(const pmt_t &obj); + +//! make a msg_accepter +pmt_t pmt_make_msg_accepter(boost::shared_ptr<gruel::msg_accepter> ma); + +//! Return underlying msg_accepter +boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj); + +/* + * ------------------------------------------------------------------------ * General functions * ------------------------------------------------------------------------ */ @@ -717,4 +763,7 @@ void pmt_dump_sizeof(); // debugging } /* namespace pmt */ + +#include <gruel/pmt_sugar.h> + #endif /* INCLUDED_PMT_H */ diff --git a/gruel/src/include/gruel/pmt_sugar.h b/gruel/src/include/gruel/pmt_sugar.h new file mode 100644 index 000000000..92bcb5fe5 --- /dev/null +++ b/gruel/src/include/gruel/pmt_sugar.h @@ -0,0 +1,165 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#ifndef INCLUDED_GRUEL_PMT_SUGAR_H +#define INCLUDED_GRUEL_PMT_SUGAR_H + +/*! + * This file is included by pmt.h and contains pseudo-constructor + * shorthand for making pmt objects + */ + +namespace pmt { + + //! Make pmt symbol + static inline pmt_t + mp(const std::string &s) + { + return pmt_string_to_symbol(s); + } + + //! Make pmt symbol + static inline pmt_t + mp(const char *s) + { + return pmt_string_to_symbol(s); + } + + //! Make pmt long + static inline pmt_t + mp(long x){ + return pmt_from_long(x); + } + + //! Make pmt long + static inline pmt_t + mp(int x){ + return pmt_from_long(x); + } + + //! Make pmt double + static inline pmt_t + mp(double x){ + return pmt_from_double(x); + } + + //! Make pmt complex + static inline pmt_t + mp(std::complex<double> z) + { + return pmt_make_rectangular(z.real(), z.imag()); + } + + //! Make pmt complex + static inline pmt_t + mp(std::complex<float> z) + { + return pmt_make_rectangular(z.real(), z.imag()); + } + + //! Make pmt msg_accepter + static inline pmt_t + mp(boost::shared_ptr<gruel::msg_accepter> ma) + { + return pmt_make_msg_accepter(ma); + } + + //! Make pmt Binary Large Object (BLOB) + static inline pmt_t + mp(const void *data, size_t len_in_bytes) + { + return pmt_make_blob(data, len_in_bytes); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0) + { + return pmt_make_tuple(e0); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1) + { + return pmt_make_tuple(e0, e1); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2) + { + return pmt_make_tuple(e0, e1, e2); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3) + { + return pmt_make_tuple(e0, e1, e2, e3); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4) + { + return pmt_make_tuple(e0, e1, e2, e3, e4); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5) + { + return pmt_make_tuple(e0, e1, e2, e3, e4, e5); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6) + { + return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7) + { + return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8) + { + return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8); + } + + //! Make tuple + static inline pmt_t + mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9) + { + return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9); + } + + +} /* namespace pmt */ + + +#endif /* INCLUDED_GRUEL_PMT_SUGAR_H */ diff --git a/gruel/src/include/gruel/send.h b/gruel/src/include/gruel/send.h deleted file mode 100644 index 292017d45..000000000 --- a/gruel/src/include/gruel/send.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GRUEL_SEND_H -#define INCLUDED_GRUEL_SEND_H - -#include <gruel/msg_accepter.h> - -namespace gruel { - - - /*! - * \brief send \p msg to \p msg_accepter - * - * Sending a message is an asynchronous operation. The \p send - * call will not wait for the message either to arrive at the - * destination or to be received. - * - * \returns msg - */ - static inline pmt::pmt_t - send(msg_accepter &acc, pmt::pmt_t msg) - { - return acc.post(msg); - } - - - -} /* namespace gruel */ - - -#endif /* INCLUDED_SEND_H */ diff --git a/gruel/src/lib/Makefile.am b/gruel/src/lib/Makefile.am index 6dfb6787c..9afa0d292 100644 --- a/gruel/src/lib/Makefile.am +++ b/gruel/src/lib/Makefile.am @@ -25,6 +25,12 @@ SUBDIRS = pmt msg AM_CPPFLAGS = $(DEFINES) $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) $(GRUEL_INCLUDES) $(WITH_INCLUDES) + +TESTS = test_gruel + +noinst_PROGRAMS = test_gruel + + lib_LTLIBRARIES = libgruel.la # magic flags @@ -47,3 +53,10 @@ libgruel_la_LIBADD = \ $(PMT_LIB) \ $(MSG_LIB) \ -lstdc++ + + +# ---------------------------------------------------------------- + +test_gruel_SOURCES = test_gruel.cc +test_gruel_LDADD = libgruel.la pmt/libpmt-qa.la + diff --git a/gruel/src/lib/pmt/Makefile.am b/gruel/src/lib/pmt/Makefile.am index 2b710a598..8750cbdf8 100644 --- a/gruel/src/lib/pmt/Makefile.am +++ b/gruel/src/lib/pmt/Makefile.am @@ -23,7 +23,6 @@ include $(top_srcdir)/Makefile.common AM_CPPFLAGS = $(DEFINES) $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) $(GRUEL_INCLUDES) $(WITH_INCLUDES) -TESTS = test_pmt noinst_LTLIBRARIES = libpmt.la @@ -90,14 +89,6 @@ libpmt_qa_la_LIBADD = \ $(CPPUNIT_LIBS) \ -lstdc++ -noinst_PROGRAMS = \ - test_pmt - - -LIBPMTQA = libpmt-qa.la - -test_pmt_SOURCES = test_pmt.cc -test_pmt_LDADD = $(LIBPMTQA) # Do creation and inclusion of other Makefiles last diff --git a/gruel/src/lib/pmt/pmt.cc b/gruel/src/lib/pmt/pmt.cc index f0e3c30a2..e50e21838 100644 --- a/gruel/src/lib/pmt/pmt.cc +++ b/gruel/src/lib/pmt/pmt.cc @@ -26,8 +26,9 @@ #include <vector> #include <gruel/pmt.h> #include "pmt_int.h" -#include <stdio.h> +#include <gruel/msg_accepter.h> #include <gruel/pmt_pool.h> +#include <stdio.h> #include <string.h> namespace pmt { @@ -882,6 +883,73 @@ pmt_any_set(pmt_t obj, const boost::any &any) } //////////////////////////////////////////////////////////////////////////// +// msg_accepter -- built from "any" +//////////////////////////////////////////////////////////////////////////// + +bool +pmt_is_msg_accepter(const pmt_t &obj) +{ + if (!pmt_is_any(obj)) + return false; + + boost::any r = pmt_any_ref(obj); + return boost::any_cast<gruel::msg_accepter_sptr>(&r) != 0; +} + +//! make a msg_accepter +pmt_t +pmt_make_msg_accepter(gruel::msg_accepter_sptr ma) +{ + return pmt_make_any(ma); +} + +//! Return underlying msg_accepter +gruel::msg_accepter_sptr +pmt_msg_accepter_ref(const pmt_t &obj) +{ + try { + return boost::any_cast<gruel::msg_accepter_sptr>(pmt_any_ref(obj)); + } + catch (boost::bad_any_cast &e){ + throw pmt_wrong_type("pmt_msg_accepter_ref", obj); + } +} + + +//////////////////////////////////////////////////////////////////////////// +// Binary Large Object -- currently a u8vector +//////////////////////////////////////////////////////////////////////////// + +bool +pmt_is_blob(pmt_t x) +{ + // return pmt_is_u8vector(x); + return pmt_is_uniform_vector(x); +} + +pmt_t +pmt_make_blob(const void *buf, size_t len_in_bytes) +{ + return pmt_init_u8vector(len_in_bytes, (const uint8_t *) buf); +} + +const void * +pmt_blob_data(pmt_t blob) +{ + size_t len; + return pmt_uniform_vector_elements(blob, len); +} + +size_t +pmt_blob_length(pmt_t blob) +{ + size_t len; + pmt_uniform_vector_elements(blob, len); + return len; +} + + +//////////////////////////////////////////////////////////////////////////// // General Functions //////////////////////////////////////////////////////////////////////////// diff --git a/gruel/src/lib/pmt/qa_pmt_prims.cc b/gruel/src/lib/pmt/qa_pmt_prims.cc index 899674bbb..59d9e14d3 100644 --- a/gruel/src/lib/pmt/qa_pmt_prims.cc +++ b/gruel/src/lib/pmt/qa_pmt_prims.cc @@ -22,8 +22,9 @@ #include <qa_pmt_prims.h> #include <cppunit/TestAssert.h> -#include <gruel/pmt.h> -#include <stdio.h> +#include <gruel/msg_passing.h> +#include <cstdio> +#include <cstring> #include <sstream> using namespace pmt; @@ -453,6 +454,41 @@ qa_pmt_prims::test_any() // ------------------------------------------------------------------------ +class qa_pmt_msg_accepter_nop : public gruel::msg_accepter { +public: + qa_pmt_msg_accepter_nop(){}; + ~qa_pmt_msg_accepter_nop(); + void post(pmt_t){}; +}; + +qa_pmt_msg_accepter_nop::~qa_pmt_msg_accepter_nop(){} + +void +qa_pmt_prims::test_msg_accepter() +{ + pmt_t sym = pmt_intern("my-symbol"); + + boost::any a0; + a0 = std::string("Hello!"); + pmt_t p0 = pmt_make_any(a0); + + gruel::msg_accepter_sptr ma0 = gruel::msg_accepter_sptr(new qa_pmt_msg_accepter_nop()); + pmt_t p1 = pmt_make_msg_accepter(ma0); + + CPPUNIT_ASSERT_EQUAL(ma0.get(), pmt_msg_accepter_ref(p1).get()); + + CPPUNIT_ASSERT_THROW(pmt_msg_accepter_ref(sym), pmt_wrong_type); + CPPUNIT_ASSERT_THROW(pmt_msg_accepter_ref(p0), pmt_wrong_type); + + // just confirm interfaces on send are OK + gruel::send(ma0.get(), sym); + gruel::send(ma0, sym); + gruel::send(p1, sym); + +} + +// ------------------------------------------------------------------------ + void qa_pmt_prims::test_serialize() { @@ -522,3 +558,19 @@ qa_pmt_prims::test_sets() CPPUNIT_ASSERT(!pmt_subsetp(l3,l2)); } +void +qa_pmt_prims::test_sugar() +{ + CPPUNIT_ASSERT(pmt_is_symbol(mp("my-symbol"))); + CPPUNIT_ASSERT_EQUAL((long) 10, pmt_to_long(mp(10))); + CPPUNIT_ASSERT_EQUAL((double) 1e6, pmt_to_double(mp(1e6))); + CPPUNIT_ASSERT_EQUAL(std::complex<double>(2, 3), + pmt_to_complex(mp(std::complex<double>(2, 3)))); + + int buf[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + pmt_t blob = mp(buf, sizeof(buf)); + const void *data = pmt_blob_data(blob); + size_t nbytes = pmt_blob_length(blob); + CPPUNIT_ASSERT_EQUAL(sizeof(buf), nbytes); + CPPUNIT_ASSERT(memcmp(buf, data, nbytes) == 0); +} diff --git a/gruel/src/lib/pmt/qa_pmt_prims.h b/gruel/src/lib/pmt/qa_pmt_prims.h index 2fe473c43..29ba02f11 100644 --- a/gruel/src/lib/pmt/qa_pmt_prims.h +++ b/gruel/src/lib/pmt/qa_pmt_prims.h @@ -40,10 +40,12 @@ class qa_pmt_prims : public CppUnit::TestCase { CPPUNIT_TEST(test_misc); CPPUNIT_TEST(test_dict); CPPUNIT_TEST(test_any); + CPPUNIT_TEST(test_msg_accepter); CPPUNIT_TEST(test_io); CPPUNIT_TEST(test_lists); CPPUNIT_TEST(test_serialize); CPPUNIT_TEST(test_sets); + CPPUNIT_TEST(test_sugar); CPPUNIT_TEST_SUITE_END(); private: @@ -59,10 +61,12 @@ class qa_pmt_prims : public CppUnit::TestCase { void test_misc(); void test_dict(); void test_any(); + void test_msg_accepter(); void test_io(); void test_lists(); void test_serialize(); void test_sets(); + void test_sugar(); }; #endif /* INCLUDED_QA_PMT_PRIMS_H */ diff --git a/gruel/src/lib/pmt/test_pmt.cc b/gruel/src/lib/test_gruel.cc index 034785f4e..669303447 100644 --- a/gruel/src/lib/pmt/test_pmt.cc +++ b/gruel/src/lib/test_gruel.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,7 +21,7 @@ */ #include <cppunit/TextTestRunner.h> -#include <qa_pmt.h> +#include "pmt/qa_pmt.h" int main(int argc, char **argv) |