diff options
26 files changed, 568 insertions, 41 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 47afd0511e..7706466c44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,6 +236,7 @@ add_subdirectory(gr-audio) add_subdirectory(gr-comedi) add_subdirectory(gr-analog) add_subdirectory(gr-digital) +add_subdirectory(gr-channels) add_subdirectory(gr-noaa) add_subdirectory(gr-pager) add_subdirectory(gr-qtgui) diff --git a/gr-channels/CMakeLists.txt b/gr-channels/CMakeLists.txt new file mode 100644 index 0000000000..54eb23fb0f --- /dev/null +++ b/gr-channels/CMakeLists.txt @@ -0,0 +1,111 @@ +# 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) + +######################################################################## +# Register component +######################################################################## +include(GrComponent) + +GR_REGISTER_COMPONENT("gr-channels" ENABLE_GR_CHANNELS + ENABLE_GRUEL + ENABLE_VOLK + Boost_FOUND + ENABLE_GR_CORE + ENABLE_GR_FFT + ENABLE_GR_FILTER + ENABLE_GR_ANALOG +) + +GR_SET_GLOBAL(GR_CHANNELS_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/lib + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +######################################################################## +# Begin conditional configuration +######################################################################## +if(ENABLE_GR_CHANNELS) + +######################################################################## +# Setup CPack components +######################################################################## +include(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_CHANNELS_DESCRIPTION "GNU Radio Channel Model Blocks") + +CPACK_COMPONENT("channels_runtime" + GROUP "Channel Models" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("channels_devel" + GROUP "Channel Models" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("channels_python" + GROUP "Channel Models" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;channels_runtime" +) + +CPACK_COMPONENT("channels_swig" + GROUP "Channel Models" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;channels_python;channels_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +add_subdirectory(include/channels) +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-channels.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-channels.pc +@ONLY) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-channels.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "channels_devel" +) + +endif(ENABLE_GR_CHANNELS) diff --git a/gr-channels/doc/CMakeLists.txt b/gr-channels/doc/CMakeLists.txt new file mode 100644 index 0000000000..53f878c215 --- /dev/null +++ b/gr-channels/doc/CMakeLists.txt @@ -0,0 +1,23 @@ +# 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. + +install( + FILES README.channels + DESTINATION ${GR_PKG_DOC_DIR} +) diff --git a/gr-channels/doc/README.channels b/gr-channels/doc/README.channels new file mode 100644 index 0000000000..2488266a0b --- /dev/null +++ b/gr-channels/doc/README.channels @@ -0,0 +1,13 @@ +This is the gr-channels package. It contains signal processing blocks to +simulate channel models. + +The Python namespace is in gnuradio.channels, which would be normally +imported as: + + from gnuradio import channels + +See the Doxygen documentation for details about the blocks available +in this package. A quick listing of the details can be found in Python +after importing by using: + + help(channels) diff --git a/gr-channels/doc/channels.dox b/gr-channels/doc/channels.dox new file mode 100644 index 0000000000..c4440b45b0 --- /dev/null +++ b/gr-channels/doc/channels.dox @@ -0,0 +1,23 @@ +/*! \page page_channels Channel Model Blocks + +\section Introduction + +This is the gr-channels package. It contains signal processing blocks to +simulate channel models. + +The Python namespace is in gnuradio.channels, which would be normally +imported as: + +\code + from gnuradio import channels +\endcode + +See the Doxygen documentation for details about the blocks available +in this package. A quick listing of the details can be found in Python +after importing by using: + +\code + help(channels) +\endcode + +*/ diff --git a/gr-channels/gnuradio-channels.pc.in b/gr-channels/gnuradio-channels.pc.in new file mode 100644 index 0000000000..9e6192db2b --- /dev/null +++ b/gr-channels/gnuradio-channels.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: gnuradio-channels +Description: GNU Radio's channel model blocks +Requires: gnuradio-core gnuradio-filter +Version: @LIBVER@ +Libs: -L${libdir} -lgnuradio-channels -lgnuradio-filter +Cflags: -I${includedir} diff --git a/gr-channels/grc/CMakeLists.txt b/gr-channels/grc/CMakeLists.txt new file mode 100644 index 0000000000..9e77fcc4ef --- /dev/null +++ b/gr-channels/grc/CMakeLists.txt @@ -0,0 +1,25 @@ +# 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. + +install(FILES + channels_block_tree.xml + channels_channel_model.xml + DESTINATION ${GRC_BLOCKS_DIR} + COMPONENT "channels_python" +) diff --git a/gr-channels/grc/channels_block_tree.xml b/gr-channels/grc/channels_block_tree.xml new file mode 100644 index 0000000000..587eebb6e9 --- /dev/null +++ b/gr-channels/grc/channels_block_tree.xml @@ -0,0 +1,35 @@ +<?xml version="1.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. +--> + +<!-- +################################################### +##Block Tree for GR Channel Model blocks. +################################################### + --> +<cat> + <name></name> <!-- Blank for Root Name --> + <cat> + <name>Channel Models</name> + <block>channels_channel_model</block> + </cat> +</cat> diff --git a/gr-filter/grc/filter_channel_model.xml b/gr-channels/grc/channels_channel_model.xml index 6d780974a2..f0d7ece3f8 100644 --- a/gr-filter/grc/filter_channel_model.xml +++ b/gr-channels/grc/channels_channel_model.xml @@ -6,10 +6,10 @@ --> <block> <name>Channel Model</name> - <key>channel_model</key> - <import>from gnuradio import filter</import> - <import>from gnuradio.filter import firdes</import> - <make>filter.channel_model( + <key>channels_channel_model</key> + <import>from gnuradio import channels</import> + <import>from gnuradio.channels import firdes</import> + <make>channels.channel_model( noise_voltage=$noise_voltage, frequency_offset=$freq_offset, epsilon=$epsilon, diff --git a/gr-channels/include/channels/CMakeLists.txt b/gr-channels/include/channels/CMakeLists.txt new file mode 100644 index 0000000000..a913b96819 --- /dev/null +++ b/gr-channels/include/channels/CMakeLists.txt @@ -0,0 +1,29 @@ +# 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. + +######################################################################## +# Install header files +######################################################################## +install(FILES + api.h + channel_model.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/channels + COMPONENT "channels_devel" +) + diff --git a/gr-channels/include/channels/api.h b/gr-channels/include/channels/api.h new file mode 100644 index 0000000000..41e65ca7cd --- /dev/null +++ b/gr-channels/include/channels/api.h @@ -0,0 +1,33 @@ +/* + * 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_CHANNELS_API_H +#define INCLUDED_CHANNELS_API_H + +#include <gruel/attributes.h> + +#ifdef gnuradio_channels_EXPORTS +# define CHANNELS_API __GR_ATTR_EXPORT +#else +# define CHANNELS_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_CHANNELS_API_H */ diff --git a/gr-filter/include/filter/channel_model.h b/gr-channels/include/channels/channel_model.h index 49c08181f7..e509933af0 100644 --- a/gr-filter/include/filter/channel_model.h +++ b/gr-channels/include/channels/channel_model.h @@ -20,15 +20,15 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_FILTER_CHANNEL_MODEL_H -#define INCLUDED_FILTER_CHANNEL_MODEL_H +#ifndef INCLUDED_CHANNELS_CHANNEL_MODEL_H +#define INCLUDED_CHANNELS_CHANNEL_MODEL_H -#include <filter/api.h> +#include <channels/api.h> #include <gr_hier_block2.h> #include <gr_types.h> namespace gr { - namespace filter { + namespace channels { /*! * \brief channel simulator @@ -44,10 +44,10 @@ namespace gr { * Multipath can be approximated in this model by using a FIR * filter representation of a multipath delay profile.. */ - class FILTER_API channel_model : virtual public gr_hier_block2 + class CHANNELS_API channel_model : virtual public gr_hier_block2 { public: - // gr::filter::channel_model::sptr + // gr::channels::channel_model::sptr typedef boost::shared_ptr<channel_model> sptr; /*! \brief Build the channel simulator. @@ -81,7 +81,7 @@ namespace gr { virtual double timing_offset() const = 0; }; - } /* namespace filter */ + } /* namespace channels */ } /* namespace gr */ -#endif /* INCLUDED_FILTER_CHANNEL_MODEL_H */ +#endif /* INCLUDED_CHANNELS_CHANNEL_MODEL_H */ diff --git a/gr-channels/lib/CMakeLists.txt b/gr-channels/lib/CMakeLists.txt new file mode 100644 index 0000000000..679586707f --- /dev/null +++ b/gr-channels/lib/CMakeLists.txt @@ -0,0 +1,55 @@ +# 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} + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_FILTER_INCLUDE_DIRS} + ${GR_ANALOG_INCLUDE_DIRS} + ${GR_CHANNELS_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} +) + +link_directories(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +list(APPEND channels_sources + channel_model_impl.cc +) + +list(APPEND channels_libs + volk + gnuradio-core + gnuradio-filter + gnuradio-analog + ${Boost_LIBRARIES} +) + +add_library(gnuradio-channels SHARED ${channels_sources}) +target_link_libraries(gnuradio-channels ${channels_libs}) +GR_LIBRARY_FOO(gnuradio-channels RUNTIME_COMPONENT "channels_runtime" DEVEL_COMPONENT "channels_devel") +add_dependencies(gnuradio-channels + channels_generated_includes channels_generated_swigs + gnuradio-core gnuradio-filter gnuradio-analog) diff --git a/gr-filter/lib/channel_model_impl.cc b/gr-channels/lib/channel_model_impl.cc index 88732d95d3..5b5586c1bd 100644 --- a/gr-filter/lib/channel_model_impl.cc +++ b/gr-channels/lib/channel_model_impl.cc @@ -25,7 +25,7 @@ #include <iostream> namespace gr { - namespace filter { + namespace channels { channel_model::sptr channel_model::make(double noise_voltage, @@ -57,13 +57,15 @@ namespace gr { d_taps.push_back(0); } - d_timing_offset = fractional_interpolator_cc::make(0, epsilon); + d_timing_offset = filter::fractional_interpolator_cc::make(0, epsilon); - d_multipath = fir_filter_ccc::make(1, d_taps); + d_multipath = filter::fir_filter_ccc::make(1, d_taps); d_noise_adder = gr_make_add_cc(); - d_noise = gr_make_noise_source_c(GR_GAUSSIAN, noise_voltage, noise_seed); - d_freq_offset = gr_make_sig_source_c(1, GR_SIN_WAVE, frequency_offset, 1.0, 0.0); + d_noise = analog::noise_source_c::make(analog::GR_GAUSSIAN, + noise_voltage, noise_seed); + d_freq_offset = analog::sig_source_c::make(1, analog::GR_SIN_WAVE, + frequency_offset, 1.0, 0.0); d_mixer_offset = gr_make_multiply_cc(); connect(self(), 0, d_timing_offset, 0); @@ -131,5 +133,5 @@ namespace gr { return d_timing_offset->interp_ratio(); } - } /* namespace filter */ + } /* namespace channels */ } /* namespace gr */ diff --git a/gr-filter/lib/channel_model_impl.h b/gr-channels/lib/channel_model_impl.h index 95a63d7904..9c36f6369e 100644 --- a/gr-filter/lib/channel_model_impl.h +++ b/gr-channels/lib/channel_model_impl.h @@ -20,31 +20,32 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H -#define INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H +#ifndef INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H +#define INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H #include <gr_top_block.h> -#include <gr_sig_source_c.h> #include <gr_add_cc.h> #include <gr_multiply_cc.h> -#include <gr_noise_source_c.h> -#include <filter/channel_model.h> +#include <analog/sig_source_c.h> +#include <analog/noise_source_c.h> +#include <channels/channel_model.h> #include <filter/fractional_interpolator_cc.h> #include <filter/fir_filter_ccc.h> namespace gr { - namespace filter { + namespace channels { - class FILTER_API channel_model_impl : public channel_model + class CHANNELS_API channel_model_impl : public channel_model { private: - gr_sig_source_c_sptr d_freq_offset; gr_add_cc_sptr d_noise_adder; - gr_noise_source_c_sptr d_noise; gr_multiply_cc_sptr d_mixer_offset; - fractional_interpolator_cc::sptr d_timing_offset; - fir_filter_ccc::sptr d_multipath; + analog::sig_source_c::sptr d_freq_offset; + analog::noise_source_c::sptr d_noise; + + filter::fractional_interpolator_cc::sptr d_timing_offset; + filter::fir_filter_ccc::sptr d_multipath; std::vector<gr_complex> d_taps; @@ -68,7 +69,7 @@ namespace gr { double timing_offset() const; }; - } /* namespace filter */ + } /* namespace channels */ } /* namespace gr */ -#endif /* INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H */ +#endif /* INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H */ diff --git a/gr-channels/python/CMakeLists.txt b/gr-channels/python/CMakeLists.txt new file mode 100644 index 0000000000..b394b32392 --- /dev/null +++ b/gr-channels/python/CMakeLists.txt @@ -0,0 +1,49 @@ +# 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/channels + COMPONENT "channels_python" +) + +######################################################################## +# Handle the unit tests +######################################################################## +if(ENABLE_TESTING) +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) + set(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-channels/python + ${CMAKE_BINARY_DIR}/gr-channels/swig + ${CMAKE_BINARY_DIR}/gr-analog/python + ${CMAKE_BINARY_DIR}/gr-analog/swig + ) + set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-channels) + 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-channels/python/__init__.py b/gr-channels/python/__init__.py new file mode 100644 index 0000000000..da50a05fc4 --- /dev/null +++ b/gr-channels/python/__init__.py @@ -0,0 +1,27 @@ +# +# 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. +# + +''' +This is the gr-channels package. This package provides GNU Radio +processing blocks for channel models and related functions. +''' + +from channels_swig import * diff --git a/gr-filter/python/qa_channel_model.py b/gr-channels/python/qa_channel_model.py index 7f1c61b4e3..31364700f5 100755 --- a/gr-filter/python/qa_channel_model.py +++ b/gr-channels/python/qa_channel_model.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -import filter_swig as filter +import analog_swig as analog +import channels_swig as channels import math class test_channel_model(gr_unittest.TestCase): @@ -37,9 +38,9 @@ class test_channel_model(gr_unittest.TestCase): fs = 1000 # baseband sampling rate freq = 100 - signal = gr.sig_source_c(fs, gr.GR_SIN_WAVE, freq, 1) + signal = analog.sig_source_c(fs, gr.GR_SIN_WAVE, freq, 1) head = gr.head(gr.sizeof_gr_complex, N) - op = filter.channel_model(0.0, 0.0, 1.0, [1,], 0) + op = channels.channel_model(0.0, 0.0, 1.0, [1,], 0) snk = gr.vector_sink_c() snk1 = gr.vector_sink_c() diff --git a/gr-channels/swig/CMakeLists.txt b/gr-channels/swig/CMakeLists.txt new file mode 100644 index 0000000000..e28d952e7a --- /dev/null +++ b/gr-channels/swig/CMakeLists.txt @@ -0,0 +1,53 @@ +# 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_TARGET_DEPS core_swig) + +set(GR_SWIG_INCLUDE_DIRS + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} + ${GR_FILTER_INCLUDE_DIRS} + ${GR_CHANNELS_INCLUDE_DIRS} +) + +set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/channels_swig_doc.i) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/channels) + +set(GR_SWIG_LIBRARIES gnuradio-channels) + +GR_SWIG_MAKE(channels_swig channels_swig.i) + +GR_SWIG_INSTALL( + TARGETS channels_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/channels + COMPONENT "channels_python" +) + +install( + FILES + channels_swig.i + ${CMAKE_CURRENT_BINARY_DIR}/channels_swig_doc.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "channels_swig" +) diff --git a/gr-channels/swig/channels_swig.i b/gr-channels/swig/channels_swig.i new file mode 100644 index 0000000000..364f8d0fbd --- /dev/null +++ b/gr-channels/swig/channels_swig.i @@ -0,0 +1,36 @@ +/* -*- 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 CHANNELS_API + +%include "gnuradio.i" + +//load generated python docstrings +%include "channels_swig_doc.i" + +%{ +#include "channels/channel_model.h" +%} + +%include "channels/channel_model.h" + +GR_SWIG_BLOCK_MAGIC2(channels, channel_model); diff --git a/gr-filter/examples/reconstruction.py b/gr-filter/examples/reconstruction.py index f4908006fc..75c224e79c 100755 --- a/gr-filter/examples/reconstruction.py +++ b/gr-filter/examples/reconstruction.py @@ -24,6 +24,12 @@ from gnuradio import gr, digital from gnuradio import filter try: + from gnuradio import channels +except ImportError: + print "Error: Program requires gr-channels." + sys.exit(1) + +try: import scipy from scipy import fftpack except ImportError: diff --git a/gr-filter/grc/CMakeLists.txt b/gr-filter/grc/CMakeLists.txt index 0940f1c73c..1ca23d560e 100644 --- a/gr-filter/grc/CMakeLists.txt +++ b/gr-filter/grc/CMakeLists.txt @@ -35,7 +35,6 @@ install(FILES filter_pfb_synthesizer.xml filter_rational_resampler_base_xxx.xml filter_single_pole_iir_filter_xx.xml - filter_channel_model.xml filter_low_pass_filter.xml filter_high_pass_filter.xml filter_band_pass_filter.xml diff --git a/gr-filter/grc/filter_block_tree.xml b/gr-filter/grc/filter_block_tree.xml index 976833abb8..9b72dcf605 100644 --- a/gr-filter/grc/filter_block_tree.xml +++ b/gr-filter/grc/filter_block_tree.xml @@ -53,6 +53,5 @@ <block>pfb_synthesizer_ccf</block> <block>rational_resampler_base_xxx</block> <block>single_pole_iir_filter_xx</block> - <block>channel_model</block> </cat> </cat> diff --git a/gr-filter/include/filter/CMakeLists.txt b/gr-filter/include/filter/CMakeLists.txt index 536b74b54e..9070a7489f 100644 --- a/gr-filter/include/filter/CMakeLists.txt +++ b/gr-filter/include/filter/CMakeLists.txt @@ -110,7 +110,6 @@ install(FILES pfb_synthesizer_ccf.h single_pole_iir_filter_cc.h single_pole_iir_filter_ff.h - channel_model.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/filter COMPONENT "filter_devel" ) diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt index c47528046a..3b4bf9f178 100644 --- a/gr-filter/lib/CMakeLists.txt +++ b/gr-filter/lib/CMakeLists.txt @@ -137,7 +137,6 @@ list(APPEND filter_sources pfb_synthesizer_ccf_impl.cc single_pole_iir_filter_cc_impl.cc single_pole_iir_filter_ff_impl.cc - channel_model_impl.cc ) list(APPEND filter_libs diff --git a/gr-filter/swig/filter_swig.i b/gr-filter/swig/filter_swig.i index 05b84d4d69..bb4eab381a 100644 --- a/gr-filter/swig/filter_swig.i +++ b/gr-filter/swig/filter_swig.i @@ -73,7 +73,6 @@ #include "filter/rational_resampler_base_scc.h" #include "filter/single_pole_iir_filter_cc.h" #include "filter/single_pole_iir_filter_ff.h" -#include "filter/channel_model.h" %} %include "filter/firdes.h" @@ -121,7 +120,6 @@ %include "filter/rational_resampler_base_scc.h" %include "filter/single_pole_iir_filter_cc.h" %include "filter/single_pole_iir_filter_ff.h" -%include "filter/channel_model.h" GR_SWIG_BLOCK_MAGIC2(filter, adaptive_fir_ccc); GR_SWIG_BLOCK_MAGIC2(filter, adaptive_fir_ccf); @@ -166,4 +164,3 @@ GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fsf); GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_scc); GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_cc); GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_ff); -GR_SWIG_BLOCK_MAGIC2(filter, channel_model); |