diff options
Diffstat (limited to 'gr-wavelet')
-rw-r--r-- | gr-wavelet/CMakeLists.txt | 109 | ||||
-rw-r--r-- | gr-wavelet/gnuradio-wavelet.pc.in | 11 | ||||
-rw-r--r-- | gr-wavelet/include/wavelet/CMakeLists.txt | 31 | ||||
-rw-r--r-- | gr-wavelet/include/wavelet/wavelet_api.h | 33 | ||||
-rw-r--r-- | gr-wavelet/include/wavelet/wavelet_squash_ff.h | 45 | ||||
-rw-r--r-- | gr-wavelet/include/wavelet/wavelet_wavelet_ff.h | 46 | ||||
-rw-r--r-- | gr-wavelet/include/wavelet/wavelet_wvps_ff.h | 44 | ||||
-rw-r--r-- | gr-wavelet/lib/CMakeLists.txt | 56 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_squash_ff_impl.cc | 93 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_squash_ff_impl.h | 58 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_wavelet_ff_impl.cc | 103 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_wavelet_ff_impl.h | 55 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_wvps_ff_impl.cc | 98 | ||||
-rw-r--r-- | gr-wavelet/lib/wavelet_wvps_ff_impl.h | 44 | ||||
-rw-r--r-- | gr-wavelet/python/CMakeLists.txt | 47 | ||||
-rw-r--r-- | gr-wavelet/python/__init__.py | 28 | ||||
-rwxr-xr-x | gr-wavelet/python/qa_classify.py | 181 | ||||
-rw-r--r-- | gr-wavelet/swig/CMakeLists.txt | 53 | ||||
-rw-r--r-- | gr-wavelet/swig/wavelet_swig.i | 48 |
19 files changed, 0 insertions, 1183 deletions
diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt deleted file mode 100644 index 555c326d1..000000000 --- a/gr-wavelet/CMakeLists.txt +++ /dev/null @@ -1,109 +0,0 @@ -# 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. - -######################################################################## -# Setup dependencies -######################################################################## -include(GrBoost) - -find_package(GSL) - -######################################################################## -# Register component -######################################################################## -include(GrComponent) - -GR_REGISTER_COMPONENT("gr-wavelet" ENABLE_GR_WAVELET - Boost_FOUND - ENABLE_GR_CORE - GSL_FOUND -) - -GR_SET_GLOBAL(GR_WAVELET_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/lib - ${CMAKE_CURRENT_SOURCE_DIR}/include/wavelet -) - -######################################################################## -# Begin conditional configuration -######################################################################## -if(ENABLE_GR_WAVELET) - -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_WAVELET_DESCRIPTION "GNU Radio Wavelet Blocks") - -CPACK_COMPONENT("wavelet_runtime" - GROUP "WAVELET" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "core_runtime" -) - -CPACK_COMPONENT("wavelet_devel" - GROUP "WAVELET" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "core_devel" -) - -CPACK_COMPONENT("wavelet_python" - GROUP "WAVELET" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "core_python;wavelet_runtime" -) - -CPACK_COMPONENT("wavelet_swig" - GROUP "WAVELET" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "core_swig;wavelet_python;wavelet_devel" -) - -######################################################################## -# Add subdirectories -######################################################################## -add_subdirectory(include/wavelet) -add_subdirectory(lib) -if(ENABLE_PYTHON) - add_subdirectory(swig) - add_subdirectory(python) -# add_subdirectory(grc) -endif(ENABLE_PYTHON) -#add_subdirectory(examples) -#add_subdirectory(doc) - -######################################################################## -# Create Pkg Config File -######################################################################## -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-wavelet.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-wavelet.pc -@ONLY) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-wavelet.pc - DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "wavelet_devel" -) - -endif(ENABLE_GR_WAVELET) diff --git a/gr-wavelet/gnuradio-wavelet.pc.in b/gr-wavelet/gnuradio-wavelet.pc.in deleted file mode 100644 index 998ae9056..000000000 --- a/gr-wavelet/gnuradio-wavelet.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gnuradio-wavelet -Description: Wavelet signal processing blocks for GNU Radio -Requires: gnuradio-core -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-wavelet -Cflags: -I${includedir} diff --git a/gr-wavelet/include/wavelet/CMakeLists.txt b/gr-wavelet/include/wavelet/CMakeLists.txt deleted file mode 100644 index a37a3b0cd..000000000 --- a/gr-wavelet/include/wavelet/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2011 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. - -######################################################################## -# Install header files -######################################################################## -install(FILES - wavelet_api.h - wavelet_squash_ff.h - wavelet_wavelet_ff.h - wavelet_wvps_ff.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "wavelet_devel" -) - diff --git a/gr-wavelet/include/wavelet/wavelet_api.h b/gr-wavelet/include/wavelet/wavelet_api.h deleted file mode 100644 index 68b2c04d7..000000000 --- a/gr-wavelet/include/wavelet/wavelet_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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_WAVELET_API_H -#define INCLUDED_WAVELET_API_H - -#include <gruel/attributes.h> - -#ifdef gnuradio_wavelet_EXPORTS -# define WAVELET_API __GR_ATTR_EXPORT -#else -# define WAVELET_API __GR_ATTR_IMPORT -#endif - -#endif /* INCLUDED_WAVELET_API_H */ diff --git a/gr-wavelet/include/wavelet/wavelet_squash_ff.h b/gr-wavelet/include/wavelet/wavelet_squash_ff.h deleted file mode 100644 index 582496916..000000000 --- a/gr-wavelet/include/wavelet/wavelet_squash_ff.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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_WAVELET_SQUASH_FF_H -#define INCLUDED_WAVELET_SQUASH_FF_H - -#include <wavelet_api.h> -#include <gr_sync_block.h> - -/*! - * \brief implements cheap resampling of spectrum directly from - * spectral points, using gsl interpolation - * \ingroup misc - */ -class wavelet_squash_ff; -typedef boost::shared_ptr<wavelet_squash_ff> wavelet_squash_ff_sptr; - -WAVELET_API wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - -class WAVELET_API wavelet_squash_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; - -#endif diff --git a/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h b/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h deleted file mode 100644 index 7d60dbdad..000000000 --- a/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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_WAVELET_WAVELET_FF_H -#define INCLUDED_WAVELET_WAVELET_FF_H - -#include <wavelet_api.h> -#include <gr_sync_block.h> - -class wavelet_wavelet_ff; -typedef boost::shared_ptr<wavelet_wavelet_ff> wavelet_wavelet_ff_sptr; - -WAVELET_API wavelet_wavelet_ff_sptr -wavelet_make_wavelet_ff(int size = 1024, - int order = 20, - bool forward = true); - -/*! - * \brief compute wavelet transform using gsl routines - * \ingroup wavelet_blk - */ - -class WAVELET_API wavelet_wavelet_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; - -#endif /* INCLUDED_WAVELET_WAVELET_FF_H */ diff --git a/gr-wavelet/include/wavelet/wavelet_wvps_ff.h b/gr-wavelet/include/wavelet/wavelet_wvps_ff.h deleted file mode 100644 index 4e2889b52..000000000 --- a/gr-wavelet/include/wavelet/wavelet_wvps_ff.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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_WAVELET_WVPS_FF_H -#define INCLUDED_WAVELET_WVPS_FF_H - -#include <wavelet_api.h> -#include <gr_sync_decimator.h> - -class wavelet_wvps_ff; -typedef boost::shared_ptr<wavelet_wvps_ff> wavelet_wvps_ff_sptr; - -WAVELET_API wavelet_wvps_ff_sptr -wavelet_make_wvps_ff(int ilen); - -/*! - * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients - * \ingroup wavelet_blk - */ -class WAVELET_API wavelet_wvps_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; - -#endif /* INCLUDED_WAVELET_WVPS_FF_H */ diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt deleted file mode 100644 index f446adb9c..000000000 --- a/gr-wavelet/lib/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -# 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. - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${GR_WAVELET_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${GSL_INCLUDE_DIRS} -) - -link_directories(${WAVELET_LIBRARY_DIRS}) -link_directories(${Boost_LIBRARY_DIRS}) -link_directories(${GSL_LIBRARY_DIRS}) -add_definitions(${GSL_DEFINITIONS}) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_wavelet_sources - wavelet_squash_ff_impl.cc - wavelet_wavelet_ff_impl.cc - wavelet_wvps_ff_impl.cc -) - -list(APPEND wavelet_libs - gnuradio-core - ${Boost_LIBRARIES} - ${WAVELET_LIBRARIES} - ${GSL_LIBRARIES} -) - -add_library(gnuradio-wavelet SHARED ${gr_wavelet_sources}) -target_link_libraries(gnuradio-wavelet ${wavelet_libs}) -GR_LIBRARY_FOO(gnuradio-wavelet RUNTIME_COMPONENT "wavelet_runtime" DEVEL_COMPONENT "wavelet_devel") diff --git a/gr-wavelet/lib/wavelet_squash_ff_impl.cc b/gr-wavelet/lib/wavelet_squash_ff_impl.cc deleted file mode 100644 index 89494a9c3..000000000 --- a/gr-wavelet/lib/wavelet_squash_ff_impl.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdexcept> -#include <wavelet_squash_ff_impl.h> -#include <gr_io_signature.h> - -// expect input vector of igrid.size y-values, -// produce output vector of ogrid.size y-values - -wavelet_squash_ff_sptr -wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid) -{ - return gnuradio::get_initial_sptr(new wavelet_squash_ff_impl(igrid, ogrid)); -} - -wavelet_squash_ff_impl::wavelet_squash_ff_impl(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 -} - -wavelet_squash_ff_impl::~wavelet_squash_ff_impl() -{ - free((char *) d_igrid); - free((char *) d_iwork); - free((char *) d_ogrid); - gsl_interp_accel_free(d_accel); - gsl_spline_free(d_spline); -} - -int -wavelet_squash_ff_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - 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/gr-wavelet/lib/wavelet_squash_ff_impl.h b/gr-wavelet/lib/wavelet_squash_ff_impl.h deleted file mode 100644 index dac50ddf2..000000000 --- a/gr-wavelet/lib/wavelet_squash_ff_impl.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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_WAVELET_SQUASH_FF_IMPL_H -#define INCLUDED_WAVELET_SQUASH_FF_IMPL_H - -#include <wavelet_api.h> -#include <wavelet_squash_ff.h> -#include <gsl/gsl_errno.h> -#include <gsl/gsl_interp.h> -#include <gsl/gsl_spline.h> - -class WAVELET_API wavelet_squash_ff_impl : public wavelet_squash_ff -{ - 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; - - wavelet_squash_ff_impl(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - friend WAVELET_API wavelet_squash_ff_sptr - wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - public: - ~wavelet_squash_ff_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_WAVELET_WAVELET_FF_IMPL_H */ diff --git a/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc b/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc deleted file mode 100644 index ccc1a6d8f..000000000 --- a/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the 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 <wavelet_wavelet_ff_impl.h> -#include <gr_io_signature.h> - -#include <stdio.h> - -// NB in this version, only Daubechies wavelets -// order is wavelet length, even, 2...20 - -wavelet_wavelet_ff_sptr -wavelet_make_wavelet_ff(int size, - int order, - bool forward) -{ - return gnuradio::get_initial_sptr(new wavelet_wavelet_ff_impl(size, order, forward)); -} - -wavelet_wavelet_ff_impl::wavelet_wavelet_ff_impl(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"); -} - -wavelet_wavelet_ff_impl::~wavelet_wavelet_ff_impl() -{ - gsl_wavelet_free(d_wavelet); - gsl_wavelet_workspace_free(d_workspace); - free((char *) d_temp); -} - -int -wavelet_wavelet_ff_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - 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/gr-wavelet/lib/wavelet_wavelet_ff_impl.h b/gr-wavelet/lib/wavelet_wavelet_ff_impl.h deleted file mode 100644 index dc33a4184..000000000 --- a/gr-wavelet/lib/wavelet_wavelet_ff_impl.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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_WAVELET_WAVELET_FF_IMPL_H -#define INCLUDED_WAVELET_WAVELET_FF_IMPL_H - -#include <wavelet_wavelet_ff.h> -#include <gsl/gsl_errno.h> -#include <gsl/gsl_wavelet.h> - -class WAVELET_API wavelet_wavelet_ff_impl : public wavelet_wavelet_ff -{ - int d_size; - int d_order; - bool d_forward; - gsl_wavelet *d_wavelet; - gsl_wavelet_workspace *d_workspace; - double *d_temp; - - friend WAVELET_API wavelet_wavelet_ff_sptr - wavelet_make_wavelet_ff(int size, - int order, - bool forward); - - wavelet_wavelet_ff_impl(int size, - int order, - bool forward); - -public: - ~wavelet_wavelet_ff_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_WAVELET_WAVELET_FF_IMPL_H */ diff --git a/gr-wavelet/lib/wavelet_wvps_ff_impl.cc b/gr-wavelet/lib/wavelet_wvps_ff_impl.cc deleted file mode 100644 index b86859b0a..000000000 --- a/gr-wavelet/lib/wavelet_wvps_ff_impl.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <wavelet_wvps_ff_impl.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; -} - -wavelet_wvps_ff_sptr -wavelet_make_wvps_ff(int ilen) -{ - return gnuradio::get_initial_sptr(new wavelet_wvps_ff_impl(ilen)); -} - -wavelet_wvps_ff_impl::wavelet_wvps_ff_impl(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 -wavelet_wvps_ff_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - 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/gr-wavelet/lib/wavelet_wvps_ff_impl.h b/gr-wavelet/lib/wavelet_wvps_ff_impl.h deleted file mode 100644 index 553469fde..000000000 --- a/gr-wavelet/lib/wavelet_wvps_ff_impl.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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_WAVELET_WVPS_FF_IMPL_H -#define INCLUDED_WAVELET_WVPS_FF_IMPL_H - -#include <wavelet_wvps_ff.h> - -class WAVELET_API wavelet_wvps_ff_impl : public wavelet_wvps_ff -{ - int d_ilen; - int d_olen; - - friend WAVELET_API wavelet_wvps_ff_sptr - wavelet_make_wvps_ff(int ilen); - - wavelet_wvps_ff_impl(int ilen); - - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_WAVELET_WVPS_FF_IMPL_H */ diff --git a/gr-wavelet/python/CMakeLists.txt b/gr-wavelet/python/CMakeLists.txt deleted file mode 100644 index 7f4d3a7af..000000000 --- a/gr-wavelet/python/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# 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. - -######################################################################## -include(GrPython) - -GR_PYTHON_INSTALL( - FILES - __init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/wavelet - COMPONENT "wavelet_python" -) - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-wavelet/python - ${CMAKE_BINARY_DIR}/gr-wavelet/swig -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-wavelet) - -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-wavelet/python/__init__.py b/gr-wavelet/python/__init__.py deleted file mode 100644 index 77e2ac7c2..000000000 --- a/gr-wavelet/python/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2011 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. -# - -''' -This is the gr-wavelet package. This package provides GNU Radio -processing blocks for wavelet transforms. -''' - -from wavelet_swig import * - diff --git a/gr-wavelet/python/qa_classify.py b/gr-wavelet/python/qa_classify.py deleted file mode 100755 index 5701bce8c..000000000 --- a/gr-wavelet/python/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 -import wavelet_swig - -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 = wavelet_swig.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 = wavelet_swig.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 = wavelet_swig.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") diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt deleted file mode 100644 index ea7a24b24..000000000 --- a/gr-wavelet/swig/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -# 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. - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_INCLUDE_DIRS - ${GR_WAVELET_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${GSL_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/wavelet_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/wavelet) - -set(GR_SWIG_LIBRARIES gnuradio-wavelet ${GSL_LDFLAGS}) - -GR_SWIG_MAKE(wavelet_swig wavelet_swig.i) - -GR_SWIG_INSTALL( - TARGETS wavelet_swig - DESTINATION ${GR_PYTHON_DIR}/gnuradio/wavelet - COMPONENT "wavelet_python" -) - -install( - FILES - wavelet_swig.i - ${CMAKE_CURRENT_BINARY_DIR}/wavelet_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "wavelet_swig" -) diff --git a/gr-wavelet/swig/wavelet_swig.i b/gr-wavelet/swig/wavelet_swig.i deleted file mode 100644 index b04efc508..000000000 --- a/gr-wavelet/swig/wavelet_swig.i +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- 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. - */ - -#define WAVELET_API - -%include "gnuradio.i" - -//load generated python docstrings -%include "wavelet_swig_doc.i" - -%{ -#include "wavelet_squash_ff.h" -#include "wavelet_wavelet_ff.h" -#include "wavelet_wvps_ff.h" -%} - -%include "wavelet_squash_ff.h" -%include "wavelet_wavelet_ff.h" -%include "wavelet_wvps_ff.h" - -GR_SWIG_BLOCK_MAGIC(wavelet,squash_ff); -wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - -GR_SWIG_BLOCK_MAGIC(wavelet,wavelet_ff); -wavelet_wavelet_ff_sptr wavelet_make_wavelet_ff(int size, int order, bool forward); - -GR_SWIG_BLOCK_MAGIC(wavelet,wvps_ff); -wavelet_wvps_ff_sptr wavelet_make_wvps_ff(int ilen); |