diff options
Diffstat (limited to 'gnuradio-examples/python/digital')
31 files changed, 0 insertions, 6892 deletions
diff --git a/gnuradio-examples/python/digital/.gitignore b/gnuradio-examples/python/digital/.gitignore deleted file mode 100644 index ff40c06f3..000000000 --- a/gnuradio-examples/python/digital/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/*.pyc -/*.pyo -/*.dat diff --git a/gnuradio-examples/python/digital/Makefile.am b/gnuradio-examples/python/digital/Makefile.am deleted file mode 100644 index f9d129400..000000000 --- a/gnuradio-examples/python/digital/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright 2004,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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -ourdatadir = $(exampledir)/digital - -dist_ourdata_DATA = \ - README \ - pick_bitrate.py \ - qt_digital_window.ui \ - qt_digital_window.py \ - qt_rx_window.ui \ - qt_rx_window.py \ - receive_path.py \ - transmit_path.py \ - usrp_receive_path.py \ - usrp_transmit_path.py - -dist_ourdata_SCRIPTS = \ - benchmark_loopback.py \ - benchmark_rx.py \ - benchmark_tx.py \ - benchmark_qt_rx.py \ - benchmark_qt_loopback.py\ - tunnel.py
\ No newline at end of file diff --git a/gnuradio-examples/python/digital/README b/gnuradio-examples/python/digital/README deleted file mode 100644 index 904a64895..000000000 --- a/gnuradio-examples/python/digital/README +++ /dev/null @@ -1,84 +0,0 @@ -Quick overview of what's here: - -* benchmark_tx.py: generates packets of the size you -specify and sends them across the air using the USRP. Known to work -well using the USRP with the RFX transceiver daughterboards. -You can specify the bitrate to use with the -r <bitrate> command line -parameter. The default is 500k. Some machines will do 1M or more. -You can select the modulation to use with the -m <modulation> command -line argument. The legal values for <modulation> are gmsk, dbpsk and dqpsk. - -* benchmark_rx.py: the receiver half of benchmark_tx.py. -Command line arguments are pretty much the same as rx. Works well -with a USRP and RFX transceiver daughterboards. Will also work -with TVRX daugherboard, but you'll need to fiddle with the gain. See -below. Prints a summary of each packet received and keeps a running -total of packets received, and how many of them were error free. -There are two levels of error reporting going on. If the access code -(PN code) and header of a packet were properly detected, then you'll -get an output line. If the CRC32 of the payload was correct you get -"ok = True", else "ok = False". The "pktno" is extracted from the -received packet. If there are skipped numbers, you're missing some -packets. Be sure you've got a suitable antenna connected to the TX/RX -port on each board. For the RFX-400, "70 cm" / 420 MHz antennas for ham -handi-talkies work great. These are available at ham radio supplies, -etc. The boards need to be at least 3m apart. You can also try -experimenting with the rx gain (-g <gain> command line option). - -Generally speaking, I start the rx first on one machine, and then fire -up the tx on the other machine. The tx also supports a discontinous -transmission mode where it sends bursts of 5 packets and then waits 1 -second. This is useful for ensuring that all the receiver control -loops lock up fast enough. - -* tunnel.py: This program provides a framework for building your own -MACs. It creates a "TAP" interface in the kernel, typically gr0, -and sends and receives ethernet frames through it. See -/usr/src/linux/Documentation/networking/tuntap.txt and/or Google for -"universal tun tap". The Linux 2.6 kernel includes the tun module, you -don't have to build it. You may have to "modprobe tun" if it's not -loaded by default. If /dev/net/tun doesn't exist, try "modprobe tun". - -To run this program you'll need to be root or running with the -appropriate capability to open the tun interface. You'll need to fire -up two copies on different machines. Once each is running you'll need -to ifconfig the gr0 interface to set the IP address. - -This will allow two machines to talk, but anything beyond the two -machines depends on your networking setup. Left as an exercise... - -On machine A: - - $ su - # ./tunnel.py --freq 423.0M --bitrate 500k - # # in another window on A, also as root... - # ifconfig gr0 192.168.200.1 - - -On machine B: - - $ su - # ./tunnel.py --freq 423.0M --bitrate 500k - # # in another window on B, also as root... - # ifconfig gr0 192.168.200.2 - -Now, on machine A you shold be able to ping machine B: - - $ ping 192.168.200.2 - -and you should see some output for each packet in the -tunnel.py window if you used the -v option. - -Likewise, on machine B: - - $ ping 192.168.200.1 - -This now uses a carrier sense MAC, so you should be able to ssh -between the machines, web browse, etc. - -* run_length.py: This program takes a single argument '-f FILE' and -outputs the number of runs of similar bits within the file. It is -useful as a diagnostic tool when experimenting with line coding or -whitening algorithms. - - diff --git a/gnuradio-examples/python/digital/benchmark_loopback.py b/gnuradio-examples/python/digital/benchmark_loopback.py deleted file mode 100755 index 47e4f2028..000000000 --- a/gnuradio-examples/python/digital/benchmark_loopback.py +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005, 2006, 2007, 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, modulation_utils -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, time, struct, sys, math - -# from current dir -from transmit_path import transmit_path -from receive_path import receive_path - -class my_top_block(gr.top_block): - def __init__(self, mod_class, demod_class, rx_callback, options): - gr.top_block.__init__(self) - - channelon = True; - - SNR = 10.0**(options.snr/10.0) - frequency_offset = options.frequency_offset - - power_in_signal = abs(options.tx_amplitude)**2 - noise_power = power_in_signal/SNR - noise_voltage = math.sqrt(noise_power) - - # With new interface, sps does not get set by default, but - # in the loopback, we don't recalculate it; so just force it here - if(options.samples_per_symbol == None): - options.samples_per_symbol = 2 - - self.txpath = transmit_path(mod_class, options) - self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) - self.rxpath = receive_path(demod_class, rx_callback, options) - - if channelon: - self.channel = gr.channel_model(noise_voltage, frequency_offset, 1.01) - - if options.discontinuous: - z = 20000*[0,] - self.zeros = gr.vector_source_c(z, True) - packet_size = 5*((4+8+4+1500+4) * 8) - self.mux = gr.stream_mux(gr.sizeof_gr_complex, [packet_size-0, int(9e5)]) - - # Connect components - self.connect(self.txpath, (self.mux,0)) - self.connect(self.zeros, (self.mux,1)) - self.connect(self.mux, self.channel, self.rxpath) - - else: - self.connect(self.txpath, self.channel, self.rxpath) - - else: - # Connect components - self.connect(self.txpath, self.throttle, self.rxpath) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - # print payload[2:len(payload)] - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - - mods = modulation_utils.type_1_mods() - demods = modulation_utils.type_1_demods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - channel_grp = parser.add_option_group("Channel") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='dbpsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - - channel_grp.add_option("", "--sample-rate", type="eng_float", default=1e5, - help="set speed of channel/simulation rate to RATE [default=%default]") - channel_grp.add_option("", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - channel_grp.add_option("", "--frequency-offset", type="eng_float", default=0, - help="set frequency offset introduced by channel [default=%default]") - channel_grp.add_option("", "--seed", action="store_true", default=False, - help="use a random seed for AWGN noise [default=%default]") - - transmit_path.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - - for mod in mods.values(): - mod.add_options(expert_grp) - for demod in demods.values(): - demod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - # Create an instance of a hierarchical block - tb = my_top_block(mods[options.modulation], demods[options.modulation], rx_callback, options) - tb.start() - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - send_pkt(struct.pack('!H', pktno & 0xffff) + (pkt_size - 2) * chr(pktno & 0xff)) - n += pkt_size - pktno += 1 - - send_pkt(eof=True) - - tb.wait() - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback.py b/gnuradio-examples/python/digital/benchmark_qt_loopback.py deleted file mode 100755 index 0ae0e4e51..000000000 --- a/gnuradio-examples/python/digital/benchmark_qt_loopback.py +++ /dev/null @@ -1,470 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, gru, modulation_utils -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import random, time, struct, sys, os, math - -from threading import Thread - -# from current dir -from transmit_path import transmit_path -from receive_path import receive_path - -try: - from gnuradio.qtgui import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Please install gr-qtgui." - sys.exit(1) - -try: - from qt_digital_window import Ui_DigitalWindow -except ImportError: - print "Error: could not find qt_digital_window.py:" - print "\t\"pyuic4 qt_digital_window.ui -o qt_digital_window.py\"" - sys.exit(1) - - -#print os.getpid() -#raw_input() - - -# //////////////////////////////////////////////////////////////////// -# Define the QT Interface and Control Dialog -# //////////////////////////////////////////////////////////////////// - - -class dialog_box(QtGui.QMainWindow): - def __init__(self, snkTx, snkRx, fg, parent=None): - - QtGui.QWidget.__init__(self, parent) - self.gui = Ui_DigitalWindow() - self.gui.setupUi(self) - - self.fg = fg - - self.set_sample_rate(self.fg.sample_rate()) - - self.set_snr(self.fg.snr()) - self.set_frequency(self.fg.frequency_offset()) - self.set_time_offset(self.fg.timing_offset()) - - self.set_gain_mu(self.fg.rx_timing_gain_alpha()) - self.set_alpha(self.fg.rx_alpha()) - - # Add the qtsnk widgets to the hlayout box - self.gui.sinkLayout.addWidget(snkTx) - self.gui.sinkLayout.addWidget(snkRx) - - - # Connect up some signals - self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), - self.pauseFg) - - self.connect(self.gui.sampleRateEdit, QtCore.SIGNAL("editingFinished()"), - self.sampleRateEditText) - - self.connect(self.gui.snrEdit, QtCore.SIGNAL("editingFinished()"), - self.snrEditText) - self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"), - self.freqEditText) - self.connect(self.gui.timeEdit, QtCore.SIGNAL("editingFinished()"), - self.timeEditText) - - self.connect(self.gui.gainMuEdit, QtCore.SIGNAL("editingFinished()"), - self.gainMuEditText) - self.connect(self.gui.alphaEdit, QtCore.SIGNAL("editingFinished()"), - self.alphaEditText) - - # Build a timer to update the packet number and PER fields - self.update_delay = 250 # time between updating packet rate fields - self.pkt_timer = QtCore.QTimer(self) - self.connect(self.pkt_timer, QtCore.SIGNAL("timeout()"), - self.updatePacketInfo) - self.pkt_timer.start(self.update_delay) - - def pauseFg(self): - if(self.gui.pauseButton.text() == "Pause"): - self.fg.stop() - self.fg.wait() - self.gui.pauseButton.setText("Unpause") - else: - self.fg.start() - self.gui.pauseButton.setText("Pause") - - # Accessor functions for Gui to manipulate system parameters - def set_sample_rate(self, sr): - ssr = eng_notation.num_to_str(sr) - self.gui.sampleRateEdit.setText(QtCore.QString("%1").arg(ssr)) - - def sampleRateEditText(self): - try: - rate = self.gui.sampleRateEdit.text().toAscii() - srate = eng_notation.str_to_num(rate) - #self.fg.set_sample_rate(srate) - except RuntimeError: - pass - - - # Accessor functions for Gui to manipulate channel model - def set_snr(self, snr): - self.gui.snrEdit.setText(QtCore.QString("%1").arg(snr)) - - def set_frequency(self, fo): - self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo)) - - def set_time_offset(self, to): - self.gui.timeEdit.setText(QtCore.QString("%1").arg(to)) - - def snrEditText(self): - try: - snr = self.gui.snrEdit.text().toDouble()[0] - self.fg.set_snr(snr) - except RuntimeError: - pass - - def freqEditText(self): - try: - freq = self.gui.freqEdit.text().toDouble()[0] - self.fg.set_frequency_offset(freq) - except RuntimeError: - pass - - def timeEditText(self): - try: - to = self.gui.timeEdit.text().toDouble()[0] - self.fg.set_timing_offset(to) - except RuntimeError: - pass - - - # Accessor functions for Gui to manipulate receiver parameters - def set_gain_mu(self, gain): - self.gui.gainMuEdit.setText(QtCore.QString("%1").arg(gain)) - - def set_alpha(self, alpha): - self.gui.alphaEdit.setText(QtCore.QString("%1").arg(alpha)) - - def alphaEditText(self): - try: - alpha = self.gui.alphaEdit.text().toDouble()[0] - self.fg.set_rx_alpha(alpha) - except RuntimeError: - pass - - def gainMuEditText(self): - try: - gain = self.gui.gainMuEdit.text().toDouble()[0] - self.fg.set_rx_timing_gain_alpha(gain) - except RuntimeError: - pass - - # Accessor functions for packet error reporting - def updatePacketInfo(self): - # Pull these globals in from the main thread - global n_rcvd, n_right, pktno - - if(pktno > 0): - per = float(n_rcvd - n_right)/float(pktno) - else: - per = 0 - self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd)) - self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right)) - self.gui.perEdit.setText(QtCore.QString("%1").arg(per)) - - - -# //////////////////////////////////////////////////////////////////// -# Define the GNU Radio Top Block -# //////////////////////////////////////////////////////////////////// - - - -class my_top_block(gr.top_block): - def __init__(self, mod_class, demod_class, rx_callback, options): - gr.top_block.__init__(self) - - self._sample_rate = options.sample_rate - - if(options.samples_per_symbol is None): - options.samples_per_symbol = 2 - - channelon = True; - - self.gui_on = options.gui - - self._frequency_offset = options.frequency_offset - self._timing_offset = options.timing_offset - self._tx_amplitude = options.tx_amplitude - self._snr_dB = options.snr - - self._noise_voltage = self.get_noise_voltage(self._snr_dB) - - self.txpath = transmit_path(mod_class, options) - self.throttle = gr.throttle(gr.sizeof_gr_complex, self.sample_rate()) - self.rxpath = receive_path(demod_class, rx_callback, options) - - # FIXME: do better exposure to lower issues for control - self._timing_gain_alpha = self.rxpath.packet_receiver._demodulator._mm_gain_mu - self._alpha = self.rxpath.packet_receiver._demodulator._costas_alpha - - if channelon: - self.channel = gr.channel_model(self._noise_voltage, - self.frequency_offset(), - self.timing_offset()) - - if options.discontinuous: - z = 20000*[0,] - self.zeros = gr.vector_source_c(z, True) - packet_size = 5*((4+8+4+1500+4) * 8) - self.mux = gr.stream_mux(gr.sizeof_gr_complex, [packet_size-0, int(9e5)]) - - # Connect components - self.connect(self.txpath, self.throttle, (self.mux,0)) - self.connect(self.zeros, (self.mux,1)) - self.connect(self.mux, self.channel, self.rxpath) - - else: - self.connect(self.txpath, self.throttle, self.channel, self.rxpath) - - if self.gui_on: - self.qapp = QtGui.QApplication(sys.argv) - fftsize = 2048 - - self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - 0, self._sample_rate, - "Tx", True, True, False, True, True) - self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - 0, self._sample_rate, - "Rx", True, True, False, True, True) - - self.snk_tx.set_frequency_axis(-80, 0) - self.snk_rx.set_frequency_axis(-60, 20) - - # Connect to the QT sinks - # FIXME: make better exposure to receiver from rxpath - self.receiver = self.rxpath.packet_receiver._demodulator.receiver - self.receiver.set_alpha(2) - self.receiver.set_beta(0.02) - self.connect(self.channel, self.snk_tx) - self.connect(self.receiver, self.snk_rx) - - pyTxQt = self.snk_tx.pyqwidget() - pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget) - - pyRxQt = self.snk_rx.pyqwidget() - pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget) - - self.main_box = dialog_box(pyTx, pyRx, self) - self.main_box.show() - - else: - # Connect components - self.connect(self.txpath, self.throttle, self.rxpath) - - - - # System Parameters - def sample_rate(self): - return self._sample_rate - - def set_sample_rate(self, sr): - self._sample_rate = sr - #self.throttle.set_samples_per_second(self._sample_rate) - - # Channel Model Parameters - def snr(self): - return self._snr_dB - - def set_snr(self, snr): - self._snr_dB = snr - self._noise_voltage = self.get_noise_voltage(self._snr_dB) - self.channel.set_noise_voltage(self._noise_voltage) - - def get_noise_voltage(self, SNR): - snr = 10.0**(SNR/10.0) - power_in_signal = abs(self._tx_amplitude)**2 - noise_power = power_in_signal/snr - noise_voltage = math.sqrt(noise_power) - return noise_voltage - - def frequency_offset(self): - return self._frequency_offset * self.sample_rate() - - def set_frequency_offset(self, fo): - self._frequency_offset = fo / self.sample_rate() - self.channel.set_frequency_offset(self._frequency_offset) - - def timing_offset(self): - return self._timing_offset - - def set_timing_offset(self, to): - self._timing_offset = to - self.channel.set_timing_offset(self._timing_offset) - - - # Receiver Parameters - def rx_timing_gain_alpha(self): - return self._timing_gain_alpha - - def rx_timing_gain_beta(self): - return self._timing_gain_beta - - def set_rx_timing_gain_alpha(self, gain): - self._timing_gain_alpha = gain - self.receiver.set_gain_mu(self._timing_gain_alpha) - - def rx_alpha(self): - return self._alpha - - def rx_beta(self): - return self.beta - - def set_rx_alpha(self, alpha): - self._alpha = alpha - self.beta = .25 * self._alpha * self._alpha - self.receiver.set_alpha(self._alpha) - self.receiver.set_beta(self.beta) - - - -# ///////////////////////////////////////////////////////////////////////////// -# Thread to handle the packet sending procedure -# Operates in parallel with qApp.exec_() -# ///////////////////////////////////////////////////////////////////////////// - - - -class th_send(Thread): - def __init__(self, send_fnc, megs, sz): - Thread.__init__(self) - self.send = send_fnc - self.nbytes = int(1e6 * megs) - self.pkt_size = int(sz) - - def run(self): - # generate and send packets - n = 0 - pktno = 0 - - while n < self.nbytes: - self.send(struct.pack('!H', pktno & 0xffff) + - (self.pkt_size - 2) * chr(pktno & 0xff)) - n += self.pkt_size - pktno += 1 - - self.send(eof=True) - - def stop(self): - self.nbytes = 0 - - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - - - -def main(): - - global n_rcvd, n_right, pktno - - n_rcvd = 0 - n_right = 0 - pktno = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right, pktno - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - if not options.gui: - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - mods = modulation_utils.type_1_mods() - demods = modulation_utils.type_1_demods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - channel_grp = parser.add_option_group("Channel") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='dbpsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - parser.add_option("-G", "--gui", action="store_true", default=False, - help="Turn on the GUI [default=%default]") - - channel_grp.add_option("", "--sample-rate", type="eng_float", default=1e5, - help="set speed of channel/simulation rate to RATE [default=%default]") - channel_grp.add_option("", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - channel_grp.add_option("", "--frequency-offset", type="eng_float", default=0, - help="set frequency offset introduced by channel [default=%default]") - channel_grp.add_option("", "--timing-offset", type="eng_float", default=1.0, - help="set timing offset introduced by channel [default=%default]") - channel_grp.add_option("", "--seed", action="store_true", default=False, - help="use a random seed for AWGN noise [default=%default]") - - transmit_path.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - - for mod in mods.values(): - mod.add_options(expert_grp) - for demod in demods.values(): - demod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - # Create an instance of a hierarchical block - tb = my_top_block(mods[options.modulation], - demods[options.modulation], - rx_callback, options) - tb.start() - - packet_sender = th_send(send_pkt, options.megabytes, options.size) - packet_sender.start() - - if(options.gui): - tb.qapp.exec_() - packet_sender.stop() - else: - # Process until done; hack in to the join to stop on an interrupt - while(packet_sender.isAlive()): - try: - packet_sender.join(1) - except KeyboardInterrupt: - packet_sender.stop() - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py deleted file mode 100755 index a36f4fbd4..000000000 --- a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py +++ /dev/null @@ -1,553 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, modulation_utils2 -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import struct, sys, math - -from threading import Thread - -# from current dir -from transmit_path import transmit_path -from receive_path import receive_path - -try: - from gnuradio.qtgui import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Please install gr-qtgui." - sys.exit(1) - -try: - from qt_digital_window2 import Ui_DigitalWindow -except ImportError: - print "Error: could not find qt_digital_window2.py:" - print "\t\"pyuic4 qt_digital_window2.ui -o qt_digital_window2.py\"" - sys.exit(1) - - -#print os.getpid() -#raw_input() - - -# //////////////////////////////////////////////////////////////////// -# Define the QT Interface and Control Dialog -# //////////////////////////////////////////////////////////////////// - - -class dialog_box(QtGui.QMainWindow): - def __init__(self, snkTx, snkRx, fg, parent=None): - - QtGui.QWidget.__init__(self, parent) - self.gui = Ui_DigitalWindow() - self.gui.setupUi(self) - - self.fg = fg - - self.set_sample_rate(self.fg.sample_rate()) - - self.set_snr(self.fg.snr()) - self.set_frequency(self.fg.frequency_offset()) - self.set_time_offset(self.fg.timing_offset()) - - self.set_gain_clock(self.fg.rx_gain_clock()) - self.set_gain_phase(self.fg.rx_gain_phase()) - self.set_gain_freq(self.fg.rx_gain_freq()) - - # Add the qtsnk widgets to the hlayout box - self.gui.sinkLayout.addWidget(snkTx) - self.gui.sinkLayout.addWidget(snkRx) - - - # Connect up some signals - self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), - self.pauseFg) - - self.connect(self.gui.sampleRateEdit, QtCore.SIGNAL("editingFinished()"), - self.sampleRateEditText) - - self.connect(self.gui.snrEdit, QtCore.SIGNAL("editingFinished()"), - self.snrEditText) - self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"), - self.freqEditText) - self.connect(self.gui.timeEdit, QtCore.SIGNAL("editingFinished()"), - self.timeEditText) - - self.connect(self.gui.gainClockEdit, QtCore.SIGNAL("editingFinished()"), - self.gainClockEditText) - self.connect(self.gui.gainPhaseEdit, QtCore.SIGNAL("editingFinished()"), - self.gainPhaseEditText) - self.connect(self.gui.gainFreqEdit, QtCore.SIGNAL("editingFinished()"), - self.gainFreqEditText) - - # Build a timer to update the packet number and PER fields - self.update_delay = 250 # time between updating packet rate fields - self.pkt_timer = QtCore.QTimer(self) - self.connect(self.pkt_timer, QtCore.SIGNAL("timeout()"), - self.updatePacketInfo) - self.pkt_timer.start(self.update_delay) - - def pauseFg(self): - if(self.gui.pauseButton.text() == "Pause"): - self.fg.stop() - self.fg.wait() - self.gui.pauseButton.setText("Unpause") - else: - self.fg.start() - self.gui.pauseButton.setText("Pause") - - # Accessor functions for Gui to manipulate system parameters - def set_sample_rate(self, sr): - ssr = eng_notation.num_to_str(sr) - self.gui.sampleRateEdit.setText(QtCore.QString("%1").arg(ssr)) - - def sampleRateEditText(self): - try: - rate = self.gui.sampleRateEdit.text().toAscii() - srate = eng_notation.str_to_num(rate) - #self.fg.set_sample_rate(srate) - except RuntimeError: - pass - - - # Accessor functions for Gui to manipulate channel model - def set_snr(self, snr): - self.gui.snrEdit.setText(QtCore.QString("%1").arg(snr)) - - def set_frequency(self, fo): - self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo)) - - def set_time_offset(self, to): - self.gui.timeEdit.setText(QtCore.QString("%1").arg(to)) - - def snrEditText(self): - try: - snr = self.gui.snrEdit.text().toDouble()[0] - self.fg.set_snr(snr) - except RuntimeError: - pass - - def freqEditText(self): - try: - freq = self.gui.freqEdit.text().toDouble()[0] - self.fg.set_frequency_offset(freq) - except RuntimeError: - pass - - def timeEditText(self): - try: - to = self.gui.timeEdit.text().toDouble()[0] - self.fg.set_timing_offset(to) - except RuntimeError: - pass - - - # Accessor functions for Gui to manipulate receiver parameters - def set_gain_clock(self, gain): - self.gui.gainClockEdit.setText(QtCore.QString("%1").arg(gain)) - - def set_gain_phase(self, gain_phase): - self.gui.gainPhaseEdit.setText(QtCore.QString("%1").arg(gain_phase)) - - def set_gain_freq(self, gain_freq): - self.gui.gainFreqEdit.setText(QtCore.QString("%1").arg(gain_freq)) - - - def set_alpha_time(self, alpha): - self.gui.alphaTimeEdit.setText(QtCore.QString("%1").arg(alpha)) - - def set_beta_time(self, beta): - self.gui.betaTimeEdit.setText(QtCore.QString("%1").arg(beta)) - - def set_alpha_phase(self, alpha): - self.gui.alphaPhaseEdit.setText(QtCore.QString("%1").arg(alpha)) - - def gainPhaseEditText(self): - try: - gain_phase = self.gui.gainPhaseEdit.text().toDouble()[0] - self.fg.set_rx_gain_phase(gain_phase) - except RuntimeError: - pass - - def gainClockEditText(self): - try: - gain = self.gui.gainClockEdit.text().toDouble()[0] - self.fg.set_rx_gain_clock(gain) - except RuntimeError: - pass - - def gainFreqEditText(self): - try: - gain = self.gui.gainFreqEdit.text().toDouble()[0] - self.fg.set_rx_gain_freq(gain) - except RuntimeError: - pass - - # Accessor functions for packet error reporting - def updatePacketInfo(self): - # Pull these globals in from the main thread - global n_rcvd, n_right, pktno - - if(pktno > 0): - per = float(n_rcvd - n_right)/float(pktno) - else: - per = 0 - self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd)) - self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right)) - self.gui.perEdit.setText(QtCore.QString("%1").arg(float(per), 0, 'e', 4)) - - - -# //////////////////////////////////////////////////////////////////// -# Define the GNU Radio Top Block -# //////////////////////////////////////////////////////////////////// - - - -class my_top_block(gr.top_block): - def __init__(self, mod_class, demod_class, rx_callback, options): - gr.top_block.__init__(self) - - self._sample_rate = options.sample_rate - - channelon = True; - - self.gui_on = options.gui - - self._frequency_offset = options.frequency_offset - self._timing_offset = options.timing_offset - self._tx_amplitude = options.tx_amplitude - self._snr_dB = options.snr - - self._noise_voltage = self.get_noise_voltage(self._snr_dB) - - # With new interface, sps does not get set by default, but - # in the loopback, we don't recalculate it; so just force it here - if(options.samples_per_symbol == None): - options.samples_per_symbol = 2 - - self.txpath = transmit_path(mod_class, options) - self.throttle = gr.throttle(gr.sizeof_gr_complex, self.sample_rate()) - self.rxpath = receive_path(demod_class, rx_callback, options) - - # FIXME: do better exposure to lower issues for control - self._gain_clock = self.rxpath.packet_receiver._demodulator._timing_alpha - self._gain_phase = self.rxpath.packet_receiver._demodulator._phase_alpha - self._gain_freq = self.rxpath.packet_receiver._demodulator._freq_alpha - - if channelon: - self.channel = gr.channel_model(self._noise_voltage, - self.frequency_offset(), - self.timing_offset()) - - if options.discontinuous: - z = 20000*[0,] - self.zeros = gr.vector_source_c(z, True) - packet_size = 5*((4+8+4+1500+4) * 8) - self.mux = gr.stream_mux(gr.sizeof_gr_complex, [packet_size-0, int(9e5)]) - - # Connect components - self.connect(self.txpath, self.throttle, (self.mux,0)) - self.connect(self.zeros, (self.mux,1)) - self.connect(self.mux, self.channel, self.rxpath) - - else: - self.connect(self.txpath, self.throttle, self.channel, self.rxpath) - - if self.gui_on: - self.qapp = QtGui.QApplication(sys.argv) - fftsize = 2048 - - self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - 0, 1, - "Tx", True, True, False, True, True) - self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - 0, 1, - "Rx", True, True, False, True, True) - - self.snk_tx.set_frequency_axis(-80, 0) - self.snk_rx.set_frequency_axis(-60, 20) - - self.freq_recov = self.rxpath.packet_receiver._demodulator.freq_recov - self.phase_recov = self.rxpath.packet_receiver._demodulator.phase_recov - self.time_recov = self.rxpath.packet_receiver._demodulator.time_recov - self.freq_recov.set_alpha(self._gain_freq) - self.freq_recov.set_beta(self._gain_freq/10.0) - self.phase_recov.set_alpha(self._gain_phase) - self.phase_recov.set_beta(0.25*self._gain_phase*self._gain_phase) - self.time_recov.set_alpha(self._gain_clock) - self.time_recov.set_beta(0.25*self._gain_clock*self._gain_clock) - - # Connect to the QT sinks - # FIXME: make better exposure to receiver from rxpath - self.connect(self.channel, self.snk_tx) - self.connect(self.phase_recov, self.snk_rx) - #self.connect(self.freq_recov, self.snk_rx) - - pyTxQt = self.snk_tx.pyqwidget() - pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget) - - pyRxQt = self.snk_rx.pyqwidget() - pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget) - - self.main_box = dialog_box(pyTx, pyRx, self) - self.main_box.show() - - else: - # Connect components - self.connect(self.txpath, self.throttle, self.rxpath) - - if options.verbose: - self._print_verbage() - - if options.log: - self._setup_logging() - - - - - # System Parameters - def sample_rate(self): - return self._sample_rate - - def set_sample_rate(self, sr): - self._sample_rate = sr - #self.throttle.set_samples_per_second(self._sample_rate) - - # Channel Model Parameters - def snr(self): - return self._snr_dB - - def set_snr(self, snr): - self._snr_dB = snr - self._noise_voltage = self.get_noise_voltage(self._snr_dB) - self.channel.set_noise_voltage(self._noise_voltage) - - def get_noise_voltage(self, SNR): - snr = 10.0**(SNR/10.0) - power_in_signal = abs(self._tx_amplitude)**2 - noise_power = power_in_signal/snr - noise_voltage = math.sqrt(noise_power) - return noise_voltage - - def frequency_offset(self): - return self._frequency_offset * self.sample_rate() - - def set_frequency_offset(self, fo): - self._frequency_offset = fo / self.sample_rate() - self.channel.set_frequency_offset(self._frequency_offset) - - def timing_offset(self): - return self._timing_offset - - def set_timing_offset(self, to): - self._timing_offset = to - self.channel.set_timing_offset(self._timing_offset) - - - # Receiver Parameters - def rx_gain_clock(self): - return self._gain_clock - - def rx_gain_clock_beta(self): - return self._gain_clock_beta - - def set_rx_gain_clock(self, gain): - self._gain_clock = gain - self._gain_clock_beta = .25 * self._gain_clock * self._gain_clock - self.rxpath.packet_receiver._demodulator.time_recov.set_alpha(self._gain_clock) - self.rxpath.packet_receiver._demodulator.time_recov.set_beta(self._gain_clock_beta) - - def rx_gain_phase(self): - return self._gain_phase - - def rx_gain_phase_beta(self): - return self._gain_phase_beta - - def set_rx_gain_phase(self, gain_phase): - self._gain_phase = gain_phase - self._gain_phase_beta = .25 * self._gain_phase * self._gain_phase - self.rxpath.packet_receiver._demodulator.phase_recov.set_alpha(self._gain_phase) - self.rxpath.packet_receiver._demodulator.phase_recov.set_beta(self._gain_phase_beta) - - - def rx_gain_freq(self): - return self._gain_freq - - def set_rx_gain_freq(self, gain_freq): - self._gain_freq = gain_freq - #self._gain_freq_beta = .25 * self._gain_freq * self._gain_freq - self.rxpath.packet_receiver._demodulator.freq_recov.set_alpha(self._gain_freq) - self.rxpath.packet_receiver._demodulator.freq_recov.set_beta(self._gain_freq/10.0) - #self.rxpath.packet_receiver._demodulator.freq_recov.set_beta(self._gain_fre_beta) - - def _print_verbage(self): - print "\nChannel:" - print "SNR: %d" % self.snr() - print "Noise voltage: %.2e" % self.get_noise_voltage(self.snr()) - print "Frequency offset: %.2e" % self.frequency_offset() - print "Timing offset: %.2e" % self.timing_offset() - - def _setup_logging(self): - pass - -# ///////////////////////////////////////////////////////////////////////////// -# Thread to handle the packet sending procedure -# Operates in parallel with qApp.exec_() -# ///////////////////////////////////////////////////////////////////////////// - - - -class th_send(Thread): - def __init__(self, send_fnc, megs, sz): - Thread.__init__(self) - self.send = send_fnc - self.nbytes = int(1e6 * megs) - self.pkt_size = int(sz) - - def run(self): - # generate and send packets - n = 0 - pktno = 0 - - while n < self.nbytes: - self.send(struct.pack('!H', pktno & 0xffff) + - (self.pkt_size - 2) * chr(pktno & 0xff)) - n += self.pkt_size - pktno += 1 - - self.send(eof=True) - - def stop(self): - self.nbytes = 0 - - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - - - -def main(): - - global n_rcvd, n_right, pktno - - n_rcvd = 0 - n_right = 0 - pktno = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right, pktno - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - if not options.gui: - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - mods = modulation_utils2.type_1_mods() - demods = modulation_utils2.type_1_demods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - channel_grp = parser.add_option_group("Channel") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - parser.add_option("-G", "--gui", action="store_true", default=False, - help="Turn on the GUI [default=%default]") - - channel_grp.add_option("", "--sample-rate", type="eng_float", default=1e5, - help="set speed of channel/simulation rate to RATE [default=%default]") - channel_grp.add_option("", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - channel_grp.add_option("", "--frequency-offset", type="eng_float", default=0, - help="set frequency offset introduced by channel [default=%default]") - channel_grp.add_option("", "--timing-offset", type="eng_float", default=1.0, - help="set timing offset introduced by channel [default=%default]") - channel_grp.add_option("", "--seed", action="store_true", default=False, - help="use a random seed for AWGN noise [default=%default]") - - transmit_path.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - - for mod in mods.values(): - mod.add_options(expert_grp) - for demod in demods.values(): - demod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - # Create an instance of a hierarchical block - tb = my_top_block(mods[options.modulation], - demods[options.modulation], - rx_callback, options) - - tb.start() - - packet_sender = th_send(send_pkt, options.megabytes, options.size) - packet_sender.start() - - if(options.gui): - tb.qapp.exec_() - packet_sender.stop() - else: - # Process until done; hack in to the join to stop on an interrupt - while(packet_sender.isAlive()): - try: - packet_sender.join(1) - except KeyboardInterrupt: - packet_sender.stop() - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/benchmark_qt_rx.py b/gnuradio-examples/python/digital/benchmark_qt_rx.py deleted file mode 100755 index 0cbb68d23..000000000 --- a/gnuradio-examples/python/digital/benchmark_qt_rx.py +++ /dev/null @@ -1,443 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2007,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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, modulation_utils -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -from gnuradio import usrp_options - -import random -import struct -import sys - -# from current dir -from receive_path import receive_path -from pick_bitrate import pick_rx_bitrate - -try: - from gnuradio.qtgui import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Please install gr-qtgui." - sys.exit(1) - -try: - from qt_rx_window import Ui_DigitalWindow -except ImportError: - print "Error: could not find qt_rx_window.py:" - print "\tYou must first build this from qt_rx_window.ui with the following command:" - print "\t\"pyuic4 qt_rx_window.ui -o qt_rx_window.py\"" - sys.exit(1) - -#import os -#print os.getpid() -#raw_input('Attach and press enter: ') - -# //////////////////////////////////////////////////////////////////// -# Define the QT Interface and Control Dialog -# //////////////////////////////////////////////////////////////////// - - -class dialog_box(QtGui.QMainWindow): - def __init__(self, snkRxIn, snkRx, fg, parent=None): - - QtGui.QWidget.__init__(self, parent) - self.gui = Ui_DigitalWindow() - self.gui.setupUi(self) - - self.fg = fg - - self.set_frequency(self.fg.frequency()) - self.set_gain(self.fg.gain()) - self.set_decim(self.fg.decim()) - self.set_gain_mu(self.fg.rx_gain_mu()) - self.set_alpha(self.fg.rx_alpha()) - - # Add the qtsnk widgets to the hlayout box - self.gui.sinkLayout.addWidget(snkRxIn) - self.gui.sinkLayout.addWidget(snkRx) - - - # Connect up some signals - self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"), - self.freqEditText) - self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"), - self.gainEditText) - self.connect(self.gui.decimEdit, QtCore.SIGNAL("editingFinished()"), - self.decimEditText) - self.connect(self.gui.gainMuEdit, QtCore.SIGNAL("editingFinished()"), - self.gainMuEditText) - self.connect(self.gui.alphaEdit, QtCore.SIGNAL("editingFinished()"), - self.alphaEditText) - - # Build a timer to update the packet number and PER fields - self.update_delay = 250 # time between updating packet rate fields - self.pkt_timer = QtCore.QTimer(self) - self.connect(self.pkt_timer, QtCore.SIGNAL("timeout()"), - self.updatePacketInfo) - self.pkt_timer.start(self.update_delay) - - - # Accessor functions for Gui to manipulate receiver parameters - def set_frequency(self, fo): - self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo)) - - def set_gain(self, gain): - self.gui.gainEdit.setText(QtCore.QString("%1").arg(gain)) - - def set_decim(self, decim): - self.gui.decimEdit.setText(QtCore.QString("%1").arg(decim)) - - def set_gain_mu(self, gain): - self.gui.gainMuEdit.setText(QtCore.QString("%1").arg(gain)) - - def set_alpha(self, alpha): - self.gui.alphaEdit.setText(QtCore.QString("%1").arg(alpha)) - - def freqEditText(self): - try: - freq = self.gui.freqEdit.text().toDouble()[0] - self.fg.set_freq(freq) - except RuntimeError: - pass - - def gainEditText(self): - try: - gain = self.gui.gainEdit.text().toDouble()[0] - self.fg.set_gain(gain) - except RuntimeError: - pass - - def decimEditText(self): - try: - decim = self.gui.decimEdit.text().toInt()[0] - self.fg.set_decim(decim) - except RuntimeError: - pass - - def alphaEditText(self): - try: - alpha = self.gui.alphaEdit.text().toDouble()[0] - self.fg.set_rx_alpha(alpha) - except RuntimeError: - pass - - def gainMuEditText(self): - try: - gain = self.gui.gainMuEdit.text().toDouble()[0] - self.fg.set_rx_gain_mu(gain) - except RuntimeError: - pass - - - # Accessor function for packet error reporting - def updatePacketInfo(self): - # Pull these globals in from the main thread - global n_rcvd, n_right, pktno - - per = float(n_rcvd - n_right)/float(pktno) - self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd)) - self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right)) - self.gui.perEdit.setText(QtCore.QString("%1").arg(per)) - - - -# //////////////////////////////////////////////////////////////////// -# Define the GNU Radio Top Block -# //////////////////////////////////////////////////////////////////// - - -class my_top_block(gr.top_block): - def __init__(self, demodulator, rx_callback, options): - gr.top_block.__init__(self) - - self._rx_freq = options.rx_freq # receiver's center frequency - self._rx_gain = options.rx_gain # receiver's gain - self._rx_subdev_spec = options.rx_subdev_spec # daughterboard to use - self._decim = options.decim # Decimating rate for the USRP (prelim) - self._bitrate = options.bitrate - self._samples_per_symbol = options.samples_per_symbol - self._demod_class = demodulator - self.gui_on = options.gui - - if self._rx_freq is None: - sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n") - raise SystemExit - - # Set up USRP source - self._setup_usrp_source(options) - - # copy the final answers back into options for use by demodulator - options.samples_per_symbol = self._samples_per_symbol - options.bitrate = self._bitrate - options.decim = self._decim - - ok = self.set_freq(self._rx_freq) - if not ok: - print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(self._rx_freq)) - raise ValueError, eng_notation.num_to_str(self._rx_freq) - - self.set_gain(options.rx_gain) - - # Set up receive path - self.rxpath = receive_path(demodulator, rx_callback, options) - - # FIXME: do better exposure to lower issues for control - self._gain_mu = self.rxpath.packet_receiver._demodulator._mm_gain_mu - self._alpha = self.rxpath.packet_receiver._demodulator._costas_alpha - - self.connect(self.u, self.rxpath) - - if self.gui_on: - self.qapp = QtGui.QApplication(sys.argv) - fftsize = 2048 - - bw_in = self.u.adc_rate() / self.decim() - self.snk_rxin = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - self._rx_freq, bw_in, - "Received", True, True, False, True, True, False) - self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - 0, self._bitrate, - "Post-Synchronizer", True, True, False, True, True, False) - - self.snk_rxin.set_frequency_axis(-60, 60) - self.snk_rx.set_frequency_axis(-60, 20) - self.snk_rxin.set_time_domain_axis(-2000,2000) - - # Connect to the QT sinks - # FIXME: make better exposure to receiver from rxpath - self.receiver = self.rxpath.packet_receiver._demodulator.receiver - self.connect(self.u, self.snk_rxin) - self.connect(self.receiver, self.snk_rx) - - pyRxInQt = self.snk_rxin.pyqwidget() - pyRxIn = sip.wrapinstance(pyRxInQt, QtGui.QWidget) - - pyRxQt = self.snk_rx.pyqwidget() - pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget) - - self.main_box = dialog_box(pyRxIn, pyRx, self) - self.main_box.show() - - def _setup_usrp_source(self, options): - self.u = usrp_options.create_usrp_source(options) - adc_rate = self.u.adc_rate() - - self.u.set_decim(self._decim) - - (self._bitrate, self._samples_per_symbol, self._decim) = \ - pick_rx_bitrate(self._bitrate, self._demod_class.bits_per_symbol(), \ - self._samples_per_symbol, self._decim, adc_rate, \ - self.u.get_decim_rates()) - - self.u.set_decim(self._decim) - self.set_auto_tr(True) # enable Auto Transmit/Receive switching - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - - Tuning is a two step process. First we ask the front-end to - tune as close to the desired frequency as it can. Then we use - the result of that operation and our target_frequency to - determine the value for the digital up converter. - """ - return self.u.set_center_freq(target_freq) - - def set_gain(self, gain): - """ - Sets the analog gain in the USRP - """ - if gain is None: - r = self.u.gain_range() - gain = (r[0] + r[1])/2 # set gain to midpoint - self._rx_gain = gain - return self.u.set_gain(self._rx_gain) - - def set_auto_tr(self, enable): - return self.u.set_auto_tr(enable) - - def set_decim(self, decim): - self._decim = decim - self.u.set_decim(self._decim) - - if(self.gui_on): - bw_in = self.u.adc_rate() / self._decim - self._bitrate = bw_in / self._samples_per_symbol - self.snk_rxin.set_frequency_range(0, -bw_in/2.0, bw_in/2.0) - self.snk_rx.set_frequency_range(0, -self._bitrate/2.0, self._bitrate/2.0) - - def frequency(self): - return self._rx_freq - - def gain(self): - return self._rx_gain - - def decim(self): - return self._decim - - def rx_gain_mu(self): - return self._gain_mu - - def rx_gain_omega(self): - return self.gain_omega - - def set_rx_gain_mu(self, gain): - self._gain_mu = gain - self.gain_omega = .25 * self._gain_mu * self._gain_mu - self.receiver.set_gain_mu(self._gain_mu) - self.receiver.set_gain_omega(self.gain_omega) - - def rx_alpha(self): - return self._alpha - - def rx_beta(self): - return self.beta - - def set_rx_alpha(self, alpha): - self._alpha = alpha - self.beta = .25 * self._alpha * self._alpha - self.receiver.set_alpha(self._alpha) - self.receiver.set_beta(self.beta) - - def add_options(normal, expert): - """ - Adds usrp-specific options to the Options Parser - """ - add_freq_option(normal) - normal.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="select USRP Rx side A or B") - normal.add_option("", "--rx-gain", type="eng_float", default=None, metavar="GAIN", - help="set receiver gain in dB [default=midpoint]. See also --show-rx-gain-range") - normal.add_option("", "--show-rx-gain-range", action="store_true", default=False, - help="print min and max Rx gain available on selected daughterboard") - normal.add_option("-v", "--verbose", action="store_true", default=False) - normal.add_option("-G", "--gui", action="store_true", default=False, - help="Turn on the GUI [default=%default]") - - expert.add_option("", "--rx-freq", type="eng_float", default=None, - help="set Rx frequency to FREQ [default=%default]", metavar="FREQ") - expert.add_option("-d", "--decim", type="intx", default=128, - help="set fpga decimation rate to DECIM [default=%default]") - expert.add_option("", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right, pktno - - n_rcvd = 0 - n_right = 0 - pktno = 1 - - def rx_callback(ok, payload): - global n_rcvd, n_right, pktno - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - if not options.gui: - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - - demods = modulation_utils.type_1_demods() - - # Create Options Parser: - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='dbpsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - - my_top_block.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - usrp_options.add_rx_options(parser) - - for mod in demods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - - # build the graph - tb = my_top_block(demods[options.modulation], rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - - if(options.gui): - tb.qapp.exec_() - else: - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/benchmark_qt_rx2.py b/gnuradio-examples/python/digital/benchmark_qt_rx2.py deleted file mode 100755 index 0c37f4c6a..000000000 --- a/gnuradio-examples/python/digital/benchmark_qt_rx2.py +++ /dev/null @@ -1,475 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, modulation_utils2 -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -from gnuradio import usrp_options - -import random -import struct -import sys - -# from current dir -from receive_path import receive_path -from pick_bitrate2 import pick_rx_bitrate - -try: - from gnuradio.qtgui import qtgui - from PyQt4 import QtGui, QtCore - import sip -except ImportError: - print "Please install gr-qtgui." - sys.exit(1) - -try: - from qt_rx_window2 import Ui_DigitalWindow -except ImportError: - print "Error: could not find qt_rx_window2.py:" - print "\tYou must first build this from qt_rx_window2.ui with the following command:" - print "\t\"pyuic4 qt_rx_window2.ui -o qt_rx_window2.py\"" - sys.exit(1) - -#import os -#print os.getpid() -#raw_input('Attach and press enter: ') - -# //////////////////////////////////////////////////////////////////// -# Define the QT Interface and Control Dialog -# //////////////////////////////////////////////////////////////////// - - -class dialog_box(QtGui.QMainWindow): - def __init__(self, snkRxIn, snkRx, fg, parent=None): - - QtGui.QWidget.__init__(self, parent) - self.gui = Ui_DigitalWindow() - self.gui.setupUi(self) - - self.fg = fg - - self.set_frequency(self.fg.frequency()) - self.set_gain(self.fg.gain()) - self.set_decim(self.fg.decim()) - self.set_gain_clock(self.fg.rx_gain_clock()) - self.set_gain_phase(self.fg.rx_gain_phase()) - self.set_gain_freq(self.fg.rx_gain_freq()) - - # Add the qtsnk widgets to the hlayout box - self.gui.sinkLayout.addWidget(snkRxIn) - self.gui.sinkLayout.addWidget(snkRx) - - - # Connect up some signals - self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"), - self.freqEditText) - self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"), - self.gainEditText) - self.connect(self.gui.decimEdit, QtCore.SIGNAL("editingFinished()"), - self.decimEditText) - self.connect(self.gui.gainClockEdit, QtCore.SIGNAL("editingFinished()"), - self.gainClockEditText) - self.connect(self.gui.gainPhaseEdit, QtCore.SIGNAL("editingFinished()"), - self.gainPhaseEditText) - self.connect(self.gui.gainFreqEdit, QtCore.SIGNAL("editingFinished()"), - self.gainFreqEditText) - - # Build a timer to update the packet number and PER fields - self.update_delay = 250 # time between updating packet rate fields - self.pkt_timer = QtCore.QTimer(self) - self.connect(self.pkt_timer, QtCore.SIGNAL("timeout()"), - self.updatePacketInfo) - self.pkt_timer.start(self.update_delay) - - - # Accessor functions for Gui to manipulate receiver parameters - def set_frequency(self, fo): - self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo)) - - def set_gain(self, gain): - self.gui.gainEdit.setText(QtCore.QString("%1").arg(gain)) - - def set_decim(self, decim): - self.gui.decimEdit.setText(QtCore.QString("%1").arg(decim)) - - def set_gain_clock(self, gain): - self.gui.gainClockEdit.setText(QtCore.QString("%1").arg(gain)) - - def set_gain_phase(self, gain_phase): - self.gui.gainPhaseEdit.setText(QtCore.QString("%1").arg(gain_phase)) - - def set_gain_freq(self, gain_freq): - self.gui.gainFreqEdit.setText(QtCore.QString("%1").arg(gain_freq)) - - def freqEditText(self): - try: - freq = self.gui.freqEdit.text().toDouble()[0] - self.fg.set_freq(freq) - except RuntimeError: - pass - - def gainEditText(self): - try: - gain = self.gui.gainEdit.text().toDouble()[0] - self.fg.set_gain(gain) - except RuntimeError: - pass - - def decimEditText(self): - try: - decim = self.gui.decimEdit.text().toInt()[0] - self.fg.set_decim(decim) - except RuntimeError: - pass - - def gainPhaseEditText(self): - try: - gain_phase = self.gui.gainPhaseEdit.text().toDouble()[0] - self.fg.set_rx_gain_phase(gain_phase) - except RuntimeError: - pass - - def gainClockEditText(self): - try: - gain = self.gui.gainClockEdit.text().toDouble()[0] - self.fg.set_rx_gain_clock(gain) - except RuntimeError: - pass - - def gainFreqEditText(self): - try: - gain = self.gui.gainFreqEdit.text().toDouble()[0] - self.fg.set_rx_gain_freq(gain) - except RuntimeError: - pass - - - # Accessor function for packet error reporting - def updatePacketInfo(self): - # Pull these globals in from the main thread - global n_rcvd, n_right, pktno - - per = float(n_rcvd - n_right)/float(pktno) - self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd)) - self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right)) - self.gui.perEdit.setText(QtCore.QString("%1").arg(per, 0, 'e', 4)) - - - -# //////////////////////////////////////////////////////////////////// -# Define the GNU Radio Top Block -# //////////////////////////////////////////////////////////////////// - - -class my_top_block(gr.top_block): - def __init__(self, demodulator, rx_callback, options): - gr.top_block.__init__(self) - - self._rx_freq = options.rx_freq # receiver's center frequency - self._rx_gain = options.rx_gain # receiver's gain - self._rx_subdev_spec = options.rx_subdev_spec # daughterboard to use - self._decim = options.decim # Decimating rate for the USRP (prelim) - self._bitrate = options.bitrate - self._samples_per_symbol = options.samples_per_symbol - self._demod_class = demodulator - self.gui_on = options.gui - - if self._rx_freq is None: - sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n") - raise SystemExit - - # Set up USRP source - self._setup_usrp_source(options) - - # copy the final answers back into options for use by demodulator - options.samples_per_symbol = self._samples_per_symbol - options.bitrate = self._bitrate - options.decim = self._decim - - ok = self.set_freq(self._rx_freq) - if not ok: - print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(self._rx_freq)) - raise ValueError, eng_notation.num_to_str(self._rx_freq) - - self.set_gain(options.rx_gain) - - # Set up receive path - self.rxpath = receive_path(demodulator, rx_callback, options) - - # FIXME: do better exposure to lower issues for control - self._gain_clock = self.rxpath.packet_receiver._demodulator._timing_alpha - self._gain_phase = self.rxpath.packet_receiver._demodulator._phase_alpha - self._gain_freq = self.rxpath.packet_receiver._demodulator._freq_alpha - - self.connect(self.u, self.rxpath) - - if self.gui_on: - self.qapp = QtGui.QApplication(sys.argv) - fftsize = 2048 - - bw_in = self.u.adc_rate() / self.decim() - self.snk_rxin = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - self._rx_freq, bw_in, - "Received", True, True, False, True, True, False) - self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - 0, self._bitrate, - "Post-Synchronizer", True, True, False, True, True, False) - - self.snk_rxin.set_frequency_axis(-140, 20) - self.snk_rx.set_frequency_axis(-80, 20) - self.snk_rxin.set_time_domain_axis(-2000,2000) - - # Connect to the QT sinks - # FIXME: make better exposure to receiver from rxpath - self.receiver = self.rxpath.packet_receiver._demodulator.phase_recov - #self.receiver = self.rxpath.packet_receiver._demodulator.freq_recov - self.connect(self.u, self.snk_rxin) - self.connect(self.receiver, self.snk_rx) - - pyRxInQt = self.snk_rxin.pyqwidget() - pyRxIn = sip.wrapinstance(pyRxInQt, QtGui.QWidget) - - pyRxQt = self.snk_rx.pyqwidget() - pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget) - - self.snk_freq = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - 0, self._bitrate, - "FLL", True, False, False, True, False, False) - - self.main_box = dialog_box(pyRxIn, pyRx, self) - self.main_box.show() - - def _setup_usrp_source(self, options): - self.u = usrp_options.create_usrp_source(options) - adc_rate = self.u.adc_rate() - - self.u.set_decim(self._decim) - - (self._bitrate, self._samples_per_symbol, self._decim) = \ - pick_rx_bitrate(options.bitrate, self._demod_class.bits_per_symbol(), \ - options.samples_per_symbol, options.decim, \ - adc_rate, self.u.get_decim_rates()) - - self.u.set_decim(self._decim) - self.set_auto_tr(True) # enable Auto Transmit/Receive switching - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - - Tuning is a two step process. First we ask the front-end to - tune as close to the desired frequency as it can. Then we use - the result of that operation and our target_frequency to - determine the value for the digital up converter. - """ - return self.u.set_center_freq(target_freq) - - def set_gain(self, gain): - """ - Sets the analog gain in the USRP - """ - if gain is None: - r = self.u.gain_range() - gain = (r[0] + r[1])/2 # set gain to midpoint - self._rx_gain = gain - ret = self.u.set_gain(self._rx_gain) - return ret - - def set_auto_tr(self, enable): - return self.u.set_auto_tr(enable) - - def set_decim(self, decim): - self._decim = decim - self.u.set_decim(self._decim) - - if(self.gui_on): - bw_in = self.u.adc_rate() / self._decim - self._bitrate = bw_in / self._samples_per_symbol - self.snk_rxin.set_frequency_range(0, bw_in) - self.snk_rx.set_frequency_range(0, self._bitrate) - - def frequency(self): - return self._rx_freq - - def gain(self): - return self._rx_gain - - def decim(self): - return self._decim - - def rx_gain_clock(self): - return self._gain_clock - - def rx_gain_clock_beta(self): - return self._gain_clock_beta - - def set_rx_gain_clock(self, gain): - self._gain_clock = gain - self._gain_clock_beta = .25 * self._gain_clock * self._gain_clock - self.rxpath.packet_receiver._demodulator.time_recov.set_alpha(self._gain_clock) - self.rxpath.packet_receiver._demodulator.time_recov.set_beta(self._gain_clock_beta) - - def rx_gain_phase(self): - return self._gain_phase - - def rx_gain_phase_beta(self): - return self._gain_phase_beta - - def set_rx_gain_phase(self, gain_phase): - self._gain_phase = gain_phase - self._gain_phase_beta = .25 * self._gain_phase * self._gain_phase - self.rxpath.packet_receiver._demodulator.phase_recov.set_alpha(self._gain_phase) - self.rxpath.packet_receiver._demodulator.phase_recov.set_beta(self._gain_phase_beta) - - - def rx_gain_freq(self): - return self._gain_freq - - def set_rx_gain_freq(self, gain_freq): - self._gain_freq = gain_freq - #self._gain_freq_beta = .25 * self._gain_freq * self._gain_freq - self.rxpath.packet_receiver._demodulator.freq_recov.set_alpha(self._gain_freq) - self.rxpath.packet_receiver._demodulator.freq_recov.set_beta(self._gain_freq/10.0) - #self.rxpath.packet_receiver._demodulator.freq_recov.set_beta(self._gain_fre_beta) - - - def add_options(normal, expert): - """ - Adds usrp-specific options to the Options Parser - """ - add_freq_option(normal) - normal.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="select USRP Rx side A or B") - normal.add_option("", "--rx-gain", type="eng_float", default=None, metavar="GAIN", - help="set receiver gain in dB [default=midpoint]. See also --show-rx-gain-range") - normal.add_option("", "--show-rx-gain-range", action="store_true", default=False, - help="print min and max Rx gain available on selected daughterboard") - normal.add_option("-v", "--verbose", action="store_true", default=False) - normal.add_option("-G", "--gui", action="store_true", default=False, - help="Turn on the GUI [default=%default]") - - expert.add_option("", "--rx-freq", type="eng_float", default=None, - help="set Rx frequency to FREQ [default=%default]", metavar="FREQ") - expert.add_option("-d", "--decim", type="intx", default=128, - help="set fpga decimation rate to DECIM [default=%default]") - expert.add_option("", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right, pktno - - n_rcvd = 0 - n_right = 0 - pktno = 1 - - def rx_callback(ok, payload): - global n_rcvd, n_right, pktno - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - if not options.gui: - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - - demods = modulation_utils2.type_1_demods() - - # Create Options Parser: - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='dbpsk2', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - - my_top_block.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - usrp_options.add_rx_options(parser) - - for mod in demods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - - # build the graph - tb = my_top_block(demods[options.modulation], rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - - if(options.gui): - tb.qapp.exec_() - else: - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/benchmark_rx.py b/gnuradio-examples/python/digital/benchmark_rx.py deleted file mode 100755 index ccb0c8963..000000000 --- a/gnuradio-examples/python/digital/benchmark_rx.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2007,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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, modulation_utils -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random -import struct -import sys - -# from current dir -import usrp_receive_path - -#import os -#print os.getpid() -#raw_input('Attach and press enter: ') - -class my_top_block(gr.top_block): - def __init__(self, demodulator, rx_callback, options): - gr.top_block.__init__(self) - - # Set up receive path - self.rxpath = usrp_receive_path.usrp_receive_path(demodulator, rx_callback, options) - - self.connect(self.rxpath) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - - demods = modulation_utils.type_1_demods() - - # Create Options Parser: - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - - usrp_receive_path.add_options(parser, expert_grp) - - for mod in demods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - - # build the graph - tb = my_top_block(demods[options.modulation], rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/benchmark_rx2.py b/gnuradio-examples/python/digital/benchmark_rx2.py deleted file mode 100755 index fe422be83..000000000 --- a/gnuradio-examples/python/digital/benchmark_rx2.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, modulation_utils2 -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random -import struct -import sys - -# from current dir -import usrp_receive_path2 - -#import os -#print os.getpid() -#raw_input('Attach and press enter: ') - -class my_top_block(gr.top_block): - def __init__(self, demodulator, rx_callback, options): - gr.top_block.__init__(self) - - # Set up receive path - self.rxpath = usrp_receive_path2.usrp_receive_path(demodulator, rx_callback, options) - - self.connect(self.rxpath) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - - demods = modulation_utils2.type_1_demods() - - # Create Options Parser: - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='dbpsk2', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - - usrp_receive_path2.add_options(parser, expert_grp) - - for mod in demods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - - # build the graph - tb = my_top_block(demods[options.modulation], rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/benchmark_tx.py b/gnuradio-examples/python/digital/benchmark_tx.py deleted file mode 100755 index 73c4a3901..000000000 --- a/gnuradio-examples/python/digital/benchmark_tx.py +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2007,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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, modulation_utils -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, time, struct, sys - -# from current dir -import usrp_transmit_path - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - -class my_top_block(gr.top_block): - def __init__(self, modulator, options): - gr.top_block.__init__(self) - - self.txpath = usrp_transmit_path.usrp_transmit_path(modulator, options) - - self.connect(self.txpath) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - def rx_callback(ok, payload): - print "ok = %r, payload = '%s'" % (ok, payload) - - mods = modulation_utils.type_1_mods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - parser.add_option("","--from-file", default=None, - help="use file for packet contents") - - usrp_transmit_path.add_options(parser, expert_grp) - - for mod in mods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.tx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - if options.from_file is not None: - source_file = open(options.from_file, 'r') - - # build the graph - tb = my_top_block(mods[options.modulation], options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - if options.from_file is None: - data = (pkt_size - 2) * chr(pktno & 0xff) - else: - data = source_file.read(pkt_size - 2) - if data == '': - break; - - payload = struct.pack('!H', pktno & 0xffff) + data - send_pkt(payload) - n += len(payload) - sys.stderr.write('.') - if options.discontinuous and pktno % 5 == 4: - time.sleep(1) - pktno += 1 - - send_pkt(eof=True) - - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/benchmark_tx2.py b/gnuradio-examples/python/digital/benchmark_tx2.py deleted file mode 100755 index 6093dba61..000000000 --- a/gnuradio-examples/python/digital/benchmark_tx2.py +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, modulation_utils2 -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, time, struct, sys - -# from current dir -import usrp_transmit_path2 - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - -class my_top_block(gr.top_block): - def __init__(self, modulator, options): - gr.top_block.__init__(self) - - self.txpath = usrp_transmit_path2.usrp_transmit_path(modulator, options) - - self.connect(self.txpath) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - def rx_callback(ok, payload): - print "ok = %r, payload = '%s'" % (ok, payload) - - mods = modulation_utils2.type_1_mods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='dbpsk2', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - parser.add_option("","--from-file", default=None, - help="use file for packet contents") - - usrp_transmit_path2.add_options(parser, expert_grp) - - for mod in mods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.tx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - if options.from_file is not None: - source_file = open(options.from_file, 'r') - - # build the graph - tb = my_top_block(mods[options.modulation], options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - if options.from_file is None: - data = (pkt_size - 2) * chr(pktno & 0xff) - else: - data = source_file.read(pkt_size - 2) - if data == '': - break; - - payload = struct.pack('!H', pktno & 0xffff) + data - send_pkt(payload) - n += len(payload) - sys.stderr.write('.') - if options.discontinuous and pktno % 5 == 4: - time.sleep(1) - pktno += 1 - - send_pkt(eof=True) - - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/pick_bitrate.py b/gnuradio-examples/python/digital/pick_bitrate.py deleted file mode 100644 index ce1e021c5..000000000 --- a/gnuradio-examples/python/digital/pick_bitrate.py +++ /dev/null @@ -1,153 +0,0 @@ -# -# Copyright 2005,2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import eng_notation - -_default_bitrate = 500e3 - -_valid_samples_per_symbol = (2,3,4,5,6,7) - -def _gen_tx_info(converter_rate, xrates): - results = [] - for samples_per_symbol in _valid_samples_per_symbol: - for interp in xrates: - bitrate = converter_rate / interp / samples_per_symbol - results.append((bitrate, samples_per_symbol, interp)) - results.sort() - return results - -def _gen_rx_info(converter_rate, xrates): - results = [] - for samples_per_symbol in _valid_samples_per_symbol: - for decim in xrates: - bitrate = converter_rate / decim / samples_per_symbol - results.append((bitrate, samples_per_symbol, decim)) - results.sort() - return results - -def _filter_info(info, samples_per_symbol, xrate): - if samples_per_symbol is not None: - info = [x for x in info if x[1] == samples_per_symbol] - if xrate is not None: - info = [x for x in info if x[2] == xrate] - return info - -def _pick_best(target_bitrate, bits_per_symbol, info): - """ - @returns tuple (bitrate, samples_per_symbol, interp_rate_or_decim_rate) - """ - if len(info) == 0: - raise RuntimeError, "info is zero length!" - - if target_bitrate is None: # return the fastest one - return info[-1] - - # convert bit rate to symbol rate - target_symbolrate = target_bitrate / bits_per_symbol - - # Find the closest matching symbol rate. - # In the event of a tie, the one with the lowest samples_per_symbol wins. - # (We already sorted them, so the first one is the one we take) - - best = info[0] - best_delta = abs(target_symbolrate - best[0]) - for x in info[1:]: - delta = abs(target_symbolrate - x[0]) - if delta < best_delta: - best_delta = delta - best = x - - # convert symbol rate back to bit rate - return ((best[0] * bits_per_symbol),) + best[1:] - -def _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - xrate, converter_rate, xrates, gen_info): - """ - @returns tuple (bitrate, samples_per_symbol, interp_rate_or_decim_rate) - """ - if not isinstance(bits_per_symbol, int) or bits_per_symbol < 1: - raise ValueError, "bits_per_symbol must be an int >= 1" - - if samples_per_symbol is not None and xrate is not None: # completely determined - return (float(converter_rate) / xrate / samples_per_symbol, - samples_per_symbol, xrate) - - if bitrate is None and samples_per_symbol is None and xrate is None: - bitrate = _default_bitrate - - # now we have a target bitrate and possibly an xrate or - # samples_per_symbol constraint, but not both of them. - - ret = _pick_best(bitrate, bits_per_symbol, - _filter_info(gen_info(converter_rate, xrates), samples_per_symbol, xrate)) - print "Actual Bitrate:", eng_notation.num_to_str(ret[0]) - return ret - -# --------------------------------------------------------------------------------------- - -def pick_tx_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - interp_rate, converter_rate, possible_interps): - """ - Given the 4 input parameters, return at configuration that matches - - @param bitrate: desired bitrate or None - @type bitrate: number or None - @param bits_per_symbol: E.g., BPSK -> 1, QPSK -> 2, 8-PSK -> 3 - @type bits_per_symbol: integer >= 1 - @param samples_per_symbol: samples/baud (aka samples/symbol) - @type samples_per_symbol: number or None - @param interp_rate: USRP interpolation factor - @type interp_rate: integer or None - @param converter_rate: converter sample rate in Hz - @type converter_rate: number - @param possible_interps: a list of possible rates - @type possible_interps: a list of integers - - @returns tuple (bitrate, samples_per_symbol, interp_rate) - """ - print "Requested TX Bitrate:", bitrate and eng_notation.num_to_str(bitrate) or 'Auto', - return _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - interp_rate, converter_rate, possible_interps, _gen_tx_info) - - -def pick_rx_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - decim_rate, converter_rate, possible_decims): - """ - Given the 4 input parameters, return at configuration that matches - - @param bitrate: desired bitrate or None - @type bitrate: number or None - @param bits_per_symbol: E.g., BPSK -> 1, QPSK -> 2, 8-PSK -> 3 - @type bits_per_symbol: integer >= 1 - @param samples_per_symbol: samples/baud (aka samples/symbol) - @type samples_per_symbol: number or None - @param decim_rate: USRP decimation factor - @type decim_rate: integer or None - @param converter_rate: converter sample rate in Hz - @type converter_rate: number - @param possible_decims: a list of possible rates - @type possible_decims: a list of integers - - @returns tuple (bitrate, samples_per_symbol, decim_rate) - """ - print "Requested RX Bitrate:", bitrate and eng_notation.num_to_str(bitrate) or 'Auto' - return _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - decim_rate, converter_rate, possible_decims, _gen_rx_info) diff --git a/gnuradio-examples/python/digital/pick_bitrate2.py b/gnuradio-examples/python/digital/pick_bitrate2.py deleted file mode 100644 index 92539560c..000000000 --- a/gnuradio-examples/python/digital/pick_bitrate2.py +++ /dev/null @@ -1,154 +0,0 @@ -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import eng_notation - -_default_bitrate = 500e3 -_sps_min = 2 -_sps_max = 100 - -def _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - xrate, converter_rate, xrates): - """ - @returns tuple (bitrate, samples_per_symbol, interp_rate_or_decim_rate) - """ - - if not isinstance(bits_per_symbol, int) or bits_per_symbol < 1: - raise ValueError, "bits_per_symbol must be an int >= 1" - - converter_rate = float(converter_rate) - bits_per_symbol = float(bits_per_symbol) - - # completely determined; if bitrate is specified, this overwrites it - if (samples_per_symbol is not None) and (xrate is not None): - bitrate = converter_rate / bits_per_symbol / xrate / samples_per_symbol - - # If only SPS is given - if (bitrate is None) and (samples_per_symbol is not None) and (xrate is None): - xrate = max(xrates) - bitrate = converter_rate / bits_per_symbol / xrate / samples_per_symbol - - # If only xrate is given, just set SPS to 2 and calculate bitrate - if (bitrate is None) and (samples_per_symbol is None) and (xrate is not None): - samples_per_symbol = 2.0 - bitrate = converter_rate / bits_per_symbol / xrate / samples_per_symbol - - # If no parameters are give, use the default bit rate - if (bitrate is None) and (samples_per_symbol is None) and (xrate is None): - bitrate = _default_bitrate - - # If only bitrate is specified, return max xrate and appropriate - # samples per symbol (minimum of 2.0) to reach bit rate - if (samples_per_symbol is None) and (xrate is None): - xrates.sort() - for i in xrange(len(xrates)): - if((converter_rate / bits_per_symbol / xrates[i]) >= 2*bitrate): - rate = xrates[i] - else: - break - - try: - xrate = rate - except UnboundLocalError: - raise ValueError("Requested bitrate out of bounds") - - samples_per_symbol = converter_rate / bits_per_symbol / rate / bitrate - bitrate = converter_rate / bits_per_symbol / xrate / samples_per_symbol - - # If bitrate and xrate are specified - if(samples_per_symbol is None): - samples_per_symbol = converter_rate / xrate / bits_per_symbol / bitrate - - # If bitrate and SPS are specified - if(xrate is None): - xrate = converter_rate / samples_per_symbol / bits_per_symbol / bitrate - if((xrate in xrates) == False): - # Find the closest avaiable rate larger than the calculated one - xrates.sort() - for x in xrates: - if(x > xrate): - xrate = x - break - if(xrate > max(xrates)): - xrate = max(xrates) - - bitrate = converter_rate / bits_per_symbol / xrate / samples_per_symbol - print "Could not find suitable rate for specified SPS and Bitrate" - print "Using rate = %d for bitrate of %sbps" % \ - (xrate, (eng_notation.num_to_str(bitrate))) - - if((xrate in xrates) == False): - raise ValueError(("Invalid rate (rate = %d)" % xrate)) - if((samples_per_symbol < _sps_min) or (samples_per_symbol > _sps_max)): - raise ValueError(("Invalid samples per symbol (sps = %.2f). Must be in [%.0f, %.0f]." \ - % (samples_per_symbol, _sps_min, _sps_max))) - - return (bitrate, samples_per_symbol, int(xrate)) - - -def pick_tx_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - interp_rate, converter_rate, possible_interps): - """ - Given the 4 input parameters, return at configuration that matches - - @param bitrate: desired bitrate or None - @type bitrate: number or None - @param bits_per_symbol: E.g., BPSK -> 1, QPSK -> 2, 8-PSK -> 3 - @type bits_per_symbol: integer >= 1 - @param samples_per_symbol: samples/baud (aka samples/symbol) - @type samples_per_symbol: number or None - @param interp_rate: USRP interpolation factor - @type interp_rate: integer or None - @param converter_rate: converter sample rate in Hz - @type converter_rate: number - @param possible_interps: a list of possible rates - @type possible_interps: a list of integers - - @returns tuple (bitrate, samples_per_symbol, interp_rate) - """ - - return _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - interp_rate, converter_rate, possible_interps) - - -def pick_rx_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - decim_rate, converter_rate, possible_decims): - """ - Given the 4 input parameters, return at configuration that matches - - @param bitrate: desired bitrate or None - @type bitrate: number or None - @param bits_per_symbol: E.g., BPSK -> 1, QPSK -> 2, 8-PSK -> 3 - @type bits_per_symbol: integer >= 1 - @param samples_per_symbol: samples/baud (aka samples/symbol) - @type samples_per_symbol: number or None - @param decim_rate: USRP decimation factor - @type decim_rate: integer or None - @param converter_rate: converter sample rate in Hz - @type converter_rate: number - @param possible_decims: a list of possible rates - @type possible_decims: a list of integers - - @returns tuple (bitrate, samples_per_symbol, decim_rate) - """ - - return _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol, - decim_rate, converter_rate, possible_decims) diff --git a/gnuradio-examples/python/digital/qt_digital_window.py b/gnuradio-examples/python/digital/qt_digital_window.py deleted file mode 100644 index b47ed0c2b..000000000 --- a/gnuradio-examples/python/digital/qt_digital_window.py +++ /dev/null @@ -1,239 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'qt_digital_window.ui' -# -# Created: Tue May 11 20:58:35 2010 -# by: PyQt4 UI code generator 4.6.1 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -class Ui_DigitalWindow(object): - def setupUi(self, DigitalWindow): - DigitalWindow.setObjectName("DigitalWindow") - DigitalWindow.resize(1059, 754) - self.centralwidget = QtGui.QWidget(DigitalWindow) - self.centralwidget.setObjectName("centralwidget") - self.verticalLayout_4 = QtGui.QVBoxLayout(self.centralwidget) - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.sinkLayout = QtGui.QHBoxLayout() - self.sinkLayout.setObjectName("sinkLayout") - self.verticalLayout_4.addLayout(self.sinkLayout) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.sysBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) - self.sysBox.setSizePolicy(sizePolicy) - self.sysBox.setMinimumSize(QtCore.QSize(240, 60)) - self.sysBox.setMaximumSize(QtCore.QSize(240, 16777215)) - self.sysBox.setObjectName("sysBox") - self.formLayoutWidget = QtGui.QWidget(self.sysBox) - self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 211, 31)) - self.formLayoutWidget.setObjectName("formLayoutWidget") - self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) - self.formLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout.setVerticalSpacing(20) - self.formLayout.setObjectName("formLayout") - self.sampleRateEdit = QtGui.QLineEdit(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sampleRateEdit.sizePolicy().hasHeightForWidth()) - self.sampleRateEdit.setSizePolicy(sizePolicy) - self.sampleRateEdit.setMinimumSize(QtCore.QSize(60, 26)) - self.sampleRateEdit.setMaximumSize(QtCore.QSize(80, 26)) - self.sampleRateEdit.setObjectName("sampleRateEdit") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) - self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sampleRateLabel.sizePolicy().hasHeightForWidth()) - self.sampleRateLabel.setSizePolicy(sizePolicy) - self.sampleRateLabel.setMinimumSize(QtCore.QSize(0, 20)) - self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 20)) - self.sampleRateLabel.setObjectName("sampleRateLabel") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) - self.verticalLayout_2.addWidget(self.sysBox) - spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout_2.addItem(spacerItem) - self.horizontalLayout.addLayout(self.verticalLayout_2) - self.channelModeBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.channelModeBox.sizePolicy().hasHeightForWidth()) - self.channelModeBox.setSizePolicy(sizePolicy) - self.channelModeBox.setMinimumSize(QtCore.QSize(245, 130)) - self.channelModeBox.setMaximumSize(QtCore.QSize(245, 16777215)) - self.channelModeBox.setObjectName("channelModeBox") - self.formLayoutWidget_2 = QtGui.QWidget(self.channelModeBox) - self.formLayoutWidget_2.setGeometry(QtCore.QRect(10, 20, 221, 98)) - self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") - self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_2) - self.formLayout_2.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout_2.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) - self.formLayout_2.setObjectName("formLayout_2") - self.snrLabel = QtGui.QLabel(self.formLayoutWidget_2) - self.snrLabel.setObjectName("snrLabel") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.snrLabel) - self.snrEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.snrEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.snrEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.snrEdit.setObjectName("snrEdit") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.snrEdit) - self.freqLabel = QtGui.QLabel(self.formLayoutWidget_2) - self.freqLabel.setObjectName("freqLabel") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.freqLabel) - self.freqEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.freqEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.freqEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.freqEdit.setObjectName("freqEdit") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.freqEdit) - self.timeLabel = QtGui.QLabel(self.formLayoutWidget_2) - self.timeLabel.setObjectName("timeLabel") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.timeLabel) - self.timeEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.timeEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.timeEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.timeEdit.setObjectName("timeEdit") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.timeEdit) - self.horizontalLayout.addWidget(self.channelModeBox) - self.rxBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) - self.rxBox.setSizePolicy(sizePolicy) - self.rxBox.setMinimumSize(QtCore.QSize(220, 130)) - self.rxBox.setMaximumSize(QtCore.QSize(180, 16777215)) - self.rxBox.setObjectName("rxBox") - self.formLayoutWidget_3 = QtGui.QWidget(self.rxBox) - self.formLayoutWidget_3.setGeometry(QtCore.QRect(10, 20, 201, 101)) - self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") - self.formLayout_3 = QtGui.QFormLayout(self.formLayoutWidget_3) - self.formLayout_3.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout_3.setObjectName("formLayout_3") - self.gainMuLabel = QtGui.QLabel(self.formLayoutWidget_3) - self.gainMuLabel.setObjectName("gainMuLabel") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.gainMuLabel) - self.alphaLabel = QtGui.QLabel(self.formLayoutWidget_3) - self.alphaLabel.setObjectName("alphaLabel") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.alphaLabel) - self.gainMuEdit = QtGui.QLineEdit(self.formLayoutWidget_3) - self.gainMuEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.gainMuEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.gainMuEdit.setObjectName("gainMuEdit") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.gainMuEdit) - self.alphaEdit = QtGui.QLineEdit(self.formLayoutWidget_3) - self.alphaEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.alphaEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.alphaEdit.setObjectName("alphaEdit") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.alphaEdit) - self.horizontalLayout.addWidget(self.rxBox) - self.rxBox_2 = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxBox_2.sizePolicy().hasHeightForWidth()) - self.rxBox_2.setSizePolicy(sizePolicy) - self.rxBox_2.setMinimumSize(QtCore.QSize(220, 125)) - self.rxBox_2.setMaximumSize(QtCore.QSize(265, 125)) - self.rxBox_2.setObjectName("rxBox_2") - self.formLayoutWidget_4 = QtGui.QWidget(self.rxBox_2) - self.formLayoutWidget_4.setGeometry(QtCore.QRect(10, 20, 201, 91)) - self.formLayoutWidget_4.setObjectName("formLayoutWidget_4") - self.formLayout_4 = QtGui.QFormLayout(self.formLayoutWidget_4) - self.formLayout_4.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout_4.setObjectName("formLayout_4") - self.pktsRcvdLabel = QtGui.QLabel(self.formLayoutWidget_4) - self.pktsRcvdLabel.setObjectName("pktsRcvdLabel") - self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.pktsRcvdLabel) - self.pktsCorrectLabel = QtGui.QLabel(self.formLayoutWidget_4) - self.pktsCorrectLabel.setObjectName("pktsCorrectLabel") - self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.pktsCorrectLabel) - self.perLabel = QtGui.QLabel(self.formLayoutWidget_4) - self.perLabel.setObjectName("perLabel") - self.formLayout_4.setWidget(2, QtGui.QFormLayout.LabelRole, self.perLabel) - self.pktsRcvdEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.pktsRcvdEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.pktsRcvdEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") - self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.pktsRcvdEdit) - self.pktsCorrectEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.pktsCorrectEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.pktsCorrectEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") - self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.pktsCorrectEdit) - self.perEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.perEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.perEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.perEdit.setObjectName("perEdit") - self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole, self.perEdit) - self.horizontalLayout.addWidget(self.rxBox_2) - spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem1) - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.pauseButton = QtGui.QPushButton(self.centralwidget) - self.pauseButton.setMinimumSize(QtCore.QSize(80, 0)) - self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) - self.pauseButton.setObjectName("pauseButton") - self.verticalLayout.addWidget(self.pauseButton) - spacerItem2 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout.addItem(spacerItem2) - self.closeButton = QtGui.QPushButton(self.centralwidget) - self.closeButton.setMinimumSize(QtCore.QSize(80, 0)) - self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) - self.closeButton.setObjectName("closeButton") - self.verticalLayout.addWidget(self.closeButton) - self.horizontalLayout.addLayout(self.verticalLayout) - self.verticalLayout_4.addLayout(self.horizontalLayout) - DigitalWindow.setCentralWidget(self.centralwidget) - self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1059, 23)) - self.menubar.setObjectName("menubar") - self.menuFile = QtGui.QMenu(self.menubar) - self.menuFile.setObjectName("menuFile") - DigitalWindow.setMenuBar(self.menubar) - self.statusbar = QtGui.QStatusBar(DigitalWindow) - self.statusbar.setObjectName("statusbar") - DigitalWindow.setStatusBar(self.statusbar) - self.actionExit = QtGui.QAction(DigitalWindow) - self.actionExit.setObjectName("actionExit") - self.menuFile.addAction(self.actionExit) - self.menubar.addAction(self.menuFile.menuAction()) - - self.retranslateUi(DigitalWindow) - QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) - QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) - QtCore.QMetaObject.connectSlotsByName(DigitalWindow) - DigitalWindow.setTabOrder(self.snrEdit, self.freqEdit) - DigitalWindow.setTabOrder(self.freqEdit, self.timeEdit) - - def retranslateUi(self, DigitalWindow): - DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8)) - self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox_2.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) - self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8)) - self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8)) - self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8)) - self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) - self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) - self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/gnuradio-examples/python/digital/qt_digital_window.ui b/gnuradio-examples/python/digital/qt_digital_window.ui deleted file mode 100644 index 4b3857d87..000000000 --- a/gnuradio-examples/python/digital/qt_digital_window.ui +++ /dev/null @@ -1,581 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>DigitalWindow</class> - <widget class="QMainWindow" name="DigitalWindow"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1059</width> - <height>754</height> - </rect> - </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <layout class="QHBoxLayout" name="sinkLayout"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="sysBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>240</width> - <height>60</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>240</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>System Parameters</string> - </property> - <widget class="QWidget" name="formLayoutWidget"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>211</width> - <height>31</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <property name="verticalSpacing"> - <number>20</number> - </property> - <item row="0" column="1"> - <widget class="QLineEdit" name="sampleRateEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>60</width> - <height>26</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>26</height> - </size> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="sampleRateLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>Sample Rate (sps)</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>60</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="channelModeBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>245</width> - <height>130</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>245</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Channel Model Parameters</string> - </property> - <widget class="QWidget" name="formLayoutWidget_2"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>221</width> - <height>98</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="snrLabel"> - <property name="text"> - <string>SNR (dB)</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="snrEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="freqLabel"> - <property name="text"> - <string>Frequency Offset (Hz)</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="freqEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="timeLabel"> - <property name="text"> - <string>Timing Offset</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="timeEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - <zorder>formLayoutWidget_2</zorder> - <zorder>sysBox</zorder> - </widget> - </item> - <item> - <widget class="QGroupBox" name="rxBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>220</width> - <height>130</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>180</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Receiver Parameters</string> - </property> - <widget class="QWidget" name="formLayoutWidget_3"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>201</width> - <height>101</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout_3"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="gainMuLabel"> - <property name="text"> - <string>Gain mu</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="alphaLabel"> - <property name="text"> - <string>Alpha</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="gainMuEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="alphaEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QGroupBox" name="rxBox_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>220</width> - <height>125</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>265</width> - <height>125</height> - </size> - </property> - <property name="title"> - <string>Received Packet Info</string> - </property> - <widget class="QWidget" name="formLayoutWidget_4"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>201</width> - <height>91</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout_4"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="pktsRcvdLabel"> - <property name="text"> - <string>Packets Rcvd.</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="pktsCorrectLabel"> - <property name="text"> - <string>Packets Correct</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="perLabel"> - <property name="text"> - <string>PER</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="pktsRcvdEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="pktsCorrectEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="perEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QPushButton" name="pauseButton"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Pause</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>60</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="closeButton"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Close</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1059</width> - <height>23</height> - </rect> - </property> - <widget class="QMenu" name="menuFile"> - <property name="title"> - <string>&File</string> - </property> - <addaction name="actionExit"/> - </widget> - <addaction name="menuFile"/> - </widget> - <widget class="QStatusBar" name="statusbar"/> - <action name="actionExit"> - <property name="text"> - <string>E&xit</string> - </property> - </action> - </widget> - <tabstops> - <tabstop>snrEdit</tabstop> - <tabstop>freqEdit</tabstop> - <tabstop>timeEdit</tabstop> - </tabstops> - <resources/> - <connections> - <connection> - <sender>closeButton</sender> - <signal>clicked()</signal> - <receiver>DigitalWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>322</x> - <y>623</y> - </hint> - <hint type="destinationlabel"> - <x>66</x> - <y>561</y> - </hint> - </hints> - </connection> - <connection> - <sender>actionExit</sender> - <signal>triggered()</signal> - <receiver>DigitalWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel"> - <x>617</x> - <y>327</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/gnuradio-examples/python/digital/qt_digital_window2.py b/gnuradio-examples/python/digital/qt_digital_window2.py deleted file mode 100644 index 2d10e3a7f..000000000 --- a/gnuradio-examples/python/digital/qt_digital_window2.py +++ /dev/null @@ -1,248 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'qt_digital_window2.ui' -# -# Created: Tue May 11 20:55:10 2010 -# by: PyQt4 UI code generator 4.6.1 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -class Ui_DigitalWindow(object): - def setupUi(self, DigitalWindow): - DigitalWindow.setObjectName("DigitalWindow") - DigitalWindow.resize(1059, 751) - self.centralwidget = QtGui.QWidget(DigitalWindow) - self.centralwidget.setObjectName("centralwidget") - self.verticalLayout_3 = QtGui.QVBoxLayout(self.centralwidget) - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.sinkLayout = QtGui.QHBoxLayout() - self.sinkLayout.setObjectName("sinkLayout") - self.verticalLayout_3.addLayout(self.sinkLayout) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.sysBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) - self.sysBox.setSizePolicy(sizePolicy) - self.sysBox.setMinimumSize(QtCore.QSize(240, 60)) - self.sysBox.setMaximumSize(QtCore.QSize(240, 16777215)) - self.sysBox.setObjectName("sysBox") - self.formLayoutWidget = QtGui.QWidget(self.sysBox) - self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 211, 31)) - self.formLayoutWidget.setObjectName("formLayoutWidget") - self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) - self.formLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout.setVerticalSpacing(20) - self.formLayout.setObjectName("formLayout") - self.sampleRateEdit = QtGui.QLineEdit(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sampleRateEdit.sizePolicy().hasHeightForWidth()) - self.sampleRateEdit.setSizePolicy(sizePolicy) - self.sampleRateEdit.setMinimumSize(QtCore.QSize(60, 26)) - self.sampleRateEdit.setMaximumSize(QtCore.QSize(80, 26)) - self.sampleRateEdit.setObjectName("sampleRateEdit") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) - self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sampleRateLabel.sizePolicy().hasHeightForWidth()) - self.sampleRateLabel.setSizePolicy(sizePolicy) - self.sampleRateLabel.setMinimumSize(QtCore.QSize(0, 20)) - self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 20)) - self.sampleRateLabel.setObjectName("sampleRateLabel") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) - self.verticalLayout_2.addWidget(self.sysBox) - spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout_2.addItem(spacerItem) - self.horizontalLayout.addLayout(self.verticalLayout_2) - self.channelModeBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.channelModeBox.sizePolicy().hasHeightForWidth()) - self.channelModeBox.setSizePolicy(sizePolicy) - self.channelModeBox.setMinimumSize(QtCore.QSize(245, 130)) - self.channelModeBox.setMaximumSize(QtCore.QSize(245, 16777215)) - self.channelModeBox.setObjectName("channelModeBox") - self.formLayoutWidget_2 = QtGui.QWidget(self.channelModeBox) - self.formLayoutWidget_2.setGeometry(QtCore.QRect(10, 20, 221, 98)) - self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") - self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_2) - self.formLayout_2.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout_2.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) - self.formLayout_2.setObjectName("formLayout_2") - self.snrLabel = QtGui.QLabel(self.formLayoutWidget_2) - self.snrLabel.setObjectName("snrLabel") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.snrLabel) - self.snrEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.snrEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.snrEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.snrEdit.setObjectName("snrEdit") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.snrEdit) - self.freqLabel = QtGui.QLabel(self.formLayoutWidget_2) - self.freqLabel.setObjectName("freqLabel") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.freqLabel) - self.freqEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.freqEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.freqEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.freqEdit.setObjectName("freqEdit") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.freqEdit) - self.timeLabel = QtGui.QLabel(self.formLayoutWidget_2) - self.timeLabel.setObjectName("timeLabel") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.timeLabel) - self.timeEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.timeEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.timeEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.timeEdit.setObjectName("timeEdit") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.timeEdit) - self.horizontalLayout.addWidget(self.channelModeBox) - self.rxBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) - self.rxBox.setSizePolicy(sizePolicy) - self.rxBox.setMinimumSize(QtCore.QSize(220, 130)) - self.rxBox.setMaximumSize(QtCore.QSize(180, 16777215)) - self.rxBox.setObjectName("rxBox") - self.formLayoutWidget_3 = QtGui.QWidget(self.rxBox) - self.formLayoutWidget_3.setGeometry(QtCore.QRect(10, 20, 201, 101)) - self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") - self.formLayout_3 = QtGui.QFormLayout(self.formLayoutWidget_3) - self.formLayout_3.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout_3.setObjectName("formLayout_3") - self.gainClockLabel = QtGui.QLabel(self.formLayoutWidget_3) - self.gainClockLabel.setObjectName("gainClockLabel") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.gainClockLabel) - self.gainPhaseLabel = QtGui.QLabel(self.formLayoutWidget_3) - self.gainPhaseLabel.setObjectName("gainPhaseLabel") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.gainPhaseLabel) - self.gainClockEdit = QtGui.QLineEdit(self.formLayoutWidget_3) - self.gainClockEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.gainClockEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.gainClockEdit.setObjectName("gainClockEdit") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.gainClockEdit) - self.gainFreqEdit = QtGui.QLineEdit(self.formLayoutWidget_3) - self.gainFreqEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.gainFreqEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.gainFreqEdit.setObjectName("gainFreqEdit") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.gainFreqEdit) - self.gainPhaseEdit = QtGui.QLineEdit(self.formLayoutWidget_3) - self.gainPhaseEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.gainPhaseEdit.setObjectName("gainPhaseEdit") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.gainPhaseEdit) - self.gainPhaseLabel_2 = QtGui.QLabel(self.formLayoutWidget_3) - self.gainPhaseLabel_2.setObjectName("gainPhaseLabel_2") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.gainPhaseLabel_2) - self.horizontalLayout.addWidget(self.rxBox) - self.rxBox_2 = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxBox_2.sizePolicy().hasHeightForWidth()) - self.rxBox_2.setSizePolicy(sizePolicy) - self.rxBox_2.setMinimumSize(QtCore.QSize(220, 125)) - self.rxBox_2.setMaximumSize(QtCore.QSize(265, 125)) - self.rxBox_2.setObjectName("rxBox_2") - self.formLayoutWidget_4 = QtGui.QWidget(self.rxBox_2) - self.formLayoutWidget_4.setGeometry(QtCore.QRect(10, 20, 201, 91)) - self.formLayoutWidget_4.setObjectName("formLayoutWidget_4") - self.formLayout_4 = QtGui.QFormLayout(self.formLayoutWidget_4) - self.formLayout_4.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout_4.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) - self.formLayout_4.setObjectName("formLayout_4") - self.pktsRcvdLabel = QtGui.QLabel(self.formLayoutWidget_4) - self.pktsRcvdLabel.setObjectName("pktsRcvdLabel") - self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.pktsRcvdLabel) - self.pktsRcvdEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.pktsRcvdEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.pktsRcvdEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") - self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.pktsRcvdEdit) - self.pktsCorrectLabel = QtGui.QLabel(self.formLayoutWidget_4) - self.pktsCorrectLabel.setObjectName("pktsCorrectLabel") - self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.pktsCorrectLabel) - self.pktsCorrectEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.pktsCorrectEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.pktsCorrectEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") - self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.pktsCorrectEdit) - self.perLabel = QtGui.QLabel(self.formLayoutWidget_4) - self.perLabel.setObjectName("perLabel") - self.formLayout_4.setWidget(2, QtGui.QFormLayout.LabelRole, self.perLabel) - self.perEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.perEdit.setMinimumSize(QtCore.QSize(60, 0)) - self.perEdit.setMaximumSize(QtCore.QSize(80, 16777215)) - self.perEdit.setObjectName("perEdit") - self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole, self.perEdit) - self.horizontalLayout.addWidget(self.rxBox_2) - spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem1) - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.pauseButton = QtGui.QPushButton(self.centralwidget) - self.pauseButton.setMinimumSize(QtCore.QSize(80, 0)) - self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) - self.pauseButton.setObjectName("pauseButton") - self.verticalLayout.addWidget(self.pauseButton) - spacerItem2 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout.addItem(spacerItem2) - self.closeButton = QtGui.QPushButton(self.centralwidget) - self.closeButton.setMinimumSize(QtCore.QSize(80, 0)) - self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) - self.closeButton.setObjectName("closeButton") - self.verticalLayout.addWidget(self.closeButton) - self.horizontalLayout.addLayout(self.verticalLayout) - self.verticalLayout_3.addLayout(self.horizontalLayout) - DigitalWindow.setCentralWidget(self.centralwidget) - self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1059, 23)) - self.menubar.setObjectName("menubar") - self.menuFile = QtGui.QMenu(self.menubar) - self.menuFile.setObjectName("menuFile") - DigitalWindow.setMenuBar(self.menubar) - self.statusbar = QtGui.QStatusBar(DigitalWindow) - self.statusbar.setObjectName("statusbar") - DigitalWindow.setStatusBar(self.statusbar) - self.actionExit = QtGui.QAction(DigitalWindow) - self.actionExit.setObjectName("actionExit") - self.menuFile.addAction(self.actionExit) - self.menubar.addAction(self.menuFile.menuAction()) - - self.retranslateUi(DigitalWindow) - QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) - QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) - QtCore.QMetaObject.connectSlotsByName(DigitalWindow) - DigitalWindow.setTabOrder(self.snrEdit, self.freqEdit) - DigitalWindow.setTabOrder(self.freqEdit, self.timeEdit) - - def retranslateUi(self, DigitalWindow): - DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.gainClockLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Clock Loop Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.gainPhaseLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Freq. Loop Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.gainPhaseLabel_2.setText(QtGui.QApplication.translate("DigitalWindow", "Phase Loop Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox_2.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) - self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8)) - self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8)) - self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8)) - self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) - self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) - self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/gnuradio-examples/python/digital/qt_digital_window2.ui b/gnuradio-examples/python/digital/qt_digital_window2.ui deleted file mode 100644 index 544704668..000000000 --- a/gnuradio-examples/python/digital/qt_digital_window2.ui +++ /dev/null @@ -1,605 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>DigitalWindow</class> - <widget class="QMainWindow" name="DigitalWindow"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1059</width> - <height>751</height> - </rect> - </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <layout class="QHBoxLayout" name="sinkLayout"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="sysBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>240</width> - <height>60</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>240</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>System Parameters</string> - </property> - <widget class="QWidget" name="formLayoutWidget"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>211</width> - <height>31</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <property name="verticalSpacing"> - <number>20</number> - </property> - <item row="0" column="1"> - <widget class="QLineEdit" name="sampleRateEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>60</width> - <height>26</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>26</height> - </size> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="sampleRateLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>Sample Rate (sps)</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>60</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="channelModeBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>245</width> - <height>130</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>245</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Channel Model Parameters</string> - </property> - <widget class="QWidget" name="formLayoutWidget_2"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>221</width> - <height>98</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="snrLabel"> - <property name="text"> - <string>SNR (dB)</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="snrEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="freqLabel"> - <property name="text"> - <string>Frequency Offset (Hz)</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="freqEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="timeLabel"> - <property name="text"> - <string>Timing Offset</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="timeEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QGroupBox" name="rxBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>220</width> - <height>130</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>180</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Receiver Parameters</string> - </property> - <widget class="QWidget" name="formLayoutWidget_3"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>201</width> - <height>101</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout_3"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="gainClockLabel"> - <property name="text"> - <string>Clock Loop Gain</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="gainPhaseLabel"> - <property name="text"> - <string>Freq. Loop Gain</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="gainClockEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="gainFreqEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="gainPhaseEdit"> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="gainPhaseLabel_2"> - <property name="text"> - <string>Phase Loop Gain</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QGroupBox" name="rxBox_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>220</width> - <height>125</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>265</width> - <height>125</height> - </size> - </property> - <property name="title"> - <string>Received Packet Info</string> - </property> - <widget class="QWidget" name="formLayoutWidget_4"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>201</width> - <height>91</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout_4"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="pktsRcvdLabel"> - <property name="text"> - <string>Packets Rcvd.</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="pktsRcvdEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="pktsCorrectLabel"> - <property name="text"> - <string>Packets Correct</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="pktsCorrectEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="perLabel"> - <property name="text"> - <string>PER</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="perEdit"> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - <zorder>pktsRcvdLabel</zorder> - <zorder>pktsCorrectLabel</zorder> - <zorder>perLabel</zorder> - <zorder>pktsRcvdEdit</zorder> - <zorder>pktsCorrectEdit</zorder> - <zorder>perEdit</zorder> - </widget> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QPushButton" name="pauseButton"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Pause</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>60</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="closeButton"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Close</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1059</width> - <height>23</height> - </rect> - </property> - <widget class="QMenu" name="menuFile"> - <property name="title"> - <string>&File</string> - </property> - <addaction name="actionExit"/> - </widget> - <addaction name="menuFile"/> - </widget> - <widget class="QStatusBar" name="statusbar"/> - <action name="actionExit"> - <property name="text"> - <string>E&xit</string> - </property> - </action> - </widget> - <tabstops> - <tabstop>snrEdit</tabstop> - <tabstop>freqEdit</tabstop> - <tabstop>timeEdit</tabstop> - </tabstops> - <resources/> - <connections> - <connection> - <sender>closeButton</sender> - <signal>clicked()</signal> - <receiver>DigitalWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>322</x> - <y>623</y> - </hint> - <hint type="destinationlabel"> - <x>66</x> - <y>561</y> - </hint> - </hints> - </connection> - <connection> - <sender>actionExit</sender> - <signal>triggered()</signal> - <receiver>DigitalWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel"> - <x>617</x> - <y>327</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/gnuradio-examples/python/digital/qt_rx_window.py b/gnuradio-examples/python/digital/qt_rx_window.py deleted file mode 100644 index e2488eb3d..000000000 --- a/gnuradio-examples/python/digital/qt_rx_window.py +++ /dev/null @@ -1,157 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'qt_rx_window.ui' -# -# Created: Tue May 11 21:03:07 2010 -# by: PyQt4 UI code generator 4.6.1 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -class Ui_DigitalWindow(object): - def setupUi(self, DigitalWindow): - DigitalWindow.setObjectName("DigitalWindow") - DigitalWindow.resize(999, 519) - self.centralwidget = QtGui.QWidget(DigitalWindow) - self.centralwidget.setObjectName("centralwidget") - self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) - self.verticalLayout.setObjectName("verticalLayout") - self.sinkLayout = QtGui.QHBoxLayout() - self.sinkLayout.setObjectName("sinkLayout") - self.verticalLayout.addLayout(self.sinkLayout) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.horizontalLayout.setObjectName("horizontalLayout") - self.rxBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) - self.rxBox.setSizePolicy(sizePolicy) - self.rxBox.setMinimumSize(QtCore.QSize(250, 190)) - self.rxBox.setMaximumSize(QtCore.QSize(250, 190)) - self.rxBox.setObjectName("rxBox") - self.gainMuEdit = QtGui.QLineEdit(self.rxBox) - self.gainMuEdit.setGeometry(QtCore.QRect(120, 120, 113, 23)) - self.gainMuEdit.setObjectName("gainMuEdit") - self.gainMuLabel = QtGui.QLabel(self.rxBox) - self.gainMuLabel.setGeometry(QtCore.QRect(10, 120, 111, 20)) - self.gainMuLabel.setObjectName("gainMuLabel") - self.alphaEdit = QtGui.QLineEdit(self.rxBox) - self.alphaEdit.setGeometry(QtCore.QRect(120, 150, 113, 23)) - self.alphaEdit.setObjectName("alphaEdit") - self.alphaLabel = QtGui.QLabel(self.rxBox) - self.alphaLabel.setGeometry(QtCore.QRect(10, 150, 111, 20)) - self.alphaLabel.setObjectName("alphaLabel") - self.gainLabel = QtGui.QLabel(self.rxBox) - self.gainLabel.setGeometry(QtCore.QRect(10, 60, 101, 17)) - self.gainLabel.setObjectName("gainLabel") - self.freqEdit = QtGui.QLineEdit(self.rxBox) - self.freqEdit.setGeometry(QtCore.QRect(120, 30, 113, 23)) - self.freqEdit.setObjectName("freqEdit") - self.freqLabel = QtGui.QLabel(self.rxBox) - self.freqLabel.setGeometry(QtCore.QRect(10, 30, 141, 17)) - self.freqLabel.setObjectName("freqLabel") - self.gainEdit = QtGui.QLineEdit(self.rxBox) - self.gainEdit.setGeometry(QtCore.QRect(120, 60, 113, 23)) - self.gainEdit.setObjectName("gainEdit") - self.decimLabel = QtGui.QLabel(self.rxBox) - self.decimLabel.setGeometry(QtCore.QRect(10, 90, 101, 17)) - self.decimLabel.setObjectName("decimLabel") - self.decimEdit = QtGui.QLineEdit(self.rxBox) - self.decimEdit.setGeometry(QtCore.QRect(120, 90, 113, 23)) - self.decimEdit.setObjectName("decimEdit") - self.horizontalLayout.addWidget(self.rxBox) - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.rxPacketBox = QtGui.QGroupBox(self.centralwidget) - self.rxPacketBox.setEnabled(True) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxPacketBox.sizePolicy().hasHeightForWidth()) - self.rxPacketBox.setSizePolicy(sizePolicy) - self.rxPacketBox.setMinimumSize(QtCore.QSize(250, 130)) - self.rxPacketBox.setMaximumSize(QtCore.QSize(250, 130)) - font = QtGui.QFont() - font.setWeight(50) - font.setBold(False) - self.rxPacketBox.setFont(font) - self.rxPacketBox.setObjectName("rxPacketBox") - self.pktsRcvdEdit = QtGui.QLineEdit(self.rxPacketBox) - self.pktsRcvdEdit.setGeometry(QtCore.QRect(120, 30, 113, 23)) - self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") - self.pktsRcvdLabel = QtGui.QLabel(self.rxPacketBox) - self.pktsRcvdLabel.setGeometry(QtCore.QRect(10, 30, 111, 20)) - self.pktsRcvdLabel.setObjectName("pktsRcvdLabel") - self.pktsCorrectEdit = QtGui.QLineEdit(self.rxPacketBox) - self.pktsCorrectEdit.setGeometry(QtCore.QRect(120, 60, 113, 23)) - self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") - self.pktsCorrectLabel = QtGui.QLabel(self.rxPacketBox) - self.pktsCorrectLabel.setGeometry(QtCore.QRect(10, 60, 111, 20)) - self.pktsCorrectLabel.setObjectName("pktsCorrectLabel") - self.perLabel = QtGui.QLabel(self.rxPacketBox) - self.perLabel.setGeometry(QtCore.QRect(10, 90, 111, 20)) - self.perLabel.setObjectName("perLabel") - self.perEdit = QtGui.QLineEdit(self.rxPacketBox) - self.perEdit.setGeometry(QtCore.QRect(120, 90, 113, 23)) - self.perEdit.setObjectName("perEdit") - self.verticalLayout_3.addWidget(self.rxPacketBox) - spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout_3.addItem(spacerItem) - self.horizontalLayout.addLayout(self.verticalLayout_3) - spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem1) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setObjectName("verticalLayout_5") - spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_5.addItem(spacerItem2) - self.closeButton = QtGui.QPushButton(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.closeButton.sizePolicy().hasHeightForWidth()) - self.closeButton.setSizePolicy(sizePolicy) - self.closeButton.setMinimumSize(QtCore.QSize(80, 30)) - self.closeButton.setMaximumSize(QtCore.QSize(80, 30)) - self.closeButton.setObjectName("closeButton") - self.verticalLayout_5.addWidget(self.closeButton) - self.horizontalLayout.addLayout(self.verticalLayout_5) - self.verticalLayout.addLayout(self.horizontalLayout) - DigitalWindow.setCentralWidget(self.centralwidget) - self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 999, 23)) - self.menubar.setObjectName("menubar") - self.menuFile = QtGui.QMenu(self.menubar) - self.menuFile.setObjectName("menuFile") - DigitalWindow.setMenuBar(self.menubar) - self.statusbar = QtGui.QStatusBar(DigitalWindow) - self.statusbar.setObjectName("statusbar") - DigitalWindow.setStatusBar(self.statusbar) - self.actionExit = QtGui.QAction(DigitalWindow) - self.actionExit.setObjectName("actionExit") - self.menuFile.addAction(self.actionExit) - self.menubar.addAction(self.menuFile.menuAction()) - - self.retranslateUi(DigitalWindow) - QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) - QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) - QtCore.QMetaObject.connectSlotsByName(DigitalWindow) - - def retranslateUi(self, DigitalWindow): - DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "mu\'s gain", None, QtGui.QApplication.UnicodeUTF8)) - self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) - self.gainLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.decimLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Decimation", None, QtGui.QApplication.UnicodeUTF8)) - self.rxPacketBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) - self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8)) - self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8)) - self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) - self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) - self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/gnuradio-examples/python/digital/qt_rx_window.ui b/gnuradio-examples/python/digital/qt_rx_window.ui deleted file mode 100644 index f5a074876..000000000 --- a/gnuradio-examples/python/digital/qt_rx_window.ui +++ /dev/null @@ -1,407 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>DigitalWindow</class> - <widget class="QMainWindow" name="DigitalWindow"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>999</width> - <height>519</height> - </rect> - </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="sinkLayout"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <item> - <widget class="QGroupBox" name="rxBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>250</width> - <height>190</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>250</width> - <height>190</height> - </size> - </property> - <property name="title"> - <string>Receiver Parameters</string> - </property> - <widget class="QLineEdit" name="gainMuEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>120</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="gainMuLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>120</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>mu's gain</string> - </property> - </widget> - <widget class="QLineEdit" name="alphaEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>150</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="alphaLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>150</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Alpha</string> - </property> - </widget> - <widget class="QLabel" name="gainLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>60</y> - <width>101</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Gain (dB)</string> - </property> - </widget> - <widget class="QLineEdit" name="freqEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>30</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="freqLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>141</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Frequency (Hz)</string> - </property> - </widget> - <widget class="QLineEdit" name="gainEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>60</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="decimLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>90</y> - <width>101</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Decimation</string> - </property> - </widget> - <widget class="QLineEdit" name="decimEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>90</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QGroupBox" name="rxPacketBox"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>250</width> - <height>130</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>250</width> - <height>130</height> - </size> - </property> - <property name="font"> - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="title"> - <string>Received Packet Info</string> - </property> - <widget class="QLineEdit" name="pktsRcvdEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>30</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="pktsRcvdLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Packets Rcvd.</string> - </property> - </widget> - <widget class="QLineEdit" name="pktsCorrectEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>60</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="pktsCorrectLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>60</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Packets Correct</string> - </property> - </widget> - <widget class="QLabel" name="perLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>90</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>PER</string> - </property> - </widget> - <widget class="QLineEdit" name="perEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>90</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>60</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="closeButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>30</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>30</height> - </size> - </property> - <property name="text"> - <string>Close</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>999</width> - <height>23</height> - </rect> - </property> - <widget class="QMenu" name="menuFile"> - <property name="title"> - <string>&File</string> - </property> - <addaction name="actionExit"/> - </widget> - <addaction name="menuFile"/> - </widget> - <widget class="QStatusBar" name="statusbar"/> - <action name="actionExit"> - <property name="text"> - <string>E&xit</string> - </property> - </action> - </widget> - <resources/> - <connections> - <connection> - <sender>actionExit</sender> - <signal>triggered()</signal> - <receiver>DigitalWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel"> - <x>617</x> - <y>327</y> - </hint> - </hints> - </connection> - <connection> - <sender>closeButton</sender> - <signal>clicked()</signal> - <receiver>DigitalWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>960</x> - <y>694</y> - </hint> - <hint type="destinationlabel"> - <x>66</x> - <y>561</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/gnuradio-examples/python/digital/qt_rx_window2.py b/gnuradio-examples/python/digital/qt_rx_window2.py deleted file mode 100644 index 2fd719ce1..000000000 --- a/gnuradio-examples/python/digital/qt_rx_window2.py +++ /dev/null @@ -1,166 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'qt_rx_window2.ui' -# -# Created: Tue May 11 21:01:39 2010 -# by: PyQt4 UI code generator 4.6.1 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -class Ui_DigitalWindow(object): - def setupUi(self, DigitalWindow): - DigitalWindow.setObjectName("DigitalWindow") - DigitalWindow.resize(1000, 523) - self.centralwidget = QtGui.QWidget(DigitalWindow) - self.centralwidget.setObjectName("centralwidget") - self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) - self.verticalLayout.setObjectName("verticalLayout") - self.sinkLayout = QtGui.QHBoxLayout() - self.sinkLayout.setObjectName("sinkLayout") - self.verticalLayout.addLayout(self.sinkLayout) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.horizontalLayout.setObjectName("horizontalLayout") - self.rxBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) - self.rxBox.setSizePolicy(sizePolicy) - self.rxBox.setMinimumSize(QtCore.QSize(250, 190)) - self.rxBox.setMaximumSize(QtCore.QSize(250, 250)) - self.rxBox.setObjectName("rxBox") - self.formLayout = QtGui.QFormLayout(self.rxBox) - self.formLayout.setObjectName("formLayout") - self.freqLabel = QtGui.QLabel(self.rxBox) - self.freqLabel.setObjectName("freqLabel") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.freqLabel) - self.freqEdit = QtGui.QLineEdit(self.rxBox) - self.freqEdit.setObjectName("freqEdit") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.freqEdit) - self.gainLabel = QtGui.QLabel(self.rxBox) - self.gainLabel.setObjectName("gainLabel") - self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.gainLabel) - self.gainEdit = QtGui.QLineEdit(self.rxBox) - self.gainEdit.setObjectName("gainEdit") - self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.gainEdit) - self.decimLabel = QtGui.QLabel(self.rxBox) - self.decimLabel.setObjectName("decimLabel") - self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.decimLabel) - self.decimEdit = QtGui.QLineEdit(self.rxBox) - self.decimEdit.setObjectName("decimEdit") - self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.decimEdit) - self.gainClockLabel = QtGui.QLabel(self.rxBox) - self.gainClockLabel.setObjectName("gainClockLabel") - self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.gainClockLabel) - self.gainClockEdit = QtGui.QLineEdit(self.rxBox) - self.gainClockEdit.setObjectName("gainClockEdit") - self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.gainClockEdit) - self.gainPhaseLabel = QtGui.QLabel(self.rxBox) - self.gainPhaseLabel.setObjectName("gainPhaseLabel") - self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.gainPhaseLabel) - self.gainPhaseEdit = QtGui.QLineEdit(self.rxBox) - self.gainPhaseEdit.setObjectName("gainPhaseEdit") - self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.gainPhaseEdit) - self.gainFreqEdit = QtGui.QLineEdit(self.rxBox) - self.gainFreqEdit.setObjectName("gainFreqEdit") - self.formLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.gainFreqEdit) - self.gainFreqLabel = QtGui.QLabel(self.rxBox) - self.gainFreqLabel.setObjectName("gainFreqLabel") - self.formLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.gainFreqLabel) - self.horizontalLayout.addWidget(self.rxBox) - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.rxPacketBox = QtGui.QGroupBox(self.centralwidget) - self.rxPacketBox.setEnabled(True) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxPacketBox.sizePolicy().hasHeightForWidth()) - self.rxPacketBox.setSizePolicy(sizePolicy) - self.rxPacketBox.setMinimumSize(QtCore.QSize(250, 130)) - self.rxPacketBox.setMaximumSize(QtCore.QSize(250, 130)) - font = QtGui.QFont() - font.setWeight(50) - font.setBold(False) - self.rxPacketBox.setFont(font) - self.rxPacketBox.setObjectName("rxPacketBox") - self.pktsRcvdEdit = QtGui.QLineEdit(self.rxPacketBox) - self.pktsRcvdEdit.setGeometry(QtCore.QRect(120, 30, 113, 23)) - self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") - self.pktsRcvdLabel = QtGui.QLabel(self.rxPacketBox) - self.pktsRcvdLabel.setGeometry(QtCore.QRect(10, 30, 111, 20)) - self.pktsRcvdLabel.setObjectName("pktsRcvdLabel") - self.pktsCorrectEdit = QtGui.QLineEdit(self.rxPacketBox) - self.pktsCorrectEdit.setGeometry(QtCore.QRect(120, 60, 113, 23)) - self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") - self.pktsCorrectLabel = QtGui.QLabel(self.rxPacketBox) - self.pktsCorrectLabel.setGeometry(QtCore.QRect(10, 60, 111, 20)) - self.pktsCorrectLabel.setObjectName("pktsCorrectLabel") - self.perLabel = QtGui.QLabel(self.rxPacketBox) - self.perLabel.setGeometry(QtCore.QRect(10, 90, 111, 20)) - self.perLabel.setObjectName("perLabel") - self.perEdit = QtGui.QLineEdit(self.rxPacketBox) - self.perEdit.setGeometry(QtCore.QRect(120, 90, 113, 23)) - self.perEdit.setObjectName("perEdit") - self.verticalLayout_3.addWidget(self.rxPacketBox) - spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout_3.addItem(spacerItem) - self.horizontalLayout.addLayout(self.verticalLayout_3) - spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem1) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setObjectName("verticalLayout_5") - spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_5.addItem(spacerItem2) - self.closeButton = QtGui.QPushButton(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.closeButton.sizePolicy().hasHeightForWidth()) - self.closeButton.setSizePolicy(sizePolicy) - self.closeButton.setMinimumSize(QtCore.QSize(80, 30)) - self.closeButton.setMaximumSize(QtCore.QSize(80, 30)) - self.closeButton.setObjectName("closeButton") - self.verticalLayout_5.addWidget(self.closeButton) - self.horizontalLayout.addLayout(self.verticalLayout_5) - self.verticalLayout.addLayout(self.horizontalLayout) - DigitalWindow.setCentralWidget(self.centralwidget) - self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 23)) - self.menubar.setObjectName("menubar") - self.menuFile = QtGui.QMenu(self.menubar) - self.menuFile.setObjectName("menuFile") - DigitalWindow.setMenuBar(self.menubar) - self.statusbar = QtGui.QStatusBar(DigitalWindow) - self.statusbar.setObjectName("statusbar") - DigitalWindow.setStatusBar(self.statusbar) - self.actionExit = QtGui.QAction(DigitalWindow) - self.actionExit.setObjectName("actionExit") - self.menuFile.addAction(self.actionExit) - self.menubar.addAction(self.menuFile.menuAction()) - - self.retranslateUi(DigitalWindow) - QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) - QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) - QtCore.QMetaObject.connectSlotsByName(DigitalWindow) - - def retranslateUi(self, DigitalWindow): - DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.gainLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.decimLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Decimation", None, QtGui.QApplication.UnicodeUTF8)) - self.gainClockLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Clock Loop Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.gainPhaseLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Phase Loop Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.gainFreqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Freq. Loop Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.rxPacketBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) - self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8)) - self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8)) - self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) - self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) - self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/gnuradio-examples/python/digital/qt_rx_window2.ui b/gnuradio-examples/python/digital/qt_rx_window2.ui deleted file mode 100644 index 745af8fb8..000000000 --- a/gnuradio-examples/python/digital/qt_rx_window2.ui +++ /dev/null @@ -1,354 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>DigitalWindow</class> - <widget class="QMainWindow" name="DigitalWindow"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1000</width> - <height>523</height> - </rect> - </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="sinkLayout"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <item> - <widget class="QGroupBox" name="rxBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>250</width> - <height>190</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>250</width> - <height>250</height> - </size> - </property> - <property name="title"> - <string>Receiver Parameters</string> - </property> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="freqLabel"> - <property name="text"> - <string>Frequency (Hz)</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="freqEdit"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="gainLabel"> - <property name="text"> - <string>Gain (dB)</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="gainEdit"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="decimLabel"> - <property name="text"> - <string>Decimation</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="decimEdit"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="gainClockLabel"> - <property name="text"> - <string>Clock Loop Gain</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="gainClockEdit"/> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="gainPhaseLabel"> - <property name="text"> - <string>Phase Loop Gain</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLineEdit" name="gainPhaseEdit"/> - </item> - <item row="5" column="1"> - <widget class="QLineEdit" name="gainFreqEdit"/> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="gainFreqLabel"> - <property name="text"> - <string>Freq. Loop Gain</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QGroupBox" name="rxPacketBox"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>250</width> - <height>130</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>250</width> - <height>130</height> - </size> - </property> - <property name="font"> - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="title"> - <string>Received Packet Info</string> - </property> - <widget class="QLineEdit" name="pktsRcvdEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>30</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="pktsRcvdLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Packets Rcvd.</string> - </property> - </widget> - <widget class="QLineEdit" name="pktsCorrectEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>60</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="pktsCorrectLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>60</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Packets Correct</string> - </property> - </widget> - <widget class="QLabel" name="perLabel"> - <property name="geometry"> - <rect> - <x>10</x> - <y>90</y> - <width>111</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>PER</string> - </property> - </widget> - <widget class="QLineEdit" name="perEdit"> - <property name="geometry"> - <rect> - <x>120</x> - <y>90</y> - <width>113</width> - <height>23</height> - </rect> - </property> - </widget> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>60</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="closeButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>30</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>30</height> - </size> - </property> - <property name="text"> - <string>Close</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1000</width> - <height>23</height> - </rect> - </property> - <widget class="QMenu" name="menuFile"> - <property name="title"> - <string>&File</string> - </property> - <addaction name="actionExit"/> - </widget> - <addaction name="menuFile"/> - </widget> - <widget class="QStatusBar" name="statusbar"/> - <action name="actionExit"> - <property name="text"> - <string>E&xit</string> - </property> - </action> - </widget> - <resources/> - <connections> - <connection> - <sender>actionExit</sender> - <signal>triggered()</signal> - <receiver>DigitalWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel"> - <x>617</x> - <y>327</y> - </hint> - </hints> - </connection> - <connection> - <sender>closeButton</sender> - <signal>clicked()</signal> - <receiver>DigitalWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>960</x> - <y>694</y> - </hint> - <hint type="destinationlabel"> - <x>66</x> - <y>561</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/gnuradio-examples/python/digital/receive_path.py b/gnuradio-examples/python/digital/receive_path.py deleted file mode 100644 index 0024d6941..000000000 --- a/gnuradio-examples/python/digital/receive_path.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2007 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, blks2 -from gnuradio import eng_notation -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# receive path -# ///////////////////////////////////////////////////////////////////////////// - -class receive_path(gr.hier_block2): - def __init__(self, demod_class, rx_callback, options): - gr.hier_block2.__init__(self, "receive_path", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose - self._bitrate = options.bitrate # desired bit rate - self._samples_per_symbol = options.samples_per_symbol # desired samples/symbol - - self._rx_callback = rx_callback # this callback is fired when there's a packet available - self._demod_class = demod_class # the demodulator_class we're using - - # Get demod_kwargs - demod_kwargs = self._demod_class.extract_kwargs_from_options(options) - - # Design filter to get actual channel we want - sw_decim = 1 - chan_coeffs = gr.firdes.low_pass (1.0, # gain - sw_decim * self._samples_per_symbol, # sampling rate - 1.0, # midpoint of trans. band - 0.5, # width of trans. band - gr.firdes.WIN_HANN) # filter type - self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs) - - # receiver - self.packet_receiver = \ - blks2.demod_pkts(self._demod_class(**demod_kwargs), - access_code=None, - callback=self._rx_callback, - threshold=-1) - - # Carrier Sensing Blocks - alpha = 0.001 - thresh = 30 # in dB, will have to adjust - self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - # connect block input to channel filter - self.connect(self, self.channel_filter) - - # connect the channel input filter to the carrier power detector - self.connect(self.channel_filter, self.probe) - - # connect channel filter to the packet receiver - self.connect(self.channel_filter, self.packet_receiver) - - def bitrate(self): - return self._bitrate - - def samples_per_symbol(self): - return self._samples_per_symbol - - def carrier_sensed(self): - """ - Return True if we think carrier is present. - """ - #return self.probe.level() > X - return self.probe.unmuted() - - def carrier_threshold(self): - """ - Return current setting in dB. - """ - return self.probe.threshold() - - def set_carrier_threshold(self, threshold_in_db): - """ - Set carrier threshold. - - @param threshold_in_db: set detection threshold - @type threshold_in_db: float (dB) - """ - self.probe.set_threshold(threshold_in_db) - - - def add_options(normal, expert): - """ - Adds receiver-specific options to the Options Parser - """ - if not normal.has_option("--bitrate"): - normal.add_option("-r", "--bitrate", type="eng_float", default=100e3, - help="specify bitrate [default=%default].") - normal.add_option("-v", "--verbose", action="store_true", default=False) - expert.add_option("-S", "--samples-per-symbol", type="float", default=None, - help="set samples/symbol [default=%default]") - expert.add_option("", "--log", action="store_true", default=False, - help="Log all parts of flow graph to files (CAUTION: lots of data)") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - - def _print_verbage(self): - """ - Prints information about the receive path - """ - print "\nReceive Path:" - print "modulation: %s" % (self._demod_class.__name__) - print "bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate)) - print "samples/symbol: %.4f" % (self._samples_per_symbol) diff --git a/gnuradio-examples/python/digital/simple.py b/gnuradio-examples/python/digital/simple.py deleted file mode 100644 index 6d340db36..000000000 --- a/gnuradio-examples/python/digital/simple.py +++ /dev/null @@ -1,64 +0,0 @@ - -from gnuradio import gr, blks2, packet_utils - -# Some constants -TX_AMPLITUDE = 0.25 -SAMPLE_RATE = 1e5 -# NOISE_VOLTAGE = 0.01 -NOISE_VOLTAGE = 0.01 -# FREQUENCY_OFFSET = 0 -FREQUENCY_OFFSET = 0.01 -TIMING_OFFSET = 1.0 -SAMPLES_PER_SYMBOL = 2 -GAIN = 1.0 -SW_DECIM = 1 -BAND_MIDPOINT = 1.0 -BAND_WIDTH = 0.5 - -# Modulation/Demodulation methods -modulator = blks2.dbpsk2_mod() -demodulator = blks2.dbpsk2_demod() - -#Transmission Blocks -packet_transmitter = blks2.mod_pkts(modulator, access_code=None, msgq_limit=4, - pad_for_usrp=True) -amp = gr.multiply_const_cc(TX_AMPLITUDE) -throttle = gr.throttle(gr.sizeof_gr_complex, SAMPLE_RATE) -# Channel -channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET) -# Receiver Blocks -chan_coeffs = gr.firdes.low_pass(GAIN, SW_DECIM * SAMPLES_PER_SYMBOL, - BAND_MIDPOINT, BAND_WIDTH, gr.firdes.WIN_HANN) -channel_filter = gr.fft_filter_ccc(SW_DECIM, chan_coeffs) -packet_receiver = blks2.demod_pkts(demodulator, access_code=None, callback=None, - threshold=-1) -# Put it all together and start it up (although nothing will be done -# until we send some packets). -tb = gr.top_block() -tb.connect(packet_transmitter, amp, throttle, channel, channel_filter, - packet_receiver) -tb.start() - -# The queue into which recieved packets are placed -pkq = packet_receiver._rcvd_pktq - -# The function to create a packet and place it in a queue to be sent. -sender = packet_transmitter.send_pkt - -# Some some packets (The second will not be recieved because it gets cut off -# before it can finish. I think this occurs during modulation.) -sender('hello there I wonder how long this needs to be before I start to see any errors.') -sender('world') -sender(eof=True) - -# Wait for all the packets to get sent and received. -tb.wait() - -# Check how many messages have been received and print them. -cnt = pkq.count() -print('There are %s messages' % cnt) -for a in range(0, cnt): - msg = pkq.delete_head() - ok, payload = packet_utils.unmake_packet(msg.to_string(), int(msg.arg1())) - print("Message %s is %s" % (a, payload)) - diff --git a/gnuradio-examples/python/digital/simple_qam.py b/gnuradio-examples/python/digital/simple_qam.py deleted file mode 100644 index 947d7faad..000000000 --- a/gnuradio-examples/python/digital/simple_qam.py +++ /dev/null @@ -1,76 +0,0 @@ - -from gnuradio import gr, blks2, packet_utils - -# Some constants -NOISE_VOLTAGE = 0.1 -FREQUENCY_OFFSET = 0.0000 -TIMING_OFFSET = 1.0 -SAMPLES_PER_SYMBOL = 2 -GAIN = 1.0 -SW_DECIM = 1 -BAND_MIDPOINT = 1.0 -BAND_WIDTH = 0.5 -FREQ_ALPHA = 0.005 -EXCESS_BW = 0.35 - -# Modulation/Demodulation methods -modulator = blks2.qam_mod(16, SAMPLES_PER_SYMBOL) -demodulator = blks2.qam_demod(16, SAMPLES_PER_SYMBOL, freq_alpha=FREQ_ALPHA) - -#Transmission Blocks -packet_transmitter = blks2.mod_pkts(modulator, access_code=None, msgq_limit=4, - pad_for_usrp=True) -# Channel -channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET) -# Receiver Blocks -chan_coeffs = gr.firdes.low_pass(GAIN, SW_DECIM * SAMPLES_PER_SYMBOL, - BAND_MIDPOINT, BAND_WIDTH, gr.firdes.WIN_HANN) -channel_filter = gr.fft_filter_ccc(SW_DECIM, chan_coeffs) -packet_receiver = blks2.demod_pkts(demodulator, access_code=None, callback=None, - threshold=-1) -# Put it all together and start it up (although nothing will be done -# until we send some packets). -tb = gr.top_block() -tb.connect(packet_transmitter, channel, channel_filter, - packet_receiver) -tb.start() - -# The queue into which recieved packets are placed -pkq = packet_receiver._rcvd_pktq - -# The function to create a packet and place it in a queue to be sent. -sender = packet_transmitter.send_pkt - -# Some some packets (The second will not be recieved because it gets cut off -# before it can finish. I think this occurs during modulation.) - -# Send some large messages to start off with to let things lock. -for i in range(0, int(20.0/SAMPLES_PER_SYMBOL)): - sender('a'*4000) - -sender('hello1') -sender('hello2') -sender('hello3') -sender('hello4') -sender('hello5') -sender('hello6') -sender('hello7') -sender('hello8') -sender('hello9') -sender('hello10') -sender('hello11') -sender('hello12') -sender('world') -sender(eof=True) - -# Wait for all the packets to get sent and received. -tb.wait() - -# Check how many messages have been received and print them. -cnt = pkq.count() -print('There are %s messages' % cnt) -for a in range(0, cnt): - msg = pkq.delete_head() - ok, payload = packet_utils.unmake_packet(msg.to_string(), int(msg.arg1())) - print("Message %s is %s" % (a, payload)) - diff --git a/gnuradio-examples/python/digital/transmit_path.py b/gnuradio-examples/python/digital/transmit_path.py deleted file mode 100644 index 86ebf75c3..000000000 --- a/gnuradio-examples/python/digital/transmit_path.py +++ /dev/null @@ -1,118 +0,0 @@ -# -# Copyright 2005, 2006, 2007 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gru, blks2 -from gnuradio import eng_notation - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# transmit path -# ///////////////////////////////////////////////////////////////////////////// - -class transmit_path(gr.hier_block2): - def __init__(self, modulator_class, options): - ''' - See below for what options should hold - ''' - gr.hier_block2.__init__(self, "transmit_path", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose - self._tx_amplitude = options.tx_amplitude # digital amplitude sent to USRP - self._bitrate = options.bitrate # desired bit rate - self._samples_per_symbol = options.samples_per_symbol # desired samples/baud - - self._modulator_class = modulator_class # the modulator_class we are using - - # Get mod_kwargs - mod_kwargs = self._modulator_class.extract_kwargs_from_options(options) - - # transmitter - modulator = self._modulator_class(**mod_kwargs) - self.packet_transmitter = \ - blks2.mod_pkts(modulator, - access_code=None, - msgq_limit=4, - pad_for_usrp=True) - - self.amp = gr.multiply_const_cc(1) - self.set_tx_amplitude(self._tx_amplitude) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - # Connect components in the flowgraph - self.connect(self.packet_transmitter, self.amp, self) - - def set_tx_amplitude(self, ampl): - """ - Sets the transmit amplitude sent to the USRP in volts - @param: ampl 0 <= ampl < 1. - """ - self._tx_amplitude = max(0.0, min(ampl, 1)) - self.amp.set_k(self._tx_amplitude) - - def send_pkt(self, payload='', eof=False): - """ - Calls the transmitter method to send a packet - """ - return self.packet_transmitter.send_pkt(payload, eof) - - def bitrate(self): - return self._bitrate - - def samples_per_symbol(self): - return self._samples_per_symbol - - def add_options(normal, expert): - """ - Adds transmitter-specific options to the Options Parser - """ - if not normal.has_option('--bitrate'): - normal.add_option("-r", "--bitrate", type="eng_float", default=100e3, - help="specify bitrate [default=%default].") - normal.add_option("", "--tx-amplitude", type="eng_float", default=0.250, metavar="AMPL", - help="set transmitter digital amplitude: 0 <= AMPL < 1 [default=%default]") - normal.add_option("-v", "--verbose", action="store_true", default=False) - - expert.add_option("-S", "--samples-per-symbol", type="float", default=None, - help="set samples/symbol [default=%default]") - expert.add_option("", "--log", action="store_true", default=False, - help="Log all parts of flow graph to file (CAUTION: lots of data)") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the transmit path - """ - print "Tx amplitude %s" % (self._tx_amplitude) - print "modulation: %s" % (self._modulator_class.__name__) - print "bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate)) - print "samples/symbol: %.4f" % (self._samples_per_symbol) - diff --git a/gnuradio-examples/python/digital/tunnel.py b/gnuradio-examples/python/digital/tunnel.py deleted file mode 100755 index b0af721da..000000000 --- a/gnuradio-examples/python/digital/tunnel.py +++ /dev/null @@ -1,287 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# ///////////////////////////////////////////////////////////////////////////// -# -# This code sets up up a virtual ethernet interface (typically gr0), -# and relays packets between the interface and the GNU Radio PHY+MAC -# -# What this means in plain language, is that if you've got a couple -# of USRPs on different machines, and if you run this code on those -# machines, you can talk between them using normal TCP/IP networking. -# -# ///////////////////////////////////////////////////////////////////////////// - - -from gnuradio import gr, gru, modulation_utils -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random -import time -import struct -import sys -import os - -# from current dir -import usrp_transmit_path -import usrp_receive_path - -#print os.getpid() -#raw_input('Attach and press enter') - - -# ///////////////////////////////////////////////////////////////////////////// -# -# Use the Universal TUN/TAP device driver to move packets to/from kernel -# -# See /usr/src/linux/Documentation/networking/tuntap.txt -# -# ///////////////////////////////////////////////////////////////////////////// - -# Linux specific... -# TUNSETIFF ifr flags from <linux/tun_if.h> - -IFF_TUN = 0x0001 # tunnel IP packets -IFF_TAP = 0x0002 # tunnel ethernet frames -IFF_NO_PI = 0x1000 # don't pass extra packet info -IFF_ONE_QUEUE = 0x2000 # beats me ;) - -def open_tun_interface(tun_device_filename): - from fcntl import ioctl - - mode = IFF_TAP | IFF_NO_PI - TUNSETIFF = 0x400454ca - - tun = os.open(tun_device_filename, os.O_RDWR) - ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode)) - ifname = ifs[:16].strip("\x00") - return (tun, ifname) - - -# ///////////////////////////////////////////////////////////////////////////// -# the flow graph -# ///////////////////////////////////////////////////////////////////////////// - -class my_top_block(gr.top_block): - - def __init__(self, mod_class, demod_class, - rx_callback, options): - - gr.top_block.__init__(self) - self.txpath = usrp_transmit_path.usrp_transmit_path(mod_class, options) - self.rxpath = usrp_receive_path.usrp_receive_path(demod_class, rx_callback, options) - self.connect(self.txpath) - self.connect(self.rxpath) - - def send_pkt(self, payload='', eof=False): - return self.txpath.send_pkt(payload, eof) - - def carrier_sensed(self): - """ - Return True if the receive path thinks there's carrier - """ - return self.rxpath.carrier_sensed() - - -# ///////////////////////////////////////////////////////////////////////////// -# Carrier Sense MAC -# ///////////////////////////////////////////////////////////////////////////// - -class cs_mac(object): - """ - Prototype carrier sense MAC - - Reads packets from the TUN/TAP interface, and sends them to the PHY. - Receives packets from the PHY via phy_rx_callback, and sends them - into the TUN/TAP interface. - - Of course, we're not restricted to getting packets via TUN/TAP, this - is just an example. - """ - def __init__(self, tun_fd, verbose=False): - self.tun_fd = tun_fd # file descriptor for TUN/TAP interface - self.verbose = verbose - self.tb = None # top block (access to PHY) - - def set_top_block(self, tb): - self.tb = tb - - def phy_rx_callback(self, ok, payload): - """ - Invoked by thread associated with PHY to pass received packet up. - - @param ok: bool indicating whether payload CRC was OK - @param payload: contents of the packet (string) - """ - if self.verbose: - print "Rx: ok = %r len(payload) = %4d" % (ok, len(payload)) - if ok: - os.write(self.tun_fd, payload) - - def main_loop(self): - """ - Main loop for MAC. - Only returns if we get an error reading from TUN. - - FIXME: may want to check for EINTR and EAGAIN and reissue read - """ - min_delay = 0.001 # seconds - - while 1: - payload = os.read(self.tun_fd, 10*1024) - if not payload: - self.tb.send_pkt(eof=True) - break - - if self.verbose: - print "Tx: len(payload) = %4d" % (len(payload),) - - delay = min_delay - while self.tb.carrier_sensed(): - sys.stderr.write('B') - time.sleep(delay) - if delay < 0.050: - delay = delay * 2 # exponential back-off - - self.tb.send_pkt(payload) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - mods = modulation_utils.type_1_mods() - demods = modulation_utils.type_1_demods() - - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - expert_grp.add_option("", "--rx-freq", type="eng_float", default=None, - help="set Rx frequency to FREQ [default=%default]", metavar="FREQ") - expert_grp.add_option("", "--tx-freq", type="eng_float", default=None, - help="set transmit frequency to FREQ [default=%default]", metavar="FREQ") - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-v","--verbose", action="store_true", default=False) - expert_grp.add_option("-c", "--carrier-threshold", type="eng_float", default=30, - help="set carrier detect threshold (dB) [default=%default]") - expert_grp.add_option("","--tun-device-filename", default="/dev/net/tun", - help="path to tun device file [default=%default]") - - usrp_transmit_path.add_options(parser, expert_grp) - usrp_receive_path.add_options(parser, expert_grp) - - for mod in mods.values(): - mod.add_options(expert_grp) - - for demod in demods.values(): - demod.add_options(expert_grp) - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - # open the TUN/TAP interface - (tun_fd, tun_ifname) = open_tun_interface(options.tun_device_filename) - - # Attempt to enable realtime scheduling - r = gr.enable_realtime_scheduling() - if r == gr.RT_OK: - realtime = True - else: - realtime = False - print "Note: failed to enable realtime scheduling" - - - # If the user hasn't set the fusb_* parameters on the command line, - # pick some values that will reduce latency. - - if options.fusb_block_size == 0 and options.fusb_nblocks == 0: - if realtime: # be more aggressive - options.fusb_block_size = gr.prefs().get_long('fusb', 'rt_block_size', 1024) - options.fusb_nblocks = gr.prefs().get_long('fusb', 'rt_nblocks', 16) - else: - options.fusb_block_size = gr.prefs().get_long('fusb', 'block_size', 4096) - options.fusb_nblocks = gr.prefs().get_long('fusb', 'nblocks', 16) - - #print "fusb_block_size =", options.fusb_block_size - #print "fusb_nblocks =", options.fusb_nblocks - - # instantiate the MAC - mac = cs_mac(tun_fd, verbose=True) - - - # build the graph (PHY) - tb = my_top_block(mods[options.modulation], - demods[options.modulation], - mac.phy_rx_callback, - options) - - mac.set_top_block(tb) # give the MAC a handle for the PHY - - if tb.txpath.bitrate() != tb.rxpath.bitrate(): - print "WARNING: Transmit bitrate = %sb/sec, Receive bitrate = %sb/sec" % ( - eng_notation.num_to_str(tb.txpath.bitrate()), - eng_notation.num_to_str(tb.rxpath.bitrate())) - - print "modulation: %s" % (options.modulation,) - print "freq: %s" % (eng_notation.num_to_str(options.tx_freq)) - print "bitrate: %sb/sec" % (eng_notation.num_to_str(tb.txpath.bitrate()),) - print "samples/symbol: %3d" % (tb.txpath.samples_per_symbol(),) - #print "interp: %3d" % (tb.txpath.interp(),) - #print "decim: %3d" % (tb.rxpath.decim(),) - - tb.rxpath.set_carrier_threshold(options.carrier_threshold) - print "Carrier sense threshold:", options.carrier_threshold, "dB" - - print - print "Allocated virtual ethernet interface: %s" % (tun_ifname,) - print "You must now use ifconfig to set its IP address. E.g.," - print - print " $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,) - print - print "Be sure to use a different address in the same subnet for each machine." - print - - - tb.start() # Start executing the flow graph (runs in separate threads) - - mac.main_loop() # don't expect this to return... - - tb.stop() # but if it does, tell flow graph to stop. - tb.wait() # wait for it to finish - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/digital/usrp_receive_path.py b/gnuradio-examples/python/digital/usrp_receive_path.py deleted file mode 100644 index a8f16e28a..000000000 --- a/gnuradio-examples/python/digital/usrp_receive_path.py +++ /dev/null @@ -1,96 +0,0 @@ -# -# 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr -from gnuradio import usrp_options -import receive_path -from pick_bitrate import pick_rx_bitrate -from gnuradio import eng_notation - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - -def add_options(parser, expert): - add_freq_option(parser) - usrp_options.add_rx_options(parser) - receive_path.receive_path.add_options(parser, expert) - expert.add_option("", "--rx-freq", type="eng_float", default=None, - help="set Rx frequency to FREQ [default=%default]", metavar="FREQ") - parser.add_option("-v", "--verbose", action="store_true", default=False) - -class usrp_receive_path(gr.hier_block2): - - def __init__(self, demod_class, rx_callback, options): - ''' - See below for what options should hold - ''' - gr.hier_block2.__init__(self, "usrp_receive_path", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - if options.rx_freq is None: - sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n") - raise SystemExit - - #setup usrp - self._demod_class = demod_class - self._setup_usrp_source(options) - - rx_path = receive_path.receive_path(demod_class, rx_callback, options) - for attr in dir(rx_path): #forward the methods - if not attr.startswith('_') and not hasattr(self, attr): - setattr(self, attr, getattr(rx_path, attr)) - - #connect - self.connect(self.u, rx_path) - - def _setup_usrp_source(self, options): - self.u = usrp_options.create_usrp_source(options) - adc_rate = self.u.adc_rate() - self.rs_rate = options.bitrate - - (self._bitrate, self._samples_per_symbol, self._decim) = \ - pick_rx_bitrate(options.bitrate, self._demod_class.bits_per_symbol(), \ - options.samples_per_symbol, options.decim, - adc_rate, self.u.get_decim_rates()) - - if options.verbose: - print 'USRP Source:', self.u - print 'Decimation: ', self._decim - - options.samples_per_symbol = self._samples_per_symbol - options.decim = self._decim - - self.u.set_decim(self._decim) - - if not self.u.set_center_freq(options.rx_freq): - print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.rx_freq)) - raise ValueError, eng_notation.num_to_str(options.rx_freq) diff --git a/gnuradio-examples/python/digital/usrp_receive_path2.py b/gnuradio-examples/python/digital/usrp_receive_path2.py deleted file mode 100644 index d20017204..000000000 --- a/gnuradio-examples/python/digital/usrp_receive_path2.py +++ /dev/null @@ -1,96 +0,0 @@ -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr -from gnuradio import usrp_options -import receive_path -from pick_bitrate2 import pick_rx_bitrate -from gnuradio import eng_notation - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - -def add_options(parser, expert): - add_freq_option(parser) - usrp_options.add_rx_options(parser) - receive_path.receive_path.add_options(parser, expert) - expert.add_option("", "--rx-freq", type="eng_float", default=None, - help="set Rx frequency to FREQ [default=%default]", metavar="FREQ") - parser.add_option("-v", "--verbose", action="store_true", default=False) - -class usrp_receive_path(gr.hier_block2): - - def __init__(self, demod_class, rx_callback, options): - ''' - See below for what options should hold - ''' - gr.hier_block2.__init__(self, "usrp_receive_path", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - if options.rx_freq is None: - sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n") - raise SystemExit - - #setup usrp - self._demod_class = demod_class - self._setup_usrp_source(options) - - rx_path = receive_path.receive_path(demod_class, rx_callback, options) - for attr in dir(rx_path): #forward the methods - if not attr.startswith('_') and not hasattr(self, attr): - setattr(self, attr, getattr(rx_path, attr)) - - #connect - self.connect(self.u, rx_path) - - def _setup_usrp_source(self, options): - self.u = usrp_options.create_usrp_source(options) - adc_rate = self.u.adc_rate() - self.rs_rate = options.bitrate - - (self._bitrate, self._samples_per_symbol, self._decim) = \ - pick_rx_bitrate(options.bitrate, self._demod_class.bits_per_symbol(), \ - options.samples_per_symbol, options.decim, - adc_rate, self.u.get_decim_rates()) - - if options.verbose: - print 'USRP Source:', self.u - print 'Decimation: ', self._decim - - options.samples_per_symbol = self._samples_per_symbol - options.decim = self._decim - - self.u.set_decim(self._decim) - - if not self.u.set_center_freq(options.rx_freq): - print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.rx_freq)) - raise ValueError, eng_notation.num_to_str(options.rx_freq) diff --git a/gnuradio-examples/python/digital/usrp_transmit_path.py b/gnuradio-examples/python/digital/usrp_transmit_path.py deleted file mode 100644 index f0f467599..000000000 --- a/gnuradio-examples/python/digital/usrp_transmit_path.py +++ /dev/null @@ -1,101 +0,0 @@ -# -# 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr -from gnuradio import usrp_options -import transmit_path -from pick_bitrate import pick_tx_bitrate -from gnuradio import eng_notation - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - -def add_options(parser, expert): - add_freq_option(parser) - usrp_options.add_tx_options(parser) - transmit_path.transmit_path.add_options(parser, expert) - expert.add_option("", "--tx-freq", type="eng_float", default=None, - help="set transmit frequency to FREQ [default=%default]", metavar="FREQ") - parser.add_option("-v", "--verbose", action="store_true", default=False) - -class usrp_transmit_path(gr.hier_block2): - def __init__(self, modulator_class, options): - ''' - See below for what options should hold - ''' - gr.hier_block2.__init__(self, "usrp_transmit_path", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - if options.tx_freq is None: - sys.stderr.write("-f FREQ or --freq FREQ or --tx-freq FREQ must be specified\n") - raise SystemExit - - #setup usrp - self._modulator_class = modulator_class - self._setup_usrp_sink(options) - - tx_path = transmit_path.transmit_path(modulator_class, options) - for attr in dir(tx_path): #forward the methods - if not attr.startswith('_') and not hasattr(self, attr): - setattr(self, attr, getattr(tx_path, attr)) - - #connect - self.connect(tx_path, self.u) - - def _setup_usrp_sink(self, options): - """ - Creates a USRP sink, determines the settings for best bitrate, - and attaches to the transmitter's subdevice. - """ - self.u = usrp_options.create_usrp_sink(options) - dac_rate = self.u.dac_rate() - self.rs_rate = options.bitrate # Store requested bit rate - - (self._bitrate, self._samples_per_symbol, self._interp) = \ - pick_tx_bitrate(options.bitrate, self._modulator_class.bits_per_symbol(), - options.samples_per_symbol, options.interp, - dac_rate, self.u.get_interp_rates()) - - options.interp = self._interp - options.samples_per_symbol = self._samples_per_symbol - options.bitrate = self._bitrate - - if options.verbose: - print 'USRP Sink:', self.u - print "Interpolation Rate: ", self._interp - - self.u.set_interp(self._interp) - self.u.set_auto_tr(True) - - if not self.u.set_center_freq(options.tx_freq): - print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.tx_freq)) - raise ValueError, eng_notation.num_to_str(options.tx_freq) diff --git a/gnuradio-examples/python/digital/usrp_transmit_path2.py b/gnuradio-examples/python/digital/usrp_transmit_path2.py deleted file mode 100644 index 54930e5a0..000000000 --- a/gnuradio-examples/python/digital/usrp_transmit_path2.py +++ /dev/null @@ -1,101 +0,0 @@ -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr -from gnuradio import usrp_options -import transmit_path -from pick_bitrate2 import pick_tx_bitrate -from gnuradio import eng_notation - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - -def add_options(parser, expert): - add_freq_option(parser) - usrp_options.add_tx_options(parser) - transmit_path.transmit_path.add_options(parser, expert) - expert.add_option("", "--tx-freq", type="eng_float", default=None, - help="set transmit frequency to FREQ [default=%default]", metavar="FREQ") - parser.add_option("-v", "--verbose", action="store_true", default=False) - -class usrp_transmit_path(gr.hier_block2): - def __init__(self, modulator_class, options): - ''' - See below for what options should hold - ''' - gr.hier_block2.__init__(self, "usrp_transmit_path", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - if options.tx_freq is None: - sys.stderr.write("-f FREQ or --freq FREQ or --tx-freq FREQ must be specified\n") - raise SystemExit - - #setup usrp - self._modulator_class = modulator_class - self._setup_usrp_sink(options) - - tx_path = transmit_path.transmit_path(modulator_class, options) - for attr in dir(tx_path): #forward the methods - if not attr.startswith('_') and not hasattr(self, attr): - setattr(self, attr, getattr(tx_path, attr)) - - #connect - self.connect(tx_path, self.u) - - def _setup_usrp_sink(self, options): - """ - Creates a USRP sink, determines the settings for best bitrate, - and attaches to the transmitter's subdevice. - """ - self.u = usrp_options.create_usrp_sink(options) - dac_rate = self.u.dac_rate() - self.rs_rate = options.bitrate # Store requested bit rate - - (self._bitrate, self._samples_per_symbol, self._interp) = \ - pick_tx_bitrate(options.bitrate, self._modulator_class.bits_per_symbol(), - options.samples_per_symbol, options.interp, - dac_rate, self.u.get_interp_rates()) - - options.interp = self._interp - options.samples_per_symbol = self._samples_per_symbol - options.bitrate = self._bitrate - - if options.verbose: - print 'USRP Sink:', self.u - print "Interpolation Rate: ", self._interp - - self.u.set_interp(self._interp) - self.u.set_auto_tr(True) - - if not self.u.set_center_freq(options.tx_freq): - print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.tx_freq)) - raise ValueError, eng_notation.num_to_str(options.tx_freq) |