diff options
author | Johnathan Corgan | 2012-04-01 13:23:06 -0700 |
---|---|---|
committer | Johnathan Corgan | 2012-04-01 13:55:45 -0700 |
commit | f9b73b1710f19529b99f8f69c8e3a06839ad68bc (patch) | |
tree | c6ec3e97110c75eb187875a9e1a8fd22b7123b2b /gnuradio-core/src | |
parent | a40ac1d61259dda14e5a6abf328004d3f4b17f02 (diff) | |
download | gnuradio-f9b73b1710f19529b99f8f69c8e3a06839ad68bc.tar.gz gnuradio-f9b73b1710f19529b99f8f69c8e3a06839ad68bc.tar.bz2 gnuradio-f9b73b1710f19529b99f8f69c8e3a06839ad68bc.zip |
wavelet: move wavelet blocks to new top-level component
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r-- | gnuradio-core/src/lib/CMakeLists.txt | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/general.i | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_squash_ff.cc | 93 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_squash_ff.h | 68 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_squash_ff.i | 34 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_wavelet_ff.cc | 107 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_wavelet_ff.h | 71 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_wavelet_ff.i | 31 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_wvps_ff.cc | 98 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_wvps_ff.h | 58 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_wvps_ff.i | 29 | ||||
-rwxr-xr-x | gnuradio-core/src/python/gnuradio/gr/qa_classify.py | 181 |
13 files changed, 0 insertions, 785 deletions
diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt index 86f88242c..73002ec7b 100644 --- a/gnuradio-core/src/lib/CMakeLists.txt +++ b/gnuradio-core/src/lib/CMakeLists.txt @@ -47,10 +47,6 @@ include_directories(${VOLK_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) link_directories(${Boost_LIBRARY_DIRS}) -add_definitions(${GSL_DEFINITIONS}) -include_directories(${GSL_INCLUDE_DIRS}) -link_directories(${GSL_LIBRARY_DIRS}) - include_directories(${FFTW3F_INCLUDE_DIRS}) link_directories(${FFTW3F_LIBRARY_DIRS}) @@ -60,7 +56,6 @@ link_directories(${FFTW3F_LIBRARY_DIRS}) list(APPEND gnuradio_core_libs gruel ${Boost_LIBRARIES} - ${GSL_LIBRARIES} ${FFTW3F_LIBRARIES} ) @@ -80,7 +75,6 @@ list(APPEND gnuradio_core_libs volk) add_library(gnuradio-core SHARED ${gnuradio_core_sources}) target_link_libraries(gnuradio-core ${gnuradio_core_libs}) GR_LIBRARY_FOO(gnuradio-core RUNTIME_COMPONENT "core_runtime" DEVEL_COMPONENT "core_devel") -#avoid fftw and gsl link in dependent libraries: set_target_properties(gnuradio-core PROPERTIES LINK_INTERFACE_LIBRARIES "gruel") ######################################################################## diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index ee6e4c4e6..1d1da247c 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -267,7 +267,6 @@ set(gr_core_general_triple_threats gr_simple_framer gr_simple_squelch_cc gr_skiphead - gr_squash_ff gr_squelch_base_cc gr_squelch_base_ff gr_stream_mux @@ -285,8 +284,6 @@ set(gr_core_general_triple_threats gr_vector_to_stream gr_vector_to_streams gr_unpack_k_bits_bb - gr_wavelet_ff - gr_wvps_ff gr_descrambler_bb gr_scrambler_bb gr_probe_mpsk_snr_c diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index fcf60c927..bf8bc163f 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -128,10 +128,7 @@ #include <gr_probe_mpsk_snr_c.h> #include <gr_probe_density_b.h> #include <gr_rail_ff.h> -#include <gr_squash_ff.h> #include <gr_stretch_ff.h> -#include <gr_wavelet_ff.h> -#include <gr_wvps_ff.h> #include <gr_copy.h> #include <gr_additive_scrambler_bb.h> #include <complex_vec_test.h> @@ -249,10 +246,7 @@ %include "gr_probe_mpsk_snr_c.i" %include "gr_probe_density_b.i" %include "gr_rail_ff.i" -%include "gr_squash_ff.i" %include "gr_stretch_ff.i" -%include "gr_wavelet_ff.i" -%include "gr_wvps_ff.i" %include "gr_copy.i" %include "gr_additive_scrambler_bb.i" %include "complex_vec_test.i" diff --git a/gnuradio-core/src/lib/general/gr_squash_ff.cc b/gnuradio-core/src/lib/general/gr_squash_ff.cc deleted file mode 100644 index 479204fdb..000000000 --- a/gnuradio-core/src/lib/general/gr_squash_ff.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdexcept> -#include <gr_squash_ff.h> -#include <gr_io_signature.h> - -// expect input vector of igrid.size y-values, -// produce output vector of ogrid.size y-values - -gr_squash_ff_sptr -gr_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid) -{ - return gnuradio::get_initial_sptr(new gr_squash_ff(igrid, ogrid)); -} - -gr_squash_ff::gr_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid) - : gr_sync_block("squash_ff", - gr_make_io_signature(1, 1, sizeof(float) * igrid.size()), - gr_make_io_signature(1, 1, sizeof(float) * ogrid.size())) -{ - d_inum = igrid.size(); - d_onum = ogrid.size(); - d_igrid = (double *) malloc(d_inum * sizeof(double)); - d_iwork = (double *) malloc(d_inum * sizeof(double)); - d_ogrid = (double *) malloc(d_onum * sizeof(double)); - for (unsigned int i = 0; i < d_inum; i++) - d_igrid[i] = igrid[i]; - for (unsigned int i = 0; i < d_onum; i++) - d_ogrid[i] = ogrid[i]; - - d_accel = gsl_interp_accel_alloc(); - d_spline = gsl_spline_alloc(gsl_interp_cspline, d_inum); // FIXME check w/ Frank -} - -gr_squash_ff::~gr_squash_ff() -{ - free((char *) d_igrid); - free((char *) d_iwork); - free((char *) d_ogrid); - gsl_interp_accel_free(d_accel); - gsl_spline_free(d_spline); -} - -int -gr_squash_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - - for (unsigned int i = 0; i < d_inum; i++) - d_iwork[i] = in[i]; - - gsl_spline_init(d_spline, d_igrid, d_iwork, d_inum); - - for (unsigned int i = 0; i < d_onum; i++) - out[i] = gsl_spline_eval(d_spline, d_ogrid[i], d_accel); - - in += d_inum; - out += d_onum; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_squash_ff.h b/gnuradio-core/src/lib/general/gr_squash_ff.h deleted file mode 100644 index f7fea1648..000000000 --- a/gnuradio-core/src/lib/general/gr_squash_ff.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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_SQUASH_FF_H_ -# define INCLUDED_GR_SQUASH_FF_H_ - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gsl/gsl_errno.h> -#include <gsl/gsl_interp.h> -#include <gsl/gsl_spline.h> -/*! - * \brief implements cheap resampling of spectrum directly from - * spectral points, using gsl interpolation - * \ingroup misc - */ - -class gr_squash_ff; -typedef boost::shared_ptr<gr_squash_ff> gr_squash_ff_sptr; - -GR_CORE_API gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - -class GR_CORE_API gr_squash_ff : public gr_sync_block -{ - friend GR_CORE_API gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - size_t d_inum; - size_t d_onum; - double *d_igrid; - double *d_iwork; - double *d_ogrid; - - gsl_interp_accel *d_accel; - gsl_spline *d_spline; - - gr_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - public: - ~gr_squash_ff(); - - 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/general/gr_squash_ff.i b/gnuradio-core/src/lib/general/gr_squash_ff.i deleted file mode 100644 index c89b1c28d..000000000 --- a/gnuradio-core/src/lib/general/gr_squash_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,squash_ff); - -gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - -class gr_squash_ff : public gr_sync_block -{ -private: - gr_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - -}; - diff --git a/gnuradio-core/src/lib/general/gr_wavelet_ff.cc b/gnuradio-core/src/lib/general/gr_wavelet_ff.cc deleted file mode 100644 index f77c96e99..000000000 --- a/gnuradio-core/src/lib/general/gr_wavelet_ff.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 tewavelet 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 <stdexcept> -#include <gr_wavelet_ff.h> -#include <gr_io_signature.h> - -#include <stdio.h> - -// NB in this version, only Daubechies wavelets -// order is wavelet length, even, 2...20 - -gr_wavelet_ff_sptr -gr_make_wavelet_ff(int size, - int order, - bool forward) -{ - return gnuradio::get_initial_sptr(new gr_wavelet_ff(size, - order, - forward)); -} - -gr_wavelet_ff::gr_wavelet_ff(int size, - int order, - bool forward) - : gr_sync_block("wavelet_ff", - gr_make_io_signature(1, 1, size * sizeof(float)), - gr_make_io_signature(1, 1, size * sizeof(float))), - d_size(size), - d_order(order), - d_forward(forward) -{ - d_wavelet = gsl_wavelet_alloc(gsl_wavelet_daubechies, d_order); - if (d_wavelet == NULL) - throw std::runtime_error("can't allocate wavelet"); - d_workspace = gsl_wavelet_workspace_alloc(d_size); - if (d_workspace == NULL) - throw std::runtime_error("can't allocate wavelet workspace"); - d_temp = (double *) malloc(d_size*sizeof(double)); - if (d_workspace == NULL) - throw std::runtime_error("can't allocate wavelet double conversion temp"); -} - -gr_wavelet_ff::~gr_wavelet_ff() -{ - gsl_wavelet_free(d_wavelet); - gsl_wavelet_workspace_free(d_workspace); - free((char *) d_temp); -} - -int -gr_wavelet_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - for (int i = 0; i < d_size; i++) - d_temp[i] = in[i]; - - if (d_forward) - gsl_wavelet_transform_forward(d_wavelet, - d_temp, - 1, - d_size, - d_workspace); - else - gsl_wavelet_transform_inverse(d_wavelet, - d_temp, - 1, - d_size, - d_workspace); - - for (int i = 0; i < d_size; i++) - out[i] = d_temp[i]; - - in += d_size; - out += d_size; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_wavelet_ff.h b/gnuradio-core/src/lib/general/gr_wavelet_ff.h deleted file mode 100644 index 107a50fe2..000000000 --- a/gnuradio-core/src/lib/general/gr_wavelet_ff.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- 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. - */ -#ifndef INCLUDED_GR_WAVELET_FF_H -#define INCLUDED_GR_WAVELET_FF_H - -#include <gr_core_api.h> -#include <iostream> -#include <gr_sync_block.h> - -#include <gsl/gsl_errno.h> -#include <gsl/gsl_wavelet.h> - -class gr_wavelet_ff; -typedef boost::shared_ptr<gr_wavelet_ff> gr_wavelet_ff_sptr; - -GR_CORE_API gr_wavelet_ff_sptr -gr_make_wavelet_ff(int size = 1024, - int order = 20, - bool forward = true); - -/*! - * \brief compute wavelet transform using gsl routines - * \ingroup wavelet_blk - */ - -class GR_CORE_API gr_wavelet_ff : public gr_sync_block -{ - int d_size; - int d_order; - bool d_forward; - gsl_wavelet *d_wavelet; - gsl_wavelet_workspace *d_workspace; - double *d_temp; - - friend GR_CORE_API gr_wavelet_ff_sptr - gr_make_wavelet_ff(int size, - int order, - bool forward); - - gr_wavelet_ff(int size, - int order, - bool forward); - -public: - ~gr_wavelet_ff(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_WAVELET_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_wavelet_ff.i b/gnuradio-core/src/lib/general/gr_wavelet_ff.i deleted file mode 100644 index 9d4264170..000000000 --- a/gnuradio-core/src/lib/general/gr_wavelet_ff.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,wavelet_ff); - -gr_wavelet_ff_sptr gr_make_wavelet_ff(int size, int order, bool forward); - -class gr_wavelet_ff : public gr_sync_block -{ -private: - gr_wavelet_ff(int size, int order, bool forward); -}; - diff --git a/gnuradio-core/src/lib/general/gr_wvps_ff.cc b/gnuradio-core/src/lib/general/gr_wvps_ff.cc deleted file mode 100644 index 8a8dc56ac..000000000 --- a/gnuradio-core/src/lib/general/gr_wvps_ff.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_wvps_ff.h> -#include <gr_io_signature.h> -#include <string.h> - -static int -ceil_log2(int k) -{ - int m = 0; - for (int n = k-1; n > 0; n >>= 1) m++; - return m; -} - -gr_wvps_ff_sptr -gr_make_wvps_ff(int ilen) -{ - return gnuradio::get_initial_sptr(new gr_wvps_ff(ilen)); -} - -gr_wvps_ff::gr_wvps_ff(int ilen) - : gr_sync_block("wvps_ff", - gr_make_io_signature(1, 1, sizeof(float) * ilen), - gr_make_io_signature(1, 1, sizeof(float) * ceil_log2(ilen))), - d_ilen(ilen), d_olen(ceil_log2(ilen)) -{ -} - -// input vector assumed to be output from gsl wavelet computation - -int -gr_wvps_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - - // any power? - - if (in[0] == 0.0) { - for (int i = 0; i < d_olen; i++) - out[i] = 0.0; - - } else { - - // get power normalization from 0-th wavelet coefficient - - float scl = 1.0/(in[0]*in[0]); - int k = 1; - - // sum powers over sequences of bins, - // sequence lengths in increasing powers of 2 - - for (int e = 0; e < d_olen; e++) { - int m = 01<<e; - float sum = 0.0; - - for (int l = 0; l < m; l++) - sum += (in[k+l]*in[k+l]); - - out[e] = scl*sum; - k += m; - } - } - - in += d_ilen; - out += d_olen; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_wvps_ff.h b/gnuradio-core/src/lib/general/gr_wvps_ff.h deleted file mode 100644 index 7c8f26066..000000000 --- a/gnuradio-core/src/lib/general/gr_wvps_ff.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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_WVPS_FF_H -#define INCLUDED_GR_WVPS_FF_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_wvps_ff; -typedef boost::shared_ptr<gr_wvps_ff> gr_wvps_ff_sptr; - -GR_CORE_API gr_wvps_ff_sptr -gr_make_wvps_ff(int ilen); - - -/*! - * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients - * \ingroup wavelet_blk - */ -class GR_CORE_API gr_wvps_ff : public gr_sync_block -{ - friend GR_CORE_API gr_wvps_ff_sptr - gr_make_wvps_ff(int ilen); - - int d_ilen; - int d_olen; - - protected: - gr_wvps_ff(int ilen); - - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; - -#endif /* INCLUDED_GR_WVPS_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_wvps_ff.i b/gnuradio-core/src/lib/general/gr_wvps_ff.i deleted file mode 100644 index 877126fb2..000000000 --- a/gnuradio-core/src/lib/general/gr_wvps_ff.i +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -GR_SWIG_BLOCK_MAGIC(gr,wvps_ff); - -gr_wvps_ff_sptr gr_make_wvps_ff(int ilen); - -class gr_wvps_ff : public gr_sync_block -{ -private: - gr_wvps_ff(int ilen); -}; diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_classify.py b/gnuradio-core/src/python/gnuradio/gr/qa_classify.py deleted file mode 100755 index ac5b53b57..000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_classify.py +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,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. -# - -import numpy -from gnuradio import gr, gr_unittest -import copy -#import pygsl.wavelet as wavelet # FIXME: pygsl not checked for in config -import math - - -def sqr(x): - return x*x - -def np2(k): - m = 0 - n = k - 1 - while n > 0: - m += 1 - return m - - -class test_classify(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - -# def test_000_(self): -# src_data = numpy.zeros(10) -# trg_data = numpy.zeros(10) -# src = gr.vector_source_f(src_data) -# dst = gr.vector_sink_f() -# self.tb.connect(src, dst) -# self.tb.run() -# rsl_data = dst.data() -# sum = 0 -# for (u,v) in zip(trg_data, rsl_data): -# w = u - v -# sum += w * w -# sum /= float(len(trg_data)) -# assert sum < 1e-6 - - def test_001_(self): - src_data = numpy.array([-1.0, 1.0, -1.0, 1.0]) - trg_data = src_data * 0.5 - src = gr.vector_source_f(src_data) - dst = gr.vector_sink_f() - rail = gr.rail_ff(-0.5, 0.5) - self.tb.connect(src, rail) - self.tb.connect(rail, dst) - self.tb.run() - rsl_data = dst.data() - sum = 0 - for (u, v) in zip(trg_data, rsl_data): - w = u - v - sum += w * w - sum /= float(len(trg_data)) - assert sum < 1e-6 - - def test_002_(self): - src_data = numpy.array([-1.0, - -1.0/2.0, - -1.0/3.0, - -1.0/4.0, - -1.0/5.0]) - trg_data = copy.deepcopy(src_data) - - src = gr.vector_source_f(src_data, False, len(src_data)) - st = gr.stretch_ff(-1.0/5.0, len(src_data)) - dst = gr.vector_sink_f(len(src_data)) - self.tb.connect(src, st) - self.tb.connect(st, dst) - self.tb.run() - rsl_data = dst.data() - sum = 0 - for (u, v) in zip(trg_data, rsl_data): - w = u - v - sum += w * w - sum /= float(len(trg_data)) - assert sum < 1e-6 - - def test_003_(self): - src_grid = (0.0, 1.0, 2.0, 3.0, 4.0) - trg_grid = copy.deepcopy(src_grid) - src_data = (0.0, 1.0, 0.0, 1.0, 0.0) - - src = gr.vector_source_f(src_data, False, len(src_grid)) - sq = gr.squash_ff(src_grid, trg_grid) - dst = gr.vector_sink_f(len(trg_grid)) - self.tb.connect(src, sq) - self.tb.connect(sq, dst) - self.tb.run() - rsl_data = dst.data() - sum = 0 - for (u, v) in zip(src_data, rsl_data): - w = u - v - sum += w * w - sum /= float(len(src_data)) - assert sum < 1e-6 - -# def test_004_(self): # FIXME: requires pygsl -# -# n = 256 -# o = 4 -# ws = wavelet.workspace(n) -# w = wavelet.daubechies(o) -# -# a = numpy.arange(n) -# b = numpy.sin(a*numpy.pi/16.0) -# c = w.transform_forward(b, ws) -# d = w.transform_inverse(c, ws) -# -# src = gr.vector_source_f(b, False, n) -# wv = gr.wavelet_ff(n, o, True) -# -# dst = gr.vector_sink_f(n) -# self.tb.connect(src, wv) -# self.tb.connect(wv, dst) -# self.tb.run() -# e = dst.data() -# -# sum = 0 -# for (u, v) in zip(c, e): -# w = u - v -# sum += w * w -# sum /= float(len(c)) -# assert sum < 1e-6 - - def test_005_(self): - - src_data = (1.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0) - - dwav = numpy.array(src_data) - wvps = numpy.zeros(3) - # wavelet power spectrum - scl = 1.0/sqr(dwav[0]) - k = 1 - for e in range(len(wvps)): - wvps[e] = scl*sqr(dwav[k:k+(01<<e)]).sum() - k += 01<<e - - src = gr.vector_source_f(src_data, False, len(src_data)) - kon = gr.wvps_ff(len(src_data)) - dst = gr.vector_sink_f(int(math.ceil(math.log(len(src_data), 2)))) - - self.tb.connect(src, kon) - self.tb.connect(kon, dst) - - self.tb.run() - snk_data = dst.data() - - sum = 0 - for (u,v) in zip(snk_data, wvps): - w = u - v - sum += w * w - sum /= float(len(snk_data)) - assert sum < 1e-6 - -if __name__ == '__main__': - gr_unittest.run(test_classify, "test_classify.xml") |