From 8b73e03472222fc7e12ebe9e85a80f3432bc1de3 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 15:18:22 +0100 Subject: Minor changes to sketch.py --- src/sketch.py | 52 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/src/sketch.py b/src/sketch.py index 5f170b2..58e36a3 100755 --- a/src/sketch.py +++ b/src/sketch.py @@ -36,7 +36,7 @@ create_viewport() setup_dearpygui() # Show demo for dev -# show_demo() +show_demo() #================================================ # Custom GNURadio blocks @@ -122,25 +122,40 @@ sim.connect((sim.digital_costas_loop_cc_0, 0), (locked_time_plot, 0)) # Settings Window with window(label="Settings", width=200, height=400, pos=(25, 450), tag="sim_win"): - add_button(label="Toggle Fullscreen", callback= toggle_viewport_fullscreen) + with child_window(autosize_x=True, height=100): + add_button(label="Toggle Fullscreen", callback= toggle_viewport_fullscreen) - add_text("Simulation running:") - add_text("false", tag="sim_running_lbl") + with child_window(autosize_x=True): + with group(horizontal=True): + add_text("Simulation running:") + add_text("false", tag="sim_running_lbl") - with group(horizontal=True): - def on_sim_start_btn_clicked(): - sim.start() - sim_runnig = True - logger.debug("Started simulation") + with group(tag="sim_grp", horizontal=True): + def on_sim_start_btn_clicked(): + global sim_running - def on_sim_stop_btn_clicked(): - sim.stop() - sim.wait() - sim_running = False - logger.debug("Stopped simulation") + if sim_running: + logger.error("Simulation is already running") + return - add_button(label="Start", tag="sim_start_btn", callback=on_sim_start_btn_clicked) - add_button(label="Stop", tag="sim_stop_btn", callback=on_sim_stop_btn_clicked) + sim.start() + sim_running = True + logger.debug("Started simulation") + + def on_sim_stop_btn_clicked(): + global sim_running + + if not sim_running: + logger.error("Simulation not running") + return + + sim.stop() + sim.wait() + sim_running = False + logger.debug("Stopped simulation") + + add_button(label="Start", tag="sim_start_btn", callback=on_sim_start_btn_clicked) + add_button(label="Stop", tag="sim_stop_btn", callback=on_sim_stop_btn_clicked) #================================================ # Flow Graph Window @@ -196,8 +211,3 @@ start_dearpygui() # clean up gui destroy_context() - -# Stop GNURadio -if sim_running: - sim.stop() - sim.wait() -- cgit v1.2.1 From e01e7d12afc6cd6dca2c4a47a56c7f6f6ccc5dba Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 15:39:57 +0100 Subject: Delete residual files --- hardware/QAM/qpks.py | 1001 ----------------------------------------------- simulation/QPSK/qpks.py | 644 ------------------------------ 2 files changed, 1645 deletions(-) delete mode 100755 hardware/QAM/qpks.py delete mode 100755 simulation/QPSK/qpks.py diff --git a/hardware/QAM/qpks.py b/hardware/QAM/qpks.py deleted file mode 100755 index f89ac12..0000000 --- a/hardware/QAM/qpks.py +++ /dev/null @@ -1,1001 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# -# SPDX-License-Identifier: GPL-3.0 -# -# GNU Radio Python Flow Graph -# Title: QPSK Hardware Simultion -# Author: Pross Naoki, Halter Sara Cinzia -# GNU Radio version: 3.8.2.0 - -from distutils.version import StrictVersion - -if __name__ == '__main__': - import ctypes - import sys - if sys.platform.startswith('linux'): - try: - x11 = ctypes.cdll.LoadLibrary('libX11.so') - x11.XInitThreads() - except: - print("Warning: failed to XInitThreads()") - -from PyQt5 import Qt -from gnuradio import qtgui -from gnuradio.filter import firdes -import sip -from gnuradio import blocks -import pmt -from gnuradio import digital -from gnuradio import gr -import sys -import signal -from argparse import ArgumentParser -from gnuradio.eng_arg import eng_float, intx -from gnuradio import eng_notation -from gnuradio import uhd -import time -from gnuradio.qtgui import Range, RangeWidget - -from gnuradio import qtgui - -class qpks(gr.top_block, Qt.QWidget): - - def __init__(self): - gr.top_block.__init__(self, "QPSK Hardware Simultion") - Qt.QWidget.__init__(self) - self.setWindowTitle("QPSK Hardware Simultion") - qtgui.util.check_set_qss() - try: - self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) - except: - pass - self.top_scroll_layout = Qt.QVBoxLayout() - self.setLayout(self.top_scroll_layout) - self.top_scroll = Qt.QScrollArea() - self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) - self.top_scroll_layout.addWidget(self.top_scroll) - self.top_scroll.setWidgetResizable(True) - self.top_widget = Qt.QWidget() - self.top_scroll.setWidget(self.top_widget) - self.top_layout = Qt.QVBoxLayout(self.top_widget) - self.top_grid_layout = Qt.QGridLayout() - self.top_layout.addLayout(self.top_grid_layout) - - self.settings = Qt.QSettings("GNU Radio", "qpks") - - try: - if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): - self.restoreGeometry(self.settings.value("geometry").toByteArray()) - else: - self.restoreGeometry(self.settings.value("geometry")) - except: - pass - - ################################################## - # Variables - ################################################## - self.sps = sps = 4 - self.nfilts = nfilts = 32 - self.excess_bw = excess_bw = .35 - self.timing_loop_bw = timing_loop_bw = 2 * 3.141592653589793 / 100 - self.samp_rate = samp_rate = .4e6 - self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts) - self.qpsk_const = qpsk_const = digital.constellation_rect([0.707+0.707j, -0.707+0.707j, -0.707-0.707j, 0.707-0.707j], [0, 1, 3, 2], - 4, 2, 2, 1, 1).base() - self.phase_bw = phase_bw = 2 * 3.141592653589793 / 100 - self.eq_ntaps = eq_ntaps = 15 - self.eq_mod = eq_mod = 2 - self.eq_gain = eq_gain = .01 - - ################################################## - # Blocks - ################################################## - self.params = Qt.QTabWidget() - self.params_widget_0 = Qt.QWidget() - self.params_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.params_widget_0) - self.params_grid_layout_0 = Qt.QGridLayout() - self.params_layout_0.addLayout(self.params_grid_layout_0) - self.params.addTab(self.params_widget_0, 'Channel') - self.params_widget_1 = Qt.QWidget() - self.params_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.params_widget_1) - self.params_grid_layout_1 = Qt.QGridLayout() - self.params_layout_1.addLayout(self.params_grid_layout_1) - self.params.addTab(self.params_widget_1, 'Receiver') - self.top_grid_layout.addWidget(self.params) - self.plots = Qt.QTabWidget() - self.plots_widget_0 = Qt.QWidget() - self.plots_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.plots_widget_0) - self.plots_grid_layout_0 = Qt.QGridLayout() - self.plots_layout_0.addLayout(self.plots_grid_layout_0) - self.plots.addTab(self.plots_widget_0, 'Constellations') - self.plots_widget_1 = Qt.QWidget() - self.plots_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.plots_widget_1) - self.plots_grid_layout_1 = Qt.QGridLayout() - self.plots_layout_1.addLayout(self.plots_grid_layout_1) - self.plots.addTab(self.plots_widget_1, 'Frequency') - self.plots_widget_2 = Qt.QWidget() - self.plots_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.plots_widget_2) - self.plots_grid_layout_2 = Qt.QGridLayout() - self.plots_layout_2.addLayout(self.plots_grid_layout_2) - self.plots.addTab(self.plots_widget_2, 'Time') - self.plots_widget_3 = Qt.QWidget() - self.plots_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.plots_widget_3) - self.plots_grid_layout_3 = Qt.QGridLayout() - self.plots_layout_3.addLayout(self.plots_grid_layout_3) - self.plots.addTab(self.plots_widget_3, 'Bits') - self.top_grid_layout.addWidget(self.plots) - self._phase_bw_range = Range(0, 1, .01, 2 * 3.141592653589793 / 100, 200) - self._phase_bw_win = RangeWidget(self._phase_bw_range, self.set_phase_bw, 'Phase Bandwidth', "counter_slider", float) - self.params_grid_layout_1.addWidget(self._phase_bw_win, 1, 0, 1, 1) - for r in range(1, 2): - self.params_grid_layout_1.setRowStretch(r, 1) - for c in range(0, 1): - self.params_grid_layout_1.setColumnStretch(c, 1) - self._eq_gain_range = Range(0, .1, .001, .01, 200) - self._eq_gain_win = RangeWidget(self._eq_gain_range, self.set_eq_gain, 'Equalizer Rate', "counter_slider", float) - self.params_grid_layout_1.addWidget(self._eq_gain_win, 0, 0, 1, 1) - for r in range(0, 1): - self.params_grid_layout_1.setRowStretch(r, 1) - for c in range(0, 1): - self.params_grid_layout_1.setColumnStretch(c, 1) - self.uhd_usrp_source_0 = uhd.usrp_source( - ",".join(("serial=309AF6A ", "")), - uhd.stream_args( - cpu_format="fc32", - args='', - channels=list(range(0,1)), - ), - ) - self.uhd_usrp_source_0.set_clock_source('external', 0) - self.uhd_usrp_source_0.set_center_freq(2.4e9, 0) - self.uhd_usrp_source_0.set_rx_agc(False, 0) - self.uhd_usrp_source_0.set_normalized_gain(0.6, 0) - self.uhd_usrp_source_0.set_antenna('RX2', 0) - self.uhd_usrp_source_0.set_samp_rate(samp_rate) - self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec()) - self.uhd_usrp_sink_0 = uhd.usrp_sink( - ",".join(("serial=309AF59 ", "")), - uhd.stream_args( - cpu_format="fc32", - args='', - channels=list(range(0,1)), - ), - '', - ) - self.uhd_usrp_sink_0.set_clock_source('external', 0) - self.uhd_usrp_sink_0.set_center_freq(2.4e9, 0) - self.uhd_usrp_sink_0.set_normalized_gain(0.35, 0) - self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) - self.uhd_usrp_sink_0.set_samp_rate(samp_rate) - self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec()) - self.qtgui_time_sink_x_2_0_0 = qtgui.time_sink_c( - 1024, #size - samp_rate, #samp_rate - "Received (RX)", #name - 1 #number of inputs - ) - self.qtgui_time_sink_x_2_0_0.set_update_time(0.10) - self.qtgui_time_sink_x_2_0_0.set_y_axis(-1, 1) - - self.qtgui_time_sink_x_2_0_0.set_y_label('Amplitude', "") - - self.qtgui_time_sink_x_2_0_0.enable_tags(False) - self.qtgui_time_sink_x_2_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") - self.qtgui_time_sink_x_2_0_0.enable_autoscale(True) - self.qtgui_time_sink_x_2_0_0.enable_grid(False) - self.qtgui_time_sink_x_2_0_0.enable_axis_labels(True) - self.qtgui_time_sink_x_2_0_0.enable_control_panel(False) - self.qtgui_time_sink_x_2_0_0.enable_stem_plot(False) - - - labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', - 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ['blue', 'red', 'green', 'black', 'cyan', - 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue'] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - - - for i in range(2): - if len(labels[i]) == 0: - if (i % 2 == 0): - self.qtgui_time_sink_x_2_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) - else: - self.qtgui_time_sink_x_2_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) - else: - self.qtgui_time_sink_x_2_0_0.set_line_label(i, labels[i]) - self.qtgui_time_sink_x_2_0_0.set_line_width(i, widths[i]) - self.qtgui_time_sink_x_2_0_0.set_line_color(i, colors[i]) - self.qtgui_time_sink_x_2_0_0.set_line_style(i, styles[i]) - self.qtgui_time_sink_x_2_0_0.set_line_marker(i, markers[i]) - self.qtgui_time_sink_x_2_0_0.set_line_alpha(i, alphas[i]) - - self._qtgui_time_sink_x_2_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_2_0_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_2.addWidget(self._qtgui_time_sink_x_2_0_0_win, 1, 0, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_2.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_2.setColumnStretch(c, 1) - self.qtgui_time_sink_x_2 = qtgui.time_sink_c( - 1024, #size - samp_rate, #samp_rate - "Modulated (TX)", #name - 1 #number of inputs - ) - self.qtgui_time_sink_x_2.set_update_time(0.10) - self.qtgui_time_sink_x_2.set_y_axis(-1, 1) - - self.qtgui_time_sink_x_2.set_y_label('Amplitude', "") - - self.qtgui_time_sink_x_2.enable_tags(False) - self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") - self.qtgui_time_sink_x_2.enable_autoscale(True) - self.qtgui_time_sink_x_2.enable_grid(False) - self.qtgui_time_sink_x_2.enable_axis_labels(True) - self.qtgui_time_sink_x_2.enable_control_panel(False) - self.qtgui_time_sink_x_2.enable_stem_plot(False) - - - labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', - 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ['blue', 'red', 'green', 'black', 'cyan', - 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue'] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - - - for i in range(2): - if len(labels[i]) == 0: - if (i % 2 == 0): - self.qtgui_time_sink_x_2.set_line_label(i, "Re{{Data {0}}}".format(i/2)) - else: - self.qtgui_time_sink_x_2.set_line_label(i, "Im{{Data {0}}}".format(i/2)) - else: - self.qtgui_time_sink_x_2.set_line_label(i, labels[i]) - self.qtgui_time_sink_x_2.set_line_width(i, widths[i]) - self.qtgui_time_sink_x_2.set_line_color(i, colors[i]) - self.qtgui_time_sink_x_2.set_line_style(i, styles[i]) - self.qtgui_time_sink_x_2.set_line_marker(i, markers[i]) - self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i]) - - self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_2.addWidget(self._qtgui_time_sink_x_2_win, 0, 0, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_2.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_2.setColumnStretch(c, 1) - self.qtgui_freq_sink_x_1_0_1_0 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - samp_rate, #bw - "Locked", #name - 1 - ) - self.qtgui_freq_sink_x_1_0_1_0.set_update_time(0.10) - self.qtgui_freq_sink_x_1_0_1_0.set_y_axis(-140, 10) - self.qtgui_freq_sink_x_1_0_1_0.set_y_label('Relative Gain', 'dB') - self.qtgui_freq_sink_x_1_0_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") - self.qtgui_freq_sink_x_1_0_1_0.enable_autoscale(False) - self.qtgui_freq_sink_x_1_0_1_0.enable_grid(False) - self.qtgui_freq_sink_x_1_0_1_0.set_fft_average(1.0) - self.qtgui_freq_sink_x_1_0_1_0.enable_axis_labels(True) - self.qtgui_freq_sink_x_1_0_1_0.enable_control_panel(False) - - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_freq_sink_x_1_0_1_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_freq_sink_x_1_0_1_0.set_line_label(i, labels[i]) - self.qtgui_freq_sink_x_1_0_1_0.set_line_width(i, widths[i]) - self.qtgui_freq_sink_x_1_0_1_0.set_line_color(i, colors[i]) - self.qtgui_freq_sink_x_1_0_1_0.set_line_alpha(i, alphas[i]) - - self._qtgui_freq_sink_x_1_0_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_1_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_0_1_0_win, 1, 2, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_1.setRowStretch(r, 1) - for c in range(2, 3): - self.plots_grid_layout_1.setColumnStretch(c, 1) - self.qtgui_freq_sink_x_1_0_1 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - samp_rate, #bw - "Equalized", #name - 1 - ) - self.qtgui_freq_sink_x_1_0_1.set_update_time(0.10) - self.qtgui_freq_sink_x_1_0_1.set_y_axis(-140, 10) - self.qtgui_freq_sink_x_1_0_1.set_y_label('Relative Gain', 'dB') - self.qtgui_freq_sink_x_1_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") - self.qtgui_freq_sink_x_1_0_1.enable_autoscale(False) - self.qtgui_freq_sink_x_1_0_1.enable_grid(False) - self.qtgui_freq_sink_x_1_0_1.set_fft_average(1.0) - self.qtgui_freq_sink_x_1_0_1.enable_axis_labels(True) - self.qtgui_freq_sink_x_1_0_1.enable_control_panel(False) - - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_freq_sink_x_1_0_1.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_freq_sink_x_1_0_1.set_line_label(i, labels[i]) - self.qtgui_freq_sink_x_1_0_1.set_line_width(i, widths[i]) - self.qtgui_freq_sink_x_1_0_1.set_line_color(i, colors[i]) - self.qtgui_freq_sink_x_1_0_1.set_line_alpha(i, alphas[i]) - - self._qtgui_freq_sink_x_1_0_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_1.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_0_1_win, 1, 1, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_1.setRowStretch(r, 1) - for c in range(1, 2): - self.plots_grid_layout_1.setColumnStretch(c, 1) - self.qtgui_freq_sink_x_1_0_0 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - samp_rate, #bw - "Received", #name - 1 - ) - self.qtgui_freq_sink_x_1_0_0.set_update_time(0.10) - self.qtgui_freq_sink_x_1_0_0.set_y_axis(-140, 10) - self.qtgui_freq_sink_x_1_0_0.set_y_label('Relative Gain', 'dB') - self.qtgui_freq_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") - self.qtgui_freq_sink_x_1_0_0.enable_autoscale(False) - self.qtgui_freq_sink_x_1_0_0.enable_grid(False) - self.qtgui_freq_sink_x_1_0_0.set_fft_average(1.0) - self.qtgui_freq_sink_x_1_0_0.enable_axis_labels(True) - self.qtgui_freq_sink_x_1_0_0.enable_control_panel(False) - - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_freq_sink_x_1_0_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_freq_sink_x_1_0_0.set_line_label(i, labels[i]) - self.qtgui_freq_sink_x_1_0_0.set_line_width(i, widths[i]) - self.qtgui_freq_sink_x_1_0_0.set_line_color(i, colors[i]) - self.qtgui_freq_sink_x_1_0_0.set_line_alpha(i, alphas[i]) - - self._qtgui_freq_sink_x_1_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_0_0_win, 0, 1, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_1.setRowStretch(r, 1) - for c in range(1, 2): - self.plots_grid_layout_1.setColumnStretch(c, 1) - self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - samp_rate, #bw - "Synchronized and filtered", #name - 1 - ) - self.qtgui_freq_sink_x_1_0.set_update_time(0.10) - self.qtgui_freq_sink_x_1_0.set_y_axis(-140, 10) - self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') - self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") - self.qtgui_freq_sink_x_1_0.enable_autoscale(False) - self.qtgui_freq_sink_x_1_0.enable_grid(False) - self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) - self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) - self.qtgui_freq_sink_x_1_0.enable_control_panel(False) - - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) - self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) - self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) - self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) - - self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 2, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_1.setRowStretch(r, 1) - for c in range(2, 3): - self.plots_grid_layout_1.setColumnStretch(c, 1) - self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - samp_rate, #bw - "Modulated (TX)", #name - 1 - ) - self.qtgui_freq_sink_x_1.set_update_time(0.10) - self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) - self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') - self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") - self.qtgui_freq_sink_x_1.enable_autoscale(False) - self.qtgui_freq_sink_x_1.enable_grid(False) - self.qtgui_freq_sink_x_1.set_fft_average(1.0) - self.qtgui_freq_sink_x_1.enable_axis_labels(True) - self.qtgui_freq_sink_x_1.enable_control_panel(False) - - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) - self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) - self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) - self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) - - self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_win, 0, 0, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_1.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_1.setColumnStretch(c, 1) - self.qtgui_eye_sink_x_1 = qtgui.eye_sink_c( - 1024, #size - samp_rate, #samp_rate - "", #name - 1 #number of inputs - ) - self.qtgui_eye_sink_x_1.set_update_time(0.10) - self.qtgui_eye_sink_x_1.set_samp_per_symbol(sps) - self.qtgui_eye_sink_x_1.set_y_axis(-1, 1) - - self.qtgui_eye_sink_x_1.set_y_label('Amplitude', "") - - self.qtgui_eye_sink_x_1.enable_tags(True) - self.qtgui_eye_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") - self.qtgui_eye_sink_x_1.enable_autoscale(False) - self.qtgui_eye_sink_x_1.enable_grid(False) - self.qtgui_eye_sink_x_1.enable_axis_labels(True) - self.qtgui_eye_sink_x_1.enable_control_panel(False) - - - labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', - 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ['blue', 'blue', 'blue', 'blue', 'blue', - 'blue', 'blue', 'blue', 'blue', 'blue'] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - - - for i in range(2): - if len(labels[i]) == 0: - if (i % 2 == 0): - self.qtgui_eye_sink_x_1.set_line_label(i, "Eye [Re{{Data {0}}}]".format(round(i/2))) - else: - self.qtgui_eye_sink_x_1.set_line_label(i, "Eye [Im{{Data {0}}}]".format(round((i-1)/2))) - else: - self.qtgui_eye_sink_x_1.set_line_label(i, labels[i]) - self.qtgui_eye_sink_x_1.set_line_width(i, widths[i]) - self.qtgui_eye_sink_x_1.set_line_color(i, colors[i]) - self.qtgui_eye_sink_x_1.set_line_style(i, styles[i]) - self.qtgui_eye_sink_x_1.set_line_marker(i, markers[i]) - self.qtgui_eye_sink_x_1.set_line_alpha(i, alphas[i]) - - self._qtgui_eye_sink_x_1_win = sip.wrapinstance(self.qtgui_eye_sink_x_1.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_3.addWidget(self._qtgui_eye_sink_x_1_win, 1, 0, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_3.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_3.setColumnStretch(c, 1) - self.qtgui_eye_sink_x_0 = qtgui.eye_sink_c( - 1024, #size - samp_rate, #samp_rate - "", #name - 1 #number of inputs - ) - self.qtgui_eye_sink_x_0.set_update_time(0.10) - self.qtgui_eye_sink_x_0.set_samp_per_symbol(sps) - self.qtgui_eye_sink_x_0.set_y_axis(-1, 1) - - self.qtgui_eye_sink_x_0.set_y_label('Amplitude', "") - - self.qtgui_eye_sink_x_0.enable_tags(True) - self.qtgui_eye_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") - self.qtgui_eye_sink_x_0.enable_autoscale(False) - self.qtgui_eye_sink_x_0.enable_grid(False) - self.qtgui_eye_sink_x_0.enable_axis_labels(True) - self.qtgui_eye_sink_x_0.enable_control_panel(False) - - - labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', - 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ['blue', 'blue', 'blue', 'blue', 'blue', - 'blue', 'blue', 'blue', 'blue', 'blue'] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - - - for i in range(2): - if len(labels[i]) == 0: - if (i % 2 == 0): - self.qtgui_eye_sink_x_0.set_line_label(i, "Eye [Re{{Data {0}}}]".format(round(i/2))) - else: - self.qtgui_eye_sink_x_0.set_line_label(i, "Eye [Im{{Data {0}}}]".format(round((i-1)/2))) - else: - self.qtgui_eye_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_eye_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_eye_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_eye_sink_x_0.set_line_style(i, styles[i]) - self.qtgui_eye_sink_x_0.set_line_marker(i, markers[i]) - self.qtgui_eye_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_eye_sink_x_0_win = sip.wrapinstance(self.qtgui_eye_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_grid_layout.addWidget(self._qtgui_eye_sink_x_0_win) - self.qtgui_const_sink_x_2 = qtgui.const_sink_c( - 1024, #size - "Locked", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_2.set_update_time(0.10) - self.qtgui_const_sink_x_2.set_y_axis(-2, 2) - self.qtgui_const_sink_x_2.set_x_axis(-2, 2) - self.qtgui_const_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_2.enable_autoscale(False) - self.qtgui_const_sink_x_2.enable_grid(False) - self.qtgui_const_sink_x_2.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_2.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_2.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_2.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_2.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_2.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_2.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_2.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_2_win = sip.wrapinstance(self.qtgui_const_sink_x_2.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_2_win, 1, 2, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(2, 3): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.qtgui_const_sink_x_1_0 = qtgui.const_sink_c( - 1024, #size - "Equalized", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_1_0.set_update_time(0.10) - self.qtgui_const_sink_x_1_0.set_y_axis(-2, 2) - self.qtgui_const_sink_x_1_0.set_x_axis(-2, 2) - self.qtgui_const_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_1_0.enable_autoscale(False) - self.qtgui_const_sink_x_1_0.enable_grid(False) - self.qtgui_const_sink_x_1_0.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_1_0.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_1_0.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_1_0.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_1_0.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_1_0.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_1_0.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_1_0_win = sip.wrapinstance(self.qtgui_const_sink_x_1_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_1_0_win, 1, 1, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(1, 2): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.qtgui_const_sink_x_0_0_0 = qtgui.const_sink_c( - 2048, #size - "Received", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_0_0_0.set_update_time(0.10) - self.qtgui_const_sink_x_0_0_0.set_y_axis(-2, 2) - self.qtgui_const_sink_x_0_0_0.set_x_axis(-2, 2) - self.qtgui_const_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_0_0_0.enable_autoscale(True) - self.qtgui_const_sink_x_0_0_0.enable_grid(False) - self.qtgui_const_sink_x_0_0_0.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_0_0_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_0_0_0.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_0_0_0.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_0_0_0.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_0_0_0.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_0_0_0.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_0_0_0.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0_0_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_0_0_win, 0, 1, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(1, 2): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c( - 2048, #size - "Synchronized and filtered", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_0_0.set_update_time(0.10) - self.qtgui_const_sink_x_0_0.set_y_axis(-2, 2) - self.qtgui_const_sink_x_0_0.set_x_axis(-2, 2) - self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_0_0.enable_autoscale(True) - self.qtgui_const_sink_x_0_0.enable_grid(False) - self.qtgui_const_sink_x_0_0.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_0_0.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_0_0.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_0_0.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_0_0.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_0_0.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_0_0.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_0_win, 0, 2, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(2, 3): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.qtgui_const_sink_x_0 = qtgui.const_sink_c( - 1024, #size - "Sent (with ISI)", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_0.set_update_time(0.10) - self.qtgui_const_sink_x_0.set_y_axis(-2, 2) - self.qtgui_const_sink_x_0.set_x_axis(-2, 2) - self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_0.enable_autoscale(False) - self.qtgui_const_sink_x_0.enable_grid(False) - self.qtgui_const_sink_x_0.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_win, 0, 0, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, int(sps / 2)) - self.digital_map_bb_0 = digital.map_bb([0, 1, 3, 2]) - self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4) - self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 4, False) - self.digital_constellation_modulator_0 = digital.generic_mod( - constellation=qpsk_const, - differential=True, - samples_per_symbol=sps, - pre_diff_code=True, - excess_bw=excess_bw, - verbose=False, - log=False) - self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(qpsk_const) - self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, int(sps / 2)) - self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1) - self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, '/home/god/Documents/Fading/hardware/QPSK/lena512color.tiff', True, 0, 0) - self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) - - - - ################################################## - # Connections - ################################################## - self.connect((self.blocks_file_source_0, 0), (self.digital_constellation_modulator_0, 0)) - self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0, 0)) - self.connect((self.digital_cma_equalizer_cc_0, 0), (self.qtgui_const_sink_x_1_0, 0)) - self.connect((self.digital_cma_equalizer_cc_0, 0), (self.qtgui_freq_sink_x_1_0_1, 0)) - self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) - self.connect((self.digital_constellation_modulator_0, 0), (self.qtgui_const_sink_x_0, 0)) - self.connect((self.digital_constellation_modulator_0, 0), (self.qtgui_freq_sink_x_1, 0)) - self.connect((self.digital_constellation_modulator_0, 0), (self.qtgui_time_sink_x_2, 0)) - self.connect((self.digital_constellation_modulator_0, 0), (self.uhd_usrp_sink_0, 0)) - self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_constellation_decoder_cb_0, 0)) - self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_2, 0)) - self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_eye_sink_x_1, 0)) - self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_freq_sink_x_1_0_1_0, 0)) - self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_time_sink_x_2_0_0, 0)) - self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_map_bb_0, 0)) - self.connect((self.digital_map_bb_0, 0), (self.blocks_null_sink_0, 0)) - self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0)) - self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_const_sink_x_0_0, 0)) - self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) - self.connect((self.uhd_usrp_source_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) - self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_const_sink_x_0_0_0, 0)) - self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_freq_sink_x_1_0_0, 0)) - - - def closeEvent(self, event): - self.settings = Qt.QSettings("GNU Radio", "qpks") - self.settings.setValue("geometry", self.saveGeometry()) - event.accept() - - def get_sps(self): - return self.sps - - def set_sps(self, sps): - self.sps = sps - self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) - self.qtgui_eye_sink_x_0.set_samp_per_symbol(self.sps) - self.qtgui_eye_sink_x_1.set_samp_per_symbol(self.sps) - - def get_nfilts(self): - return self.nfilts - - def set_nfilts(self, nfilts): - self.nfilts = nfilts - self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) - - def get_excess_bw(self): - return self.excess_bw - - def set_excess_bw(self, excess_bw): - self.excess_bw = excess_bw - self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) - - def get_timing_loop_bw(self): - return self.timing_loop_bw - - def set_timing_loop_bw(self, timing_loop_bw): - self.timing_loop_bw = timing_loop_bw - self.digital_pfb_clock_sync_xxx_0.set_loop_bandwidth(self.timing_loop_bw) - - def get_samp_rate(self): - return self.samp_rate - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.qtgui_eye_sink_x_0.set_samp_rate(self.samp_rate) - self.qtgui_eye_sink_x_1.set_samp_rate(self.samp_rate) - self.qtgui_freq_sink_x_1.set_frequency_range(0, self.samp_rate) - self.qtgui_freq_sink_x_1_0.set_frequency_range(0, self.samp_rate) - self.qtgui_freq_sink_x_1_0_0.set_frequency_range(0, self.samp_rate) - self.qtgui_freq_sink_x_1_0_1.set_frequency_range(0, self.samp_rate) - self.qtgui_freq_sink_x_1_0_1_0.set_frequency_range(0, self.samp_rate) - self.qtgui_time_sink_x_2.set_samp_rate(self.samp_rate) - self.qtgui_time_sink_x_2_0_0.set_samp_rate(self.samp_rate) - self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate) - self.uhd_usrp_source_0.set_samp_rate(self.samp_rate) - - def get_rrc_taps(self): - return self.rrc_taps - - def set_rrc_taps(self, rrc_taps): - self.rrc_taps = rrc_taps - self.digital_pfb_clock_sync_xxx_0.update_taps(self.rrc_taps) - - def get_qpsk_const(self): - return self.qpsk_const - - def set_qpsk_const(self, qpsk_const): - self.qpsk_const = qpsk_const - - def get_phase_bw(self): - return self.phase_bw - - def set_phase_bw(self, phase_bw): - self.phase_bw = phase_bw - self.digital_costas_loop_cc_0.set_loop_bandwidth(self.phase_bw) - - def get_eq_ntaps(self): - return self.eq_ntaps - - def set_eq_ntaps(self, eq_ntaps): - self.eq_ntaps = eq_ntaps - - def get_eq_mod(self): - return self.eq_mod - - def set_eq_mod(self, eq_mod): - self.eq_mod = eq_mod - self.digital_cma_equalizer_cc_0.set_modulus(self.eq_mod) - - def get_eq_gain(self): - return self.eq_gain - - def set_eq_gain(self, eq_gain): - self.eq_gain = eq_gain - self.digital_cma_equalizer_cc_0.set_gain(self.eq_gain) - - - - - -def main(top_block_cls=qpks, options=None): - if gr.enable_realtime_scheduling() != gr.RT_OK: - print("Error: failed to enable real-time scheduling.") - - if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): - style = gr.prefs().get_string('qtgui', 'style', 'raster') - Qt.QApplication.setGraphicsSystem(style) - qapp = Qt.QApplication(sys.argv) - - tb = top_block_cls() - - tb.start() - - tb.show() - - def sig_handler(sig=None, frame=None): - Qt.QApplication.quit() - - signal.signal(signal.SIGINT, sig_handler) - signal.signal(signal.SIGTERM, sig_handler) - - timer = Qt.QTimer() - timer.start(500) - timer.timeout.connect(lambda: None) - - def quitting(): - tb.stop() - tb.wait() - - qapp.aboutToQuit.connect(quitting) - qapp.exec_() - -if __name__ == '__main__': - main() diff --git a/simulation/QPSK/qpks.py b/simulation/QPSK/qpks.py deleted file mode 100755 index 98a982f..0000000 --- a/simulation/QPSK/qpks.py +++ /dev/null @@ -1,644 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# -# SPDX-License-Identifier: GPL-3.0 -# -# GNU Radio Python Flow Graph -# Title: QPSK -# Author: Pross Naoki, Halter Sara Cinzia -# GNU Radio version: 3.8.2.0 - -from distutils.version import StrictVersion - -if __name__ == '__main__': - import ctypes - import sys - if sys.platform.startswith('linux'): - try: - x11 = ctypes.cdll.LoadLibrary('libX11.so') - x11.XInitThreads() - except: - print("Warning: failed to XInitThreads()") - -from PyQt5 import Qt -from gnuradio import qtgui -from gnuradio.filter import firdes -import sip -from gnuradio import blocks -import numpy -from gnuradio import channels -from gnuradio import digital -from gnuradio import gr -import sys -import signal -from argparse import ArgumentParser -from gnuradio.eng_arg import eng_float, intx -from gnuradio import eng_notation -from gnuradio.qtgui import Range, RangeWidget - -from gnuradio import qtgui - -class qpks(gr.top_block, Qt.QWidget): - - def __init__(self): - gr.top_block.__init__(self, "QPSK") - Qt.QWidget.__init__(self) - self.setWindowTitle("QPSK") - qtgui.util.check_set_qss() - try: - self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) - except: - pass - self.top_scroll_layout = Qt.QVBoxLayout() - self.setLayout(self.top_scroll_layout) - self.top_scroll = Qt.QScrollArea() - self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) - self.top_scroll_layout.addWidget(self.top_scroll) - self.top_scroll.setWidgetResizable(True) - self.top_widget = Qt.QWidget() - self.top_scroll.setWidget(self.top_widget) - self.top_layout = Qt.QVBoxLayout(self.top_widget) - self.top_grid_layout = Qt.QGridLayout() - self.top_layout.addLayout(self.top_grid_layout) - - self.settings = Qt.QSettings("GNU Radio", "qpks") - - try: - if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): - self.restoreGeometry(self.settings.value("geometry").toByteArray()) - else: - self.restoreGeometry(self.settings.value("geometry")) - except: - pass - - ################################################## - # Variables - ################################################## - self.sps = sps = 4 - self.nfilts = nfilts = 32 - self.excess_bw = excess_bw = 350e-3 - self.timing_loop_bw = timing_loop_bw = 2 * 3.141592653589793 / 100 - self.time_offset = time_offset = 1.0 - self.samp_rate = samp_rate = 32000 - self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts) - self.qpsk_const = qpsk_const = digital.constellation_rect([0.707+1j, -0.707+0.707j, -0.707-0.707j, 0.707-0.707j], [0, 1, 3, 2], - 4, 2, 2, 1, 1).base() - self.phase_bw = phase_bw = 2 * 3.141592653589793 / 100 - self.noise_volt = noise_volt = 0.0001 - self.freq_offset = freq_offset = 0 - self.eq_ntaps = eq_ntaps = 15 - self.eq_mod = eq_mod = 1 - self.eq_gain = eq_gain = .01 - self.chn_taps = chn_taps = [1.0 + 0.0j, ] - - ################################################## - # Blocks - ################################################## - self.params = Qt.QTabWidget() - self.params_widget_0 = Qt.QWidget() - self.params_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.params_widget_0) - self.params_grid_layout_0 = Qt.QGridLayout() - self.params_layout_0.addLayout(self.params_grid_layout_0) - self.params.addTab(self.params_widget_0, 'Channel') - self.params_widget_1 = Qt.QWidget() - self.params_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.params_widget_1) - self.params_grid_layout_1 = Qt.QGridLayout() - self.params_layout_1.addLayout(self.params_grid_layout_1) - self.params.addTab(self.params_widget_1, 'Receiver') - self.top_grid_layout.addWidget(self.params) - self._timing_loop_bw_range = Range(0, 200e-3, 10e-3, 2 * 3.141592653589793 / 100, 200) - self._timing_loop_bw_win = RangeWidget(self._timing_loop_bw_range, self.set_timing_loop_bw, 'Time Bandwidth', "counter_slider", float) - self.params_grid_layout_0.addWidget(self._timing_loop_bw_win, 1, 1, 1, 1) - for r in range(1, 2): - self.params_grid_layout_0.setRowStretch(r, 1) - for c in range(1, 2): - self.params_grid_layout_0.setColumnStretch(c, 1) - self._time_offset_range = Range(0.999, 1.001, 0.0001, 1.0, 200) - self._time_offset_win = RangeWidget(self._time_offset_range, self.set_time_offset, 'Timing Offset', "counter_slider", float) - self.params_grid_layout_0.addWidget(self._time_offset_win, 0, 1, 1, 1) - for r in range(0, 1): - self.params_grid_layout_0.setRowStretch(r, 1) - for c in range(1, 2): - self.params_grid_layout_0.setColumnStretch(c, 1) - self.plots = Qt.QTabWidget() - self.plots_widget_0 = Qt.QWidget() - self.plots_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.plots_widget_0) - self.plots_grid_layout_0 = Qt.QGridLayout() - self.plots_layout_0.addLayout(self.plots_grid_layout_0) - self.plots.addTab(self.plots_widget_0, 'Constellations') - self.plots_widget_1 = Qt.QWidget() - self.plots_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.plots_widget_1) - self.plots_grid_layout_1 = Qt.QGridLayout() - self.plots_layout_1.addLayout(self.plots_grid_layout_1) - self.plots.addTab(self.plots_widget_1, 'Frequency') - self.plots_widget_2 = Qt.QWidget() - self.plots_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.plots_widget_2) - self.plots_grid_layout_2 = Qt.QGridLayout() - self.plots_layout_2.addLayout(self.plots_grid_layout_2) - self.plots.addTab(self.plots_widget_2, 'Time') - self.top_grid_layout.addWidget(self.plots) - self._phase_bw_range = Range(0, 1, .01, 2 * 3.141592653589793 / 100, 200) - self._phase_bw_win = RangeWidget(self._phase_bw_range, self.set_phase_bw, 'Phase Bandwidth', "counter_slider", float) - self.params_grid_layout_1.addWidget(self._phase_bw_win, 1, 0, 1, 1) - for r in range(1, 2): - self.params_grid_layout_1.setRowStretch(r, 1) - for c in range(0, 1): - self.params_grid_layout_1.setColumnStretch(c, 1) - self._noise_volt_range = Range(0, 1, 0.01, 0.0001, 200) - self._noise_volt_win = RangeWidget(self._noise_volt_range, self.set_noise_volt, 'Noise Voltage', "counter_slider", float) - self.params_grid_layout_0.addWidget(self._noise_volt_win, 0, 0, 1, 1) - for r in range(0, 1): - self.params_grid_layout_0.setRowStretch(r, 1) - for c in range(0, 1): - self.params_grid_layout_0.setColumnStretch(c, 1) - self._freq_offset_range = Range(-100e-3, 100e-3, 1e-3, 0, 200) - self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, 'Frequency Offset', "counter_slider", float) - self.params_grid_layout_0.addWidget(self._freq_offset_win, 1, 0, 1, 1) - for r in range(1, 2): - self.params_grid_layout_0.setRowStretch(r, 1) - for c in range(0, 1): - self.params_grid_layout_0.setColumnStretch(c, 1) - self._eq_gain_range = Range(0, .1, .001, .01, 200) - self._eq_gain_win = RangeWidget(self._eq_gain_range, self.set_eq_gain, 'Equalizer Rate', "counter_slider", float) - self.params_grid_layout_1.addWidget(self._eq_gain_win, 0, 0, 1, 1) - for r in range(0, 1): - self.params_grid_layout_1.setRowStretch(r, 1) - for c in range(0, 1): - self.params_grid_layout_1.setColumnStretch(c, 1) - self.qtgui_time_sink_x_0 = qtgui.time_sink_f( - 1024, #size - samp_rate, #samp_rate - "Decoded", #name - 2 #number of inputs - ) - self.qtgui_time_sink_x_0.set_update_time(0.10) - self.qtgui_time_sink_x_0.set_y_axis(-1, 1) - - self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") - - self.qtgui_time_sink_x_0.enable_tags(True) - self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") - self.qtgui_time_sink_x_0.enable_autoscale(False) - self.qtgui_time_sink_x_0.enable_grid(False) - self.qtgui_time_sink_x_0.enable_axis_labels(True) - self.qtgui_time_sink_x_0.enable_control_panel(False) - self.qtgui_time_sink_x_0.enable_stem_plot(False) - - - labels = ['Received', 'Sent', 'Signal 3', 'Signal 4', 'Signal 5', - 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ['blue', 'red', 'green', 'black', 'cyan', - 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue'] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - - - for i in range(2): - if len(labels[i]) == 0: - self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) - self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) - self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_win, 0, 0, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_2.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_2.setColumnStretch(c, 1) - self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - samp_rate, #bw - "Channel", #name - 1 - ) - self.qtgui_freq_sink_x_0.set_update_time(0.10) - self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) - self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') - self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") - self.qtgui_freq_sink_x_0.enable_autoscale(False) - self.qtgui_freq_sink_x_0.enable_grid(False) - self.qtgui_freq_sink_x_0.set_fft_average(1.0) - self.qtgui_freq_sink_x_0.enable_axis_labels(True) - self.qtgui_freq_sink_x_0.enable_control_panel(False) - - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_1.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_1.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_1.setColumnStretch(c, 1) - self.qtgui_const_sink_x_2 = qtgui.const_sink_c( - 1024, #size - "Locked", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_2.set_update_time(0.10) - self.qtgui_const_sink_x_2.set_y_axis(-2, 2) - self.qtgui_const_sink_x_2.set_x_axis(-2, 2) - self.qtgui_const_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_2.enable_autoscale(False) - self.qtgui_const_sink_x_2.enable_grid(False) - self.qtgui_const_sink_x_2.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_2.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_2.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_2.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_2.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_2.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_2.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_2.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_2_win = sip.wrapinstance(self.qtgui_const_sink_x_2.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_2_win, 1, 1, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(1, 2): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.qtgui_const_sink_x_1 = qtgui.const_sink_c( - 1024, #size - "Equalized", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_1.set_update_time(0.10) - self.qtgui_const_sink_x_1.set_y_axis(-2, 2) - self.qtgui_const_sink_x_1.set_x_axis(-2, 2) - self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_1.enable_autoscale(False) - self.qtgui_const_sink_x_1.enable_grid(False) - self.qtgui_const_sink_x_1.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_1.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_1.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_1.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_1.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_1.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_1.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_1_win = sip.wrapinstance(self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_1_win, 1, 0, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c( - 2048, #size - "Synchronized", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_0_0.set_update_time(0.10) - self.qtgui_const_sink_x_0_0.set_y_axis(-2, 2) - self.qtgui_const_sink_x_0_0.set_x_axis(-2, 2) - self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_0_0.enable_autoscale(False) - self.qtgui_const_sink_x_0_0.enable_grid(False) - self.qtgui_const_sink_x_0_0.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_0_0.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_0_0.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_0_0.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_0_0.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_0_0.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_0_0.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_0_win, 0, 1, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(1, 2): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.qtgui_const_sink_x_0 = qtgui.const_sink_c( - 2048, #size - "Channel", #name - 1 #number of inputs - ) - self.qtgui_const_sink_x_0.set_update_time(0.10) - self.qtgui_const_sink_x_0.set_y_axis(-2, 2) - self.qtgui_const_sink_x_0.set_x_axis(-2, 2) - self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_0.enable_autoscale(False) - self.qtgui_const_sink_x_0.enable_grid(False) - self.qtgui_const_sink_x_0.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(1): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_win, 0, 0, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_0.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_0.setColumnStretch(c, 1) - self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps * 1.001, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 2) - self.digital_map_bb_0 = digital.map_bb([0, 1, 3, 2]) - self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4) - self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 4, False) - self.digital_constellation_modulator_0 = digital.generic_mod( - constellation=qpsk_const, - differential=True, - samples_per_symbol=sps, - pre_diff_code=True, - excess_bw=excess_bw, - verbose=False, - log=False) - self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(qpsk_const) - self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, 2) - self.channels_channel_model_0 = channels.channel_model( - noise_voltage=noise_volt, - frequency_offset=freq_offset, - epsilon=time_offset, - taps=chn_taps, - noise_seed=0, - block_tags=False) - self.blocks_unpack_k_bits_bb_0_0 = blocks.unpack_k_bits_bb(2) - self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2) - self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) - self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, 50) - self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1) - self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) - self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 256, 1000))), True) - - - - ################################################## - # Connections - ################################################## - self.connect((self.analog_random_source_x_0, 0), (self.blocks_unpack_k_bits_bb_0_0, 0)) - self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0, 0)) - self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 0)) - self.connect((self.blocks_char_to_float_0_0, 0), (self.blocks_delay_0, 0)) - self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0, 1)) - self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) - self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0, 0)) - self.connect((self.blocks_unpack_k_bits_bb_0_0, 0), (self.blocks_char_to_float_0_0, 0)) - self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) - self.connect((self.channels_channel_model_0, 0), (self.qtgui_const_sink_x_0, 0)) - self.connect((self.channels_channel_model_0, 0), (self.qtgui_freq_sink_x_0, 0)) - self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0, 0)) - self.connect((self.digital_cma_equalizer_cc_0, 0), (self.qtgui_const_sink_x_1, 0)) - self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) - self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) - self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_constellation_decoder_cb_0, 0)) - self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_2, 0)) - self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_map_bb_0, 0)) - self.connect((self.digital_map_bb_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) - self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0)) - self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_const_sink_x_0_0, 0)) - - - def closeEvent(self, event): - self.settings = Qt.QSettings("GNU Radio", "qpks") - self.settings.setValue("geometry", self.saveGeometry()) - event.accept() - - def get_sps(self): - return self.sps - - def set_sps(self, sps): - self.sps = sps - self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) - - def get_nfilts(self): - return self.nfilts - - def set_nfilts(self, nfilts): - self.nfilts = nfilts - self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) - - def get_excess_bw(self): - return self.excess_bw - - def set_excess_bw(self, excess_bw): - self.excess_bw = excess_bw - self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) - - def get_timing_loop_bw(self): - return self.timing_loop_bw - - def set_timing_loop_bw(self, timing_loop_bw): - self.timing_loop_bw = timing_loop_bw - self.digital_pfb_clock_sync_xxx_0.set_loop_bandwidth(self.timing_loop_bw) - - def get_time_offset(self): - return self.time_offset - - def set_time_offset(self, time_offset): - self.time_offset = time_offset - self.channels_channel_model_0.set_timing_offset(self.time_offset) - - def get_samp_rate(self): - return self.samp_rate - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.blocks_throttle_0.set_sample_rate(self.samp_rate) - self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate) - self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate) - - def get_rrc_taps(self): - return self.rrc_taps - - def set_rrc_taps(self, rrc_taps): - self.rrc_taps = rrc_taps - self.digital_pfb_clock_sync_xxx_0.update_taps(self.rrc_taps) - - def get_qpsk_const(self): - return self.qpsk_const - - def set_qpsk_const(self, qpsk_const): - self.qpsk_const = qpsk_const - - def get_phase_bw(self): - return self.phase_bw - - def set_phase_bw(self, phase_bw): - self.phase_bw = phase_bw - self.digital_costas_loop_cc_0.set_loop_bandwidth(self.phase_bw) - - def get_noise_volt(self): - return self.noise_volt - - def set_noise_volt(self, noise_volt): - self.noise_volt = noise_volt - self.channels_channel_model_0.set_noise_voltage(self.noise_volt) - - def get_freq_offset(self): - return self.freq_offset - - def set_freq_offset(self, freq_offset): - self.freq_offset = freq_offset - self.channels_channel_model_0.set_frequency_offset(self.freq_offset) - - def get_eq_ntaps(self): - return self.eq_ntaps - - def set_eq_ntaps(self, eq_ntaps): - self.eq_ntaps = eq_ntaps - - def get_eq_mod(self): - return self.eq_mod - - def set_eq_mod(self, eq_mod): - self.eq_mod = eq_mod - self.digital_cma_equalizer_cc_0.set_modulus(self.eq_mod) - - def get_eq_gain(self): - return self.eq_gain - - def set_eq_gain(self, eq_gain): - self.eq_gain = eq_gain - self.digital_cma_equalizer_cc_0.set_gain(self.eq_gain) - - def get_chn_taps(self): - return self.chn_taps - - def set_chn_taps(self, chn_taps): - self.chn_taps = chn_taps - self.channels_channel_model_0.set_taps(self.chn_taps) - - - - - -def main(top_block_cls=qpks, options=None): - if gr.enable_realtime_scheduling() != gr.RT_OK: - print("Error: failed to enable real-time scheduling.") - - if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): - style = gr.prefs().get_string('qtgui', 'style', 'raster') - Qt.QApplication.setGraphicsSystem(style) - qapp = Qt.QApplication(sys.argv) - - tb = top_block_cls() - - tb.start() - - tb.show() - - def sig_handler(sig=None, frame=None): - Qt.QApplication.quit() - - signal.signal(signal.SIGINT, sig_handler) - signal.signal(signal.SIGTERM, sig_handler) - - timer = Qt.QTimer() - timer.start(500) - timer.timeout.connect(lambda: None) - - def quitting(): - tb.stop() - tb.wait() - - qapp.aboutToQuit.connect(quitting) - qapp.exec_() - -if __name__ == '__main__': - main() -- cgit v1.2.1 From 7e822110ef8ef4109d202f18e6a84caea3d0dc62 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 15:40:36 +0100 Subject: Set hardware/QAM to do 16-QAM --- hardware/QAM/qam.grc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/QAM/qam.grc b/hardware/QAM/qam.grc index 4c53ba6..e14f1fe 100644 --- a/hardware/QAM/qam.grc +++ b/hardware/QAM/qam.grc @@ -42,7 +42,7 @@ blocks: rot_sym: '4' soft_dec_lut: None sym_map: '[0, 1, 3, 2]' - type: bpsk + type: 16qam states: bus_sink: false bus_source: false -- cgit v1.2.1 From 3e8b6bac228772eb5410a19020e997fb3a9eeece Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 18:16:22 +0100 Subject: Create ipython notebook for computations --- notebooks/Fading.ipynb | 108 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 notebooks/Fading.ipynb diff --git a/notebooks/Fading.ipynb b/notebooks/Fading.ipynb new file mode 100644 index 0000000..e320893 --- /dev/null +++ b/notebooks/Fading.ipynb @@ -0,0 +1,108 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "e19197ba", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "\n", + "import matplotlib.pyplot as plt\n", + "import matplotlib.image as mpimg" + ] + }, + { + "cell_type": "markdown", + "id": "ea1a7a45", + "metadata": {}, + "source": [ + "# Simple 2 tap fading" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "4465dcd9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "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\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "nsamples = 200\n", + "samp_rate = 32e3\n", + "\n", + "# QPSK modulation\n", + "samp_per_sym = 4\n", + "symbol_map = {\n", + " 0: 1 + 1j,\n", + " 1: -1 + 1j,\n", + " 2: -1 - 1j,\n", + " 3: 1 - 1j,\n", + "}\n", + "\n", + "# generate random data for testing\n", + "data = np.random.randint(low=0, high=4, size=nsamples)\n", + "\n", + "# modulate and add AWGN\n", + "noise = np.random.normal(0, .03, size=nsamples) + 1j * np.random.normal(0, .03, size=nsamples)\n", + "sig = np.array(list(map(lambda v: symbol_map[v], data))) + noise\n", + "\n", + "# add 2 tap frequency selective channel\n", + "delay = np.zeros(5 * samp_per_sym)\n", + "one = np.array([1])\n", + "taps = np.concatenate([one, delay, .2 * one])\n", + "\n", + "# apply channel\n", + "sig_fading = np.convolve(sig, taps)\n", + "\n", + "# plot figure\n", + "fig = plt.figure()\n", + "plt.scatter(sig_fading.real, sig_fading.imag)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} -- cgit v1.2.1 From b81ddc9473f429f28cbde012840923a5582725a7 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 18:46:53 +0100 Subject: Move screenshots --- .../figures/screenshots/BPSK_2021-11-10_15-49-16.png | Bin 0 -> 89114 bytes doc/thesis/figures/screenshots/QAM16_Simulation.png | Bin 0 -> 75755 bytes doc/thesis/figures/screenshots/QPSK_Hardware.png | Bin 0 -> 83957 bytes doc/thesis/figures/screenshots/qpsk_nogui.pdf | Bin 0 -> 26645 bytes hardware/QAM/QPSK_Hardware.png | Bin 83957 -> 0 bytes simulation/QAM/QAM16_Simulation.png | Bin 75755 -> 0 bytes simulation/QAM_Fading/BPSK_2021-11-10_15-49-16.png | Bin 89114 -> 0 bytes simulation/QPSK/qpsk_nogui.pdf | Bin 26645 -> 0 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/thesis/figures/screenshots/BPSK_2021-11-10_15-49-16.png create mode 100644 doc/thesis/figures/screenshots/QAM16_Simulation.png create mode 100644 doc/thesis/figures/screenshots/QPSK_Hardware.png create mode 100644 doc/thesis/figures/screenshots/qpsk_nogui.pdf delete mode 100644 hardware/QAM/QPSK_Hardware.png delete mode 100644 simulation/QAM/QAM16_Simulation.png delete mode 100644 simulation/QAM_Fading/BPSK_2021-11-10_15-49-16.png delete mode 100644 simulation/QPSK/qpsk_nogui.pdf diff --git a/doc/thesis/figures/screenshots/BPSK_2021-11-10_15-49-16.png b/doc/thesis/figures/screenshots/BPSK_2021-11-10_15-49-16.png new file mode 100644 index 0000000..6ae117d Binary files /dev/null and b/doc/thesis/figures/screenshots/BPSK_2021-11-10_15-49-16.png differ diff --git a/doc/thesis/figures/screenshots/QAM16_Simulation.png b/doc/thesis/figures/screenshots/QAM16_Simulation.png new file mode 100644 index 0000000..1342db4 Binary files /dev/null and b/doc/thesis/figures/screenshots/QAM16_Simulation.png differ diff --git a/doc/thesis/figures/screenshots/QPSK_Hardware.png b/doc/thesis/figures/screenshots/QPSK_Hardware.png new file mode 100644 index 0000000..062d95e Binary files /dev/null and b/doc/thesis/figures/screenshots/QPSK_Hardware.png differ diff --git a/doc/thesis/figures/screenshots/qpsk_nogui.pdf b/doc/thesis/figures/screenshots/qpsk_nogui.pdf new file mode 100644 index 0000000..0b0077e Binary files /dev/null and b/doc/thesis/figures/screenshots/qpsk_nogui.pdf differ diff --git a/hardware/QAM/QPSK_Hardware.png b/hardware/QAM/QPSK_Hardware.png deleted file mode 100644 index 062d95e..0000000 Binary files a/hardware/QAM/QPSK_Hardware.png and /dev/null differ diff --git a/simulation/QAM/QAM16_Simulation.png b/simulation/QAM/QAM16_Simulation.png deleted file mode 100644 index 1342db4..0000000 Binary files a/simulation/QAM/QAM16_Simulation.png and /dev/null differ diff --git a/simulation/QAM_Fading/BPSK_2021-11-10_15-49-16.png b/simulation/QAM_Fading/BPSK_2021-11-10_15-49-16.png deleted file mode 100644 index 6ae117d..0000000 Binary files a/simulation/QAM_Fading/BPSK_2021-11-10_15-49-16.png and /dev/null differ diff --git a/simulation/QPSK/qpsk_nogui.pdf b/simulation/QPSK/qpsk_nogui.pdf deleted file mode 100644 index 0b0077e..0000000 Binary files a/simulation/QPSK/qpsk_nogui.pdf and /dev/null differ -- cgit v1.2.1 From 08e362e23f658b02ab3fa6d30500bd095c699aae Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 18:47:12 +0100 Subject: Add more references --- references/books/WsComm_LectureNotes_2021.pdf | Bin 0 -> 17635797 bytes references/fundamentals/1993-10.pdf | Bin 0 -> 627296 bytes ..._of_future_wireless_multimedia_communications.pdf | Bin 0 -> 346998 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 references/books/WsComm_LectureNotes_2021.pdf create mode 100644 references/fundamentals/1993-10.pdf create mode 100644 references/fundamentals/An_overview_of_OFDM_and_related_techniques_towards_development_of_future_wireless_multimedia_communications.pdf diff --git a/references/books/WsComm_LectureNotes_2021.pdf b/references/books/WsComm_LectureNotes_2021.pdf new file mode 100644 index 0000000..12b4af6 Binary files /dev/null and b/references/books/WsComm_LectureNotes_2021.pdf differ diff --git a/references/fundamentals/1993-10.pdf b/references/fundamentals/1993-10.pdf new file mode 100644 index 0000000..4e77426 Binary files /dev/null and b/references/fundamentals/1993-10.pdf differ diff --git a/references/fundamentals/An_overview_of_OFDM_and_related_techniques_towards_development_of_future_wireless_multimedia_communications.pdf b/references/fundamentals/An_overview_of_OFDM_and_related_techniques_towards_development_of_future_wireless_multimedia_communications.pdf new file mode 100644 index 0000000..250770d Binary files /dev/null and b/references/fundamentals/An_overview_of_OFDM_and_related_techniques_towards_development_of_future_wireless_multimedia_communications.pdf differ -- cgit v1.2.1 From 0ad4b5f2b78e199dae017fdb6cb80fca39102e5a Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 19:21:33 +0100 Subject: Rename sketch.py to gui.py, move tests in test/ directory --- src/Test_Plots/test.py | 57 ------- src/Test_Plots/test10.py | 53 ------ src/Test_Plots/test1_updating_series_data.py | 30 ---- src/Test_Plots/test2_axis_limis.py | 40 ----- src/Test_Plots/test3_custom_axis_labels.py | 34 ---- src/Test_Plots/test4_multiple_y_axes.py | 25 --- src/Test_Plots/test5_annotations.py | 32 ---- src/Test_Plots/test6_drag_points_and_lines.py | 26 --- src/Test_Plots/test7_querying.py | 37 ----- src/Test_Plots/test8_custom_context_menus.py | 33 ---- src/Test_Plots/test9_colors_and_styles.py | 50 ------ src/gui.py | 213 +++++++++++++++++++++++++ src/sketch.py | 213 ------------------------- tests/dearpygui/test.py | 57 +++++++ tests/dearpygui/test10.py | 53 ++++++ tests/dearpygui/test1_updating_series_data.py | 30 ++++ tests/dearpygui/test2_axis_limis.py | 40 +++++ tests/dearpygui/test3_custom_axis_labels.py | 34 ++++ tests/dearpygui/test4_multiple_y_axes.py | 25 +++ tests/dearpygui/test5_annotations.py | 32 ++++ tests/dearpygui/test6_drag_points_and_lines.py | 26 +++ tests/dearpygui/test7_querying.py | 37 +++++ tests/dearpygui/test8_custom_context_menus.py | 33 ++++ tests/dearpygui/test9_colors_and_styles.py | 50 ++++++ 24 files changed, 630 insertions(+), 630 deletions(-) delete mode 100644 src/Test_Plots/test.py delete mode 100644 src/Test_Plots/test10.py delete mode 100644 src/Test_Plots/test1_updating_series_data.py delete mode 100644 src/Test_Plots/test2_axis_limis.py delete mode 100644 src/Test_Plots/test3_custom_axis_labels.py delete mode 100644 src/Test_Plots/test4_multiple_y_axes.py delete mode 100644 src/Test_Plots/test5_annotations.py delete mode 100644 src/Test_Plots/test6_drag_points_and_lines.py delete mode 100644 src/Test_Plots/test7_querying.py delete mode 100644 src/Test_Plots/test8_custom_context_menus.py delete mode 100644 src/Test_Plots/test9_colors_and_styles.py create mode 100755 src/gui.py delete mode 100755 src/sketch.py create mode 100644 tests/dearpygui/test.py create mode 100644 tests/dearpygui/test10.py create mode 100644 tests/dearpygui/test1_updating_series_data.py create mode 100644 tests/dearpygui/test2_axis_limis.py create mode 100644 tests/dearpygui/test3_custom_axis_labels.py create mode 100644 tests/dearpygui/test4_multiple_y_axes.py create mode 100644 tests/dearpygui/test5_annotations.py create mode 100644 tests/dearpygui/test6_drag_points_and_lines.py create mode 100644 tests/dearpygui/test7_querying.py create mode 100644 tests/dearpygui/test8_custom_context_menus.py create mode 100644 tests/dearpygui/test9_colors_and_styles.py diff --git a/src/Test_Plots/test.py b/src/Test_Plots/test.py deleted file mode 100644 index 3fb0d51..0000000 --- a/src/Test_Plots/test.py +++ /dev/null @@ -1,57 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -import qpks as qp - -q = qp.qpsk_nogui() - -dpg.create_context() - -# data = q.analog_random_source_x_0 - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) -sindatay2 = [] -for i in range(0, 100): - sindatay2.append(2 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=500, height=400): - # create a theme for the plot - with dpg.theme(tag="plot_theme"): - with dpg.theme_component(dpg.mvStemSeries): - dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 255, 0), category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Diamond, category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 7, category=dpg.mvThemeCat_Plots) - - with dpg.theme_component(dpg.mvScatterSeries): - dpg.add_theme_color(dpg.mvPlotCol_Line, (60, 150, 200), category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Square, category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 4, category=dpg.mvThemeCat_Plots) - - # create plot - with dpg.plot(tag="plot", label="Line Series", height=-1, width=-1): - - # optionally create legend - dpg.add_plot_legend() - - # REQUIRED: create x and y axes - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") - - # series belong to a y axis - # dpg.add_stem_series(data, sindatay, label="Source", parent="yaxis", tag="series_data") - dpg.add_stem_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="yaxis", tag="series_data") - dpg.add_scatter_series(sindatax, sindatay2, label="2 + 0.5 * sin(x)", parent="yaxis", tag="series_data2") - - # apply theme to series - dpg.bind_item_theme("series_data", "plot_theme") - dpg.bind_item_theme("series_data2", "plot_theme") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() \ No newline at end of file diff --git a/src/Test_Plots/test10.py b/src/Test_Plots/test10.py deleted file mode 100644 index d478d9a..0000000 --- a/src/Test_Plots/test10.py +++ /dev/null @@ -1,53 +0,0 @@ -from dearpygui.core import * -from dearpygui.simple import * -from math import cos - -def plot_callback(sender, data): - # keeping track of frames - frame_count = get_data("frame_count") - frame_count += 1 - add_data("frame_count", frame_count) - - # updating plot data - plot_datax = get_data("plot_datax") - plot_datay = get_data("plot_datay") - if len(plot_datax) > 2000: - frame_count = 0 - plot_datax.clear() - plot_datay.clear() - plot_datax.append(3.14 * frame_count / 180) - plot_datay.append(cos(3 * 3.14 * frame_count / 180)) - add_data("plot_datax", plot_datax) - add_data("plot_datay", plot_datay) - - # plotting new data - add_line_series("Plot", "Cos", plot_datax, plot_datay, weight=2) - -with window("Tutorial", width=500, height=500): - add_plot("Plot", height=-1) - add_data("plot_datax", []) - add_data("plot_datay", []) - add_data("frame_count", 0) - add_input_text("freq") - with menu_bar("Main Menu Bar"): - with menu("File"): - add_menu_item("test") - set_render_callback(plot_callback) - -with window("Heat", width=500, height=500): - add_plot("HeatPlot", show_color_scale=False, scale_min=0.0, scale_max=6.0, - scale_height=400, no_legend=True, - no_mouse_pos=True, xaxis_lock_min=True, xaxis_lock_max=True, xaxis_no_gridlines=True, xaxis_no_tick_marks=True, - yaxis_no_gridlines=True, yaxis_no_tick_marks=True, yaxis_lock_min=True, yaxis_lock_max=True, height=400) - set_color_map("HeatPlot", 6) - values = [0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0, - 2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0, - 1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0, - 0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0, - 0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0, - 1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1, - 0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3] - add_heat_series("HeatPlot", "heat data", values, 7, 7, 0, 6, format='') - - -start_dearpygui() \ No newline at end of file diff --git a/src/Test_Plots/test1_updating_series_data.py b/src/Test_Plots/test1_updating_series_data.py deleted file mode 100644 index 1371008..0000000 --- a/src/Test_Plots/test1_updating_series_data.py +++ /dev/null @@ -1,30 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - -# creating data -sindatax = [] -sindatay = [] -for i in range(0, 500): - sindatax.append(i / 1000) - sindatay.append(0.5 + 0.5 * sin(50 * i / 1000)) - -with dpg.window(label="Tutorial"): - # create plot - with dpg.plot(label="Line Series", height=400, width=400): - # optionally create legend - dpg.add_plot_legend() - - # REQUIRED: create x and y axes - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis") - - # series belong to a y axis - dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() \ No newline at end of file diff --git a/src/Test_Plots/test2_axis_limis.py b/src/Test_Plots/test2_axis_limis.py deleted file mode 100644 index bdfeda1..0000000 --- a/src/Test_Plots/test2_axis_limis.py +++ /dev/null @@ -1,40 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin, cos - -dpg.create_context() - -sindatax = [] -sindatay = [] -for i in range(0, 500): - sindatax.append(i / 1000) - sindatay.append(0.5 + 0.5 * sin(50 * i / 1000)) - -def update_series(): - - cosdatax = [] - cosdatay = [] - for i in range(0, 500): - cosdatax.append(i / 1000) - cosdatay.append(0.5 + 0.5 * cos(50 * i / 1000)) - dpg.set_value('series_tag', [cosdatax, cosdatay]) - dpg.set_item_label('series_tag', "0.5 + 0.5 * cos(x)") - -with dpg.window(label="Tutorial", tag="win"): - dpg.add_button(label="Update Series", callback=update_series) - # create plot - with dpg.plot(label="Line Series", height=400, width=400): - # optionally create legend - dpg.add_plot_legend() - - # REQUIRED: create x and y axes - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis") - - # series belong to a y axis - dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis", tag="series_tag") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() diff --git a/src/Test_Plots/test3_custom_axis_labels.py b/src/Test_Plots/test3_custom_axis_labels.py deleted file mode 100644 index be6b80b..0000000 --- a/src/Test_Plots/test3_custom_axis_labels.py +++ /dev/null @@ -1,34 +0,0 @@ -import dearpygui.dearpygui as dpg - -dpg.create_context() - -with dpg.window(label="Tutorial", width=400, height=400): - with dpg.group(horizontal=True): - dpg.add_button(label="fit y", callback=lambda: dpg.fit_axis_data("y_axis")) - dpg.add_button(label="unlock x limits", callback=lambda: dpg.set_axis_limits_auto("x_axis")) - dpg.add_button(label="unlock y limits", callback=lambda: dpg.set_axis_limits_auto("y_axis")) - dpg.add_button(label="print limits x", callback=lambda: print(dpg.get_axis_limits("x_axis"))) - dpg.add_button(label="print limits y", callback=lambda: print(dpg.get_axis_limits("y_axis"))) - - with dpg.plot(label="Bar Series", height=-1, width=-1): - dpg.add_plot_legend() - - # create x axis - dpg.add_plot_axis(dpg.mvXAxis, label="Student", no_gridlines=True, tag="x_axis") - dpg.set_axis_limits(dpg.last_item(), 9, 33) - dpg.set_axis_ticks(dpg.last_item(), (("S1", 11), ("S2", 21), ("S3", 31))) - - # create y axis - dpg.add_plot_axis(dpg.mvYAxis, label="Score", tag="y_axis") - dpg.set_axis_limits("y_axis", 0, 110) - - # add series to y axis - dpg.add_bar_series([10, 20, 30], [100, 75, 90], label="Final Exam", weight=1, parent="y_axis") - dpg.add_bar_series([11, 21, 31], [83, 75, 72], label="Midterm Exam", weight=1, parent="y_axis") - dpg.add_bar_series([12, 22, 32], [42, 68, 23], label="Course Grade", weight=1, parent="y_axis") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() \ No newline at end of file diff --git a/src/Test_Plots/test4_multiple_y_axes.py b/src/Test_Plots/test4_multiple_y_axes.py deleted file mode 100644 index ebaac7e..0000000 --- a/src/Test_Plots/test4_multiple_y_axes.py +++ /dev/null @@ -1,25 +0,0 @@ -import dearpygui.dearpygui as dpg - -dpg.create_context() - -with dpg.window(label="Tutorial", width=400, height=400): - with dpg.plot(label="Bar Series", height=-1, width=-1): - dpg.add_plot_legend() - - # create x axis - dpg.add_plot_axis(dpg.mvXAxis, label="Student", no_gridlines=True) - dpg.set_axis_ticks(dpg.last_item(), (("S1", 11), ("S2", 21), ("S3", 31))) - - # create y axis - dpg.add_plot_axis(dpg.mvYAxis, label="Score", tag="yaxis_tag") - - # add series to y axis - dpg.add_bar_series([10, 20, 30], [100, 75, 90], label="Final Exam", weight=1, parent="yaxis_tag") - dpg.add_bar_series([11, 21, 31], [83, 75, 72], label="Midterm Exam", weight=1, parent="yaxis_tag") - dpg.add_bar_series([12, 22, 32], [42, 68, 23], label="Course Grade", weight=1, parent="yaxis_tag") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() \ No newline at end of file diff --git a/src/Test_Plots/test5_annotations.py b/src/Test_Plots/test5_annotations.py deleted file mode 100644 index 9deff6b..0000000 --- a/src/Test_Plots/test5_annotations.py +++ /dev/null @@ -1,32 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=400, height=400): - with dpg.plot(label="Annotations", height=-1, width=-1): - dpg.add_plot_legend() - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y") - dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent=dpg.last_item()) - - # annotations belong to the plot NOT axis - dpg.add_plot_annotation(label="BL", default_value=(0.25, 0.25), offset=(-15, 15), color=[255, 255, 0, 255]) - dpg.add_plot_annotation(label="BR", default_value=(0.75, 0.25), offset=(15, 15), color=[255, 255, 0, 255]) - dpg.add_plot_annotation(label="TR not clampled", default_value=(0.75, 0.75), offset=(-15, -15), - color=[255, 255, 0, 255], clamped=False) - dpg.add_plot_annotation(label="TL", default_value=(0.25, 0.75), offset=(-15, -15), color=[255, 255, 0, 255]) - dpg.add_plot_annotation(label="Center", default_value=(0.5, 0.5), color=[255, 255, 0, 255]) - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() diff --git a/src/Test_Plots/test6_drag_points_and_lines.py b/src/Test_Plots/test6_drag_points_and_lines.py deleted file mode 100644 index c6d8862..0000000 --- a/src/Test_Plots/test6_drag_points_and_lines.py +++ /dev/null @@ -1,26 +0,0 @@ -import dearpygui.dearpygui as dpg - -dpg.create_context() - -def print_val(sender): - print(dpg.get_value(sender)) - -with dpg.window(label="Tutorial", width=400, height=400): - with dpg.plot(label="Drag Lines/Points", height=-1, width=-1): - dpg.add_plot_legend() - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.set_axis_limits(dpg.last_item(), -5, 5) - dpg.add_plot_axis(dpg.mvYAxis, label="y") - dpg.set_axis_limits(dpg.last_item(), -5, 5) - - # drag lines/points belong to the plot NOT axis - dpg.add_drag_line(label="dline1", color=[255, 0, 0, 255], default_value=2.0, callback=print_val) - dpg.add_drag_line(label="dline2", color=[255, 255, 0, 255], vertical=False, default_value=-2, callback=print_val) - dpg.add_drag_point(label="dpoint1", color=[255, 0, 255, 255], default_value=(1.0, 1.0), callback=print_val) - dpg.add_drag_point(label="dpoint2", color=[255, 0, 255, 255], default_value=(-1.0, 1.0), callback=print_val) - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() \ No newline at end of file diff --git a/src/Test_Plots/test7_querying.py b/src/Test_Plots/test7_querying.py deleted file mode 100644 index 06f3ceb..0000000 --- a/src/Test_Plots/test7_querying.py +++ /dev/null @@ -1,37 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=400, height=600): - dpg.add_text("Click and drag the middle mouse button over the top plot!") - - - def query(sender, app_data, user_data): - dpg.set_axis_limits("xaxis_tag2", app_data[0], app_data[1]) - dpg.set_axis_limits("yaxis_tag2", app_data[2], app_data[3]) - - - # plot 1 - with dpg.plot(no_title=True, height=200, callback=query, query=True, no_menus=True, width=-1): - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y") - dpg.add_line_series(sindatax, sindatay, parent=dpg.last_item()) - - # plot 2 - with dpg.plot(no_title=True, height=200, no_menus=True, width=-1): - dpg.add_plot_axis(dpg.mvXAxis, label="x1", tag="xaxis_tag2") - dpg.add_plot_axis(dpg.mvYAxis, label="y1", tag="yaxis_tag2") - dpg.add_line_series(sindatax, sindatay, parent="yaxis_tag2") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() \ No newline at end of file diff --git a/src/Test_Plots/test8_custom_context_menus.py b/src/Test_Plots/test8_custom_context_menus.py deleted file mode 100644 index b459d15..0000000 --- a/src/Test_Plots/test8_custom_context_menus.py +++ /dev/null @@ -1,33 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=400, height=400): - # create plot - dpg.add_text("Right click a series in the legend!") - with dpg.plot(label="Line Series", height=-1, width=-1): - dpg.add_plot_legend() - - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") - - # series 1 - dpg.add_line_series(sindatax, sindatay, label="series 1", parent="yaxis", tag="series_1") - dpg.add_button(label="Delete Series 1", parent=dpg.last_item(), callback=lambda: dpg.delete_item("series_1")) - - # series 2 - dpg.add_line_series(sindatax, sindatay, label="series 2", parent="yaxis", tag="series_2") - dpg.add_button(label="Delete Series 2", parent=dpg.last_item(), callback=lambda: dpg.delete_item("series_2")) - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() diff --git a/src/Test_Plots/test9_colors_and_styles.py b/src/Test_Plots/test9_colors_and_styles.py deleted file mode 100644 index 2f1c7ef..0000000 --- a/src/Test_Plots/test9_colors_and_styles.py +++ /dev/null @@ -1,50 +0,0 @@ -import dearpygui.dearpygui as dpg -from math import sin - -dpg.create_context() - -sindatax = [] -sindatay = [] -for i in range(0, 100): - sindatax.append(i / 100) - sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) -sindatay2 = [] -for i in range(0, 100): - sindatay2.append(2 + 0.5 * sin(50 * i / 100)) - -with dpg.window(label="Tutorial", width=500, height=400): - # create a theme for the plot - with dpg.theme(tag="plot_theme"): - with dpg.theme_component(dpg.mvStemSeries): - dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 255, 0), category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Diamond, category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 7, category=dpg.mvThemeCat_Plots) - - with dpg.theme_component(dpg.mvScatterSeries): - dpg.add_theme_color(dpg.mvPlotCol_Line, (60, 150, 200), category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Square, category=dpg.mvThemeCat_Plots) - dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 4, category=dpg.mvThemeCat_Plots) - - # create plot - with dpg.plot(tag="plot", label="Line Series", height=-1, width=-1): - - # optionally create legend - dpg.add_plot_legend() - - # REQUIRED: create x and y axes - dpg.add_plot_axis(dpg.mvXAxis, label="x") - dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") - - # series belong to a y axis - dpg.add_stem_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="yaxis", tag="series_data") - dpg.add_scatter_series(sindatax, sindatay2, label="2 + 0.5 * sin(x)", parent="yaxis", tag="series_data2") - - # apply theme to series - dpg.bind_item_theme("series_data", "plot_theme") - dpg.bind_item_theme("series_data2", "plot_theme") - -dpg.create_viewport(title='Custom Title', width=800, height=600) -dpg.setup_dearpygui() -dpg.show_viewport() -dpg.start_dearpygui() -dpg.destroy_context() diff --git a/src/gui.py b/src/gui.py new file mode 100755 index 0000000..58e36a3 --- /dev/null +++ b/src/gui.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python3 + +# Python stdlib +import sys + +# Grahical libraries +from dearpygui.dearpygui import * +from dearpygui.demo import show_demo + +# Detect (unix) signals +import signal + +# GNURadio tools +from gnuradio import gr + +# Mathematics +import numpy as np + +# Our interface for simulation / hardware +import qpsk + +# For debugging +import logging + +#================================================ +# Debugging tools + +logging.basicConfig(format="[%(levelname)s] %(asctime)s %(message)s", level=logging.DEBUG) +logger = logging.getLogger(__name__) + +#================================================ +# Initialize DearPyGUI + +create_context() +create_viewport() +setup_dearpygui() + +# Show demo for dev +show_demo() + +#================================================ +# Custom GNURadio blocks + +class pygui_plot_block(gr.sync_block): + def __init__(self, title="Plot", xlabel="x", ylabel="y"): + gr.sync_block.__init__(self, name="PyGUI Plot", + in_sig=[np.complex64], out_sig=None) + + self.title = title + self.xlabel = xlabel + self.ylabel = ylabel + + # TODO: parametrize with nsamples + self.buffer = np.linspace(0, 1, 1000) + + def construct_gui(self, width, height, **kwargs): + # Create plot + with plot(label=self.title, height=height, width=width, **kwargs): + add_plot_legend() + add_plot_axis(mvXAxis, label=self.xlabel) + add_plot_axis(mvYAxis, label=self.ylabel) + + def work(self, input_items, output_items): + # This is a sink (no output) + # TODO: add samples to display buffer + return 0 + + +class pygui_constellation_block(gr.sync_block): + def __init__(self, title="Constellation", xlabel="In-Phase", ylabel="Quadrature"): + gr.sync_block.__init__(self, name="PyGUI Constellation Diagram", + in_sig=[np.complex64], out_sig=None) + + self.title = title + self.xlabel = xlabel + selt.ylabel = ylabel + + def construct_gui(self, width, height, **kwargs): + # TODO: Create a widget based ons scatter plot + pass + + def work(self, input_items, output_items): + # This is a sink (no output) + # TODO: add samples to display buffer + return 0 + + +#================================================ +# GUI Callback functions + +# Flow graph window +def on_rx_node_link(sender, app_data): + link_id_1, link_id_2 = app_data + add_node_link(link_id_1, link_id_2, parent=sender) + +def on_rx_node_delink(sender, app_data): + link_id = app_data + delete_item(link_id) + +#================================================ +# Set up GNURadio simulation + +# Global variables, yes I know they are ugly +sim = qpsk.qpsk_nogui() +sim_running = False + +# Catch signals +def sim_sig_handler(sig=None, frame=None): + sim.stop() + sim.wait() + sys.exit(0) + +# TODO: create GUI handlers +signal.signal(signal.SIGINT, sim_sig_handler) +signal.signal(signal.SIGTERM, sim_sig_handler); + +# Add GUI blocks +locked_time_plot = pygui_plot_block(title="Locked signal", ylabel="Amplitude", xlabel="Time") +sim.connect((sim.digital_costas_loop_cc_0, 0), (locked_time_plot, 0)) + +#================================================ +# Settings Window + +with window(label="Settings", width=200, height=400, pos=(25, 450), tag="sim_win"): + with child_window(autosize_x=True, height=100): + add_button(label="Toggle Fullscreen", callback= toggle_viewport_fullscreen) + + with child_window(autosize_x=True): + with group(horizontal=True): + add_text("Simulation running:") + add_text("false", tag="sim_running_lbl") + + with group(tag="sim_grp", horizontal=True): + def on_sim_start_btn_clicked(): + global sim_running + + if sim_running: + logger.error("Simulation is already running") + return + + sim.start() + sim_running = True + logger.debug("Started simulation") + + def on_sim_stop_btn_clicked(): + global sim_running + + if not sim_running: + logger.error("Simulation not running") + return + + sim.stop() + sim.wait() + sim_running = False + logger.debug("Stopped simulation") + + add_button(label="Start", tag="sim_start_btn", callback=on_sim_start_btn_clicked) + add_button(label="Stop", tag="sim_stop_btn", callback=on_sim_stop_btn_clicked) + +#================================================ +# Flow Graph Window + +with window(label="RX DSP Flow Graph", width=800, height=400, pos=(25,25), tag="rx_win"): + with node_editor(callback=on_rx_node_link, delink_callback=on_rx_node_delink): + with node(label="USRP Source", pos=(20,100)): + with node_attribute(tag="src_out", attribute_type=mvNode_Attr_Output): + add_text("Signal from antenna") + + with node(label="Clock Sync", pos=(200,200)): + with node_attribute(tag="clksync_in", attribute_type=mvNode_Attr_Input): + add_text("Input") + + with node_attribute(tag="clksync_out", attribute_type=mvNode_Attr_Output): + add_text("Synchronized") + + with node(label="Equalizer", pos=(350,100)): + with node_attribute(tag="eq_in", attribute_type=mvNode_Attr_Input): + add_text("Input") + + with node_attribute(attribute_type=mvNode_Attr_Static): + add_knob_float(label="Gain") + + with node_attribute(tag="eq_out", attribute_type=mvNode_Attr_Output): + add_text("Equalized") + + with node(label="Phase Locked Loop", pos=(600, 200)): + with node_attribute(tag="pll_in", attribute_type=mvNode_Attr_Input): + add_text("Input") + + with node_attribute(tag="pll_out", attribute_type=mvNode_Attr_Output): + add_text("Locked") + add_knob_float(label="Loop BW") + + + add_node_link(get_alias_id("src_out"), get_alias_id("clksync_in")) + add_node_link(get_alias_id("clksync_out"), get_alias_id("eq_in")) + add_node_link(get_alias_id("eq_out"), get_alias_id("pll_in")) + +#================================================ +# Time plots Window + +with window(label="Time domain plots", width=800, height=400, pos=(850,25), tag="time_plots_win"): + locked_time_plot.construct_gui(width=780, height=300) + +#================================================ +# Start GUI + +# Start window and main loop +show_viewport() +start_dearpygui() + +# clean up gui +destroy_context() diff --git a/src/sketch.py b/src/sketch.py deleted file mode 100755 index 58e36a3..0000000 --- a/src/sketch.py +++ /dev/null @@ -1,213 +0,0 @@ -#!/usr/bin/env python3 - -# Python stdlib -import sys - -# Grahical libraries -from dearpygui.dearpygui import * -from dearpygui.demo import show_demo - -# Detect (unix) signals -import signal - -# GNURadio tools -from gnuradio import gr - -# Mathematics -import numpy as np - -# Our interface for simulation / hardware -import qpsk - -# For debugging -import logging - -#================================================ -# Debugging tools - -logging.basicConfig(format="[%(levelname)s] %(asctime)s %(message)s", level=logging.DEBUG) -logger = logging.getLogger(__name__) - -#================================================ -# Initialize DearPyGUI - -create_context() -create_viewport() -setup_dearpygui() - -# Show demo for dev -show_demo() - -#================================================ -# Custom GNURadio blocks - -class pygui_plot_block(gr.sync_block): - def __init__(self, title="Plot", xlabel="x", ylabel="y"): - gr.sync_block.__init__(self, name="PyGUI Plot", - in_sig=[np.complex64], out_sig=None) - - self.title = title - self.xlabel = xlabel - self.ylabel = ylabel - - # TODO: parametrize with nsamples - self.buffer = np.linspace(0, 1, 1000) - - def construct_gui(self, width, height, **kwargs): - # Create plot - with plot(label=self.title, height=height, width=width, **kwargs): - add_plot_legend() - add_plot_axis(mvXAxis, label=self.xlabel) - add_plot_axis(mvYAxis, label=self.ylabel) - - def work(self, input_items, output_items): - # This is a sink (no output) - # TODO: add samples to display buffer - return 0 - - -class pygui_constellation_block(gr.sync_block): - def __init__(self, title="Constellation", xlabel="In-Phase", ylabel="Quadrature"): - gr.sync_block.__init__(self, name="PyGUI Constellation Diagram", - in_sig=[np.complex64], out_sig=None) - - self.title = title - self.xlabel = xlabel - selt.ylabel = ylabel - - def construct_gui(self, width, height, **kwargs): - # TODO: Create a widget based ons scatter plot - pass - - def work(self, input_items, output_items): - # This is a sink (no output) - # TODO: add samples to display buffer - return 0 - - -#================================================ -# GUI Callback functions - -# Flow graph window -def on_rx_node_link(sender, app_data): - link_id_1, link_id_2 = app_data - add_node_link(link_id_1, link_id_2, parent=sender) - -def on_rx_node_delink(sender, app_data): - link_id = app_data - delete_item(link_id) - -#================================================ -# Set up GNURadio simulation - -# Global variables, yes I know they are ugly -sim = qpsk.qpsk_nogui() -sim_running = False - -# Catch signals -def sim_sig_handler(sig=None, frame=None): - sim.stop() - sim.wait() - sys.exit(0) - -# TODO: create GUI handlers -signal.signal(signal.SIGINT, sim_sig_handler) -signal.signal(signal.SIGTERM, sim_sig_handler); - -# Add GUI blocks -locked_time_plot = pygui_plot_block(title="Locked signal", ylabel="Amplitude", xlabel="Time") -sim.connect((sim.digital_costas_loop_cc_0, 0), (locked_time_plot, 0)) - -#================================================ -# Settings Window - -with window(label="Settings", width=200, height=400, pos=(25, 450), tag="sim_win"): - with child_window(autosize_x=True, height=100): - add_button(label="Toggle Fullscreen", callback= toggle_viewport_fullscreen) - - with child_window(autosize_x=True): - with group(horizontal=True): - add_text("Simulation running:") - add_text("false", tag="sim_running_lbl") - - with group(tag="sim_grp", horizontal=True): - def on_sim_start_btn_clicked(): - global sim_running - - if sim_running: - logger.error("Simulation is already running") - return - - sim.start() - sim_running = True - logger.debug("Started simulation") - - def on_sim_stop_btn_clicked(): - global sim_running - - if not sim_running: - logger.error("Simulation not running") - return - - sim.stop() - sim.wait() - sim_running = False - logger.debug("Stopped simulation") - - add_button(label="Start", tag="sim_start_btn", callback=on_sim_start_btn_clicked) - add_button(label="Stop", tag="sim_stop_btn", callback=on_sim_stop_btn_clicked) - -#================================================ -# Flow Graph Window - -with window(label="RX DSP Flow Graph", width=800, height=400, pos=(25,25), tag="rx_win"): - with node_editor(callback=on_rx_node_link, delink_callback=on_rx_node_delink): - with node(label="USRP Source", pos=(20,100)): - with node_attribute(tag="src_out", attribute_type=mvNode_Attr_Output): - add_text("Signal from antenna") - - with node(label="Clock Sync", pos=(200,200)): - with node_attribute(tag="clksync_in", attribute_type=mvNode_Attr_Input): - add_text("Input") - - with node_attribute(tag="clksync_out", attribute_type=mvNode_Attr_Output): - add_text("Synchronized") - - with node(label="Equalizer", pos=(350,100)): - with node_attribute(tag="eq_in", attribute_type=mvNode_Attr_Input): - add_text("Input") - - with node_attribute(attribute_type=mvNode_Attr_Static): - add_knob_float(label="Gain") - - with node_attribute(tag="eq_out", attribute_type=mvNode_Attr_Output): - add_text("Equalized") - - with node(label="Phase Locked Loop", pos=(600, 200)): - with node_attribute(tag="pll_in", attribute_type=mvNode_Attr_Input): - add_text("Input") - - with node_attribute(tag="pll_out", attribute_type=mvNode_Attr_Output): - add_text("Locked") - add_knob_float(label="Loop BW") - - - add_node_link(get_alias_id("src_out"), get_alias_id("clksync_in")) - add_node_link(get_alias_id("clksync_out"), get_alias_id("eq_in")) - add_node_link(get_alias_id("eq_out"), get_alias_id("pll_in")) - -#================================================ -# Time plots Window - -with window(label="Time domain plots", width=800, height=400, pos=(850,25), tag="time_plots_win"): - locked_time_plot.construct_gui(width=780, height=300) - -#================================================ -# Start GUI - -# Start window and main loop -show_viewport() -start_dearpygui() - -# clean up gui -destroy_context() diff --git a/tests/dearpygui/test.py b/tests/dearpygui/test.py new file mode 100644 index 0000000..3fb0d51 --- /dev/null +++ b/tests/dearpygui/test.py @@ -0,0 +1,57 @@ +import dearpygui.dearpygui as dpg +from math import sin + +import qpks as qp + +q = qp.qpsk_nogui() + +dpg.create_context() + +# data = q.analog_random_source_x_0 + +sindatax = [] +sindatay = [] +for i in range(0, 100): + sindatax.append(i / 100) + sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) +sindatay2 = [] +for i in range(0, 100): + sindatay2.append(2 + 0.5 * sin(50 * i / 100)) + +with dpg.window(label="Tutorial", width=500, height=400): + # create a theme for the plot + with dpg.theme(tag="plot_theme"): + with dpg.theme_component(dpg.mvStemSeries): + dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 255, 0), category=dpg.mvThemeCat_Plots) + dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Diamond, category=dpg.mvThemeCat_Plots) + dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 7, category=dpg.mvThemeCat_Plots) + + with dpg.theme_component(dpg.mvScatterSeries): + dpg.add_theme_color(dpg.mvPlotCol_Line, (60, 150, 200), category=dpg.mvThemeCat_Plots) + dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Square, category=dpg.mvThemeCat_Plots) + dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 4, category=dpg.mvThemeCat_Plots) + + # create plot + with dpg.plot(tag="plot", label="Line Series", height=-1, width=-1): + + # optionally create legend + dpg.add_plot_legend() + + # REQUIRED: create x and y axes + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") + + # series belong to a y axis + # dpg.add_stem_series(data, sindatay, label="Source", parent="yaxis", tag="series_data") + dpg.add_stem_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="yaxis", tag="series_data") + dpg.add_scatter_series(sindatax, sindatay2, label="2 + 0.5 * sin(x)", parent="yaxis", tag="series_data2") + + # apply theme to series + dpg.bind_item_theme("series_data", "plot_theme") + dpg.bind_item_theme("series_data2", "plot_theme") + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() \ No newline at end of file diff --git a/tests/dearpygui/test10.py b/tests/dearpygui/test10.py new file mode 100644 index 0000000..d478d9a --- /dev/null +++ b/tests/dearpygui/test10.py @@ -0,0 +1,53 @@ +from dearpygui.core import * +from dearpygui.simple import * +from math import cos + +def plot_callback(sender, data): + # keeping track of frames + frame_count = get_data("frame_count") + frame_count += 1 + add_data("frame_count", frame_count) + + # updating plot data + plot_datax = get_data("plot_datax") + plot_datay = get_data("plot_datay") + if len(plot_datax) > 2000: + frame_count = 0 + plot_datax.clear() + plot_datay.clear() + plot_datax.append(3.14 * frame_count / 180) + plot_datay.append(cos(3 * 3.14 * frame_count / 180)) + add_data("plot_datax", plot_datax) + add_data("plot_datay", plot_datay) + + # plotting new data + add_line_series("Plot", "Cos", plot_datax, plot_datay, weight=2) + +with window("Tutorial", width=500, height=500): + add_plot("Plot", height=-1) + add_data("plot_datax", []) + add_data("plot_datay", []) + add_data("frame_count", 0) + add_input_text("freq") + with menu_bar("Main Menu Bar"): + with menu("File"): + add_menu_item("test") + set_render_callback(plot_callback) + +with window("Heat", width=500, height=500): + add_plot("HeatPlot", show_color_scale=False, scale_min=0.0, scale_max=6.0, + scale_height=400, no_legend=True, + no_mouse_pos=True, xaxis_lock_min=True, xaxis_lock_max=True, xaxis_no_gridlines=True, xaxis_no_tick_marks=True, + yaxis_no_gridlines=True, yaxis_no_tick_marks=True, yaxis_lock_min=True, yaxis_lock_max=True, height=400) + set_color_map("HeatPlot", 6) + values = [0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0, + 2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0, + 1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0, + 0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0, + 0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0, + 1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1, + 0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3] + add_heat_series("HeatPlot", "heat data", values, 7, 7, 0, 6, format='') + + +start_dearpygui() \ No newline at end of file diff --git a/tests/dearpygui/test1_updating_series_data.py b/tests/dearpygui/test1_updating_series_data.py new file mode 100644 index 0000000..1371008 --- /dev/null +++ b/tests/dearpygui/test1_updating_series_data.py @@ -0,0 +1,30 @@ +import dearpygui.dearpygui as dpg +from math import sin + +dpg.create_context() + +# creating data +sindatax = [] +sindatay = [] +for i in range(0, 500): + sindatax.append(i / 1000) + sindatay.append(0.5 + 0.5 * sin(50 * i / 1000)) + +with dpg.window(label="Tutorial"): + # create plot + with dpg.plot(label="Line Series", height=400, width=400): + # optionally create legend + dpg.add_plot_legend() + + # REQUIRED: create x and y axes + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis") + + # series belong to a y axis + dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis") + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() \ No newline at end of file diff --git a/tests/dearpygui/test2_axis_limis.py b/tests/dearpygui/test2_axis_limis.py new file mode 100644 index 0000000..bdfeda1 --- /dev/null +++ b/tests/dearpygui/test2_axis_limis.py @@ -0,0 +1,40 @@ +import dearpygui.dearpygui as dpg +from math import sin, cos + +dpg.create_context() + +sindatax = [] +sindatay = [] +for i in range(0, 500): + sindatax.append(i / 1000) + sindatay.append(0.5 + 0.5 * sin(50 * i / 1000)) + +def update_series(): + + cosdatax = [] + cosdatay = [] + for i in range(0, 500): + cosdatax.append(i / 1000) + cosdatay.append(0.5 + 0.5 * cos(50 * i / 1000)) + dpg.set_value('series_tag', [cosdatax, cosdatay]) + dpg.set_item_label('series_tag', "0.5 + 0.5 * cos(x)") + +with dpg.window(label="Tutorial", tag="win"): + dpg.add_button(label="Update Series", callback=update_series) + # create plot + with dpg.plot(label="Line Series", height=400, width=400): + # optionally create legend + dpg.add_plot_legend() + + # REQUIRED: create x and y axes + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis") + + # series belong to a y axis + dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis", tag="series_tag") + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() diff --git a/tests/dearpygui/test3_custom_axis_labels.py b/tests/dearpygui/test3_custom_axis_labels.py new file mode 100644 index 0000000..be6b80b --- /dev/null +++ b/tests/dearpygui/test3_custom_axis_labels.py @@ -0,0 +1,34 @@ +import dearpygui.dearpygui as dpg + +dpg.create_context() + +with dpg.window(label="Tutorial", width=400, height=400): + with dpg.group(horizontal=True): + dpg.add_button(label="fit y", callback=lambda: dpg.fit_axis_data("y_axis")) + dpg.add_button(label="unlock x limits", callback=lambda: dpg.set_axis_limits_auto("x_axis")) + dpg.add_button(label="unlock y limits", callback=lambda: dpg.set_axis_limits_auto("y_axis")) + dpg.add_button(label="print limits x", callback=lambda: print(dpg.get_axis_limits("x_axis"))) + dpg.add_button(label="print limits y", callback=lambda: print(dpg.get_axis_limits("y_axis"))) + + with dpg.plot(label="Bar Series", height=-1, width=-1): + dpg.add_plot_legend() + + # create x axis + dpg.add_plot_axis(dpg.mvXAxis, label="Student", no_gridlines=True, tag="x_axis") + dpg.set_axis_limits(dpg.last_item(), 9, 33) + dpg.set_axis_ticks(dpg.last_item(), (("S1", 11), ("S2", 21), ("S3", 31))) + + # create y axis + dpg.add_plot_axis(dpg.mvYAxis, label="Score", tag="y_axis") + dpg.set_axis_limits("y_axis", 0, 110) + + # add series to y axis + dpg.add_bar_series([10, 20, 30], [100, 75, 90], label="Final Exam", weight=1, parent="y_axis") + dpg.add_bar_series([11, 21, 31], [83, 75, 72], label="Midterm Exam", weight=1, parent="y_axis") + dpg.add_bar_series([12, 22, 32], [42, 68, 23], label="Course Grade", weight=1, parent="y_axis") + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() \ No newline at end of file diff --git a/tests/dearpygui/test4_multiple_y_axes.py b/tests/dearpygui/test4_multiple_y_axes.py new file mode 100644 index 0000000..ebaac7e --- /dev/null +++ b/tests/dearpygui/test4_multiple_y_axes.py @@ -0,0 +1,25 @@ +import dearpygui.dearpygui as dpg + +dpg.create_context() + +with dpg.window(label="Tutorial", width=400, height=400): + with dpg.plot(label="Bar Series", height=-1, width=-1): + dpg.add_plot_legend() + + # create x axis + dpg.add_plot_axis(dpg.mvXAxis, label="Student", no_gridlines=True) + dpg.set_axis_ticks(dpg.last_item(), (("S1", 11), ("S2", 21), ("S3", 31))) + + # create y axis + dpg.add_plot_axis(dpg.mvYAxis, label="Score", tag="yaxis_tag") + + # add series to y axis + dpg.add_bar_series([10, 20, 30], [100, 75, 90], label="Final Exam", weight=1, parent="yaxis_tag") + dpg.add_bar_series([11, 21, 31], [83, 75, 72], label="Midterm Exam", weight=1, parent="yaxis_tag") + dpg.add_bar_series([12, 22, 32], [42, 68, 23], label="Course Grade", weight=1, parent="yaxis_tag") + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() \ No newline at end of file diff --git a/tests/dearpygui/test5_annotations.py b/tests/dearpygui/test5_annotations.py new file mode 100644 index 0000000..9deff6b --- /dev/null +++ b/tests/dearpygui/test5_annotations.py @@ -0,0 +1,32 @@ +import dearpygui.dearpygui as dpg +from math import sin + +dpg.create_context() + + +sindatax = [] +sindatay = [] +for i in range(0, 100): + sindatax.append(i / 100) + sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) + +with dpg.window(label="Tutorial", width=400, height=400): + with dpg.plot(label="Annotations", height=-1, width=-1): + dpg.add_plot_legend() + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.add_plot_axis(dpg.mvYAxis, label="y") + dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent=dpg.last_item()) + + # annotations belong to the plot NOT axis + dpg.add_plot_annotation(label="BL", default_value=(0.25, 0.25), offset=(-15, 15), color=[255, 255, 0, 255]) + dpg.add_plot_annotation(label="BR", default_value=(0.75, 0.25), offset=(15, 15), color=[255, 255, 0, 255]) + dpg.add_plot_annotation(label="TR not clampled", default_value=(0.75, 0.75), offset=(-15, -15), + color=[255, 255, 0, 255], clamped=False) + dpg.add_plot_annotation(label="TL", default_value=(0.25, 0.75), offset=(-15, -15), color=[255, 255, 0, 255]) + dpg.add_plot_annotation(label="Center", default_value=(0.5, 0.5), color=[255, 255, 0, 255]) + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() diff --git a/tests/dearpygui/test6_drag_points_and_lines.py b/tests/dearpygui/test6_drag_points_and_lines.py new file mode 100644 index 0000000..c6d8862 --- /dev/null +++ b/tests/dearpygui/test6_drag_points_and_lines.py @@ -0,0 +1,26 @@ +import dearpygui.dearpygui as dpg + +dpg.create_context() + +def print_val(sender): + print(dpg.get_value(sender)) + +with dpg.window(label="Tutorial", width=400, height=400): + with dpg.plot(label="Drag Lines/Points", height=-1, width=-1): + dpg.add_plot_legend() + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.set_axis_limits(dpg.last_item(), -5, 5) + dpg.add_plot_axis(dpg.mvYAxis, label="y") + dpg.set_axis_limits(dpg.last_item(), -5, 5) + + # drag lines/points belong to the plot NOT axis + dpg.add_drag_line(label="dline1", color=[255, 0, 0, 255], default_value=2.0, callback=print_val) + dpg.add_drag_line(label="dline2", color=[255, 255, 0, 255], vertical=False, default_value=-2, callback=print_val) + dpg.add_drag_point(label="dpoint1", color=[255, 0, 255, 255], default_value=(1.0, 1.0), callback=print_val) + dpg.add_drag_point(label="dpoint2", color=[255, 0, 255, 255], default_value=(-1.0, 1.0), callback=print_val) + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() \ No newline at end of file diff --git a/tests/dearpygui/test7_querying.py b/tests/dearpygui/test7_querying.py new file mode 100644 index 0000000..06f3ceb --- /dev/null +++ b/tests/dearpygui/test7_querying.py @@ -0,0 +1,37 @@ +import dearpygui.dearpygui as dpg +from math import sin + +dpg.create_context() + +sindatax = [] +sindatay = [] +for i in range(0, 100): + sindatax.append(i / 100) + sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) + +with dpg.window(label="Tutorial", width=400, height=600): + dpg.add_text("Click and drag the middle mouse button over the top plot!") + + + def query(sender, app_data, user_data): + dpg.set_axis_limits("xaxis_tag2", app_data[0], app_data[1]) + dpg.set_axis_limits("yaxis_tag2", app_data[2], app_data[3]) + + + # plot 1 + with dpg.plot(no_title=True, height=200, callback=query, query=True, no_menus=True, width=-1): + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.add_plot_axis(dpg.mvYAxis, label="y") + dpg.add_line_series(sindatax, sindatay, parent=dpg.last_item()) + + # plot 2 + with dpg.plot(no_title=True, height=200, no_menus=True, width=-1): + dpg.add_plot_axis(dpg.mvXAxis, label="x1", tag="xaxis_tag2") + dpg.add_plot_axis(dpg.mvYAxis, label="y1", tag="yaxis_tag2") + dpg.add_line_series(sindatax, sindatay, parent="yaxis_tag2") + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() \ No newline at end of file diff --git a/tests/dearpygui/test8_custom_context_menus.py b/tests/dearpygui/test8_custom_context_menus.py new file mode 100644 index 0000000..b459d15 --- /dev/null +++ b/tests/dearpygui/test8_custom_context_menus.py @@ -0,0 +1,33 @@ +import dearpygui.dearpygui as dpg +from math import sin + +dpg.create_context() + +sindatax = [] +sindatay = [] +for i in range(0, 100): + sindatax.append(i / 100) + sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) + +with dpg.window(label="Tutorial", width=400, height=400): + # create plot + dpg.add_text("Right click a series in the legend!") + with dpg.plot(label="Line Series", height=-1, width=-1): + dpg.add_plot_legend() + + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") + + # series 1 + dpg.add_line_series(sindatax, sindatay, label="series 1", parent="yaxis", tag="series_1") + dpg.add_button(label="Delete Series 1", parent=dpg.last_item(), callback=lambda: dpg.delete_item("series_1")) + + # series 2 + dpg.add_line_series(sindatax, sindatay, label="series 2", parent="yaxis", tag="series_2") + dpg.add_button(label="Delete Series 2", parent=dpg.last_item(), callback=lambda: dpg.delete_item("series_2")) + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() diff --git a/tests/dearpygui/test9_colors_and_styles.py b/tests/dearpygui/test9_colors_and_styles.py new file mode 100644 index 0000000..2f1c7ef --- /dev/null +++ b/tests/dearpygui/test9_colors_and_styles.py @@ -0,0 +1,50 @@ +import dearpygui.dearpygui as dpg +from math import sin + +dpg.create_context() + +sindatax = [] +sindatay = [] +for i in range(0, 100): + sindatax.append(i / 100) + sindatay.append(0.5 + 0.5 * sin(50 * i / 100)) +sindatay2 = [] +for i in range(0, 100): + sindatay2.append(2 + 0.5 * sin(50 * i / 100)) + +with dpg.window(label="Tutorial", width=500, height=400): + # create a theme for the plot + with dpg.theme(tag="plot_theme"): + with dpg.theme_component(dpg.mvStemSeries): + dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 255, 0), category=dpg.mvThemeCat_Plots) + dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Diamond, category=dpg.mvThemeCat_Plots) + dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 7, category=dpg.mvThemeCat_Plots) + + with dpg.theme_component(dpg.mvScatterSeries): + dpg.add_theme_color(dpg.mvPlotCol_Line, (60, 150, 200), category=dpg.mvThemeCat_Plots) + dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Square, category=dpg.mvThemeCat_Plots) + dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 4, category=dpg.mvThemeCat_Plots) + + # create plot + with dpg.plot(tag="plot", label="Line Series", height=-1, width=-1): + + # optionally create legend + dpg.add_plot_legend() + + # REQUIRED: create x and y axes + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis") + + # series belong to a y axis + dpg.add_stem_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="yaxis", tag="series_data") + dpg.add_scatter_series(sindatax, sindatay2, label="2 + 0.5 * sin(x)", parent="yaxis", tag="series_data2") + + # apply theme to series + dpg.bind_item_theme("series_data", "plot_theme") + dpg.bind_item_theme("series_data2", "plot_theme") + +dpg.create_viewport(title='Custom Title', width=800, height=600) +dpg.setup_dearpygui() +dpg.show_viewport() +dpg.start_dearpygui() +dpg.destroy_context() -- cgit v1.2.1 From b0db2314e0d43c528e4797c6f329d49742578531 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 19:32:38 +0100 Subject: Create QAM without gui --- simulation/QAM/lena512color.tiff | Bin 0 -> 786572 bytes simulation/QAM/qam.grc | 765 +----------------------- simulation/QAM/qam.py | 6 +- simulation/QAM/qam_nogui.grc | 1208 ++++++++++++++++++++++++++++++++++++++ simulation/QAM/qam_nogui.py | 238 ++++++++ src/qam.py | 1 + 6 files changed, 1477 insertions(+), 741 deletions(-) create mode 100644 simulation/QAM/lena512color.tiff create mode 100644 simulation/QAM/qam_nogui.grc create mode 100755 simulation/QAM/qam_nogui.py create mode 120000 src/qam.py diff --git a/simulation/QAM/lena512color.tiff b/simulation/QAM/lena512color.tiff new file mode 100644 index 0000000..ffe5c83 Binary files /dev/null and b/simulation/QAM/lena512color.tiff differ diff --git a/simulation/QAM/qam.grc b/simulation/QAM/qam.grc index d74a8fb..e1d0277 100644 --- a/simulation/QAM/qam.grc +++ b/simulation/QAM/qam.grc @@ -8,9 +8,9 @@ options: description: '' gen_cmake: 'On' gen_linking: dynamic - generate_options: qt_gui + generate_options: no_gui hier_block_src_path: '.:' - id: qam + id: qam_nogui max_nouts: '0' output_language: python placement: (0,0) @@ -54,7 +54,7 @@ blocks: rot_sym: '4' soft_dec_lut: None sym_map: '[0, 1, 3, 2]' - type: 8psk + type: 16qam states: bus_sink: false bus_source: false @@ -63,24 +63,15 @@ blocks: rotation: 0 state: true - name: eq_gain - id: variable_qtgui_range + id: variable parameters: comment: '' - gui_hint: 'params@1: 0,0,1,1' - label: Equalizer Rate - min_len: '200' - orient: Qt.Horizontal - rangeType: float - start: '0' - step: '.001' - stop: '.1' - value: '.01' - widget: counter_slider + value: 10e-3 states: bus_sink: false bus_source: false bus_structure: null - coordinate: [1336, 460.0] + coordinate: [1336, 212.0] rotation: 0 state: true - name: eq_mod @@ -120,24 +111,15 @@ blocks: rotation: 0 state: true - name: freq_offset - id: variable_qtgui_range + id: variable parameters: comment: '' - gui_hint: 'params@0: 1,0,1,1' - label: Frequency Offset - min_len: '200' - orient: Qt.Horizontal - rangeType: float - start: -100e-3 - step: 1e-3 - stop: 100e-3 value: '0' - widget: counter_slider states: bus_sink: false bus_source: false bus_structure: null - coordinate: [640, 460.0] + coordinate: [736, 180.0] rotation: 0 state: true - name: nfilts @@ -153,45 +135,27 @@ blocks: rotation: 0 state: true - name: noise_volt - id: variable_qtgui_range + id: variable parameters: comment: '' - gui_hint: 'params@0: 0,0,1,1' - label: Noise Voltage - min_len: '200' - orient: Qt.Horizontal - rangeType: float - start: '0' - step: '0.01' - stop: '1' - value: '0.0001' - widget: counter_slider + value: 100e-6 states: bus_sink: false bus_source: false bus_structure: null - coordinate: [504, 460.0] + coordinate: [640, 180.0] rotation: 0 state: true - name: phase_bw - id: variable_qtgui_range + id: variable parameters: comment: '' - gui_hint: 'params@1: 1,0,1,1' - label: Phase Bandwidth - min_len: '200' - orient: Qt.Horizontal - rangeType: float - start: '0' - step: '.01' - stop: '1' value: 2 * 3.141592653589793 / 100 - widget: counter_slider states: bus_sink: false bus_source: false bus_structure: null - coordinate: [1640, 428.0] + coordinate: [1640, 188.0] rotation: 0 state: true - name: qam_const @@ -212,7 +176,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [224, 444.0] + coordinate: [224, 436.0] rotation: 0 state: true - name: rrc_taps @@ -252,45 +216,27 @@ blocks: rotation: 0 state: true - name: time_offset - id: variable_qtgui_range + id: variable parameters: comment: '' - gui_hint: 'params@0: 0,1,1,1' - label: Timing Offset - min_len: '200' - orient: Qt.Horizontal - rangeType: float - start: '0.999' - step: '0.0001' - stop: '1.001' - value: '1.0' - widget: counter_slider + value: '1' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [504, 604.0] + coordinate: [736, 252.0] rotation: 0 state: true - name: timing_loop_bw - id: variable_qtgui_range + id: variable parameters: comment: '' - gui_hint: 'params@0: 1,1,1,1' - label: Time Bandwidth - min_len: '200' - orient: Qt.Horizontal - rangeType: float - start: '0' - step: 10e-3 - stop: 200e-3 value: 2 * 3.141592653589793 / 100 - widget: counter_slider states: bus_sink: false bus_source: false bus_structure: null - coordinate: [1008, 548.0] + coordinate: [1000, 228.0] rotation: 0 state: true - name: analog_random_source_x_0 @@ -330,40 +276,21 @@ blocks: coordinate: [2272, 276.0] rotation: 0 state: true -- name: blocks_char_to_float_0_0 - id: blocks_char_to_float - parameters: - affinity: '' - alias: '' - comment: '' - maxoutbuf: '0' - minoutbuf: '0' - scale: '1' - vlen: '1' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [408, 840.0] - rotation: 0 - state: true -- name: blocks_delay_0 - id: blocks_delay +- name: blocks_null_sink_0 + id: blocks_null_sink parameters: affinity: '' alias: '' + bus_structure_sink: '[[0,],]' comment: '' - delay: '50' - maxoutbuf: '0' - minoutbuf: '0' - num_ports: '1' + num_inputs: '1' type: float vlen: '1' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [2264, 844.0] + coordinate: [2488, 280.0] rotation: 0 state: true - name: blocks_throttle_0 @@ -401,22 +328,6 @@ blocks: coordinate: [2192, 436.0] rotation: 0 state: true -- name: blocks_unpack_k_bits_bb_0_0 - id: blocks_unpack_k_bits_bb - parameters: - affinity: '' - alias: '' - comment: '' - k: '2' - maxoutbuf: '0' - minoutbuf: '0' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [232, 840.0] - rotation: 0 - state: true - name: channels_channel_model_0 id: channels_channel_model parameters: @@ -449,7 +360,7 @@ blocks: modulus: eq_mod mu: eq_gain num_taps: eq_ntaps - sps: '2' + sps: sps states: bus_sink: false bus_source: false @@ -556,7 +467,7 @@ blocks: max_dev: '1.5' maxoutbuf: '0' minoutbuf: '0' - osps: '2' + osps: sps sps: sps * 1.001 taps: rrc_taps type: ccf @@ -567,642 +478,20 @@ blocks: coordinate: [1000, 308.0] rotation: 0 state: true -- name: params - id: qtgui_tab_widget - parameters: - alias: '' - comment: '' - gui_hint: '' - label0: Channel - label1: Receiver - label10: Tab 10 - label11: Tab 11 - label12: Tab 12 - label13: Tab 13 - label14: Tab 14 - label15: Tab 15 - label16: Tab 16 - label17: Tab 17 - label18: Tab 18 - label19: Tab 19 - label2: Tab 2 - label3: Tab 3 - label4: Tab 4 - label5: Tab 5 - label6: Tab 6 - label7: Tab 7 - label8: Tab 8 - label9: Tab 9 - num_tabs: '2' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [296, 12.0] - rotation: 0 - state: true -- name: plots - id: qtgui_tab_widget - parameters: - alias: '' - comment: '' - gui_hint: '' - label0: Constellations - label1: Frequency - label10: Tab 10 - label11: Tab 11 - label12: Tab 12 - label13: Tab 13 - label14: Tab 14 - label15: Tab 15 - label16: Tab 16 - label17: Tab 17 - label18: Tab 18 - label19: Tab 19 - label2: Time - label3: Tab 3 - label4: Tab 4 - label5: Tab 5 - label6: Tab 6 - label7: Tab 7 - label8: Tab 8 - label9: Tab 9 - num_tabs: '3' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [448, 12.0] - rotation: 0 - state: true -- name: qtgui_const_sink_x_0 - id: qtgui_const_sink_x - parameters: - affinity: '' - alias: '' - alpha1: '1.0' - alpha10: '1.0' - alpha2: '1.0' - alpha3: '1.0' - alpha4: '1.0' - alpha5: '1.0' - alpha6: '1.0' - alpha7: '1.0' - alpha8: '1.0' - alpha9: '1.0' - autoscale: 'False' - axislabels: 'True' - color1: '"blue"' - color10: '"red"' - color2: '"red"' - color3: '"red"' - color4: '"red"' - color5: '"red"' - color6: '"red"' - color7: '"red"' - color8: '"red"' - color9: '"red"' - comment: '' - grid: 'False' - gui_hint: 'plots@0: 0,0,1,1' - label1: '' - label10: '' - label2: '' - label3: '' - label4: '' - label5: '' - label6: '' - label7: '' - label8: '' - label9: '' - legend: 'True' - marker1: '0' - marker10: '0' - marker2: '0' - marker3: '0' - marker4: '0' - marker5: '0' - marker6: '0' - marker7: '0' - marker8: '0' - marker9: '0' - name: '"Channel"' - nconnections: '1' - size: '2048' - style1: '0' - style10: '0' - style2: '0' - style3: '0' - style4: '0' - style5: '0' - style6: '0' - style7: '0' - style8: '0' - style9: '0' - tr_chan: '0' - tr_level: '0.0' - tr_mode: qtgui.TRIG_MODE_FREE - tr_slope: qtgui.TRIG_SLOPE_POS - tr_tag: '""' - type: complex - update_time: '0.10' - width1: '1' - width10: '1' - width2: '1' - width3: '1' - width4: '1' - width5: '1' - width6: '1' - width7: '1' - width8: '1' - width9: '1' - xmax: '2' - xmin: '-2' - ymax: '2' - ymin: '-2' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [836.0, 128] - rotation: 90 - state: enabled -- name: qtgui_const_sink_x_0_0 - id: qtgui_const_sink_x - parameters: - affinity: '' - alias: '' - alpha1: '1.0' - alpha10: '1.0' - alpha2: '1.0' - alpha3: '1.0' - alpha4: '1.0' - alpha5: '1.0' - alpha6: '1.0' - alpha7: '1.0' - alpha8: '1.0' - alpha9: '1.0' - autoscale: 'False' - axislabels: 'True' - color1: '"blue"' - color10: '"red"' - color2: '"red"' - color3: '"red"' - color4: '"red"' - color5: '"red"' - color6: '"red"' - color7: '"red"' - color8: '"red"' - color9: '"red"' - comment: '' - grid: 'False' - gui_hint: 'plots@0: 0,1,1,1' - label1: '' - label10: '' - label2: '' - label3: '' - label4: '' - label5: '' - label6: '' - label7: '' - label8: '' - label9: '' - legend: 'True' - marker1: '0' - marker10: '0' - marker2: '0' - marker3: '0' - marker4: '0' - marker5: '0' - marker6: '0' - marker7: '0' - marker8: '0' - marker9: '0' - name: '"Synchronized"' - nconnections: '1' - size: '2048' - style1: '0' - style10: '0' - style2: '0' - style3: '0' - style4: '0' - style5: '0' - style6: '0' - style7: '0' - style8: '0' - style9: '0' - tr_chan: '0' - tr_level: '0.0' - tr_mode: qtgui.TRIG_MODE_FREE - tr_slope: qtgui.TRIG_SLOPE_POS - tr_tag: '""' - type: complex - update_time: '0.10' - width1: '1' - width10: '1' - width2: '1' - width3: '1' - width4: '1' - width5: '1' - width6: '1' - width7: '1' - width8: '1' - width9: '1' - xmax: '2' - xmin: '-2' - ymax: '2' - ymin: '-2' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [1228.0, 88] - rotation: 90 - state: enabled -- name: qtgui_const_sink_x_1 - id: qtgui_const_sink_x - parameters: - affinity: '' - alias: '' - alpha1: '1.0' - alpha10: '1.0' - alpha2: '1.0' - alpha3: '1.0' - alpha4: '1.0' - alpha5: '1.0' - alpha6: '1.0' - alpha7: '1.0' - alpha8: '1.0' - alpha9: '1.0' - autoscale: 'False' - axislabels: 'True' - color1: '"blue"' - color10: '"red"' - color2: '"red"' - color3: '"red"' - color4: '"red"' - color5: '"red"' - color6: '"red"' - color7: '"red"' - color8: '"red"' - color9: '"red"' - comment: '' - grid: 'False' - gui_hint: 'plots@0: 1,0,1,1' - label1: '' - label10: '' - label2: '' - label3: '' - label4: '' - label5: '' - label6: '' - label7: '' - label8: '' - label9: '' - legend: 'True' - marker1: '0' - marker10: '0' - marker2: '0' - marker3: '0' - marker4: '0' - marker5: '0' - marker6: '0' - marker7: '0' - marker8: '0' - marker9: '0' - name: '"Equalized"' - nconnections: '1' - size: '1024' - style1: '0' - style10: '0' - style2: '0' - style3: '0' - style4: '0' - style5: '0' - style6: '0' - style7: '0' - style8: '0' - style9: '0' - tr_chan: '0' - tr_level: '0.0' - tr_mode: qtgui.TRIG_MODE_FREE - tr_slope: qtgui.TRIG_SLOPE_POS - tr_tag: '""' - type: complex - update_time: '0.10' - width1: '1' - width10: '1' - width2: '1' - width3: '1' - width4: '1' - width5: '1' - width6: '1' - width7: '1' - width8: '1' - width9: '1' - xmax: '2' - xmin: '-2' - ymax: '2' - ymin: '-2' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [1524.0, 88] - rotation: 90 - state: true -- name: qtgui_const_sink_x_2 - id: qtgui_const_sink_x - parameters: - affinity: '' - alias: '' - alpha1: '1.0' - alpha10: '1.0' - alpha2: '1.0' - alpha3: '1.0' - alpha4: '1.0' - alpha5: '1.0' - alpha6: '1.0' - alpha7: '1.0' - alpha8: '1.0' - alpha9: '1.0' - autoscale: 'False' - axislabels: 'True' - color1: '"blue"' - color10: '"red"' - color2: '"red"' - color3: '"red"' - color4: '"red"' - color5: '"red"' - color6: '"red"' - color7: '"red"' - color8: '"red"' - color9: '"red"' - comment: '' - grid: 'False' - gui_hint: 'plots@0: 1,1,1,1' - label1: '' - label10: '' - label2: '' - label3: '' - label4: '' - label5: '' - label6: '' - label7: '' - label8: '' - label9: '' - legend: 'True' - marker1: '0' - marker10: '0' - marker2: '0' - marker3: '0' - marker4: '0' - marker5: '0' - marker6: '0' - marker7: '0' - marker8: '0' - marker9: '0' - name: '"Locked"' - nconnections: '1' - size: '1024' - style1: '0' - style10: '0' - style2: '0' - style3: '0' - style4: '0' - style5: '0' - style6: '0' - style7: '0' - style8: '0' - style9: '0' - tr_chan: '0' - tr_level: '0.0' - tr_mode: qtgui.TRIG_MODE_FREE - tr_slope: qtgui.TRIG_SLOPE_POS - tr_tag: '""' - type: complex - update_time: '0.10' - width1: '1' - width10: '1' - width2: '1' - width3: '1' - width4: '1' - width5: '1' - width6: '1' - width7: '1' - width8: '1' - width9: '1' - xmax: '2' - xmin: '-2' - ymax: '2' - ymin: '-2' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [1860.0, 64] - rotation: 90 - state: true -- name: qtgui_freq_sink_x_0 - id: qtgui_freq_sink_x - parameters: - affinity: '' - alias: '' - alpha1: '1.0' - alpha10: '1.0' - alpha2: '1.0' - alpha3: '1.0' - alpha4: '1.0' - alpha5: '1.0' - alpha6: '1.0' - alpha7: '1.0' - alpha8: '1.0' - alpha9: '1.0' - autoscale: 'False' - average: '1.0' - axislabels: 'True' - bw: samp_rate - color1: '"blue"' - color10: '"dark blue"' - color2: '"red"' - color3: '"green"' - color4: '"black"' - color5: '"cyan"' - color6: '"magenta"' - color7: '"yellow"' - color8: '"dark red"' - color9: '"dark green"' - comment: '' - ctrlpanel: 'False' - fc: '0' - fftsize: '1024' - freqhalf: 'True' - grid: 'False' - gui_hint: 'plots@1: 0,0,1,1' - label: Relative Gain - label1: '' - label10: '''''' - label2: '''''' - label3: '''''' - label4: '''''' - label5: '''''' - label6: '''''' - label7: '''''' - label8: '''''' - label9: '''''' - legend: 'True' - maxoutbuf: '0' - minoutbuf: '0' - name: '"Channel"' - nconnections: '1' - showports: 'False' - tr_chan: '0' - tr_level: '0.0' - tr_mode: qtgui.TRIG_MODE_FREE - tr_tag: '""' - type: complex - units: dB - update_time: '0.10' - width1: '1' - width10: '1' - width2: '1' - width3: '1' - width4: '1' - width5: '1' - width6: '1' - width7: '1' - width8: '1' - width9: '1' - wintype: firdes.WIN_BLACKMAN_hARRIS - ymax: '10' - ymin: '-140' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [856.0, 472] - rotation: 270 - state: true -- name: qtgui_time_sink_x_0 - id: qtgui_time_sink_x - parameters: - affinity: '' - alias: '' - alpha1: '1.0' - alpha10: '1.0' - alpha2: '1.0' - alpha3: '1.0' - alpha4: '1.0' - alpha5: '1.0' - alpha6: '1.0' - alpha7: '1.0' - alpha8: '1.0' - alpha9: '1.0' - autoscale: 'False' - axislabels: 'True' - color1: blue - color10: dark blue - color2: red - color3: green - color4: black - color5: cyan - color6: magenta - color7: yellow - color8: dark red - color9: dark green - comment: '' - ctrlpanel: 'False' - entags: 'True' - grid: 'False' - gui_hint: 'plots@2: 0,0,1,1' - label1: Received - label10: Signal 10 - label2: Sent - label3: Signal 3 - label4: Signal 4 - label5: Signal 5 - label6: Signal 6 - label7: Signal 7 - label8: Signal 8 - label9: Signal 9 - legend: 'True' - marker1: '-1' - marker10: '-1' - marker2: '-1' - marker3: '-1' - marker4: '-1' - marker5: '-1' - marker6: '-1' - marker7: '-1' - marker8: '-1' - marker9: '-1' - name: '"Decoded"' - nconnections: '2' - size: '1024' - srate: samp_rate - stemplot: 'False' - style1: '1' - style10: '1' - style2: '1' - style3: '1' - style4: '1' - style5: '1' - style6: '1' - style7: '1' - style8: '1' - style9: '1' - tr_chan: '0' - tr_delay: '0' - tr_level: '0.0' - tr_mode: qtgui.TRIG_MODE_FREE - tr_slope: qtgui.TRIG_SLOPE_POS - tr_tag: '""' - type: float - update_time: '0.10' - width1: '1' - width10: '1' - width2: '1' - width3: '1' - width4: '1' - width5: '1' - width6: '1' - width7: '1' - width8: '1' - width9: '1' - ylabel: Amplitude - ymax: '1' - ymin: '-1' - yunit: '""' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [2504, 268.0] - rotation: 0 - state: true connections: -- [analog_random_source_x_0, '0', blocks_unpack_k_bits_bb_0_0, '0'] - [analog_random_source_x_0, '0', digital_constellation_modulator_0, '0'] -- [blocks_char_to_float_0, '0', qtgui_time_sink_x_0, '0'] -- [blocks_char_to_float_0_0, '0', blocks_delay_0, '0'] -- [blocks_delay_0, '0', qtgui_time_sink_x_0, '1'] +- [blocks_char_to_float_0, '0', blocks_null_sink_0, '0'] - [blocks_throttle_0, '0', channels_channel_model_0, '0'] - [blocks_unpack_k_bits_bb_0, '0', blocks_char_to_float_0, '0'] -- [blocks_unpack_k_bits_bb_0_0, '0', blocks_char_to_float_0_0, '0'] - [channels_channel_model_0, '0', digital_pfb_clock_sync_xxx_0, '0'] -- [channels_channel_model_0, '0', qtgui_const_sink_x_0, '0'] -- [channels_channel_model_0, '0', qtgui_freq_sink_x_0, '0'] - [digital_cma_equalizer_cc_0, '0', digital_costas_loop_cc_0, '0'] -- [digital_cma_equalizer_cc_0, '0', qtgui_const_sink_x_1, '0'] - [digital_constellation_decoder_cb_0, '0', digital_diff_decoder_bb_0, '0'] - [digital_constellation_modulator_0, '0', blocks_throttle_0, '0'] - [digital_costas_loop_cc_0, '0', digital_constellation_decoder_cb_0, '0'] -- [digital_costas_loop_cc_0, '0', qtgui_const_sink_x_2, '0'] - [digital_diff_decoder_bb_0, '0', digital_map_bb_0, '0'] - [digital_map_bb_0, '0', blocks_unpack_k_bits_bb_0, '0'] - [digital_pfb_clock_sync_xxx_0, '0', digital_cma_equalizer_cc_0, '0'] -- [digital_pfb_clock_sync_xxx_0, '0', qtgui_const_sink_x_0_0, '0'] metadata: file_format: 1 diff --git a/simulation/QAM/qam.py b/simulation/QAM/qam.py index 8977787..d64a687 100755 --- a/simulation/QAM/qam.py +++ b/simulation/QAM/qam.py @@ -90,7 +90,7 @@ class qam(gr.top_block, Qt.QWidget): self.eq_ntaps = eq_ntaps = 15 self.eq_mod = eq_mod = 1 self.eq_gain = eq_gain = .01 - self.const = const = digital.constellation_8psk().base() + self.const = const = digital.constellation_16qam().base() self.chn_taps = chn_taps = [1.0 + 0.0j, ] ################################################## @@ -438,7 +438,7 @@ class qam(gr.top_block, Qt.QWidget): self.plots_grid_layout_0.setRowStretch(r, 1) for c in range(0, 1): self.plots_grid_layout_0.setColumnStretch(c, 1) - self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps * 1.001, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 2) + self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps * 1.001, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, sps) self.digital_map_bb_0 = digital.map_bb([0, 1, 3, 2]) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4) self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 4, False) @@ -451,7 +451,7 @@ class qam(gr.top_block, Qt.QWidget): verbose=False, log=False) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(const) - self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, 2) + self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, sps) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise_volt, frequency_offset=freq_offset, diff --git a/simulation/QAM/qam_nogui.grc b/simulation/QAM/qam_nogui.grc new file mode 100644 index 0000000..1264e80 --- /dev/null +++ b/simulation/QAM/qam_nogui.grc @@ -0,0 +1,1208 @@ +options: + parameters: + author: Pross Naoki, Halter Sara Cinzia + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: qam + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '1' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: QAM + window_size: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 8] + rotation: 0 + state: enabled + +blocks: +- name: chn_taps + id: variable + parameters: + comment: '' + value: '[1.0 + 0.0j, ]' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [640, 252.0] + rotation: 0 + state: true +- name: const + id: variable_constellation + parameters: + comment: '' + const_points: '[-1-1j, -1+1j, 1+1j, 1-1j]' + dims: '1' + precision: '8' + rot_sym: '4' + soft_dec_lut: None + sym_map: '[0, 1, 3, 2]' + type: 16qam + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [224, 604.0] + rotation: 0 + state: true +- name: eq_gain + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 'params@1: 0,0,1,1' + label: Equalizer Rate + min_len: '200' + orient: Qt.Horizontal + rangeType: float + start: '0' + step: '.001' + stop: '.1' + value: '.01' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1336, 460.0] + rotation: 0 + state: true +- name: eq_mod + id: variable + parameters: + comment: '' + value: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1336, 388.0] + rotation: 0 + state: true +- name: eq_ntaps + id: variable + parameters: + comment: '' + value: '15' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1416, 388.0] + rotation: 0 + state: true +- name: excess_bw + id: variable + parameters: + comment: '' + value: 350e-3 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [320, 268.0] + rotation: 0 + state: true +- name: freq_offset + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 'params@0: 1,0,1,1' + label: Frequency Offset + min_len: '200' + orient: Qt.Horizontal + rangeType: float + start: -100e-3 + step: 1e-3 + stop: 100e-3 + value: '0' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [640, 460.0] + rotation: 0 + state: true +- name: nfilts + id: variable + parameters: + comment: '' + value: '32' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1008, 476.0] + rotation: 0 + state: true +- name: noise_volt + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 'params@0: 0,0,1,1' + label: Noise Voltage + min_len: '200' + orient: Qt.Horizontal + rangeType: float + start: '0' + step: '0.01' + stop: '1' + value: '0.0001' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [504, 460.0] + rotation: 0 + state: true +- name: phase_bw + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 'params@1: 1,0,1,1' + label: Phase Bandwidth + min_len: '200' + orient: Qt.Horizontal + rangeType: float + start: '0' + step: '.01' + stop: '1' + value: 2 * 3.141592653589793 / 100 + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1640, 428.0] + rotation: 0 + state: true +- name: qam_const + id: variable_constellation_rect + parameters: + comment: '' + const_points: '[(-3-3j), (-1-3j), (1-3j), (3-3j), (-3-1j), (-1-1j), (1-1j), (3-1j), + (-3+1j), (-1+1j), (1+1j), (3+1j), (-3+3j), (-1+3j), (1+3j), (3+3j)]' + imag_sect: '1' + precision: '4' + real_sect: '1' + rot_sym: '4' + soft_dec_lut: None + sym_map: '[0, 4, 12, 8, 1, 5, 13, 9, 3, 7, 15, 11, 2, 6, 14, 10]' + w_imag_sect: '1' + w_real_sect: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [224, 436.0] + rotation: 0 + state: true +- name: rrc_taps + id: variable + parameters: + comment: '' + value: firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1080, 476.0] + rotation: 0 + state: true +- name: samp_rate + id: variable + parameters: + comment: '' + value: '32000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [192, 12.0] + rotation: 0 + state: enabled +- name: sps + id: variable + parameters: + comment: '' + value: '4' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [224, 268.0] + rotation: 0 + state: true +- name: time_offset + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 'params@0: 0,1,1,1' + label: Timing Offset + min_len: '200' + orient: Qt.Horizontal + rangeType: float + start: '0.999' + step: '0.0001' + stop: '1.001' + value: '1.0' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [504, 604.0] + rotation: 0 + state: true +- name: timing_loop_bw + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 'params@0: 1,1,1,1' + label: Time Bandwidth + min_len: '200' + orient: Qt.Horizontal + rangeType: float + start: '0' + step: 10e-3 + stop: 200e-3 + value: 2 * 3.141592653589793 / 100 + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1008, 548.0] + rotation: 0 + state: true +- name: analog_random_source_x_0 + id: analog_random_source_x + parameters: + affinity: '' + alias: '' + comment: '' + max: '256' + maxoutbuf: '0' + min: '0' + minoutbuf: '0' + num_samps: '1000' + repeat: 'True' + type: byte + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [32, 332.0] + rotation: 0 + state: enabled +- name: blocks_char_to_float_0 + id: blocks_char_to_float + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + scale: '1' + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [2272, 276.0] + rotation: 0 + state: true +- name: blocks_char_to_float_0_0 + id: blocks_char_to_float + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + scale: '1' + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [408, 840.0] + rotation: 0 + state: true +- name: blocks_delay_0 + id: blocks_delay + parameters: + affinity: '' + alias: '' + comment: '' + delay: '50' + maxoutbuf: '0' + minoutbuf: '0' + num_ports: '1' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [2264, 844.0] + rotation: 0 + state: true +- name: blocks_throttle_0 + id: blocks_throttle + parameters: + affinity: '' + alias: '' + comment: '' + ignoretag: 'True' + maxoutbuf: '0' + minoutbuf: '0' + samples_per_second: samp_rate + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [464, 356.0] + rotation: 0 + state: enabled +- name: blocks_unpack_k_bits_bb_0 + id: blocks_unpack_k_bits_bb + parameters: + affinity: '' + alias: '' + comment: '' + k: '2' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [2192, 436.0] + rotation: 0 + state: true +- name: blocks_unpack_k_bits_bb_0_0 + id: blocks_unpack_k_bits_bb + parameters: + affinity: '' + alias: '' + comment: '' + k: '2' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [232, 840.0] + rotation: 0 + state: true +- name: channels_channel_model_0 + id: channels_channel_model + parameters: + affinity: '' + alias: '' + block_tags: 'False' + comment: '' + epsilon: time_offset + freq_offset: freq_offset + maxoutbuf: '0' + minoutbuf: '0' + noise_voltage: noise_volt + seed: '0' + taps: chn_taps + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [640, 316.0] + rotation: 0 + state: enabled +- name: digital_cma_equalizer_cc_0 + id: digital_cma_equalizer_cc + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + modulus: eq_mod + mu: eq_gain + num_taps: eq_ntaps + sps: sps + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1336, 284.0] + rotation: 0 + state: true +- name: digital_constellation_decoder_cb_0 + id: digital_constellation_decoder_cb + parameters: + affinity: '' + alias: '' + comment: '' + constellation: const + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1976, 276.0] + rotation: 0 + state: true +- name: digital_constellation_modulator_0 + id: digital_constellation_modulator + parameters: + affinity: '' + alias: '' + comment: '' + constellation: const + differential: 'True' + excess_bw: excess_bw + log: 'False' + maxoutbuf: '0' + minoutbuf: '0' + samples_per_symbol: sps + verbose: 'False' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [224, 332.0] + rotation: 0 + state: enabled +- name: digital_costas_loop_cc_0 + id: digital_costas_loop_cc + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + order: '4' + use_snr: 'False' + w: phase_bw + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1640, 280.0] + rotation: 0 + state: true +- name: digital_diff_decoder_bb_0 + id: digital_diff_decoder_bb + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + modulus: '4' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1976, 348.0] + rotation: 180 + state: true +- name: digital_map_bb_0 + id: digital_map_bb + parameters: + affinity: '' + alias: '' + comment: '' + map: '[0, 1, 3, 2]' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1984, 436.0] + rotation: 0 + state: true +- name: digital_pfb_clock_sync_xxx_0 + id: digital_pfb_clock_sync_xxx + parameters: + affinity: '' + alias: '' + comment: '' + filter_size: nfilts + init_phase: nfilts/2 + loop_bw: timing_loop_bw + max_dev: '1.5' + maxoutbuf: '0' + minoutbuf: '0' + osps: sps + sps: sps * 1.001 + taps: rrc_taps + type: ccf + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1000, 308.0] + rotation: 0 + state: true +- name: params + id: qtgui_tab_widget + parameters: + alias: '' + comment: '' + gui_hint: '' + label0: Channel + label1: Receiver + label10: Tab 10 + label11: Tab 11 + label12: Tab 12 + label13: Tab 13 + label14: Tab 14 + label15: Tab 15 + label16: Tab 16 + label17: Tab 17 + label18: Tab 18 + label19: Tab 19 + label2: Tab 2 + label3: Tab 3 + label4: Tab 4 + label5: Tab 5 + label6: Tab 6 + label7: Tab 7 + label8: Tab 8 + label9: Tab 9 + num_tabs: '2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [296, 12.0] + rotation: 0 + state: true +- name: plots + id: qtgui_tab_widget + parameters: + alias: '' + comment: '' + gui_hint: '' + label0: Constellations + label1: Frequency + label10: Tab 10 + label11: Tab 11 + label12: Tab 12 + label13: Tab 13 + label14: Tab 14 + label15: Tab 15 + label16: Tab 16 + label17: Tab 17 + label18: Tab 18 + label19: Tab 19 + label2: Time + label3: Tab 3 + label4: Tab 4 + label5: Tab 5 + label6: Tab 6 + label7: Tab 7 + label8: Tab 8 + label9: Tab 9 + num_tabs: '3' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [448, 12.0] + rotation: 0 + state: true +- name: qtgui_const_sink_x_0 + id: qtgui_const_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: '"blue"' + color10: '"red"' + color2: '"red"' + color3: '"red"' + color4: '"red"' + color5: '"red"' + color6: '"red"' + color7: '"red"' + color8: '"red"' + color9: '"red"' + comment: '' + grid: 'False' + gui_hint: 'plots@0: 0,0,1,1' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + marker1: '0' + marker10: '0' + marker2: '0' + marker3: '0' + marker4: '0' + marker5: '0' + marker6: '0' + marker7: '0' + marker8: '0' + marker9: '0' + name: '"Channel"' + nconnections: '1' + size: '2048' + style1: '0' + style10: '0' + style2: '0' + style3: '0' + style4: '0' + style5: '0' + style6: '0' + style7: '0' + style8: '0' + style9: '0' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + xmax: '2' + xmin: '-2' + ymax: '2' + ymin: '-2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [836.0, 128] + rotation: 90 + state: enabled +- name: qtgui_const_sink_x_0_0 + id: qtgui_const_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: '"blue"' + color10: '"red"' + color2: '"red"' + color3: '"red"' + color4: '"red"' + color5: '"red"' + color6: '"red"' + color7: '"red"' + color8: '"red"' + color9: '"red"' + comment: '' + grid: 'False' + gui_hint: 'plots@0: 0,1,1,1' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + marker1: '0' + marker10: '0' + marker2: '0' + marker3: '0' + marker4: '0' + marker5: '0' + marker6: '0' + marker7: '0' + marker8: '0' + marker9: '0' + name: '"Synchronized"' + nconnections: '1' + size: '2048' + style1: '0' + style10: '0' + style2: '0' + style3: '0' + style4: '0' + style5: '0' + style6: '0' + style7: '0' + style8: '0' + style9: '0' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + xmax: '2' + xmin: '-2' + ymax: '2' + ymin: '-2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1228.0, 88] + rotation: 90 + state: enabled +- name: qtgui_const_sink_x_1 + id: qtgui_const_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: '"blue"' + color10: '"red"' + color2: '"red"' + color3: '"red"' + color4: '"red"' + color5: '"red"' + color6: '"red"' + color7: '"red"' + color8: '"red"' + color9: '"red"' + comment: '' + grid: 'False' + gui_hint: 'plots@0: 1,0,1,1' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + marker1: '0' + marker10: '0' + marker2: '0' + marker3: '0' + marker4: '0' + marker5: '0' + marker6: '0' + marker7: '0' + marker8: '0' + marker9: '0' + name: '"Equalized"' + nconnections: '1' + size: '1024' + style1: '0' + style10: '0' + style2: '0' + style3: '0' + style4: '0' + style5: '0' + style6: '0' + style7: '0' + style8: '0' + style9: '0' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + xmax: '2' + xmin: '-2' + ymax: '2' + ymin: '-2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1524.0, 88] + rotation: 90 + state: true +- name: qtgui_const_sink_x_2 + id: qtgui_const_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: '"blue"' + color10: '"red"' + color2: '"red"' + color3: '"red"' + color4: '"red"' + color5: '"red"' + color6: '"red"' + color7: '"red"' + color8: '"red"' + color9: '"red"' + comment: '' + grid: 'False' + gui_hint: 'plots@0: 1,1,1,1' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + marker1: '0' + marker10: '0' + marker2: '0' + marker3: '0' + marker4: '0' + marker5: '0' + marker6: '0' + marker7: '0' + marker8: '0' + marker9: '0' + name: '"Locked"' + nconnections: '1' + size: '1024' + style1: '0' + style10: '0' + style2: '0' + style3: '0' + style4: '0' + style5: '0' + style6: '0' + style7: '0' + style8: '0' + style9: '0' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + xmax: '2' + xmin: '-2' + ymax: '2' + ymin: '-2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1860.0, 64] + rotation: 90 + state: true +- name: qtgui_freq_sink_x_0 + id: qtgui_freq_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + average: '1.0' + axislabels: 'True' + bw: samp_rate + color1: '"blue"' + color10: '"dark blue"' + color2: '"red"' + color3: '"green"' + color4: '"black"' + color5: '"cyan"' + color6: '"magenta"' + color7: '"yellow"' + color8: '"dark red"' + color9: '"dark green"' + comment: '' + ctrlpanel: 'False' + fc: '0' + fftsize: '1024' + freqhalf: 'True' + grid: 'False' + gui_hint: 'plots@1: 0,0,1,1' + label: Relative Gain + label1: '' + label10: '''''' + label2: '''''' + label3: '''''' + label4: '''''' + label5: '''''' + label6: '''''' + label7: '''''' + label8: '''''' + label9: '''''' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '"Channel"' + nconnections: '1' + showports: 'False' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_tag: '""' + type: complex + units: dB + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + wintype: firdes.WIN_BLACKMAN_hARRIS + ymax: '10' + ymin: '-140' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [856.0, 472] + rotation: 270 + state: true +- name: qtgui_time_sink_x_0 + id: qtgui_time_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 'plots@2: 0,0,1,1' + label1: Received + label10: Signal 10 + label2: Sent + label3: Signal 3 + label4: Signal 4 + label5: Signal 5 + label6: Signal 6 + label7: Signal 7 + label8: Signal 8 + label9: Signal 9 + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '"Decoded"' + nconnections: '2' + size: '1024' + srate: samp_rate + stemplot: 'False' + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: float + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Amplitude + ymax: '1' + ymin: '-1' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [2504, 268.0] + rotation: 0 + state: true + +connections: +- [analog_random_source_x_0, '0', blocks_unpack_k_bits_bb_0_0, '0'] +- [analog_random_source_x_0, '0', digital_constellation_modulator_0, '0'] +- [blocks_char_to_float_0, '0', qtgui_time_sink_x_0, '0'] +- [blocks_char_to_float_0_0, '0', blocks_delay_0, '0'] +- [blocks_delay_0, '0', qtgui_time_sink_x_0, '1'] +- [blocks_throttle_0, '0', channels_channel_model_0, '0'] +- [blocks_unpack_k_bits_bb_0, '0', blocks_char_to_float_0, '0'] +- [blocks_unpack_k_bits_bb_0_0, '0', blocks_char_to_float_0_0, '0'] +- [channels_channel_model_0, '0', digital_pfb_clock_sync_xxx_0, '0'] +- [channels_channel_model_0, '0', qtgui_const_sink_x_0, '0'] +- [channels_channel_model_0, '0', qtgui_freq_sink_x_0, '0'] +- [digital_cma_equalizer_cc_0, '0', digital_costas_loop_cc_0, '0'] +- [digital_cma_equalizer_cc_0, '0', qtgui_const_sink_x_1, '0'] +- [digital_constellation_decoder_cb_0, '0', digital_diff_decoder_bb_0, '0'] +- [digital_constellation_modulator_0, '0', blocks_throttle_0, '0'] +- [digital_costas_loop_cc_0, '0', digital_constellation_decoder_cb_0, '0'] +- [digital_costas_loop_cc_0, '0', qtgui_const_sink_x_2, '0'] +- [digital_diff_decoder_bb_0, '0', digital_map_bb_0, '0'] +- [digital_map_bb_0, '0', blocks_unpack_k_bits_bb_0, '0'] +- [digital_pfb_clock_sync_xxx_0, '0', digital_cma_equalizer_cc_0, '0'] +- [digital_pfb_clock_sync_xxx_0, '0', qtgui_const_sink_x_0_0, '0'] + +metadata: + file_format: 1 diff --git a/simulation/QAM/qam_nogui.py b/simulation/QAM/qam_nogui.py new file mode 100755 index 0000000..67ee236 --- /dev/null +++ b/simulation/QAM/qam_nogui.py @@ -0,0 +1,238 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# +# SPDX-License-Identifier: GPL-3.0 +# +# GNU Radio Python Flow Graph +# Title: QAM +# Author: Pross Naoki, Halter Sara Cinzia +# GNU Radio version: 3.8.2.0 + +from gnuradio import blocks +import numpy +from gnuradio import channels +from gnuradio.filter import firdes +from gnuradio import digital +from gnuradio import gr +import sys +import signal +from argparse import ArgumentParser +from gnuradio.eng_arg import eng_float, intx +from gnuradio import eng_notation + + +class qam_nogui(gr.top_block): + + def __init__(self): + gr.top_block.__init__(self, "QAM") + + ################################################## + # Variables + ################################################## + self.sps = sps = 4 + self.nfilts = nfilts = 32 + self.excess_bw = excess_bw = 350e-3 + self.timing_loop_bw = timing_loop_bw = 2 * 3.141592653589793 / 100 + self.time_offset = time_offset = 1 + self.samp_rate = samp_rate = 32000 + self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts) + self.qam_const = qam_const = digital.constellation_rect([(-3-3j), (-1-3j), (1-3j), (3-3j), (-3-1j), (-1-1j), (1-1j), (3-1j), (-3+1j), (-1+1j), (1+1j), (3+1j), (-3+3j), (-1+3j), (1+3j), (3+3j)], [0, 4, 12, 8, 1, 5, 13, 9, 3, 7, 15, 11, 2, 6, 14, 10], + 4, 1, 1, 1, 1).base() + self.phase_bw = phase_bw = 2 * 3.141592653589793 / 100 + self.noise_volt = noise_volt = 100e-6 + self.freq_offset = freq_offset = 0 + self.eq_ntaps = eq_ntaps = 15 + self.eq_mod = eq_mod = 1 + self.eq_gain = eq_gain = 10e-3 + self.const = const = digital.constellation_16qam().base() + self.chn_taps = chn_taps = [1.0 + 0.0j, ] + + ################################################## + # Blocks + ################################################## + self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps * 1.001, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, sps) + self.digital_map_bb_0 = digital.map_bb([0, 1, 3, 2]) + self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4) + self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 4, False) + self.digital_constellation_modulator_0 = digital.generic_mod( + constellation=const, + differential=True, + samples_per_symbol=sps, + pre_diff_code=True, + excess_bw=excess_bw, + verbose=False, + log=False) + self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(const) + self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, sps) + self.channels_channel_model_0 = channels.channel_model( + noise_voltage=noise_volt, + frequency_offset=freq_offset, + epsilon=time_offset, + taps=chn_taps, + noise_seed=0, + block_tags=False) + self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2) + self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) + self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1) + self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) + self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 256, 1000))), True) + + + + ################################################## + # Connections + ################################################## + self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0, 0)) + self.connect((self.blocks_char_to_float_0, 0), (self.blocks_null_sink_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) + self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0, 0)) + self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) + self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0, 0)) + self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) + self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) + self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_constellation_decoder_cb_0, 0)) + self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_map_bb_0, 0)) + self.connect((self.digital_map_bb_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) + self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0)) + + + def get_sps(self): + return self.sps + + def set_sps(self, sps): + self.sps = sps + self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) + + def get_nfilts(self): + return self.nfilts + + def set_nfilts(self, nfilts): + self.nfilts = nfilts + self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) + + def get_excess_bw(self): + return self.excess_bw + + def set_excess_bw(self, excess_bw): + self.excess_bw = excess_bw + self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) + + def get_timing_loop_bw(self): + return self.timing_loop_bw + + def set_timing_loop_bw(self, timing_loop_bw): + self.timing_loop_bw = timing_loop_bw + self.digital_pfb_clock_sync_xxx_0.set_loop_bandwidth(self.timing_loop_bw) + + def get_time_offset(self): + return self.time_offset + + def set_time_offset(self, time_offset): + self.time_offset = time_offset + self.channels_channel_model_0.set_timing_offset(self.time_offset) + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.blocks_throttle_0.set_sample_rate(self.samp_rate) + + def get_rrc_taps(self): + return self.rrc_taps + + def set_rrc_taps(self, rrc_taps): + self.rrc_taps = rrc_taps + self.digital_pfb_clock_sync_xxx_0.update_taps(self.rrc_taps) + + def get_qam_const(self): + return self.qam_const + + def set_qam_const(self, qam_const): + self.qam_const = qam_const + + def get_phase_bw(self): + return self.phase_bw + + def set_phase_bw(self, phase_bw): + self.phase_bw = phase_bw + self.digital_costas_loop_cc_0.set_loop_bandwidth(self.phase_bw) + + def get_noise_volt(self): + return self.noise_volt + + def set_noise_volt(self, noise_volt): + self.noise_volt = noise_volt + self.channels_channel_model_0.set_noise_voltage(self.noise_volt) + + def get_freq_offset(self): + return self.freq_offset + + def set_freq_offset(self, freq_offset): + self.freq_offset = freq_offset + self.channels_channel_model_0.set_frequency_offset(self.freq_offset) + + def get_eq_ntaps(self): + return self.eq_ntaps + + def set_eq_ntaps(self, eq_ntaps): + self.eq_ntaps = eq_ntaps + + def get_eq_mod(self): + return self.eq_mod + + def set_eq_mod(self, eq_mod): + self.eq_mod = eq_mod + self.digital_cma_equalizer_cc_0.set_modulus(self.eq_mod) + + def get_eq_gain(self): + return self.eq_gain + + def set_eq_gain(self, eq_gain): + self.eq_gain = eq_gain + self.digital_cma_equalizer_cc_0.set_gain(self.eq_gain) + + def get_const(self): + return self.const + + def set_const(self, const): + self.const = const + + def get_chn_taps(self): + return self.chn_taps + + def set_chn_taps(self, chn_taps): + self.chn_taps = chn_taps + self.channels_channel_model_0.set_taps(self.chn_taps) + + + + + +def main(top_block_cls=qam_nogui, options=None): + if gr.enable_realtime_scheduling() != gr.RT_OK: + print("Error: failed to enable real-time scheduling.") + tb = top_block_cls() + + def sig_handler(sig=None, frame=None): + tb.stop() + tb.wait() + + sys.exit(0) + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + + tb.start() + + try: + input('Press Enter to quit: ') + except EOFError: + pass + tb.stop() + tb.wait() + + +if __name__ == '__main__': + main() diff --git a/src/qam.py b/src/qam.py new file mode 120000 index 0000000..a59366b --- /dev/null +++ b/src/qam.py @@ -0,0 +1 @@ +../simulation/QAM/qam_nogui.py \ No newline at end of file -- cgit v1.2.1 From bf41ed4934742edf85e9973286b04f023f660c2f Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 19:45:58 +0100 Subject: Create ZMQ test --- tests/zmq/lena512color.tiff | Bin 0 -> 786572 bytes tests/zmq/server.py | 4 ++ tests/zmq/zmqtest.grc | 112 ++++++++++++++++++++++++++++++++++++++++++++ tests/zmq/zmqtest.py | 85 +++++++++++++++++++++++++++++++++ 4 files changed, 201 insertions(+) create mode 100644 tests/zmq/lena512color.tiff create mode 100644 tests/zmq/server.py create mode 100644 tests/zmq/zmqtest.grc create mode 100755 tests/zmq/zmqtest.py diff --git a/tests/zmq/lena512color.tiff b/tests/zmq/lena512color.tiff new file mode 100644 index 0000000..ffe5c83 Binary files /dev/null and b/tests/zmq/lena512color.tiff differ diff --git a/tests/zmq/server.py b/tests/zmq/server.py new file mode 100644 index 0000000..be4bede --- /dev/null +++ b/tests/zmq/server.py @@ -0,0 +1,4 @@ +import zmq +import pmt + +import numpy as np diff --git a/tests/zmq/zmqtest.grc b/tests/zmq/zmqtest.grc new file mode 100644 index 0000000..ad1729d --- /dev/null +++ b/tests/zmq/zmqtest.grc @@ -0,0 +1,112 @@ +options: + parameters: + author: Naoki Pross + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: no_gui + hier_block_src_path: '.:' + id: zmqtest + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '1' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: ZMQ test + window_size: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 8] + rotation: 0 + state: enabled + +blocks: +- name: samp_rate + id: variable + parameters: + comment: '' + value: '32000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 12] + rotation: 0 + state: enabled +- name: blocks_throttle_0 + id: blocks_throttle + parameters: + affinity: '' + alias: '' + comment: '' + ignoretag: 'True' + maxoutbuf: '0' + minoutbuf: '0' + samples_per_second: samp_rate + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [440, 324.0] + rotation: 0 + state: true +- name: zeromq_rep_sink_0 + id: zeromq_rep_sink + parameters: + address: '' + affinity: '' + alias: '' + comment: '' + hwm: '-1' + pass_tags: 'False' + timeout: '100' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [664, 308.0] + rotation: 0 + state: true +- name: zeromq_req_source_0 + id: zeromq_req_source + parameters: + address: '' + affinity: '' + alias: '' + comment: '' + hwm: '-1' + maxoutbuf: '0' + minoutbuf: '0' + pass_tags: 'False' + timeout: '100' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [216, 308.0] + rotation: 0 + state: true + +connections: +- [blocks_throttle_0, '0', zeromq_rep_sink_0, '0'] +- [zeromq_req_source_0, '0', blocks_throttle_0, '0'] + +metadata: + file_format: 1 diff --git a/tests/zmq/zmqtest.py b/tests/zmq/zmqtest.py new file mode 100755 index 0000000..a046c13 --- /dev/null +++ b/tests/zmq/zmqtest.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# +# SPDX-License-Identifier: GPL-3.0 +# +# GNU Radio Python Flow Graph +# Title: ZMQ test +# Author: Naoki Pross +# GNU Radio version: 3.8.2.0 + +from gnuradio import blocks +from gnuradio import gr +from gnuradio.filter import firdes +import sys +import signal +from argparse import ArgumentParser +from gnuradio.eng_arg import eng_float, intx +from gnuradio import eng_notation +from gnuradio import zeromq + + +class zmqtest(gr.top_block): + + def __init__(self): + gr.top_block.__init__(self, "ZMQ test") + + ################################################## + # Variables + ################################################## + self.samp_rate = samp_rate = 32000 + + ################################################## + # Blocks + ################################################## + self.zeromq_req_source_0 = zeromq.req_source(gr.sizeof_gr_complex, 1, '', 100, False, -1) + self.zeromq_rep_sink_0 = zeromq.rep_sink(gr.sizeof_gr_complex, 1, '', 100, False, -1) + self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) + + + + ################################################## + # Connections + ################################################## + self.connect((self.blocks_throttle_0, 0), (self.zeromq_rep_sink_0, 0)) + self.connect((self.zeromq_req_source_0, 0), (self.blocks_throttle_0, 0)) + + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.blocks_throttle_0.set_sample_rate(self.samp_rate) + + + + + +def main(top_block_cls=zmqtest, options=None): + if gr.enable_realtime_scheduling() != gr.RT_OK: + print("Error: failed to enable real-time scheduling.") + tb = top_block_cls() + + def sig_handler(sig=None, frame=None): + tb.stop() + tb.wait() + + sys.exit(0) + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + + tb.start() + + try: + input('Press Enter to quit: ') + except EOFError: + pass + tb.stop() + tb.wait() + + +if __name__ == '__main__': + main() -- cgit v1.2.1