diff options
-rw-r--r-- | cmake/Modules/FindQwt.cmake | 7 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/ctrlport/IceRadioClient.py | 2 | ||||
-rwxr-xr-x | gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx | 7 | ||||
-rw-r--r-- | gr-analog/grc/analog_agc3_xx.xml | 56 | ||||
-rw-r--r-- | gr-analog/grc/analog_block_tree.xml | 2 | ||||
-rw-r--r-- | gr-analog/grc/analog_fastnoise_source_x.xml | 86 | ||||
-rw-r--r-- | gr-analog/include/gnuradio/analog/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-analog/include/gnuradio/analog/agc3_cc.h | 71 | ||||
-rw-r--r-- | gr-analog/lib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-analog/lib/agc3_cc_impl.cc | 94 | ||||
-rw-r--r-- | gr-analog/lib/agc3_cc_impl.h | 63 | ||||
-rw-r--r-- | gr-analog/swig/analog_swig.i | 3 | ||||
-rw-r--r-- | grc/gui/Actions.py | 2 | ||||
-rw-r--r-- | grc/python/flow_graph.tmpl | 5 |
14 files changed, 393 insertions, 7 deletions
diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake index db5ca6d27e..eba3e64e31 100644 --- a/cmake/Modules/FindQwt.cmake +++ b/cmake/Modules/FindQwt.cmake @@ -5,6 +5,8 @@ find_path (QWT_INCLUDE_DIRS NAMES qwt_plot.h + HINTS + ${CMAKE_INSTALL_PREFIX}/include/qwt PATHS /usr/local/include/qwt-qt4 /usr/local/include/qwt @@ -16,7 +18,10 @@ find_path (QWT_INCLUDE_DIRS ) find_library (QWT_LIBRARIES - NAMES qwt-qt4 qwt + NAMES qwt qwt-qt4 + HINTS + ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib64 PATHS /usr/local/lib /usr/lib diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/IceRadioClient.py b/gnuradio-runtime/python/gnuradio/ctrlport/IceRadioClient.py index 0964b5a4ba..4657482c3e 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/IceRadioClient.py +++ b/gnuradio-runtime/python/gnuradio/ctrlport/IceRadioClient.py @@ -58,6 +58,8 @@ class IceRadioClient(Ice.Application): self.useglacier = False host = args[1] port = args[2] + if(port == "-p"): + port = args[3] if self.useglacier: gstring = ginst + "/router -t:tcp -h " + ghost + " -p " + gport diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx index a65b0406e4..54d617b683 100755 --- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx +++ b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx @@ -22,8 +22,9 @@ import random,math,operator import networkx as nx; +import matplotlib +matplotlib.use("Qt4Agg"); import matplotlib.pyplot as plt - from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar from matplotlib.figure import Figure @@ -34,8 +35,6 @@ from PyQt4 import QtCore,Qt,Qwt5 import PyQt4.QtGui as QtGui import sys, time, re, pprint import itertools -import scipy -from scipy import spatial import Ice from gnuradio.ctrlport.IceRadioClient import * @@ -670,7 +669,7 @@ class MForm(QtGui.QWidget): thrsh = 100 if(x is not None and y is not None): - nearby = map(lambda z: spatial.distance.euclidean((x,y), z), self.pos.values()) + nearby = map(lambda z: math.sqrt( math.pow(x-z[0],2) + math.pow(y-z[1],2)), self.pos.values()) i = nearby.index(min(nearby)) if(abs(self.pos.values()[i][0] - x) < thrsh and abs(self.pos.values()[i][1]-y) < thrsh): diff --git a/gr-analog/grc/analog_agc3_xx.xml b/gr-analog/grc/analog_agc3_xx.xml new file mode 100644 index 0000000000..d39e81e660 --- /dev/null +++ b/gr-analog/grc/analog_agc3_xx.xml @@ -0,0 +1,56 @@ +<?xml version="1.0"?> +<!-- +################################################### +##AGC3 +################################################### + --> +<block> + <name>AGC3</name> + <key>analog_agc3_xx</key> + <import>from gnuradio import analog</import> + <make>analog.agc3_$(type.fcn)($attack_rate, $decay_rate, $reference)</make> + <callback>set_attack_rate($attack_rate)</callback> + <callback>set_decay_rate($decay_rate)</callback> + <callback>set_reference($reference)</callback> + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Complex</name> + <key>complex</key> + <opt>fcn:cc</opt> + </option> +<!-- <option> + <name>Float</name> + <key>float</key> + <opt>fcn:ff</opt> + </option> --> + </param> + <param> + <name>Attack Rate</name> + <key>attack_rate</key> + <value>1e-3</value> + <type>real</type> + </param> + <param> + <name>Decay Rate</name> + <key>decay_rate</key> + <value>1e-4</value> + <type>real</type> + </param> + <param> + <name>Reference</name> + <key>reference</key> + <value>1.0</value> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>$type</type> + </sink> + <source> + <name>out</name> + <type>$type</type> + </source> +</block> diff --git a/gr-analog/grc/analog_block_tree.xml b/gr-analog/grc/analog_block_tree.xml index 6fdd139a85..ff64f03b70 100644 --- a/gr-analog/grc/analog_block_tree.xml +++ b/gr-analog/grc/analog_block_tree.xml @@ -32,6 +32,7 @@ <name>Level Controllers</name> <block>analog_agc_xx</block> <block>analog_agc2_xx</block> + <block>analog_agc3_xx</block> <block>analog_feedforward_agc_cc</block> <block>analog_ctcss_squelch_ff</block> <block>analog_pwr_squelch_xx</block> @@ -60,6 +61,7 @@ <block>analog_sig_source_x</block> <block>analog_const_source_x</block> <block>analog_noise_source_x</block> + <block>analog_fastnoise_source_x</block> <block>analog_random_source_x</block> </cat> <cat> diff --git a/gr-analog/grc/analog_fastnoise_source_x.xml b/gr-analog/grc/analog_fastnoise_source_x.xml new file mode 100644 index 0000000000..f18c8c2f54 --- /dev/null +++ b/gr-analog/grc/analog_fastnoise_source_x.xml @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Fast Noise Source +################################################### + --> +<block> + <name>Fast Noise Source</name> + <key>analog_fastnoise_source_x</key> + <import>from gnuradio import analog</import> + <make>analog.fastnoise_source_$(type.fcn)($noise_type, $amp, $seed, $samples)</make> + <callback>set_type($noise_type)</callback> + <callback>set_amplitude($amp)</callback> + <param> + <name>Output Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Complex</name> + <key>complex</key> + <opt>fcn:c</opt> + </option> + <option> + <name>Float</name> + <key>float</key> + <opt>fcn:f</opt> + </option> + <option> + <name>Int</name> + <key>int</key> + <opt>fcn:i</opt> + </option> + <option> + <name>Short</name> + <key>short</key> + <opt>fcn:s</opt> + </option> + </param> + <param> + <name>Noise Type</name> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + <type>int</type> + <option> + <name>Uniform</name> + <key>analog.GR_UNIFORM</key> + </option> + <option> + <name>Gaussian</name> + <key>analog.GR_GAUSSIAN</key> + </option> + <option> + <name>Laplacian</name> + <key>analog.GR_LAPLACIAN</key> + </option> + <option> + <name>Impulse</name> + <key>analog.GR_IMPULSE</key> + </option> + </param> + <param> + <name>Amplitude</name> + <key>amp</key> + <value>1</value> + <type>real</type> + </param> + <param> + <name>Seed</name> + <key>seed</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Variate Pool Size</name> + <key>samples</key> + <value>8192</value> + <type>int</type> + </param> + <source> + <name>out</name> + <type>$type</type> + </source> + <doc> +The fast noise source works by pre-generating a pool of random variates taken from the specified distribution. At runtime, samples are then uniform randomly chosen from this pool which is a very fast operation. + </doc> +</block> diff --git a/gr-analog/include/gnuradio/analog/CMakeLists.txt b/gr-analog/include/gnuradio/analog/CMakeLists.txt index 0343abcd85..bc2631c89a 100644 --- a/gr-analog/include/gnuradio/analog/CMakeLists.txt +++ b/gr-analog/include/gnuradio/analog/CMakeLists.txt @@ -88,6 +88,7 @@ install(FILES agc_ff.h agc2_cc.h agc2_ff.h + agc3_cc.h cpfsk_bc.h ctcss_squelch_ff.h dpll_bb.h diff --git a/gr-analog/include/gnuradio/analog/agc3_cc.h b/gr-analog/include/gnuradio/analog/agc3_cc.h new file mode 100644 index 0000000000..9ce2c0c18f --- /dev/null +++ b/gr-analog/include/gnuradio/analog/agc3_cc.h @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_AGC3_CC_H +#define INCLUDED_ANALOG_AGC3_CC_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class with + * attack and decay rates. + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc3_cc : virtual public gr_sync_block + { + public: + // gr::analog::agc3_cc::sptr + typedef boost::shared_ptr<agc3_cc> sptr; + + /*! + * Build a complex value AGC loop block with attack and decay rates. + * + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0); + + virtual float attack_rate() const = 0; + virtual float decay_rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + + virtual void set_attack_rate(float rate) = 0; + virtual void set_decay_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC3_CC_H */ diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index ce10422487..473003a3bf 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -120,6 +120,7 @@ list(APPEND analog_sources agc_ff_impl.cc agc2_cc_impl.cc agc2_ff_impl.cc + agc3_cc_impl.cc cpfsk_bc_impl.cc ctcss_squelch_ff_impl.cc dpll_bb_impl.cc diff --git a/gr-analog/lib/agc3_cc_impl.cc b/gr-analog/lib/agc3_cc_impl.cc new file mode 100644 index 0000000000..26dd91e518 --- /dev/null +++ b/gr-analog/lib/agc3_cc_impl.cc @@ -0,0 +1,94 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2010,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "agc3_cc_impl.h" +#include <gr_io_signature.h> +#include <volk/volk.h> + +namespace gr { + namespace analog { + + agc3_cc::sptr + agc3_cc::make(float attack_rate, float decay_rate, float reference) + { + return gnuradio::get_initial_sptr (new agc3_cc_impl(attack_rate, decay_rate, reference)); + } + + agc3_cc_impl::agc3_cc_impl(float attack_rate, float decay_rate, float reference) + : gr_sync_block("agc3_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + d_attack(attack_rate), d_decay(decay_rate), + d_reference(reference), d_gain(1.0), + d_reset(true) + { + set_alignment(volk_get_alignment()); + } + + agc3_cc_impl::~agc3_cc_impl() + { + } + + int + agc3_cc_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const gr_complex *in = (const gr_complex*)input_items[0]; + gr_complex *out = (gr_complex*)output_items[0]; + // Compute magnitude of each sample +#ifdef __GNUC__ + float mags[noutput_items] __attribute__ ((aligned (16))); +#else + float mags[noutput_items]; +#endif + volk_32fc_magnitude_32f(mags, &in[0], noutput_items); + // Compute a linear average on reset (no expected) + if(__builtin_expect (d_reset, false)){ + float mag; + for(int i=0; i<noutput_items; i++){ + mag += mags[i]; + } + d_gain = d_reference * (noutput_items/mag); + // scale output values + for(int i=0; i<noutput_items; i++){ + out[i] = in[i] * d_gain; + } + d_reset = false; + } else { + // Otherwise perform a normal iir update + for(int i=0; i<noutput_items; i++){ + float newlevel = mags[i]; // abs(in[i]); + float rate = (newlevel > d_reference/d_gain)?d_attack:d_decay; + d_gain = (d_gain*(1-rate)) + (d_reference/newlevel)*rate; + out[i] = in[i] * d_gain; + } + } + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/agc3_cc_impl.h b/gr-analog/lib/agc3_cc_impl.h new file mode 100644 index 0000000000..0913243fd6 --- /dev/null +++ b/gr-analog/lib/agc3_cc_impl.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_AGC3_IMPL_CC_H +#define INCLUDED_ANALOG_AGC3_IMPL_CC_H + +#include <analog/agc3_cc.h> + +namespace gr { + namespace analog { + + class agc3_cc_impl : public agc3_cc + { + public: + agc3_cc_impl(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0); + ~agc3_cc_impl(); + + float attack_rate() const { return d_attack; } + float decay_rate() const { return d_decay; } + float reference() const { return d_reference; } + float gain() const { return d_gain; } + + void set_attack_rate(float rate) { d_attack = rate; } + void set_decay_rate(float rate) { d_decay = rate; } + void set_reference(float reference) { d_reference = reference; } + void set_gain(float gain) { d_gain = gain; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + private: + float d_attack; + float d_decay; + float d_reference; + float d_gain; + bool d_reset; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC3_CC_IMPL_H */ diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i index 2db207f126..d9561b32d5 100644 --- a/gr-analog/swig/analog_swig.i +++ b/gr-analog/swig/analog_swig.i @@ -40,6 +40,7 @@ #include "gnuradio/analog/agc_ff.h" #include "gnuradio/analog/agc2_cc.h" #include "gnuradio/analog/agc2_ff.h" +#include "gnuradio/analog/agc3_cc.h" #include "gnuradio/analog/cpfsk_bc.h" #include "gnuradio/analog/ctcss_squelch_ff.h" #include "gnuradio/analog/dpll_bb.h" @@ -81,6 +82,7 @@ %include "gnuradio/analog/agc_ff.h" %include "gnuradio/analog/agc2_cc.h" %include "gnuradio/analog/agc2_ff.h" +%include "gnuradio/analog/agc3_cc.h" %include "gnuradio/analog/cpfsk_bc.h" %include "gnuradio/analog/ctcss_squelch_ff.h" %include "gnuradio/analog/dpll_bb.h" @@ -119,6 +121,7 @@ GR_SWIG_BLOCK_MAGIC2(analog, agc_cc); GR_SWIG_BLOCK_MAGIC2(analog, agc_ff); GR_SWIG_BLOCK_MAGIC2(analog, agc2_cc); GR_SWIG_BLOCK_MAGIC2(analog, agc2_ff); +GR_SWIG_BLOCK_MAGIC2(analog, agc3_cc); GR_SWIG_BLOCK_MAGIC2(analog, cpfsk_bc); GR_SWIG_BLOCK_MAGIC2(analog, ctcss_squelch_ff); GR_SWIG_BLOCK_MAGIC2(analog, dpll_bb); diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py index 36fbd4c423..9225b0bd52 100644 --- a/grc/gui/Actions.py +++ b/grc/gui/Actions.py @@ -208,7 +208,7 @@ BLOCK_CREATE_HIER = Action( label='C_reate Hier', tooltip='Create hier block from selected blocks', stock_id=gtk.STOCK_CONNECT, - keypresses=(gtk.keysyms.c, NO_MODS_MASK), +# keypresses=(gtk.keysyms.c, NO_MODS_MASK), ) BLOCK_CUT = Action( label='Cu_t', diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 11e33af7fd..d104d4913d 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -64,7 +64,10 @@ class $(class_name)(gr.top_block, Qt.QWidget): gr.top_block.__init__(self, "$title") Qt.QWidget.__init__(self) self.setWindowTitle("$title") - self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) + 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() |