diff options
54 files changed, 1891 insertions, 990 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 807b363f1..8f8adbb33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,8 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) # Set the version information here set(VERSION_INFO_MAJOR_VERSION 3) set(VERSION_INFO_API_COMPAT 6) -set(VERSION_INFO_MINOR_VERSION 3) -set(VERSION_INFO_MAINT_VERSION 0) +set(VERSION_INFO_MINOR_VERSION 4) +set(VERSION_INFO_MAINT_VERSION git) include(GrVersion) #setup version info # Append -O2 optimization flag for Debug builds diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake index 23bea41ad..dfd17fc24 100644 --- a/cmake/Modules/GrBoost.cmake +++ b/cmake/Modules/GrBoost.cmake @@ -34,9 +34,9 @@ set(BOOST_REQUIRED_COMPONENTS thread ) -if(UNIX AND EXISTS "/usr/lib64") +if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64") list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix -endif(UNIX AND EXISTS "/usr/lib64") +endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64") if(MSVC) if (NOT DEFINED BOOST_ALL_DYN_LINK) @@ -50,14 +50,38 @@ if(MSVC) endif(BOOST_ALL_DYN_LINK) endif(MSVC) -# Boost 1.52 disabled, see https://svn.boost.org/trac/boost/ticket/7669 +find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) + +# This does not allow us to disable specific versions. It is used +# internally by cmake to know the formation newer versions. As newer +# Boost version beyond what is shown here are produced, we must extend +# this list. To disable Boost versions, see below. set(Boost_ADDITIONAL_VERSIONS "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" - "1.50.0" "1.50" "1.51.0" "1.51" "1.53.0" "1.53" "1.54.0" "1.54" + "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" ) -find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) + +# Boost 1.52 disabled, see https://svn.boost.org/trac/boost/ticket/7669 +# Similar problems with Boost 1.46 and 1.47. + +# For any unsuitable Boost version, add the version number below in +# the following format: XXYYZZ +# Where: +# XX is the major version ('10' for version 1) +# YY is the minor version number ('46' for 1.46) +# ZZ is the patcher version number (typically just '00') +set(Boost_NOGO_VERSIONS + 104600 104700 105200 +) + +foreach(ver ${Boost_NOGO_VERSIONS}) + if(${Boost_VERSION} EQUAL ${ver}) + MESSAGE(STATUS "Found incompatible Boost (version ${Boost_VERSION}). Disabling.") + set(Boost_FOUND FALSE) + endif(${Boost_VERSION} EQUAL ${ver}) +endforeach(ver) diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 4c99acfc3..ce9a80f37 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -259,6 +259,7 @@ set(gr_core_general_triple_threats gr_pwr_squelch_cc gr_pwr_squelch_ff gr_quadrature_demod_cf + gr_random_pdu gr_rail_ff gr_regenerate_bb gr_remez diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 1446088a2..b727bc8a6 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -70,6 +70,7 @@ #include <gr_agc_cc.h> #include <gr_agc2_ff.h> #include <gr_agc2_cc.h> +#include <gr_random_pdu.h> #include <gr_rms_cf.h> #include <gr_rms_ff.h> #include <gr_nlog10_ff.h> @@ -194,6 +195,7 @@ %include "gr_agc_cc.i" %include "gr_agc2_ff.i" %include "gr_agc2_cc.i" +%include "gr_random_pdu.i" %include "gr_rms_cf.i" %include "gr_rms_ff.i" %include "gr_nlog10_ff.i" diff --git a/gnuradio-core/src/lib/general/gr_random_pdu.cc b/gnuradio-core/src/lib/general/gr_random_pdu.cc new file mode 100644 index 000000000..9f692c72b --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_random_pdu.cc @@ -0,0 +1,83 @@ +/* -*- c++ -*- */ +/* + * Copyright 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 <gr_random_pdu.h> +#include <gr_io_signature.h> +#include <cstdio> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdexcept> +#include <string.h> +#include <iostream> + +// public constructor that returns a shared_ptr + +gr_random_pdu_sptr +gr_make_random_pdu (int items_min, int items_max) +{ + return gnuradio::get_initial_sptr(new gr_random_pdu(items_min, items_max)); +} + +gr_random_pdu::gr_random_pdu (int items_min, int items_max) + : gr_block("random_pdu", + gr_make_io_signature(0, 0, 0), + gr_make_io_signature(0, 0, 0)), + urange(items_min, items_max), + brange(0, 255), + rvar(rng, urange), + bvar(rng, brange) +{ + message_port_register_out(pmt::mp("pdus")); + message_port_register_in(pmt::mp("generate")); + set_msg_handler(pmt::mp("generate"), boost::bind(&gr_random_pdu::generate_pdu, this, _1)); +} + +bool gr_random_pdu::start(){ + output_random(); + return true; +} + +void gr_random_pdu::output_random(){ + + // pick a random vector length + int len = rvar(); + + // fill it with random bytes + unsigned char vec[len]; + for(int i=0; i<len; i++){ + vec[i] = (unsigned char) bvar(); + } + + // send the vector + pmt::pmt_t vecpmt( pmt::pmt_make_blob( vec, len ) ); + pmt::pmt_t pdu( pmt::pmt_cons( pmt::PMT_NIL, vecpmt ) ); + message_port_pub( pmt::mp("pdus"), pdu ); + + std::cout << "sending new random vector of length " << len << "\n"; +} + diff --git a/gnuradio-core/src/lib/general/gr_random_pdu.h b/gnuradio-core/src/lib/general/gr_random_pdu.h new file mode 100644 index 000000000..e6457d21b --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_random_pdu.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 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_GR_RANDOM_PDU_H +#define INCLUDED_GR_RANDOM_PDU_H + +#include <gr_core_api.h> +#include <gr_block.h> +#include <gr_message.h> +#include <gr_msg_queue.h> + +#include <boost/random.hpp> +#include <boost/generator_iterator.hpp> + +class gr_random_pdu; +typedef boost::shared_ptr<gr_random_pdu> gr_random_pdu_sptr; + +GR_CORE_API gr_random_pdu_sptr gr_make_random_pdu (int mintime, int maxtime); + +/*! + * \brief Send message at defined interval + * \ingroup msg_blk + */ +class GR_CORE_API gr_random_pdu : public gr_block +{ + private: + friend GR_CORE_API gr_random_pdu_sptr + gr_make_random_pdu(int mintime, int maxtime); + + void output_random(); + + boost::mt19937 rng; + boost::uniform_int<> urange; + boost::uniform_int<> brange; + boost::variate_generator< boost::mt19937, boost::uniform_int<> > rvar; // pdu length + boost::variate_generator< boost::mt19937, boost::uniform_int<> > bvar; // pdu contents + + public: + gr_random_pdu (int, int); + bool start(); + void generate_pdu(pmt::pmt_t msg){ output_random(); } + void generate_pdu(){ output_random(); } +}; + +#endif /* INCLUDED_GR_RANDOM_PDU_H */ diff --git a/gnuradio-core/src/lib/general/gr_random_pdu.i b/gnuradio-core/src/lib/general/gr_random_pdu.i new file mode 100644 index 000000000..045a33060 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_random_pdu.i @@ -0,0 +1,30 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,random_pdu); + +%{ +#include <gr_random_pdu.h> +%} + +%include "gr_random_pdu.h" + diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index b44a47075..db3103a26 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -85,6 +85,7 @@ expand_h_cc_i(gr_vector_source_X b s i f c) expand_h_cc_i(gr_vector_insert_X b) expand_h_cc_i(gr_vector_sink_X b s i f c) expand_h_cc_i(gr_noise_source_X s i f c) +expand_h_cc_i(gr_fastnoise_source_X s i f c) expand_h_cc_i(gr_sig_source_X s i f c) expand_h_cc_i(gr_probe_signal_X b s i f c) expand_h_cc_i(gr_probe_signal_vX b s i f c) diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t new file mode 100644 index 000000000..7be7bdde8 --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t @@ -0,0 +1,116 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <@NAME@.h> +#include <gr_io_signature.h> +#include <stdexcept> + + +@NAME@_sptr +gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed, long samples) +{ + return gnuradio::get_initial_sptr(new @NAME@ (type, ampl, seed, samples)); +} + + +@NAME@::@NAME@ (gr_noise_type_t type, float ampl, long seed, long samples) + : gr_sync_block ("@BASE_NAME@", + gr_make_io_signature (0, 0, 0), + gr_make_io_signature (1, 1, sizeof (@TYPE@))), + d_type (type), + d_ampl (ampl), + d_rng (seed) +{ + d_samples.resize(samples); + generate(); +} + +void +@NAME@::generate() +{ + int noutput_items = d_samples.size(); + switch (d_type){ +#if @IS_COMPLEX@ // complex? + + case GR_UNIFORM: + for (int i = 0; i < noutput_items; i++) + d_samples[i] = gr_complex (d_ampl * ((d_rng.ran1 () * 2.0) - 1.0), + d_ampl * ((d_rng.ran1 () * 2.0) - 1.0)); + break; + + case GR_GAUSSIAN: + for (int i = 0; i < noutput_items; i++) + d_samples[i] = d_ampl * d_rng.rayleigh_complex (); + break; + +#else // nope... + + case GR_UNIFORM: + for (int i = 0; i < noutput_items; i++) + d_samples[i] = (@TYPE@)(d_ampl * ((d_rng.ran1 () * 2.0) - 1.0)); + break; + + case GR_GAUSSIAN: + for (int i = 0; i < noutput_items; i++) + d_samples[i] = (@TYPE@)(d_ampl * d_rng.gasdev ()); + break; + + case GR_LAPLACIAN: + for (int i = 0; i < noutput_items; i++) + d_samples[i] = (@TYPE@)(d_ampl * d_rng.laplacian ()); + break; + + case GR_IMPULSE: // FIXME changeable impulse settings + for (int i = 0; i < noutput_items; i++) + d_samples[i] = (@TYPE@)(d_ampl * d_rng.impulse (9)); + break; +#endif + + default: + throw std::runtime_error ("invalid type"); + } + +} + +int +@NAME@::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + @TYPE@ *out = (@TYPE@ *) output_items[0]; + + for(int i=0; i<noutput_items; i++){ +#ifdef __USE_GNU + size_t idx = lrand48() % d_samples.size(); +#else + size_t idx = rand() % d_samples.size(); +#endif + out[i] = d_samples[idx]; + } + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t new file mode 100644 index 000000000..fab3e776f --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t @@ -0,0 +1,85 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gr_core_api.h> +#include <gr_sync_block.h> +#include <gr_noise_type.h> +#include <gr_random.h> + + +class @NAME@; +typedef boost::shared_ptr<@NAME@> @NAME@_sptr; + +/*! \brief Make a noise source + * \param type the random distribution to use (see gr_noise_type.h) + * \param ampl a scaling factor for the output + * \param seed seed for random generators. Note that for uniform and + * Gaussian distributions, this should be a negative number. + */ +GR_CORE_API @NAME@_sptr +gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples=1024*16); + +/*! + * \brief Random number source + * \ingroup source_blk + * + * \details + * Generate random values from different distributions. + * Currently, only Gaussian and uniform are enabled. + * + * \param type the random distribution to use (see gr_noise_type.h) + * \param ampl a scaling factor for the output + * \param seed seed for random generators. Note that for uniform and + * Gaussian distributions, this should be a negative number. + */ +class GR_CORE_API @NAME@ : public gr_sync_block { + friend GR_CORE_API @NAME@_sptr + + gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed, long samples); + + gr_noise_type_t d_type; + float d_ampl; + gr_random d_rng; + std::vector<@TYPE@> d_samples; + + @NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples=1024*16); + + public: + void set_type (gr_noise_type_t type) { d_type = type; generate(); } + void set_amplitude (float ampl) { d_ampl = ampl; generate(); } + void generate(); + + gr_noise_type_t type () const { return d_type; } + float amplitude () const { return d_ampl; } + + virtual int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + + +#endif diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t new file mode 100644 index 000000000..e1f7c775b --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t @@ -0,0 +1,40 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 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. + */ + +// @WARNING@ + +GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); + +@NAME@_sptr +gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples = 1024*16); + +class @NAME@ : public gr_block { + private: + @NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples = 1024*16); + + public: + void set_type (gr_noise_type_t type) { d_type = type; } + void set_amplitude (float ampl) { d_ampl = ampl; } + + gr_noise_type_t type () const { return d_type; } + float amplitude () const { return d_ampl; } +}; diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.cc b/gnuradio-core/src/lib/hier/gr_channel_model.cc index bb01972d2..7da357809 100644 --- a/gnuradio-core/src/lib/hier/gr_channel_model.cc +++ b/gnuradio-core/src/lib/hier/gr_channel_model.cc @@ -59,7 +59,7 @@ gr_channel_model::gr_channel_model(double noise_voltage, d_multipath = gr_make_fir_filter_ccc(1, d_taps); d_noise_adder = gr_make_add_cc(); - d_noise = gr_make_noise_source_c(GR_GAUSSIAN, noise_voltage, noise_seed); + d_noise = gr_make_fastnoise_source_c(GR_GAUSSIAN, noise_voltage, noise_seed, 1024*8); d_freq_offset = gr_make_sig_source_c(1, GR_SIN_WAVE, frequency_offset, 1.0, 0.0); d_mixer_offset = gr_make_multiply_cc(); diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.h b/gnuradio-core/src/lib/hier/gr_channel_model.h index f0b31b1a6..5796a6db2 100644 --- a/gnuradio-core/src/lib/hier/gr_channel_model.h +++ b/gnuradio-core/src/lib/hier/gr_channel_model.h @@ -25,7 +25,7 @@ #include <gr_sig_source_c.h> #include <gr_fir_filter_ccc.h> #include <gr_add_cc.h> -#include <gr_noise_source_c.h> +#include <gr_fastnoise_source_c.h> #include <gr_multiply_cc.h> class gr_channel_model; @@ -61,7 +61,7 @@ class GR_CORE_API gr_channel_model : public gr_hier_block2 gr_sig_source_c_sptr d_freq_offset; gr_fir_filter_ccc_sptr d_multipath; gr_add_cc_sptr d_noise_adder; - gr_noise_source_c_sptr d_noise; + gr_fastnoise_source_c_sptr d_noise; gr_multiply_cc_sptr d_mixer_offset; std::vector<gr_complex> d_taps; diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 43aebf0bf..5ba30955f 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -187,6 +187,13 @@ gr_block::add_item_tag(unsigned int which_output, } void +gr_block::remove_item_tag(unsigned int which_input, + const gr_tag_t &tag) +{ + d_detail->remove_item_tag(which_input, tag); +} + +void gr_block::get_tags_in_range(std::vector<gr_tag_t> &v, unsigned int which_output, uint64_t start, uint64_t end) diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 57e3fda90..7a70bdaf0 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -416,6 +416,42 @@ class GR_CORE_API gr_block : public gr_basic_block { void add_item_tag(unsigned int which_output, const gr_tag_t &tag); /*! + * \brief Removes a tag from the given input buffer. + * + * \param which_input an integer of which input stream to remove the tag from + * \param abs_offset a uint64 number of the absolute item number + * assicated with the tag. Can get from nitems_written. + * \param key the tag key as a PMT symbol + * \param value any PMT holding any value for the given key + * \param srcid optional source ID specifier; defaults to PMT_F + * + * If no such tag is found, does nothing. + */ + inline void remove_item_tag(unsigned int which_input, + uint64_t abs_offset, + const pmt::pmt_t &key, + const pmt::pmt_t &value, + const pmt::pmt_t &srcid=pmt::PMT_F) + { + gr_tag_t tag; + tag.offset = abs_offset; + tag.key = key; + tag.value = value; + tag.srcid = srcid; + this->remove_item_tag(which_input, tag); + } + + /*! + * \brief Removes a tag from the given input buffer. + * + * If no such tag is found, does nothing. + * + * \param which_input an integer of which input stream to remove the tag from + * \param tag the tag object to remove + */ + void remove_item_tag(unsigned int which_input, const gr_tag_t &tag); + + /*! * \brief Given a [start,end), returns a vector of all tags in the range. * * Range of counts is from start to end-1. diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 337c9518e..c65493473 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -156,6 +156,18 @@ gr_block_detail::add_item_tag(unsigned int which_output, const gr_tag_t &tag) } void +gr_block_detail::remove_item_tag(unsigned int which_input, const gr_tag_t &tag) +{ + if(!pmt_is_symbol(tag.key)) { + throw pmt_wrong_type("gr_block_detail::add_item_tag key", tag.key); + } + else { + // Add tag to gr_buffer's deque tags + d_input[which_input]->buffer()->remove_item_tag(tag); + } +} + +void gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v, unsigned int which_input, uint64_t abs_start, diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index 16d9f4d42..af00ea7c7 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -95,8 +95,7 @@ class GR_CORE_API gr_block_detail { /*! * \brief Adds a new tag to the given output stream. * - * This takes the input parameters and builds a PMT tuple - * from it. It then calls gr_buffer::add_item_tag(pmt::pmt_t t), + * Calls gr_buffer::add_item_tag(), * which appends the tag onto its deque. * * \param which_output an integer of which output stream to attach the tag @@ -105,6 +104,16 @@ class GR_CORE_API gr_block_detail { void add_item_tag(unsigned int which_output, const gr_tag_t &tag); /*! + * \brief Removes a tag from the given input stream. + * + * Calls gr_buffer::remove_item_tag(), which removes the tag from its deque. + * + * \param which_input an integer of which input stream to remove the tag from + * \param tag the tag object to add + */ + void remove_item_tag(unsigned int which_input, const gr_tag_t &tag); + + /*! * \brief Given a [start,end), returns a vector of all tags in the range. * * Pass-through function to gr_buffer_reader to get a vector of tags diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index b923ca57a..369959d65 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -234,6 +234,18 @@ gr_buffer::add_item_tag(const gr_tag_t &tag) } void +gr_buffer::remove_item_tag(const gr_tag_t &tag) +{ + gruel::scoped_lock guard(*mutex()); + for (std::deque<gr_tag_t>::iterator it = d_item_tags.begin(); it != d_item_tags.end(); ++it) { + if (*it == tag) { + d_item_tags.erase(it); + break; + } + } +} + +void gr_buffer::prune_tags(uint64_t max_time) { /* NOTE: this function _should_ lock the mutex before editing diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 67d48fb2d..28ea97726 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -103,6 +103,15 @@ class GR_CORE_API gr_buffer { void add_item_tag(const gr_tag_t &tag); /*! + * \brief Removes an existing tag from the buffer. + * + * If no such tag is found, does nothing. + * + * \param tag the tag that needs to be removed + */ + void remove_item_tag(const gr_tag_t &tag); + + /*! * \brief Removes all tags before \p max_time from buffer * * \param max_time the time (item number) to trim up until. diff --git a/gnuradio-core/src/lib/runtime/gr_tags.h b/gnuradio-core/src/lib/runtime/gr_tags.h index 8bffcd0fe..a9ca90235 100644 --- a/gnuradio-core/src/lib/runtime/gr_tags.h +++ b/gnuradio-core/src/lib/runtime/gr_tags.h @@ -45,6 +45,11 @@ struct GR_CORE_API gr_tag_t{ ){ return x.offset < y.offset; } + + inline bool operator == (const gr_tag_t &t) const + { + return (t.key == key) && (t.value == value) && (t.srcid == srcid) && (t.offset == offset); + } }; #endif /*INCLUDED_GR_TAGS_H*/ diff --git a/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt index bd78c8fb4..da22a5f98 100644 --- a/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt +++ b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt @@ -29,6 +29,7 @@ GR_PYTHON_INSTALL(FILES gr_threading_24.py hier_block2.py prefs.py + tag_utils.py top_block.py pubsub.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr diff --git a/gnuradio-core/src/python/gnuradio/gr/__init__.py b/gnuradio-core/src/python/gnuradio/gr/__init__.py index 5d01ea11b..f1b971e62 100644 --- a/gnuradio-core/src/python/gnuradio/gr/__init__.py +++ b/gnuradio-core/src/python/gnuradio/gr/__init__.py @@ -29,6 +29,7 @@ from exceptions import * from hier_block2 import * from top_block import * from gateway import basic_block, sync_block, decim_block, interp_block +from tag_utils import tag_to_python, tag_to_pmt # create a couple of aliases serial_to_parallel = stream_to_vector diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py b/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py new file mode 100755 index 000000000..daf87f912 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# +# Copyright 2007,2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +import tag_utils + +try: from gruel import pmt +except: import pmt + +class test_tag_utils (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + + def tearDown (self): + self.tb = None + + def test_001(self): + t = gr.gr_tag_t() + t.offset = 10 + t.key = pmt.pmt_string_to_symbol('key') + t.value = pmt.pmt_from_long(23) + t.srcid = pmt.pmt_from_bool(False) + pt = tag_utils.tag_to_python(t) + self.assertEqual(pt.key, 'key') + self.assertEqual(pt.value, 23) + self.assertEqual(pt.offset, 10) + + +if __name__ == '__main__': + print 'hi' + gr_unittest.run(test_tag_utils, "test_tag_utils.xml") + diff --git a/gnuradio-core/src/python/gnuradio/gr/tag_utils.py b/gnuradio-core/src/python/gnuradio/gr/tag_utils.py new file mode 100644 index 000000000..923718fc9 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr/tag_utils.py @@ -0,0 +1,54 @@ +# +# Copyright 2003-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. +# +""" Conversion tools between stream tags and Python objects """ + +try: import pmt +except: from gruel import pmt + +from gnuradio_core import gr_tag_t + +class PythonTag(object): + " Python container for tags " + def __init__(self): + self.offset = None + self.key = None + self.value = None + self.srcid = None + +def tag_to_python(tag): + """ Convert a stream tag to a Python-readable object """ + newtag = PythonTag() + newtag.offset = tag.offset + newtag.key = pmt.to_python(tag.key) + newtag.value = pmt.to_python(tag.value) + newtag.srcid = pmt.to_python(tag.srcid) + return newtag + +def tag_to_pmt(tag): + """ Convert a Python-readable object to a stream tag """ + newtag = gr_tag_t() + newtag.offset = tag.offset + newtag.key = pmt.to_python(tag.key) + newtag.value = pmt.from_python(tag.value) + newtag.srcid = pmt.from_python(tag.srcid) + return newtag + + diff --git a/gr-atsc/src/lib/atsc.i b/gr-atsc/src/lib/atsc.i index 6e5662ae6..6b83a2315 100644 --- a/gr-atsc/src/lib/atsc.i +++ b/gr-atsc/src/lib/atsc.i @@ -225,6 +225,7 @@ class atsc_equalizer : public gr_sync_block public: void reset(); + std::vector<double> taps(); }; // ---------------------------------------------------------------- diff --git a/gr-atsc/src/lib/atsc_bit_timing_loop.cc b/gr-atsc/src/lib/atsc_bit_timing_loop.cc index 7abd907cc..dc43d28bc 100644 --- a/gr-atsc/src/lib/atsc_bit_timing_loop.cc +++ b/gr-atsc/src/lib/atsc_bit_timing_loop.cc @@ -44,7 +44,7 @@ atsc_make_bit_timing_loop() atsc_bit_timing_loop::atsc_bit_timing_loop() : gr_block("atsc_bit_timing_loop", gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(2, 2, sizeof(float))), + gr_make_io_signature3(2, 3, sizeof(float), sizeof(float), sizeof(float))), d_interp(ratio_of_rx_clock_to_symbol_freq), d_next_input(0), d_rx_clock_to_symbol_freq (ratio_of_rx_clock_to_symbol_freq), d_si(0) @@ -82,6 +82,7 @@ atsc_bit_timing_loop::work (int noutput_items, const float *in = (const float *) input_items[0]; float *out_sample = (float *) output_items[0]; atsc::syminfo *out_tag = (atsc::syminfo *) output_items[1]; + float *out_timing_error = (float *) output_items[2]; assert(sizeof(float) == sizeof(atsc::syminfo)); @@ -110,12 +111,15 @@ atsc_bit_timing_loop::work (int noutput_items, } d_sssr.update (interp_sample, &seg_locked, &symbol_index, &timing_adjustment); + if (output_items.size() == 3) { + out_timing_error[k] = timing_adjustment; + } out_sample[k] = interp_sample; tag.valid = seg_locked; tag.symbol_num = symbol_index; out_tag[k] = tag; } - + return k; } diff --git a/gr-atsc/src/lib/atsc_equalizer.h b/gr-atsc/src/lib/atsc_equalizer.h index 32b449b62..aca5e63b4 100644 --- a/gr-atsc/src/lib/atsc_equalizer.h +++ b/gr-atsc/src/lib/atsc_equalizer.h @@ -25,6 +25,7 @@ #include <atsc_api.h> #include <gr_sync_block.h> #include <atsci_equalizer.h> +#include <vector> class atsc_equalizer; typedef boost::shared_ptr<atsc_equalizer> atsc_equalizer_sptr; @@ -47,6 +48,10 @@ class ATSC_API atsc_equalizer : public gr_sync_block public: void forecast (int noutput_items, gr_vector_int &ninput_items_required); + std::vector<double> taps() { + return d_equalizer->taps(); + } + int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/gr-atsc/src/lib/atsci_equalizer.h b/gr-atsc/src/lib/atsci_equalizer.h index a0a1fc674..b0c243b51 100644 --- a/gr-atsc/src/lib/atsci_equalizer.h +++ b/gr-atsc/src/lib/atsci_equalizer.h @@ -25,6 +25,7 @@ #include <atsc_api.h> #include <atsci_syminfo.h> +#include <vector> /*! * \brief abstract base class for ATSC equalizer @@ -54,6 +55,10 @@ public: atsci_equalizer (); virtual ~atsci_equalizer (); + virtual std::vector<double> taps () { + return std::vector<double>(); + } + // MANIPULATORS /*! diff --git a/gr-atsc/src/lib/atsci_equalizer_lms.h b/gr-atsc/src/lib/atsci_equalizer_lms.h index 68aa34ca5..eac72f75b 100644 --- a/gr-atsc/src/lib/atsci_equalizer_lms.h +++ b/gr-atsc/src/lib/atsci_equalizer_lms.h @@ -37,6 +37,9 @@ public: virtual void reset (); virtual int ntaps () const; virtual int npretaps () const; + std::vector<double> taps () { + return d_taps; + } protected: FILE *trainingfile; diff --git a/gr-atsc/src/lib/atsci_sssr.cc b/gr-atsc/src/lib/atsci_sssr.cc index 48c0c51fb..56a0c6a00 100644 --- a/gr-atsc/src/lib/atsci_sssr.cc +++ b/gr-atsc/src/lib/atsci_sssr.cc @@ -29,6 +29,7 @@ #include <gr_math.h> #include <stdio.h> #include <boost/math/special_functions/sign.hpp> +#include <iostream> /* * ---------------------------------------------------------------- @@ -142,7 +143,11 @@ atsci_sssr::update (sssr::sample_t sample_in, // input double qo = d_quad_filter.update (sample_in); d_quad_output[d_counter] = qo; - int bit = boost::math::signbit (sample_in) ^ 1; // slice on sign: + => 1, - => 0 + int bit = boost::math::signbit (sample_in); + if (bit != 0) + bit = 0; + else + bit = 1; int corr_out = d_correlator.update (bit); int weight = sipp (corr_out); int corr_value = d_integrator.update (weight, d_counter); @@ -153,6 +158,7 @@ atsci_sssr::update (sssr::sample_t sample_in, // input int best_correlation_value; best_correlation_index = d_integrator.find_max (&best_correlation_value); d_seg_locked = best_correlation_value >= MIN_SEG_LOCK_CORRELATION_VALUE; + //std::cout << "best = " << best_correlation_value << " min is " << MIN_SEG_LOCK_CORRELATION_VALUE << std::endl; d_timing_adjust = d_quad_output[best_correlation_index]; d_symbol_index = SYMBOL_INDEX_OFFSET - 1 - best_correlation_index; diff --git a/gr-atsc/src/python/all_atsc.py b/gr-atsc/src/python/all_atsc.py new file mode 100644 index 000000000..0137839bd --- /dev/null +++ b/gr-atsc/src/python/all_atsc.py @@ -0,0 +1,140 @@ +#!/usr/bin/env /usr/bin/python +# +# Copyright 2004 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 2, 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +# This module starts the atsc processing chain taking the captured +# off-air signal created with: +# +# uhd_rx_cfile.py --samp-rate=6.4e6 +# -f <center of tv signal channel freq> +# -g <appropriate gain for best signal / noise> +# -s output shorts +# +# All this module does is multiply the sample rate by 3, from 6.4e6 to +# 19.2e6 complex samples / sec, then lowpass filter with a cutoff of 3.2MHz +# and a transition band width of .5MHz. Center of the tv channels is +# then at 0 with edges at -3.2MHz and 3.2MHz. + +from gnuradio import gr, atsc +import sys, os, math + +def graph (args): + + nargs = len(args) + if nargs == 2: + infile = args[0] + outfile = args[1] + else: + raise ValueError('usage: interp.py input_file output_file\n') + + tb = gr.top_block () + + # Convert to a from shorts to a stream of complex numbers. + srcf = gr.file_source (gr.sizeof_short,infile) + s2ss = gr.stream_to_streams(gr.sizeof_short,2) + s2f1 = gr.short_to_float() + s2f2 = gr.short_to_float() + src0 = gr.float_to_complex() + tb.connect(srcf, s2ss) + tb.connect((s2ss, 0), s2f1, (src0, 0)) + tb.connect((s2ss, 1), s2f2, (src0, 1)) + + # Low pass filter it and increase sample rate by a factor of 3. + lp_coeffs = gr.firdes.low_pass ( 3, 19.2e6, 3.2e6, .5e6, gr.firdes.WIN_HAMMING ) + lp = gr.interp_fir_filter_ccf ( 3, lp_coeffs ) + tb.connect(src0, lp) + + # Upconvert it. + duc_coeffs = gr.firdes.low_pass ( 1, 19.2e6, 9e6, 1e6, gr.firdes.WIN_HAMMING ) + duc = gr.freq_xlating_fir_filter_ccf ( 1, duc_coeffs, 5.75e6, 19.2e6 ) + # Discard the imaginary component. + c2f = gr.complex_to_float() + tb.connect(lp, duc, c2f) + + # Frequency Phase Lock Loop + input_rate = 19.2e6 + IF_freq = 5.75e6 + # 1/2 as wide because we're designing lp filter + symbol_rate = atsc.ATSC_SYMBOL_RATE/2. + NTAPS = 279 + tt = gr.firdes.root_raised_cosine (1.0, input_rate, symbol_rate, .115, NTAPS) + # heterodyne the low pass coefficients up to the specified bandpass + # center frequency. Note that when we do this, the filter bandwidth + # is effectively twice the low pass (2.69 * 2 = 5.38) and hence + # matches the diagram in the ATSC spec. + arg = 2. * math.pi * IF_freq / input_rate + t=[] + for i in range(len(tt)): + t += [tt[i] * 2. * math.cos(arg * i)] + rrc = gr.fir_filter_fff(1, t) + + fpll = atsc.fpll() + + pilot_freq = IF_freq - 3e6 + 0.31e6 + lower_edge = 6e6 - 0.31e6 + upper_edge = IF_freq - 3e6 + pilot_freq + transition_width = upper_edge - lower_edge + lp_coeffs = gr.firdes.low_pass (1.0, + input_rate, + (lower_edge + upper_edge) * 0.5, + transition_width, + gr.firdes.WIN_HAMMING); + + lp_filter = gr.fir_filter_fff (1,lp_coeffs) + + alpha = 1e-5 + iir = gr.single_pole_iir_filter_ff(alpha) + remove_dc = gr.sub_ff() + + tb.connect(c2f, fpll, lp_filter) + tb.connect(lp_filter, iir) + tb.connect(lp_filter, (remove_dc,0)) + tb.connect(iir, (remove_dc,1)) + + # Bit Timing Loop, Field Sync Checker and Equalizer + + btl = atsc.bit_timing_loop() + fsc = atsc.fs_checker() + eq = atsc.equalizer() + fsd = atsc.field_sync_demux() + + tb.connect(remove_dc, btl) + tb.connect((btl, 0),(fsc, 0),(eq, 0),(fsd, 0)) + tb.connect((btl, 1),(fsc, 1),(eq, 1),(fsd, 1)) + + # Viterbi + + viterbi = atsc.viterbi_decoder() + deinter = atsc.deinterleaver() + rs_dec = atsc.rs_decoder() + derand = atsc.derandomizer() + depad = atsc.depad() + dst = gr.file_sink(gr.sizeof_char, outfile) + tb.connect(fsd, viterbi, deinter, rs_dec, derand, depad, dst) + + dst2 = gr.file_sink(gr.sizeof_gr_complex, "atsc_complex.data") + tb.connect(src0, dst2) + + tb.run () + +if __name__ == '__main__': + graph (sys.argv[1:]) + + diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc index daf8bfde0..9d7b9c946 100644 --- a/gr-digital/examples/demod/ber_simulation.grc +++ b/gr-digital/examples/demod/ber_simulation.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jul 5 15:57:06 2012</timestamp> + <timestamp>Mon Jan 14 11:20:53 2013</timestamp> <block> <key>options</key> <param> @@ -123,29 +123,6 @@ </param> </block> <block> - <key>digital_constellation_decoder_cb</key> - <param> - <key>id</key> - <value>digital_constellation_decoder_cb_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>constellation</key> - <value>const.base()</value> - </param> - <param> - <key>_coordinate</key> - <value>(618, 164)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>wxgui_numbersink2</key> <param> <key>id</key> @@ -256,22 +233,54 @@ </param> </block> <block> - <key>variable</key> + <key>variable_slider</key> <param> <key>id</key> - <value>const</value> + <value>EbN0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> + <key>label</key> + <value>Eb/N0 (dB)</value> + </param> + <param> <key>value</key> - <value>digital.qpsk_constellation()</value> + <value>10</value> + </param> + <param> + <key>min</key> + <value>-10</value> + </param> + <param> + <key>max</key> + <value>200</value> + </param> + <param> + <key>num_steps</key> + <value>211</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(116, 310)</value> + <value>(311, 309)</value> </param> <param> <key>_rotation</key> @@ -282,7 +291,7 @@ <key>variable</key> <param> <key>id</key> - <value>samp_rate</value> + <value>const</value> </param> <param> <key>_enabled</key> @@ -290,11 +299,11 @@ </param> <param> <key>value</key> - <value>100e3</value> + <value>(digital.constellation_bpsk(), digital.constellation_qpsk(), digital.constellation_8psk())</value> </param> <param> <key>_coordinate</key> - <value>(16, 308)</value> + <value>(116, 310)</value> </param> <param> <key>_rotation</key> @@ -302,10 +311,10 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>random_source_x</key> <param> <key>id</key> - <value>wxgui_scopesink2_0</value> + <value>random_source_x</value> </param> <param> <key>_enabled</key> @@ -313,63 +322,101 @@ </param> <param> <key>type</key> - <value>complex</value> + <value>byte</value> </param> <param> - <key>title</key> - <value>"Constellation: "+str(const.arity()) + "-PSK"</value> + <key>min</key> + <value>0</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>max</key> + <value>const[const_type].arity()</value> </param> <param> - <key>v_scale</key> - <value>0</value> + <key>num_samps</key> + <value>10000000</value> </param> <param> - <key>v_offset</key> - <value>0</value> + <key>repeat</key> + <value>True</value> </param> <param> - <key>t_scale</key> + <key>_coordinate</key> + <value>(17, 125)</value> + </param> + <param> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>gr_noise_source_x</key> <param> - <key>ac_couple</key> - <value>False</value> + <key>id</key> + <value>gr_noise_source_x</value> </param> <param> - <key>xy_mode</key> + <key>_enabled</key> <value>True</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>win_size</key> - <value></value> + <key>noise_type</key> + <value>gr.GR_GAUSSIAN</value> </param> <param> - <key>grid_pos</key> - <value>2, 0, 1, 1</value> + <key>amp</key> + <value>1.0 / math.sqrt(2.0 * const[const_type].bits_per_symbol() * 10**(EbN0/10))</value> </param> <param> - <key>notebook</key> - <value></value> + <key>seed</key> + <value>42</value> </param> <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> + <key>_coordinate</key> + <value>(16, 224)</value> </param> <param> - <key>y_axis_label</key> - <value>Counts</value> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>gr_chunks_to_symbols_xx</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>byte</value> + </param> + <param> + <key>out_type</key> + <value>complex</value> + </param> + <param> + <key>symbol_table</key> + <value>const[const_type].points()</value> + </param> + <param> + <key>dimension</key> + <value>1</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(623, 228)</value> + <value>(240, 140)</value> </param> <param> <key>_rotation</key> @@ -396,7 +443,7 @@ </param> <param> <key>bits_per_symbol</key> - <value>const.bits_per_symbol()</value> + <value>const[const_type].bits_per_symbol()</value> </param> <param> <key>_coordinate</key> @@ -408,10 +455,33 @@ </param> </block> <block> - <key>gr_noise_source_x</key> + <key>digital_constellation_decoder_cb</key> <param> <key>id</key> - <value>gr_noise_source_x</value> + <value>digital_constellation_decoder_cb_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>constellation</key> + <value>const[const_type].base()</value> + </param> + <param> + <key>_coordinate</key> + <value>(618, 164)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0</value> </param> <param> <key>_enabled</key> @@ -422,59 +492,60 @@ <value>complex</value> </param> <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> + <key>title</key> + <value>"Constellation: "+str(const[const_type].arity()) + "-PSK"</value> </param> <param> - <key>amp</key> - <value>1.0 / math.sqrt(2.0 * const.bits_per_symbol() * 10**(EbN0/10))</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>seed</key> - <value>42</value> + <key>v_scale</key> + <value>0</value> </param> <param> - <key>_coordinate</key> - <value>(16, 224)</value> + <key>v_offset</key> + <value>0</value> </param> <param> - <key>_rotation</key> + <key>t_scale</key> <value>0</value> </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>_enabled</key> + <key>xy_mode</key> <value>True</value> </param> <param> - <key>in_type</key> - <value>byte</value> + <key>num_inputs</key> + <value>1</value> </param> <param> - <key>out_type</key> - <value>complex</value> + <key>win_size</key> + <value></value> </param> <param> - <key>symbol_table</key> - <value>const.points()</value> + <key>grid_pos</key> + <value>2, 0, 1, 1</value> </param> <param> - <key>dimension</key> - <value>1</value> + <key>notebook</key> + <value></value> </param> <param> - <key>num_ports</key> - <value>1</value> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(240, 140)</value> + <value>(623, 228)</value> </param> <param> <key>_rotation</key> @@ -482,54 +553,45 @@ </param> </block> <block> - <key>variable_slider</key> + <key>variable</key> <param> <key>id</key> - <value>EbN0</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Eb/N0 (dB)</value> - </param> - <param> <key>value</key> - <value>10</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>200</value> + <value>100e3</value> </param> <param> - <key>num_steps</key> - <value>211</value> + <key>_coordinate</key> + <value>(16, 308)</value> </param> <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>converver</key> - <value>float_converter</value> + <key>id</key> + <value>const_type</value> </param> <param> - <key>grid_pos</key> - <value></value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>notebook</key> - <value></value> + <key>value</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(311, 309)</value> + <value>(18, 428)</value> </param> <param> <key>_rotation</key> @@ -537,38 +599,42 @@ </param> </block> <block> - <key>random_source_x</key> + <key>variable_static_text</key> <param> <key>id</key> - <value>random_source_x</value> + <value>variable_static_text_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>byte</value> + <key>label</key> + <value>Constellation Type</value> </param> <param> - <key>min</key> - <value>0</value> + <key>value</key> + <value>{0: 'BPSK', 1: 'QPSK', 2: '8-PSK'}[const_type] + " - Change const_type for different constellation types!"</value> </param> <param> - <key>max</key> - <value>const.arity()</value> + <key>converver</key> + <value>str_converter</value> </param> <param> - <key>num_samps</key> - <value>10000000</value> + <key>formatter</key> + <value>None</value> </param> <param> - <key>repeat</key> - <value>True</value> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(17, 125)</value> + <value>(422, 311)</value> </param> <param> <key>_rotation</key> diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc index 09d3085dd..589c651f4 100644 --- a/gr-digital/examples/demod/digital_freq_lock.grc +++ b/gr-digital/examples/demod/digital_freq_lock.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jul 5 18:11:22 2012</timestamp> + <timestamp>Mon Jan 14 10:49:20 2013</timestamp> <block> <key>options</key> <param> @@ -609,53 +609,6 @@ </param> </block> <block> - <key>digital_psk_mod</key> - <param> - <key>id</key> - <value>digital_psk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>constellation_points</key> - <value>2</value> - </param> - <param> - <key>mod_code</key> - <value>"gray"</value> - </param> - <param> - <key>differential</key> - <value>False</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(194, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>wxgui_scopesink2</key> <param> <key>id</key> @@ -856,6 +809,53 @@ <value>0</value> </param> </block> + <block> + <key>digital_psk_mod</key> + <param> + <key>id</key> + <value>digital_psk_mod_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>constellation_points</key> + <value>2</value> + </param> + <param> + <key>mod_code</key> + <value>"gray"</value> + </param> + <param> + <key>differential</key> + <value>False</value> + </param> + <param> + <key>samples_per_symbol</key> + <value>sps</value> + </param> + <param> + <key>excess_bw</key> + <value>rolloff</value> + </param> + <param> + <key>verbose</key> + <value>False</value> + </param> + <param> + <key>log</key> + <value>False</value> + </param> + <param> + <key>_coordinate</key> + <value>(194, 104)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <connection> <source_block_id>gr_channel_model_0</source_block_id> <sink_block_id>wxgui_scopesink2_0</sink_block_id> diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc index dbd4befa6..7bc071d11 100644 --- a/gr-digital/examples/demod/pam_sync.grc +++ b/gr-digital/examples/demod/pam_sync.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jul 5 17:54:54 2012</timestamp> + <timestamp>Mon Jan 14 10:47:40 2013</timestamp> <block> <key>options</key> <param> @@ -84,98 +84,6 @@ </param> </block> <block> - <key>variable</key> - <param> - <key>id</key> - <value>rrctaps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), rolloff, int(11*spb*nfilts))</value> - </param> - <param> - <key>_coordinate</key> - <value>(686, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.35</value> - </param> - <param> - <key>_coordinate</key> - <value>(607, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>spb</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(542, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sig_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(861, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>virtual_sink</key> <param> <key>id</key> @@ -296,29 +204,6 @@ <key>variable</key> <param> <key>id</key> - <value>nfilts</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>_coordinate</key> - <value>(598, 186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> <value>samp_rate</value> </param> <param> @@ -378,76 +263,6 @@ </param> </block> <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>byte</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>const.points()</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(196, 87)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_pfb_arb_resampler_ccf</key> - <param> - <key>id</key> - <value>blks2_pfb_arb_resampler_ccf_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>rate</key> - <value>spb</value> - </param> - <param> - <key>taps</key> - <value>firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32)</value> - </param> - <param> - <key>size</key> - <value>32</value> - </param> - <param> - <key>_coordinate</key> - <value>(435, 80)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>gr_channel_model</key> <param> <key>id</key> @@ -487,37 +302,6 @@ </param> </block> <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>sig_amp</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(659, 95)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>gr_throttle</key> <param> <key>id</key> @@ -572,33 +356,6 @@ </param> </block> <block> - <key>digital_costas_loop_cc</key> - <param> - <key>id</key> - <value>digital_costas_loop_cc_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>w</key> - <value>phase_bw</value> - </param> - <param> - <key>order</key> - <value>4</value> - </param> - <param> - <key>_coordinate</key> - <value>(866, 246)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>wxgui_scopesink2</key> <param> <key>id</key> @@ -1241,10 +998,226 @@ </param> </block> <block> + <key>gr_multiply_const_vxx</key> + <param> + <key>id</key> + <value>gr_multiply_const_vxx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>const</key> + <value>sig_amp</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(659, 95)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>gr_chunks_to_symbols_xx</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>byte</value> + </param> + <param> + <key>out_type</key> + <value>complex</value> + </param> + <param> + <key>symbol_table</key> + <value>const.points()</value> + </param> + <param> + <key>dimension</key> + <value>1</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(178, 87)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>spb</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>4.0</value> + </param> + <param> + <key>_coordinate</key> + <value>(513, -1)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>rolloff</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>0.35</value> + </param> + <param> + <key>_coordinate</key> + <value>(578, -1)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>rrctaps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(nfilts*spb), rolloff, int(11*spb*nfilts))</value> + </param> + <param> + <key>_coordinate</key> + <value>(660, 0)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sig_amp</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>1.0</value> + </param> + <param> + <key>_coordinate</key> + <value>(887, -1)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>nfilts</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>32</value> + </param> + <param> + <key>_coordinate</key> + <value>(816, 0)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blks2_pfb_arb_resampler_ccf</key> + <param> + <key>id</key> + <value>blks2_pfb_arb_resampler_ccf_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>rate</key> + <value>spb</value> + </param> + <param> + <key>taps</key> + <value>firdes.root_raised_cosine(nfilts, 1.0, 1.0/nfilts, rolloff, int(11*spb*nfilts))</value> + </param> + <param> + <key>size</key> + <value>nfilts</value> + </param> + <param> + <key>_coordinate</key> + <value>(411, 80)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> <key>variable_slider</key> <param> <key>id</key> - <value>noise_amp</value> + <value>freq_offset</value> </param> <param> <key>_enabled</key> @@ -1252,7 +1225,7 @@ </param> <param> <key>label</key> - <value>Channel Noise</value> + <value>Frequency Offset</value> </param> <param> <key>value</key> @@ -1260,11 +1233,11 @@ </param> <param> <key>min</key> - <value>0</value> + <value>-0.5</value> </param> <param> <key>max</key> - <value>1.0</value> + <value>0.5</value> </param> <param> <key>num_steps</key> @@ -1280,7 +1253,7 @@ </param> <param> <key>grid_pos</key> - <value>(1,2,1,1)</value> + <value>(2,2,1,1)</value> </param> <param> <key>notebook</key> @@ -1288,7 +1261,7 @@ </param> <param> <key>_coordinate</key> - <value>(125, 284)</value> + <value>(-1, 285)</value> </param> <param> <key>_rotation</key> @@ -1299,7 +1272,7 @@ <key>variable_slider</key> <param> <key>id</key> - <value>freq_offset</value> + <value>noise_amp</value> </param> <param> <key>_enabled</key> @@ -1307,7 +1280,7 @@ </param> <param> <key>label</key> - <value>Frequency Offset</value> + <value>Channel Noise</value> </param> <param> <key>value</key> @@ -1315,11 +1288,11 @@ </param> <param> <key>min</key> - <value>-0.5</value> + <value>0</value> </param> <param> <key>max</key> - <value>0.5</value> + <value>1.0</value> </param> <param> <key>num_steps</key> @@ -1335,7 +1308,7 @@ </param> <param> <key>grid_pos</key> - <value>(2,2,1,1)</value> + <value>(1,2,1,1)</value> </param> <param> <key>notebook</key> @@ -1343,7 +1316,34 @@ </param> <param> <key>_coordinate</key> - <value>(6, 284)</value> + <value>(129, 285)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_costas_loop_cc</key> + <param> + <key>id</key> + <value>digital_costas_loop_cc_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>w</key> + <value>phase_bw</value> + </param> + <param> + <key>order</key> + <value>const.arity()</value> + </param> + <param> + <key>_coordinate</key> + <value>(866, 246)</value> </param> <param> <key>_rotation</key> @@ -1381,12 +1381,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_chunks_to_symbols_xx</source_block_id> - <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_channel_model_0</source_block_id> <sink_block_id>digital_fll_band_edge_cc_0</sink_block_id> <source_key>0</source_key> @@ -1428,4 +1422,10 @@ <source_key>0</source_key> <sink_key>0</sink_key> </connection> + <connection> + <source_block_id>gr_chunks_to_symbols_xx</source_block_id> + <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc index c253d9a9f..af14191eb 100644 --- a/gr-digital/examples/demod/pam_timing.grc +++ b/gr-digital/examples/demod/pam_timing.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jul 5 17:55:51 2012</timestamp> + <timestamp>Mon Jan 14 11:00:42 2013</timestamp> <block> <key>options</key> <param> @@ -53,7 +53,7 @@ </param> <param> <key>_coordinate</key> - <value>(10, 10)</value> + <value>(-1, 0)</value> </param> <param> <key>_rotation</key> @@ -61,71 +61,65 @@ </param> </block> <block> - <key>gr_uchar_to_float</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_uchar_to_float_0</value> + <value>beta</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(217, 108)</value> + <key>label</key> + <value>Timing Beta</value> </param> <param> - <key>_rotation</key> + <key>value</key> <value>0</value> </param> - </block> - <block> - <key>gr_uchar_to_float</key> <param> - <key>id</key> - <value>gr_uchar_to_float_0_0</value> + <key>min</key> + <value>0.0</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>max</key> + <value>0.1</value> </param> <param> - <key>_coordinate</key> - <value>(216, 273)</value> + <key>num_steps</key> + <value>1000</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> - </block> - <block> - <key>variable</key> <param> - <key>id</key> - <value>samp_rate</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>value</key> - <value>32000</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(128, 9)</value> + <value>(668, 5)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> <key>variable_slider</key> <param> <key>id</key> - <value>freq_offset</value> + <value>alpha</value> </param> <param> <key>_enabled</key> @@ -133,7 +127,7 @@ </param> <param> <key>label</key> - <value>Frequency Offset</value> + <value>Timing Alpha</value> </param> <param> <key>value</key> @@ -141,11 +135,11 @@ </param> <param> <key>min</key> - <value>-0.5</value> + <value>0</value> </param> <param> <key>max</key> - <value>0.5</value> + <value>1</value> </param> <param> <key>num_steps</key> @@ -169,7 +163,7 @@ </param> <param> <key>_coordinate</key> - <value>(293, 684)</value> + <value>(552, 4)</value> </param> <param> <key>_rotation</key> @@ -180,7 +174,7 @@ <key>random_source_x</key> <param> <key>id</key> - <value>random_source_x_0</value> + <value>random_source_x</value> </param> <param> <key>_enabled</key> @@ -196,11 +190,11 @@ </param> <param> <key>max</key> - <value>pam_amp</value> + <value>const.arity()</value> </param> <param> <key>num_samps</key> - <value>10000</value> + <value>10000000</value> </param> <param> <key>repeat</key> @@ -208,7 +202,7 @@ </param> <param> <key>_coordinate</key> - <value>(13, 80)</value> + <value>(-1, 163)</value> </param> <param> <key>_rotation</key> @@ -216,38 +210,38 @@ </param> </block> <block> - <key>random_source_x</key> + <key>gr_chunks_to_symbols_xx</key> <param> <key>id</key> - <value>random_source_x_0_0</value> + <value>gr_chunks_to_symbols_xx</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> + <key>in_type</key> <value>byte</value> </param> <param> - <key>min</key> - <value>0</value> + <key>out_type</key> + <value>complex</value> </param> <param> - <key>max</key> - <value>pam_amp</value> + <key>symbol_table</key> + <value>const.points()</value> </param> <param> - <key>num_samps</key> - <value>10000</value> + <key>dimension</key> + <value>1</value> </param> <param> - <key>repeat</key> - <value>True</value> + <key>num_ports</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(15, 245)</value> + <value>(203, 178)</value> </param> <param> <key>_rotation</key> @@ -255,10 +249,10 @@ </param> </block> <block> - <key>const_source_x</key> + <key>gr_multiply_const_vxx</key> <param> <key>id</key> - <value>const_source_x_0</value> + <value>gr_multiply_const_vxx_0</value> </param> <param> <key>_enabled</key> @@ -266,42 +260,19 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> <key>const</key> - <value>-0.5*(pam_amp-1)</value> - </param> - <param> - <key>_coordinate</key> - <value>(213, 197)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>const_source_x</key> - <param> - <key>id</key> - <value>const_source_x_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> + <value>sig_amp</value> </param> <param> - <key>const</key> - <value>-0.5*(pam_amp-1)</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(200, 360)</value> + <value>(651, 186)</value> </param> <param> <key>_rotation</key> @@ -309,65 +280,38 @@ </param> </block> <block> - <key>notebook</key> + <key>gr_channel_model</key> <param> <key>id</key> - <value>notebook_0</value> + <value>gr_channel_model_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['error', 'phase', 'freq', 'Resampled Signal']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(729, 769)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_0</value> + <key>noise_voltage</key> + <value>noise_amp</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>freq_offset</key> + <value>freq_offset</value> </param> <param> - <key>type</key> - <value>float</value> + <key>epsilon</key> + <value>interpratio</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>taps</key> + <value>1.0</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>seed</key> + <value>42</value> </param> <param> <key>_coordinate</key> - <value>(440, 167)</value> + <value>(73, 354)</value> </param> <param> <key>_rotation</key> @@ -375,10 +319,10 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>gr_add_xx_0_1</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> @@ -386,11 +330,11 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>samples_per_second</key> + <value>samp_rate</value> </param> <param> <key>vlen</key> @@ -398,7 +342,7 @@ </param> <param> <key>_coordinate</key> - <value>(430, 330)</value> + <value>(274, 384)</value> </param> <param> <key>_rotation</key> @@ -409,7 +353,7 @@ <key>variable</key> <param> <key>id</key> - <value>nfilts</value> + <value>sig_amp</value> </param> <param> <key>_enabled</key> @@ -417,11 +361,11 @@ </param> <param> <key>value</key> - <value>32</value> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(435, 686)</value> + <value>(662, 128)</value> </param> <param> <key>_rotation</key> @@ -432,7 +376,7 @@ <key>variable_slider</key> <param> <key>id</key> - <value>noise_amp</value> + <value>interpratio</value> </param> <param> <key>_enabled</key> @@ -440,19 +384,19 @@ </param> <param> <key>label</key> - <value>Channel Noise</value> + <value>Timing Offset</value> </param> <param> <key>value</key> - <value>0</value> + <value>1.00</value> </param> <param> <key>min</key> - <value>0</value> + <value>0.99</value> </param> <param> <key>max</key> - <value>1.0</value> + <value>1.01</value> </param> <param> <key>num_steps</key> @@ -476,18 +420,18 @@ </param> <param> <key>_coordinate</key> - <value>(168, 684)</value> + <value>(-1, 465)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> <key>variable_slider</key> <param> <key>id</key> - <value>interpratio</value> + <value>noise_amp</value> </param> <param> <key>_enabled</key> @@ -495,19 +439,19 @@ </param> <param> <key>label</key> - <value>Timing Offset</value> + <value>Channel Noise</value> </param> <param> <key>value</key> - <value>1.00</value> + <value>0</value> </param> <param> <key>min</key> - <value>0.99</value> + <value>0</value> </param> <param> <key>max</key> - <value>1.01</value> + <value>1.0</value> </param> <param> <key>num_steps</key> @@ -531,18 +475,18 @@ </param> <param> <key>_coordinate</key> - <value>(40, 684)</value> + <value>(114, 465)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> <key>variable_slider</key> <param> <key>id</key> - <value>beta</value> + <value>freq_offset</value> </param> <param> <key>_enabled</key> @@ -550,7 +494,7 @@ </param> <param> <key>label</key> - <value>Timing Beta</value> + <value>Frequency Offset</value> </param> <param> <key>value</key> @@ -558,11 +502,11 @@ </param> <param> <key>min</key> - <value>0.0</value> + <value>-0.5</value> </param> <param> <key>max</key> - <value>0.1</value> + <value>0.5</value> </param> <param> <key>num_steps</key> @@ -586,62 +530,53 @@ </param> <param> <key>_coordinate</key> - <value>(668, 5)</value> + <value>(236, 465)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>variable_slider</key> + <key>variable</key> <param> <key>id</key> - <value>alpha</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Timing Alpha</value> - </param> - <param> <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> + <value>32000</value> </param> <param> - <key>num_steps</key> - <value>1000</value> + <key>_coordinate</key> + <value>(282, 324)</value> </param> <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>converver</key> - <value>float_converter</value> + <key>id</key> + <value>const</value> </param> <param> - <key>grid_pos</key> - <value></value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>notebook</key> - <value></value> + <key>value</key> + <value>digital.qpsk_constellation()</value> </param> <param> <key>_coordinate</key> - <value>(552, 4)</value> + <value>(206, 116)</value> </param> <param> <key>_rotation</key> @@ -649,22 +584,22 @@ </param> </block> <block> - <key>variable</key> + <key>import</key> <param> <key>id</key> - <value>pam_amp</value> + <value>import_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>2</value> + <key>import</key> + <value>from gnuradio import digital</value> </param> <param> <key>_coordinate</key> - <value>(223, 9)</value> + <value>(-1, 61)</value> </param> <param> <key>_rotation</key> @@ -675,7 +610,7 @@ <key>variable</key> <param> <key>id</key> - <value>sig_amp</value> + <value>rolloff</value> </param> <param> <key>_enabled</key> @@ -683,11 +618,11 @@ </param> <param> <key>value</key> - <value>1</value> + <value>.35</value> </param> <param> <key>_coordinate</key> - <value>(315, 9)</value> + <value>(459, 262)</value> </param> <param> <key>_rotation</key> @@ -695,74 +630,77 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>variable</key> <param> <key>id</key> - <value>wxgui_scopesink2_0</value> + <value>nfilts</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>value</key> + <value>32</value> </param> <param> - <key>title</key> - <value>Scope Plot</value> + <key>_coordinate</key> + <value>(539, 262)</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>gr_pfb_clock_sync_xxx</key> <param> - <key>v_scale</key> - <value>0</value> + <key>id</key> + <value>gr_pfb_clock_sync_xxx_0</value> </param> <param> - <key>v_offset</key> - <value>0</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>t_scale</key> - <value>0</value> + <key>type</key> + <value>ccf</value> </param> <param> - <key>ac_couple</key> - <value>False</value> + <key>sps</key> + <value>spb</value> </param> <param> - <key>xy_mode</key> - <value>False</value> + <key>alpha</key> + <value>alpha</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>beta</key> + <value>beta</value> </param> <param> - <key>win_size</key> - <value></value> + <key>taps</key> + <value>firdes.root_raised_cosine(nfilts, nfilts*spb, 1.0, rolloff, 44*nfilts)</value> </param> <param> - <key>grid_pos</key> - <value></value> + <key>filter_size</key> + <value>nfilts</value> </param> <param> - <key>notebook</key> - <value></value> + <key>init_phase</key> + <value>16</value> </param> <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> + <key>max_dev</key> + <value>1.5</value> </param> <param> - <key>y_axis_label</key> - <value>Counts</value> + <key>osps</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(1116, 500)</value> + <value>(444, 331)</value> </param> <param> <key>_rotation</key> @@ -770,30 +708,30 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blks2_pfb_arb_resampler_ccf</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blks2_pfb_arb_resampler_ccf_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>rate</key> + <value>spb</value> </param> <param> - <key>samples_per_second</key> - <value>samp_rate</value> + <key>taps</key> + <value>firdes.root_raised_cosine(nfilts, nfilts, 1.0, rolloff, 44*nfilts)</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>size</key> + <value>nfilts</value> </param> <param> <key>_coordinate</key> - <value>(290, 575)</value> + <value>(438, 171)</value> </param> <param> <key>_rotation</key> @@ -804,7 +742,7 @@ <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_0</value> + <value>wxgui_scopesink2_0_0_1</value> </param> <param> <key>_enabled</key> @@ -812,11 +750,11 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> <key>title</key> - <value>Scope Plot</value> + <value>Error</value> </param> <param> <key>samp_rate</key> @@ -824,7 +762,7 @@ </param> <param> <key>v_scale</key> - <value>9</value> + <value>.5</value> </param> <param> <key>v_offset</key> @@ -856,7 +794,7 @@ </param> <param> <key>notebook</key> - <value>notebook_0,1</value> + <value>notebook_0,3</value> </param> <param> <key>trig_mode</key> @@ -868,30 +806,7 @@ </param> <param> <key>_coordinate</key> - <value>(1112, 881)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rrctaps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), .35, int(11*spb*nfilts))</value> - </param> - <param> - <key>_coordinate</key> - <value>(513, 679)</value> + <value>(826, 112)</value> </param> <param> <key>_rotation</key> @@ -902,7 +817,7 @@ <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_1</value> + <value>wxgui_scopesink2_0</value> </param> <param> <key>_enabled</key> @@ -914,7 +829,7 @@ </param> <param> <key>title</key> - <value>Error</value> + <value>Scope Plot</value> </param> <param> <key>samp_rate</key> @@ -922,7 +837,7 @@ </param> <param> <key>v_scale</key> - <value>.5</value> + <value>0</value> </param> <param> <key>v_offset</key> @@ -954,7 +869,7 @@ </param> <param> <key>notebook</key> - <value>notebook_0,3</value> + <value></value> </param> <param> <key>trig_mode</key> @@ -966,7 +881,7 @@ </param> <param> <key>_coordinate</key> - <value>(1115, 358)</value> + <value>(829, 266)</value> </param> <param> <key>_rotation</key> @@ -974,92 +889,74 @@ </param> </block> <block> - <key>gr_float_to_complex</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>gr_float_to_complex_0</value> + <value>wxgui_scopesink2_0_0_0_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_pfb_arb_resampler_ccf</key> - <param> - <key>id</key> - <value>blks2_pfb_arb_resampler_ccf_0</value> + <key>type</key> + <value>float</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>title</key> + <value>Scope Plot</value> </param> <param> - <key>rate</key> - <value>spb</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>taps</key> - <value>firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32)</value> + <key>v_scale</key> + <value>1.25</value> </param> <param> - <key>size</key> - <value>32</value> + <key>v_offset</key> + <value>0</value> </param> <param> - <key>_coordinate</key> - <value>(816, 181)</value> + <key>t_scale</key> + <value>0</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>ac_couple</key> + <value>False</value> </param> - </block> - <block> - <key>gr_channel_model</key> <param> - <key>id</key> - <value>gr_channel_model_0</value> + <key>xy_mode</key> + <value>False</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>num_inputs</key> + <value>1</value> </param> <param> - <key>noise_voltage</key> - <value>noise_amp</value> + <key>win_size</key> + <value></value> </param> <param> - <key>freq_offset</key> - <value>freq_offset</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>epsilon</key> - <value>interpratio</value> + <key>notebook</key> + <value>notebook_0,2</value> </param> <param> - <key>taps</key> - <value>1.0</value> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> </param> <param> - <key>seed</key> - <value>42</value> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(59, 543)</value> + <value>(824, 485)</value> </param> <param> <key>_rotation</key> @@ -1067,10 +964,10 @@ </param> </block> <block> - <key>gr_multiply_const_vxx</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>gr_multiply_const_vxx_0</value> + <value>wxgui_scopesink2_0_0</value> </param> <param> <key>_enabled</key> @@ -1078,97 +975,63 @@ </param> <param> <key>type</key> - <value>complex</value> + <value>float</value> </param> <param> - <key>const</key> - <value>sig_amp</value> + <key>title</key> + <value>Error</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>_coordinate</key> - <value>(714, 382)</value> + <key>v_scale</key> + <value>3</value> </param> <param> - <key>_rotation</key> + <key>v_offset</key> <value>0</value> </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>spb</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4.2563</value> - </param> <param> - <key>_coordinate</key> - <value>(42, 840)</value> - </param> - <param> - <key>_rotation</key> + <key>t_scale</key> <value>0</value> </param> - </block> - <block> - <key>gr_pfb_clock_sync_xxx</key> - <param> - <key>id</key> - <value>gr_pfb_clock_sync_xxx_0</value> - </param> <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ccf</value> - </param> - <param> - <key>sps</key> - <value>spb</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>alpha</key> - <value>alpha</value> + <key>xy_mode</key> + <value>False</value> </param> <param> - <key>beta</key> - <value>beta</value> + <key>num_inputs</key> + <value>1</value> </param> <param> - <key>taps</key> - <value>rrctaps</value> + <key>win_size</key> + <value></value> </param> <param> - <key>filter_size</key> - <value>nfilts</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>init_phase</key> - <value>16</value> + <key>notebook</key> + <value>notebook_0,0</value> </param> <param> - <key>max_dev</key> - <value>1.5</value> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> </param> <param> - <key>osps</key> - <value>1</value> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(512, 527)</value> + <value>(829, 358)</value> </param> <param> <key>_rotation</key> @@ -1179,7 +1042,7 @@ <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0</value> + <value>wxgui_scopesink2_0_0_0</value> </param> <param> <key>_enabled</key> @@ -1191,7 +1054,7 @@ </param> <param> <key>title</key> - <value>Error</value> + <value>Scope Plot</value> </param> <param> <key>samp_rate</key> @@ -1199,7 +1062,7 @@ </param> <param> <key>v_scale</key> - <value>3</value> + <value>9</value> </param> <param> <key>v_offset</key> @@ -1231,7 +1094,7 @@ </param> <param> <key>notebook</key> - <value>notebook_0,0</value> + <value>notebook_0,1</value> </param> <param> <key>trig_mode</key> @@ -1243,7 +1106,7 @@ </param> <param> <key>_coordinate</key> - <value>(1114, 615)</value> + <value>(754, 607)</value> </param> <param> <key>_rotation</key> @@ -1251,74 +1114,57 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>notebook</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_0_0</value> + <value>notebook_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>style</key> + <value>wx.NB_TOP</value> </param> <param> - <key>title</key> - <value>Scope Plot</value> + <key>labels</key> + <value>['error', 'phase', 'freq', 'Resampled Signal']</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>v_scale</key> - <value>1.25</value> + <key>notebook</key> + <value></value> </param> <param> - <key>v_offset</key> - <value>0</value> + <key>_coordinate</key> + <value>(380, 511)</value> </param> <param> - <key>t_scale</key> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,2</value> + <key>id</key> + <value>spb</value> </param> <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>y_axis_label</key> - <value>Counts</value> + <key>value</key> + <value>4.2563</value> </param> <param> <key>_coordinate</key> - <value>(1080, 751)</value> + <value>(300, 0)</value> </param> <param> <key>_rotation</key> @@ -1326,110 +1172,68 @@ </param> </block> <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_uchar_to_float_0</sink_block_id> + <source_block_id>gr_channel_model_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_uchar_to_float_0</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>const_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_uchar_to_float_0_0</source_block_id> - <sink_block_id>gr_add_xx_0_1</sink_block_id> - <source_key>0</source_key> + <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id> + <source_key>2</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>const_source_x_0_0</source_block_id> - <sink_block_id>gr_add_xx_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0_0</source_block_id> - <sink_block_id>gr_uchar_to_float_0_0</sink_block_id> + <source_block_id>gr_multiply_const_vxx_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> + <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_add_xx_0</source_block_id> - <sink_block_id>gr_float_to_complex_0</sink_block_id> + <source_block_id>gr_multiply_const_vxx_0</source_block_id> + <sink_block_id>gr_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_add_xx_0_1</source_block_id> - <sink_block_id>gr_float_to_complex_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> + <source_block_id>gr_chunks_to_symbols_xx</source_block_id> + <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id> + <source_block_id>random_source_x</source_block_id> + <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> - <source_key>1</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> <sink_block_id>wxgui_scopesink2_0_0_0</sink_block_id> <source_key>3</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id> - <source_key>2</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_float_to_complex_0</source_block_id> - <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> + <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> + <source_key>1</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> + <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py b/gr-digital/examples/narrowband/digital_bert_rx.py index ab7e988eb..4055aa244 100755 --- a/gr-digital/examples/narrowband/digital_bert_rx.py +++ b/gr-digital/examples/narrowband/digital_bert_rx.py @@ -114,7 +114,7 @@ class rx_psk_block(gr.top_block): if(options.rx_freq is not None): symbol_rate = options.bitrate / self._demodulator.bits_per_symbol() - self._source = uhd_receiver(options.args, options.bitrate, + self._source = uhd_receiver(options.args, symbol_rate, options.samples_per_symbol, options.rx_freq, options.rx_gain, options.spec, diff --git a/gr-digital/grc/digital_pfb_clock_sync.xml b/gr-digital/grc/digital_pfb_clock_sync.xml index 9e2a4cd5e..255eb7f7a 100644 --- a/gr-digital/grc/digital_pfb_clock_sync.xml +++ b/gr-digital/grc/digital_pfb_clock_sync.xml @@ -8,11 +8,9 @@ <name>Polyphase Clock Sync</name> <key>digital_pfb_clock_sync_xxx</key> <import>from gnuradio import digital</import> - <make>digital.pfb_clock_sync_$(type)($sps, $alpha, $taps, $filter_size, $init_phase, $max_dev, $osps) -self.$(id).set_beta($beta)</make> + <make>digital.pfb_clock_sync_$(type)($sps, $loop_bw, $taps, $filter_size, $init_phase, $max_dev, $osps)</make> <callback>set_taps($taps)</callback> - <callback>set_alpha($alpha)</callback> - <callback>set_beta($beta)</callback> + <callback>set_loop_bandwidth($loop_bw)</callback> <param> <name>Type</name> @@ -40,13 +38,8 @@ self.$(id).set_beta($beta)</make> <type>real</type> </param> <param> - <name>Alpha</name> - <key>alpha</key> - <type>real</type> - </param> - <param> - <name>Beta</name> - <key>beta</key> + <name>Loop Bandwidth</name> + <key>loop_bw</key> <type>real</type> </param> <param> diff --git a/gr-digital/include/digital_constellation_receiver_cb.h b/gr-digital/include/digital_constellation_receiver_cb.h index 3a14bb5de..92c31311f 100644 --- a/gr-digital/include/digital_constellation_receiver_cb.h +++ b/gr-digital/include/digital_constellation_receiver_cb.h @@ -41,36 +41,18 @@ digital_make_constellation_receiver_cb (digital_constellation_sptr constellation float loop_bw, float fmin, float fmax); /*! - * \brief This block takes care of receiving generic modulated signals - * through phase, frequency, and symbol synchronization. + * \brief This block does fine-phase and frequency locking and decision making. * \ingroup sync_blk * \ingroup demod_blk * \ingroup digital * - * This block takes care of receiving generic modulated signals - * through phase, frequency, and symbol synchronization. It performs - * carrier frequency and phase locking as well as symbol timing - * recovery. - * * The phase and frequency synchronization are based on a Costas loop * that finds the error of the incoming signal point compared to its * nearest constellation point. The frequency and phase of the NCO are * updated according to this error. * - * The symbol synchronization is done using a modified Mueller and - * Muller circuit from the paper: - * - * "G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller - * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22 - * June 1995, pp. 1032 - 1033." - * - * This circuit interpolates the downconverted sample (using the NCO - * developed by the Costas loop) every mu samples, then it finds the - * sampling error based on this and the past symbols and the decision - * made on the samples. Like the phase error detector, there are - * optimized decision algorithms for BPSK and QPKS, but 8PSK uses - * another brute force computation against all possible symbols. The - * modifications to the M&M used here reduce self-noise. + * The decicision making itself is performed by the appropriate method of the + * passed constellation object. * */ @@ -87,13 +69,11 @@ protected: /*! * \brief Constructor to synchronize incoming M-PSK symbols * - * \param constellation constellation of points for generic modulation + * \param constellation constellation object for generic demodulation * \param loop_bw Loop bandwidth of the Costas Loop (~ 2pi/100) * \param fmin minimum normalized frequency value the loop can achieve * \param fmax maximum normalized frequency value the loop can achieve * - * The constructor also chooses which phase detector and decision maker to use in the - * work loop based on the value of M. */ digital_constellation_receiver_cb (digital_constellation_sptr constellation, float loop_bw, float fmin, float fmax); diff --git a/gr-howto-write-a-block/python/CMakeLists.txt b/gr-howto-write-a-block/python/CMakeLists.txt index d5fb19523..ac5531638 100644 --- a/gr-howto-write-a-block/python/CMakeLists.txt +++ b/gr-howto-write-a-block/python/CMakeLists.txt @@ -31,6 +31,7 @@ endif() GR_PYTHON_INSTALL( FILES __init__.py + square3_ff.py DESTINATION ${GR_PYTHON_DIR}/howto ) diff --git a/gr-howto-write-a-block/python/__init__.py b/gr-howto-write-a-block/python/__init__.py index 2bd27cb31..6e5e1c147 100644 --- a/gr-howto-write-a-block/python/__init__.py +++ b/gr-howto-write-a-block/python/__init__.py @@ -25,6 +25,7 @@ description here (python/__init__.py). # import swig generated symbols into the howto namespace from howto_swig import * +from square3_ff import square3_ff # import any pure python here # diff --git a/gr-howto-write-a-block/python/qa_howto.py b/gr-howto-write-a-block/python/qa_howto.py index 7321941d5..5e62fc890 100755 --- a/gr-howto-write-a-block/python/qa_howto.py +++ b/gr-howto-write-a-block/python/qa_howto.py @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import howto_swig +from square3_ff import square3_ff class qa_howto (gr_unittest.TestCase): @@ -55,5 +56,17 @@ class qa_howto (gr_unittest.TestCase): result_data = dst.data () self.assertFloatTuplesAlmostEqual (expected_result, result_data, 6) + def test_003_square3_ff (self): + src_data = (-3, 4, -5.5, 2, 3) + expected_result = (9, 16, 30.25, 4, 9) + src = gr.vector_source_f (src_data) + sqr = square3_ff () + dst = gr.vector_sink_f () + self.tb.connect (src, sqr) + self.tb.connect (sqr, dst) + self.tb.run () + result_data = dst.data () + self.assertFloatTuplesAlmostEqual (expected_result, result_data, 6) + if __name__ == '__main__': gr_unittest.main () diff --git a/gr-howto-write-a-block/python/square3_ff.py b/gr-howto-write-a-block/python/square3_ff.py new file mode 100644 index 000000000..df702734e --- /dev/null +++ b/gr-howto-write-a-block/python/square3_ff.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# +# Copyright 2013 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. +# + +import numpy +from gnuradio import gr + +class square3_ff(gr.sync_block): + " Squaring block " + def __init__(self): + gr.sync_block.__init__( + self, + name = "square3_ff", + in_sig = [numpy.float32], # Input signature: 1 float at a time + out_sig = [numpy.float32], # Output signature: 1 float at a time + ) + + def work(self, input_items, output_items): + """ Notes: + - You must not forget the [:] at the output items, otherwise + stuff doesn't truly get copied to the output + - Both input_ and output_items[N] are numpy arrays, so you can + do fancy stuff like multiplying them elementwise + - noutput_items and ninput_items are implicit in the length of + output_items and input_items, respectively + """ + output_items[0][:] = input_items[0] * input_items[0] + return len(output_items[0]) + diff --git a/gr-wxgui/src/python/forms/forms.py b/gr-wxgui/src/python/forms/forms.py index f1d0038ab..cabc5860b 100644 --- a/gr-wxgui/src/python/forms/forms.py +++ b/gr-wxgui/src/python/forms/forms.py @@ -500,7 +500,8 @@ class notebook(_chooser_base): self._add_widget(self._notebook) def _handle(self, event): self[INT_KEY] = self._notebook.GetSelection() - def _update(self, i): self._notebook.SetSelection(i) + # SetSelection triggers a page change event (deprecated, breaks on Windows) and ChangeSelection does not + def _update(self, i): self._notebook.ChangeSelection(i) # ---------------------------------------------------------------- # Stand-alone test application diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/src/python/plotter/plotter_base.py index 41c94e5e0..b8a2ce709 100644 --- a/gr-wxgui/src/python/plotter/plotter_base.py +++ b/gr-wxgui/src/python/plotter/plotter_base.py @@ -151,6 +151,8 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): Resize the view port if the width or height changed. Redraw the screen, calling the draw functions. """ + # create device context (needed on Windows, noop on X) + dc = wx.PaintDC(self) self.lock() self.SetCurrent() @@ -172,26 +174,29 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): for cache in self._gl_caches: cache.changed(True) self._resized_flag = False - # clear buffer - GL.glClear(GL.GL_COLOR_BUFFER_BIT) + # clear buffer if needed + if self.clear_accum or not self.use_persistence: + GL.glClear(GL.GL_COLOR_BUFFER_BIT) + self.clear_accum=False + + # apply fading + if self.use_persistence: + GL.glEnable(GL.GL_BLEND) + GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA) + + GL.glBegin(GL.GL_QUADS) + GL.glColor4f(1,1,1,self.persist_alpha) + GL.glVertex2f(0, self.height) + GL.glVertex2f(self.width, self.height) + GL.glVertex2f(self.width, 0) + GL.glVertex2f(0, 0) + GL.glEnd() + + GL.glDisable(GL.GL_BLEND) # draw functions for fcn in self._draw_fcns: fcn[1]() - # apply persistence - if self.use_persistence: - if self.clear_accum: - #GL.glClear(GL.GL_ACCUM_BUFFER_BIT) - try: - GL.glAccum(GL.GL_LOAD, 1.0) - except: - pass - self.clear_accum=False - - GL.glAccum(GL.GL_MULT, 1.0-self.persist_alpha) - GL.glAccum(GL.GL_ACCUM, self.persist_alpha) - GL.glAccum(GL.GL_RETURN, 1.0) - # show result self.SwapBuffers() self.unlock() diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 183883959..dcd6c5448 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -45,6 +45,7 @@ <block>gr_tagged_stream_to_pdu</block> <block>gr_tuntap_pdu</block> <block>gr_socket_pdu</block> + <block>gr_random_pdu</block> </cat> <cat> <name>Operators</name> diff --git a/grc/blocks/gr_random_pdu.xml b/grc/blocks/gr_random_pdu.xml new file mode 100644 index 000000000..ed5a79a92 --- /dev/null +++ b/grc/blocks/gr_random_pdu.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Random PDU +################################################### + --> +<block> + <name>Random PDU Generator</name> + <key>gr_random_pdu</key> + <import>from gnuradio import gr</import> + <import>from gruel import pmt</import> + <make>gr.random_pdu($minsize, $maxsize)</make> + <param> + <name>Min Bytes</name> + <key>minsize</key> + <value>50</value> + <type>int</type> + </param> + <param> + <name>Max Bytes</name> + <key>maxsize</key> + <value>2000</value> + <type>int</type> + </param> + <sink> + <name>generate</name> + <type>message</type> + <optional>1</optional> + </sink> + <source> + <name>pdus</name> + <type>message</type> + <optional>1</optional> + </source> +</block> diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py index 67e5af97b..6af4bcb62 100644 --- a/grc/gui/FlowGraph.py +++ b/grc/gui/FlowGraph.py @@ -494,8 +494,9 @@ class FlowGraph(Element): Move a selected element to the new coordinate. Auto-scroll the scroll bars at the boundaries. """ - #to perform a movement, the mouse must be pressed, no pending events - if gtk.events_pending() or not self.mouse_pressed: return + #to perform a movement, the mouse must be pressed + # (no longer checking pending events via gtk.events_pending() - always true in Windows) + if not self.mouse_pressed: return #perform autoscrolling width, height = self.get_size() x, y = coordinate diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py index 37a100c94..1dc02dabb 100644 --- a/grc/gui/MainWindow.py +++ b/grc/gui/MainWindow.py @@ -180,6 +180,9 @@ class MainWindow(gtk.Window): if file_path: Messages.send_end_load() except Exception, e: #return on failure Messages.send_fail_load(e) + if isinstance(e, KeyError) and str(e) == "'options'": + # This error is unrecoverable, so crash gracefully + exit(-1) return #add this page to the notebook self.notebook.append_page(page, page.get_tab()) diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion index e76322b4d..dabca3028 100755 --- a/grc/scripts/gnuradio-companion +++ b/grc/scripts/gnuradio-companion @@ -39,10 +39,19 @@ Is the library path environment variable set correctly? d.run() exit(-1) -from gnuradio import gr from optparse import OptionParser +import os if __name__ == "__main__": + if ('GR_DONT_LOAD_PREFS' in os.environ.keys() and + (not 'GRC_BLOCKS_PATH' in os.environ.keys() or len(os.environ['GRC_BLOCKS_PATH']) == 0)): + d = gtk.MessageDialog( + type=gtk.MESSAGE_ERROR, + buttons=gtk.BUTTONS_CLOSE, + message_format="""Can't find block definitions. Use config.conf or GRC_BLOCKS_PATH. """) + d.set_title("No block definitions available.") + d.run() + exit(-1) usage = 'usage: %prog [options] [saved flow graphs]' version = """ GNU Radio Companion %s diff --git a/gruel/src/python/CMakeLists.txt b/gruel/src/python/CMakeLists.txt index 13f2111ba..f5c4ac47a 100644 --- a/gruel/src/python/CMakeLists.txt +++ b/gruel/src/python/CMakeLists.txt @@ -28,8 +28,9 @@ GR_PYTHON_INSTALL( COMPONENT "gruel_python" ) -GR_PYTHON_INSTALL( - FILES pmt/__init__.py +GR_PYTHON_INSTALL(FILES + pmt/__init__.py + pmt/pmt_to_python.py DESTINATION ${GR_PYTHON_DIR}/gruel/pmt COMPONENT "gruel_python" ) diff --git a/gruel/src/python/pmt/__init__.py b/gruel/src/python/pmt/__init__.py index 0862af0eb..bc933e80a 100644 --- a/gruel/src/python/pmt/__init__.py +++ b/gruel/src/python/pmt/__init__.py @@ -26,4 +26,6 @@ The GNU Radio Utility Etcetera Library's Polymorphic Types for Python. ''' from pmt_swig import * +from pmt_to_python import pmt_to_python as to_python +from pmt_to_python import python_to_pmt as to_pmt diff --git a/gruel/src/python/pmt/pmt_to_python.py b/gruel/src/python/pmt/pmt_to_python.py new file mode 100644 index 000000000..030c1c11d --- /dev/null +++ b/gruel/src/python/pmt/pmt_to_python.py @@ -0,0 +1,97 @@ +# Copyright 2012,2013 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. + +try: import pmt_swig as pmt +except: import pmt +import numpy + +#define missing +def pmt_to_tuple(p): + elems = list() + for i in range(pmt.pmt_length(p)): + elem = pmt.pmt_tuple_ref(p, i) + elems.append(pmt_to_python(elem)) + return tuple(elems) + +def pmt_from_tuple(p): + args = map(python_to_pmt, p) + return pmt.pmt_make_tuple(*args) + +def pmt_to_vector(p): + v = list() + for i in range(pmt.pmt_length(p)): + elem = pmt.pmt_vector_ref(p, i) + v.append(pmt_to_python(elem)) + return v + +def pmt_from_vector(p): + v = pmt.pmt_make_vector(len(p), pmt.PMT_NIL) + for i, elem in enumerate(p): + pmt.pmt_vector_set(v, i, python_to_pmt(elem)) + return v + +def pmt_to_dict(p): + d = dict() + items = pmt.pmt_dict_items(p) + for i in range(pmt.pmt_length(items)): + pair = pmt.pmt_nth(i, items) + k = pmt.pmt_car(pair) + v = pmt.pmt_cdr(pair) + d[pmt_to_python(k)] = pmt_to_python(v) + return d + +def pmt_from_dict(p): + d = pmt.pmt_make_dict() + for k, v in p.iteritems(): + #dict is immutable -> therefore pmt_dict_add returns the new dict + d = pmt.pmt_dict_add(d, python_to_pmt(k), python_to_pmt(v)) + return d + +def numpy_to_blob(p): + p = p.view(numpy.uint8) + b = pmt.pmt_make_blob(len(p)) + pmt.pmt_blob_data(b)[:] = p + return b + +THE_TABLE = ( #python type, check pmt type, to python, from python + (None, pmt.pmt_is_null, lambda x: None, lambda x: pmt.PMT_NIL), + (bool, pmt.pmt_is_bool, pmt.pmt_to_bool, pmt.pmt_from_bool), + (str, pmt.pmt_is_symbol, pmt.pmt_symbol_to_string, pmt.pmt_string_to_symbol), + (int, pmt.pmt_is_integer, pmt.pmt_to_long, pmt.pmt_from_long), + (long, pmt.pmt_is_uint64, lambda x: long(pmt.pmt_to_uint64(x)), pmt.pmt_from_uint64), + (float, pmt.pmt_is_real, pmt.pmt_to_double, pmt.pmt_from_double), + (complex, pmt.pmt_is_complex, pmt.pmt_to_complex, pmt.pmt_from_complex), + (tuple, pmt.pmt_is_tuple, pmt_to_tuple, pmt_from_tuple), + (list, pmt.pmt_is_vector, pmt_to_vector, pmt_from_vector), + (dict, pmt.pmt_is_dict, pmt_to_dict, pmt_from_dict), + (numpy.ndarray, pmt.pmt_is_blob, pmt.pmt_blob_data, numpy_to_blob), +) + +def pmt_to_python(p): + for python_type, pmt_check, to_python, from_python in THE_TABLE: + if pmt_check(p): return to_python(p) + return p #give up, we return the same + +def python_to_pmt(p): + for python_type, pmt_check, to_python, from_python in THE_TABLE: + if python_type is None: + if p == None: return from_python(p) + elif isinstance(p, python_type): return from_python(p) + return p #give up, we return the same + diff --git a/gruel/src/python/qa_pmt_to_python.py b/gruel/src/python/qa_pmt_to_python.py new file mode 100755 index 000000000..c63403a52 --- /dev/null +++ b/gruel/src/python/qa_pmt_to_python.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# +# Copyright 2013 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. +# + +import unittest +import pmt + +class test_gruel_pmt_to_python(unittest.TestCase): + + def test01 (self): + b = pmt.pmt_from_double(123765) + self.assertEqual(pmt.to_python(b), 123765) + t = pmt.to_pmt(range(5)) + +if __name__ == '__main__': + unittest.main() diff --git a/volk/apps/CMakeLists.txt b/volk/apps/CMakeLists.txt index a89a9409d..03ad92b79 100644 --- a/volk/apps/CMakeLists.txt +++ b/volk/apps/CMakeLists.txt @@ -18,9 +18,7 @@ ######################################################################## # Setup profiler ######################################################################## -find_package(Boost COMPONENTS unit_test_framework) - -if(Boost_FOUND AND UNIX) #uses mkdir and $HOME +if(Boost_FOUND) if(MSVC) include_directories(${CMAKE_SOURCE_DIR}/msvc) @@ -48,4 +46,4 @@ install( COMPONENT "volk" ) -endif(Boost_FOUND AND UNIX) +endif(Boost_FOUND) |