From de43bb0ad502b13e77961634a8b14295b2b7178e Mon Sep 17 00:00:00 2001 From: csrichter Date: Mon, 17 Apr 2017 20:34:25 +0200 Subject: [PATCH] deleted old unneeded blocks --- grc/CMakeLists.txt | 3 - grc/multirds_diff_add_sync_decim.xml | 60 -------- grc/multirds_qtguitest.xml | 55 -------- grc/multirds_smooth_vectors.xml | 52 ------- include/multirds/CMakeLists.txt | 1 - include/multirds/diff_add_sync_decim.h | 56 -------- lib/CMakeLists.txt | 1 - lib/diff_add_sync_decim_impl.cc | 142 ------------------- lib/diff_add_sync_decim_impl.h | 54 -------- python/CMakeLists.txt | 2 - python/__init__.py | 4 +- python/qtguitest.py | 183 ------------------------- python/smooth_vectors.py | 60 -------- swig/multirds_swig.i | 4 +- 14 files changed, 3 insertions(+), 674 deletions(-) delete mode 100644 grc/multirds_diff_add_sync_decim.xml delete mode 100644 grc/multirds_qtguitest.xml delete mode 100644 grc/multirds_smooth_vectors.xml delete mode 100644 include/multirds/diff_add_sync_decim.h delete mode 100644 lib/diff_add_sync_decim_impl.cc delete mode 100644 lib/diff_add_sync_decim_impl.h delete mode 100644 python/qtguitest.py delete mode 100644 python/smooth_vectors.py diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt index 6b7985e..7ef77d5 100644 --- a/grc/CMakeLists.txt +++ b/grc/CMakeLists.txt @@ -18,16 +18,13 @@ # Boston, MA 02110-1301, USA. install(FILES multirds_multi_rds_printer.xml - multirds_qtguitest.xml multirds_rds_table_qt.xml multirds_rds_parser_table_qt.xml multirds_rds_decoder.xml multirds_max_freq.xml - multirds_smooth_vectors.xml multirds_stream_selector.xml multirds_vector_cutter.xml multirds_decoder_compare.xml - multirds_diff_add_sync_decim.xml multirds_sync_decim.xml multirds_rds_decoder_redsea.xml multirds_qtgui_range.xml diff --git a/grc/multirds_diff_add_sync_decim.xml b/grc/multirds_diff_add_sync_decim.xml deleted file mode 100644 index 96834bc..0000000 --- a/grc/multirds_diff_add_sync_decim.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - diff_add_sync_decim - multirds_diff_add_sync_decim - [multirds] - import multirds - multirds.diff_add_sync_decim($threshold,$max_ratio_below_threshold, $log) - - - Log - log - False - bool - - - - - Threshold - threshold - 0.5 - float - - - max_ratio_below_threshold - max_ratio_below_threshold - 0.8 - float - - 0 < $max_ratio_below_threshold < 1 - - - - in - float - - - - - out - float - - diff --git a/grc/multirds_qtguitest.xml b/grc/multirds_qtguitest.xml deleted file mode 100644 index 4802698..0000000 --- a/grc/multirds_qtguitest.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - qtguitest - multirds_qtguitest - [multirds] - import multirds - from multirds.qtguitest import qtguitest, CRWidget,Signals - self.$(id) = $(id) = $value - #set $win = 'self._%s_win'%$id - #set $signals = 'self._%s_signals'%$id -#if not $label() - #set $label = '"%s"'%$id -#end if -$(signals) = Signals() -self.$(id) = multirds.qtguitest($(signals),$nPorts) -$(win) = CRWidget($signals, $label) -$(gui_hint()($win)) - - - - Label - label - - string - #if $label() then 'none' else 'part'# - - - GUI Hint - gui_hint - - gui_hint - part - - - - Number of Ports - nPorts - 1 - int - part - - - in - message - $nPorts - 1 - - - - diff --git a/grc/multirds_smooth_vectors.xml b/grc/multirds_smooth_vectors.xml deleted file mode 100644 index 75ac34e..0000000 --- a/grc/multirds_smooth_vectors.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - smooth_vectors - multirds_smooth_vectors - [multirds] - import multirds - multirds.smooth_vectors($vec_len, $decim, $moving_avg_len) - - - vec_len - vec_len - 1024 - int - - - decim - decim - 1 - int - - - moving_avg_len - moving_avg_len - 2 - int - - - - - in - float - $vec_len - - - - out - float - $vec_len - - diff --git a/include/multirds/CMakeLists.txt b/include/multirds/CMakeLists.txt index 076f1ba..ea04c37 100644 --- a/include/multirds/CMakeLists.txt +++ b/include/multirds/CMakeLists.txt @@ -23,7 +23,6 @@ install(FILES api.h rds_decoder.h - diff_add_sync_decim.h sync_decim.h rds_decoder_redsea.h DESTINATION include/multirds ) diff --git a/include/multirds/diff_add_sync_decim.h b/include/multirds/diff_add_sync_decim.h deleted file mode 100644 index 4deef45..0000000 --- a/include/multirds/diff_add_sync_decim.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2017 <+YOU OR YOUR COMPANY+>. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_CRFA_DIFF_ADD_SYNC_DECIM_H -#define INCLUDED_CRFA_DIFF_ADD_SYNC_DECIM_H - -#include -#include - -namespace gr { - namespace multirds { - - /*! - * \brief <+description of block+> - * \ingroup multirds - * - */ - class CRFA_API diff_add_sync_decim : virtual public gr::sync_decimator - { - public: - typedef boost::shared_ptr sptr; - - /*! - * \brief Return a shared_ptr to a new instance of multirds::diff_add_sync_decim. - * - * To avoid accidental use of raw pointers, multirds::diff_add_sync_decim's - * constructor is in a private implementation - * class. multirds::diff_add_sync_decim::make is the public interface for - * creating new instances. - */ - static sptr make(float threshold,float max_ratio_below_threshold,bool log); - }; - - } // namespace multirds -} // namespace gr - -#endif /* INCLUDED_CRFA_DIFF_ADD_SYNC_DECIM_H */ - diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8fce430..0d45ae4 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -26,7 +26,6 @@ include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIRS}) list(APPEND multirds_sources rds_decoder_impl.cc - diff_add_sync_decim_impl.cc sync_decim_impl.cc rds_decoder_redsea_impl.cc ) diff --git a/lib/diff_add_sync_decim_impl.cc b/lib/diff_add_sync_decim_impl.cc deleted file mode 100644 index 251b833..0000000 --- a/lib/diff_add_sync_decim_impl.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2017 <+YOU OR YOUR COMPANY+>. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include "diff_add_sync_decim_impl.h" -#define DECIM 2 -#define lout log && std::cout - -namespace gr { - namespace multirds { - - diff_add_sync_decim::sptr - diff_add_sync_decim::make(float threshold,float max_ratio_below_threshold,bool log) - { - return gnuradio::get_initial_sptr - (new diff_add_sync_decim_impl(threshold,max_ratio_below_threshold,log)); - } - - /* - * The private constructor - */ - diff_add_sync_decim_impl::diff_add_sync_decim_impl(float threshold,float max_ratio_below_threshold,bool log) - : gr::sync_decimator("diff_add_sync_decim", - gr::io_signature::make(1, 1, sizeof(float)), - gr::io_signature::make(1, 1, sizeof(float)), DECIM), - threshold(threshold), - max_ratio_below_threshold(max_ratio_below_threshold), - log(log) - - { - //nothing to do? - - //init persistant vars - last_input=0; - skip=0; - } - - /* - * Our virtual destructor. - */ - diff_add_sync_decim_impl::~diff_add_sync_decim_impl() - { - } - - int - diff_add_sync_decim_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - int values_below_threshold=0; - int values_below_threshold_skip=0; - int values_below_threshold_noskip=0; - float out_noskip; - float out_skip; - for (int i = 0; i < noutput_items; i++) { - //out[i]=in[DECIM*i];// keep 1 in DECIM - if(i==0){ - out_skip=last_input-in[DECIM*i];} - else{ - out_skip=in[DECIM*i-1]-in[DECIM*i];} - - out_noskip=in[DECIM*i]-in[DECIM*i+1]; - - switch(skip){ - case 0: - out[i]=out_noskip; - break; - case 1: - out[i]=out_skip; - break; - default: - out[i]=out_noskip; - break; - } - - if(abs(out[i])0.5) - if ((float)values_below_threshold / (float)noutput_items >max_ratio_below_threshold && values_below_threshold>8)//2/2(=100%) below threshold is not significant - { - //lout<<"resync:"<9){ -// if(values_below_threshold_noskip>values_below_threshold_skip){ -// skip=1; -// } -// else{ -// skip=0; -// } -// } - //lout << "noutput_items:"<< noutput_items <<", threshold:"<. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_CRFA_DIFF_ADD_SYNC_DECIM_IMPL_H -#define INCLUDED_CRFA_DIFF_ADD_SYNC_DECIM_IMPL_H - -#include - -namespace gr { - namespace multirds { - - class diff_add_sync_decim_impl : public diff_add_sync_decim - { - private: - // Nothing to declare in this block. - - public: - diff_add_sync_decim_impl(float threshold,float max_ratio_below_threshold,bool log); - ~diff_add_sync_decim_impl(); - - // Where all the action really happens - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - bool log; - float threshold; - float max_ratio_below_threshold; - float last_input; - //enum { SKIP, NOSKIP } d_state; - unsigned int skip; - }; - - } // namespace multirds -} // namespace gr - -#endif /* INCLUDED_CRFA_DIFF_ADD_SYNC_DECIM_IMPL_H */ - diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 6a35b9c..de4f034 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -32,11 +32,9 @@ GR_PYTHON_INSTALL( FILES __init__.py multi_rds_printer.py - qtguitest.py rds_table_qt.py rds_parser_table_qt.py max_freq.py - smooth_vectors.py chart.py stream_selector.py vector_cutter.py diff --git a/python/__init__.py b/python/__init__.py index b26b12c..a4cceef 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -32,11 +32,11 @@ except ImportError: # import any pure python here from multi_rds_printer import multi_rds_printer -from qtguitest import qtguitest + from rds_table_qt import rds_table_qt from rds_parser_table_qt import rds_parser_table_qt from max_freq import max_freq -from smooth_vectors import smooth_vectors + from chart import Chart from stream_selector import stream_selector from vector_cutter import vector_cutter diff --git a/python/qtguitest.py b/python/qtguitest.py deleted file mode 100644 index e1f5043..0000000 --- a/python/qtguitest.py +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Copyright 2016 <+YOU OR YOUR COMPANY+>. -# -# This is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import numpy -from gnuradio import gr -import code,pmt -from PyQt4 import Qt, QtCore, QtGui -import pprint -pp = pprint.PrettyPrinter() - -from PyQt4.QtCore import QObject, pyqtSignal - -class Signals(QObject): - DataUpdateEvent = QtCore.pyqtSignal(dict) - def __init__(self, parent=None): - super(QtCore.QObject, self).__init__() - -class qtguitest(gr.sync_block): - """ - docstring for block qtguitest - """ - def __init__(self,signals,nPorts): - #QObject.__init__() - gr.sync_block.__init__(self, - name="qtguitest", - in_sig=None, - out_sig=None) - for i in range(0,nPorts): - self.message_port_register_in(pmt.intern('in%d'%i)) - self.set_msg_handler(pmt.intern('in%d'%i), self.handle_msg) - #self.message_port_register_in(pmt.intern('in1')) - #self.set_msg_handler(pmt.intern('in1'), self.handle_msg) - #code.interact(local=locals()) - self.signals=signals - def handle_msg(self, msg): - self.signals.DataUpdateEvent.emit({'string':pmt.to_python(msg)}) - print(msg) -class CRWidget(QtGui.QWidget): - def __init__(self, signals,label): - print("gui initializing") - self.signals = signals - self.signals.DataUpdateEvent.connect(self.display_data) - """ Creates the QT Range widget """ - QtGui.QWidget.__init__(self) - layout = Qt.QVBoxLayout() - self.label = Qt.QLabel(label) - layout.addWidget(self.label) - - self.setLayout(layout) - self.table=QtGui.QTableWidget(self) - self.table.setRowCount(5) - self.table.setColumnCount(6) - self.table.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) #disallow editing - #Data - - data = {'ID':range(1,6), - 'freq':['97.0','101.3','104.6','107.7'], - 'name':['foo','antenne1','bar','DieNeue'], - 'AF':['7','8','9','5'], - 'text':['bla','bli','blu',u'blä'], - 'buttons':[]} - #Enter data onto Table - horHeaders = [] - for n, key in enumerate(['ID','freq','name','AF','text','buttons']): - #for n, key in enumerate(sorted(data.keys())): - horHeaders.append(key) - for m, item in enumerate(data[key]): - if type(item)==int:#convert ints to strings - newitem = QtGui.QTableWidgetItem(str(item)) - else: - newitem = QtGui.QTableWidgetItem(item) - self.table.setItem(m, n, newitem) - for i in range(0,4): - button=QtGui.QPushButton("play") - self.table.setCellWidget(i,5,button) - button.clicked.connect(self.onCLick) - - #Add Header - self.table.setHorizontalHeaderLabels(horHeaders) - layout.addWidget(self.label) - layout.addWidget(self.table) - - self.table.setHorizontalHeaderLabels(horHeaders) - self.table.setMaximumHeight(250)#TODO use dynamic value - test=""" - adkasldjkasd - #ad - asd - as - d - asd - asdas - d - as - f - as - fa - - sfasfasfasfasofsa - afasfasf - """ - self.tmc_message_label=QtGui.QLabel("TMC messages:") - #self.tmc_message_label.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) - #self.tmc_message_label.setMaximumHeight(100) - - self.event_filter=QtGui.QLineEdit()#QPlainTextEdit ? - self.location_filter=QtGui.QLineEdit() - - self.button = QtGui.QPushButton("i am a button") - self.button.clicked.connect(self.onCLick) - layout.addWidget(self.button) - - #self.filter_label=QtGui.QLabel() - filter_layout = Qt.QHBoxLayout() - filter_layout.addWidget(QtGui.QLabel("event filter:")) - filter_layout.addWidget(self.event_filter) - filter_layout.addWidget(QtGui.QLabel("location filter:")) - filter_layout.addWidget(self.location_filter) - #self.filter_label.setLayout(filter_layout) - self.tmc_message_label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) - #self.tmc_message_label.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) - layout.addLayout(filter_layout) - layout.addWidget(self.tmc_message_label) - - self.logOutput = Qt.QTextEdit(test) - self.logOutput.setReadOnly(True) - self.logOutput.setLineWrapMode(Qt.QTextEdit.NoWrap) - self.logOutput.setMaximumHeight(100) - font = self.logOutput.font() - font.setFamily("Courier") - font.setPointSize(10) - layout.addWidget(self.logOutput) - - - - def display_data(self, event): - #msg_type = event.data[0] - #msg = unicode(event.data[1], errors='replace') - #if (msg_type==0): #program information - # self.label.setText(msg) - #self.layout() - pp.pprint(event) - self.table.currentItem().setText(event['string']) - def onCLick(self): - print("button clicked") - #pp.pprint(event) -if __name__ == "__main__": - from PyQt4 import Qt - import sys - - # def valueChanged(frequency): - # print("Value updated - " + str(frequency)) - - app = Qt.QApplication(sys.argv) - # widget = RangeWidget(Range(0, 100, 10, 1, 100), valueChanged, "Test", "counter_slider", int) - mainobj= Signals() - #mainobj=None - widget = CRWidget(mainobj,"TestLabel") - widget.show() - widget.setWindowTitle("Test Qt gui") - widget.setGeometry(200,200,600,300) - #code.interact(local=locals()) - #sys.exit(app.exec_()) - app.exec_(code.interact(local=locals())) - widget = None \ No newline at end of file diff --git a/python/smooth_vectors.py b/python/smooth_vectors.py deleted file mode 100644 index d648078..0000000 --- a/python/smooth_vectors.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Copyright 2016 <+YOU OR YOUR COMPANY+>. -# -# This is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import numpy as np -from gnuradio import gr -import code - -class smooth_vectors(gr.decim_block): - """ - docstring for block smooth_vectors - """ - def __init__(self, vec_len,decim,moving_avg_len): - gr.decim_block.__init__(self, - name="smooth_vectors", - in_sig=[(np.float32,vec_len)], - out_sig=[(np.float32,vec_len)], - decim=decim) - self.vec_len=vec_len - self.decim=decim - self.moving_avg_len=moving_avg_len - self.last_inputs=[] - #self.count=1 - - - def work(self, input_items, output_items): - in0 = input_items[0]#0th input port? - out = output_items[0] - #self.last_inputs.insert(0,in0) - #code.interact(local=locals()) - for i in range(0,self.decim): - self.last_inputs.insert(0,in0[i]) - - - out[:] =np.mean( np.array(self.last_inputs), axis=0 ) - # <+signal processing here+> - - if len(self.last_inputs)>self.moving_avg_len: - self.last_inputs.pop(len(self.last_inputs)-1)#remove last - #out[:] = in0 - #self.count += 1 - return len(output_items[0]) - diff --git a/swig/multirds_swig.i b/swig/multirds_swig.i index a23650c..2cd4c32 100644 --- a/swig/multirds_swig.i +++ b/swig/multirds_swig.i @@ -9,15 +9,13 @@ %{ #include "multirds/rds_decoder.h" -#include "multirds/diff_add_sync_decim.h" #include "multirds/sync_decim.h" #include "multirds/rds_decoder_redsea.h" %} %include "multirds/rds_decoder.h" GR_SWIG_BLOCK_MAGIC2(multirds, rds_decoder); -%include "multirds/diff_add_sync_decim.h" -GR_SWIG_BLOCK_MAGIC2(multirds, diff_add_sync_decim); + %include "multirds/sync_decim.h" GR_SWIG_BLOCK_MAGIC2(multirds, sync_decim); %include "multirds/rds_decoder_redsea.h"