diff options
Diffstat (limited to 'gr-utils')
-rw-r--r-- | gr-utils/CMakeLists.txt | 8 | ||||
-rw-r--r-- | gr-utils/octave/cic_comp_taps.m | 45 | ||||
-rw-r--r-- | gr-utils/octave/cool.m | 50 | ||||
-rw-r--r-- | gr-utils/octave/db_width.m | 35 | ||||
-rw-r--r-- | gr-utils/octave/filter_tools.m | 42 | ||||
-rw-r--r-- | gr-utils/octave/is_complex.m | 24 | ||||
-rw-r--r-- | gr-utils/octave/lp_to_bp.m | 27 | ||||
-rw-r--r-- | gr-utils/octave/plot_cic_decimator_response.m | 44 | ||||
-rw-r--r-- | gr-utils/octave/plot_freq_response.m | 36 | ||||
-rw-r--r-- | gr-utils/octave/plot_freq_response_db.m | 39 | ||||
-rw-r--r-- | gr-utils/octave/plot_freq_response_phase.m | 38 | ||||
-rw-r--r-- | gr-utils/octave/plotfft.m | 40 | ||||
-rw-r--r-- | gr-utils/octave/plotfftavgk.m | 61 | ||||
-rw-r--r-- | gr-utils/octave/plotfftavgk_db.m | 73 | ||||
-rw-r--r-- | gr-utils/octave/plotfftk.m | 41 | ||||
-rw-r--r-- | gr-utils/octave/plotfftk_db.m | 43 | ||||
-rw-r--r-- | gr-utils/octave/put_markers.m | 32 | ||||
-rw-r--r-- | gr-utils/octave/rainbow.m | 53 | ||||
-rw-r--r-- | gr-utils/octave/read_char_binary.m | 45 | ||||
-rw-r--r-- | gr-utils/octave/read_complex_binary.m | 48 | ||||
-rw-r--r-- | gr-utils/octave/read_cshort_binary.m | 46 | ||||
-rw-r--r-- | gr-utils/octave/read_float_binary.m | 45 | ||||
-rw-r--r-- | gr-utils/octave/read_int_binary.m | 46 | ||||
-rw-r--r-- | gr-utils/octave/read_short_binary.m | 45 | ||||
-rw-r--r-- | gr-utils/octave/read_xambi.m | 46 | ||||
-rw-r--r-- | gr-utils/octave/runsum.m | 9 | ||||
-rw-r--r-- | gr-utils/octave/single_pole_iir.m | 25 | ||||
-rw-r--r-- | gr-utils/octave/split_vect.m | 15 | ||||
-rw-r--r-- | gr-utils/octave/write_float_binary.m | 40 | ||||
-rw-r--r-- | gr-utils/octave/write_short_binary.m | 40 | ||||
-rw-r--r-- | gr-utils/python/CMakeLists.txt (renamed from gr-utils/src/python/CMakeLists.txt) | 1 | ||||
-rw-r--r-- | gr-utils/python/README.plot (renamed from gr-utils/src/python/README.plot) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_modtool (renamed from gr-utils/src/python/gr_modtool) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_char (renamed from gr-utils/src/python/gr_plot_char) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_const (renamed from gr-utils/src/python/gr_plot_const) | 0 | ||||
-rw-r--r-- | gr-utils/python/gr_plot_fft (renamed from gr-utils/src/python/gr_plot_fft) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_fft_c (renamed from gr-utils/src/python/gr_plot_fft_c) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_fft_f (renamed from gr-utils/src/python/gr_plot_fft_f) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_float (renamed from gr-utils/src/python/gr_plot_float) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_int (renamed from gr-utils/src/python/gr_plot_int) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_iq (renamed from gr-utils/src/python/gr_plot_iq) | 0 | ||||
-rw-r--r-- | gr-utils/python/gr_plot_psd (renamed from gr-utils/src/python/gr_plot_psd) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_psd_c (renamed from gr-utils/src/python/gr_plot_psd_c) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_psd_f (renamed from gr-utils/src/python/gr_plot_psd_f) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_qt (renamed from gr-utils/src/python/gr_plot_qt) | 0 | ||||
-rwxr-xr-x | gr-utils/python/gr_plot_short (renamed from gr-utils/src/python/gr_plot_short) | 0 | ||||
-rw-r--r-- | gr-utils/python/gr_read_file_metadata (renamed from gr-utils/src/python/gr_read_file_metadata) | 6 | ||||
-rwxr-xr-x | gr-utils/python/grcc (renamed from gr-utils/src/python/grcc) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/CMakeLists.txt (renamed from gr-utils/src/python/modtool/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/README.modtool (renamed from gr-utils/src/python/modtool/README.modtool) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/__init__.py (renamed from gr-utils/src/python/modtool/__init__.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/cmakefile_editor.py (renamed from gr-utils/src/python/modtool/cmakefile_editor.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/code_generator.py (renamed from gr-utils/src/python/modtool/code_generator.py) | 16 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/CMakeLists.txt) | 20 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/apps/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/apps/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake (renamed from gr-utils/src/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake (renamed from gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake | 6 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake (renamed from gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake (renamed from gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake (renamed from gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake (renamed from gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake (renamed from gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in (renamed from gr-utils/src/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/docs/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/README.howto (renamed from gr-utils/src/python/modtool/gr-newmod/docs/README.howto) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in) | 2 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py (renamed from gr-utils/src/python/modtool/gr-newmod/docs/doxygen/swig_doc.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/grc/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/grc/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/include/howto/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/include/howto/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/include/howto/api.h (renamed from gr-utils/src/python/modtool/gr-newmod/include/howto/api.h) | 2 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/lib/CMakeLists.txt) | 4 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/lib/qa_howto.cc (renamed from gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.cc) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/lib/qa_howto.h (renamed from gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.h) | 2 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/lib/test_howto.cc (renamed from gr-utils/src/python/modtool/gr-newmod/lib/test_howto.cc) | 6 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/python/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/python/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/python/__init__.py (renamed from gr-utils/src/python/modtool/gr-newmod/python/__init__.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt (renamed from gr-utils/src/python/modtool/gr-newmod/swig/CMakeLists.txt) | 8 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/swig/howto_swig.i (renamed from gr-utils/src/python/modtool/gr-newmod/swig/howto_swig.i) | 2 | ||||
-rw-r--r-- | gr-utils/python/modtool/grc_xml_generator.py (renamed from gr-utils/src/python/modtool/grc_xml_generator.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool.conf.in (renamed from gr-utils/src/python/modtool/modtool.conf.in) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_add.py (renamed from gr-utils/src/python/modtool/modtool_add.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_base.py (renamed from gr-utils/src/python/modtool/modtool_base.py) | 2 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_disable.py (renamed from gr-utils/src/python/modtool/modtool_disable.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_help.py (renamed from gr-utils/src/python/modtool/modtool_help.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_info.py (renamed from gr-utils/src/python/modtool/modtool_info.py) | 6 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_makexml.py (renamed from gr-utils/src/python/modtool/modtool_makexml.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_newmod.py (renamed from gr-utils/src/python/modtool/modtool_newmod.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/modtool_rm.py (renamed from gr-utils/src/python/modtool/modtool_rm.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/modtool/parser_cc_block.py (renamed from gr-utils/src/python/modtool/parser_cc_block.py) | 6 | ||||
-rw-r--r-- | gr-utils/python/modtool/templates.py (renamed from gr-utils/src/python/modtool/templates.py) | 20 | ||||
-rw-r--r-- | gr-utils/python/modtool/util_functions.py (renamed from gr-utils/src/python/modtool/util_functions.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/plot_data.py (renamed from gr-utils/src/python/plot_data.py) | 3 | ||||
-rwxr-xr-x | gr-utils/python/plot_fft_base.py (renamed from gr-utils/src/python/plot_fft_base.py) | 0 | ||||
-rwxr-xr-x | gr-utils/python/plot_psd_base.py (renamed from gr-utils/src/python/plot_psd_base.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/pyqt_filter.py (renamed from gr-utils/src/python/pyqt_filter.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/pyqt_filter.ui (renamed from gr-utils/src/python/pyqt_filter.ui) | 0 | ||||
-rw-r--r-- | gr-utils/python/pyqt_plot.py (renamed from gr-utils/src/python/pyqt_plot.py) | 0 | ||||
-rw-r--r-- | gr-utils/python/pyqt_plot.ui (renamed from gr-utils/src/python/pyqt_plot.ui) | 0 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_filter_design | 874 | ||||
-rw-r--r-- | gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake | 26 | ||||
-rw-r--r-- | gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake | 26 |
115 files changed, 1232 insertions, 987 deletions
diff --git a/gr-utils/CMakeLists.txt b/gr-utils/CMakeLists.txt index 50ec7e86cf..decd973485 100644 --- a/gr-utils/CMakeLists.txt +++ b/gr-utils/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,7 +26,7 @@ ######################################################################## include(GrComponent) GR_REGISTER_COMPONENT("gr-utils" ENABLE_GR_UTILS - ENABLE_GR_CORE + ENABLE_GNURADIO_RUNTIME ENABLE_PYTHON ) @@ -42,13 +42,13 @@ include(GrPackage) CPACK_COMPONENT("utils" DISPLAY_NAME "Utils" DESCRIPTION "Misc gnuradio python utilities" - DEPENDS "core_python" + DEPENDS "runtime_python" ) ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(src/python) +add_subdirectory(python) endif(ENABLE_GR_UTILS) diff --git a/gr-utils/octave/cic_comp_taps.m b/gr-utils/octave/cic_comp_taps.m new file mode 100644 index 0000000000..9ae5cb1674 --- /dev/null +++ b/gr-utils/octave/cic_comp_taps.m @@ -0,0 +1,45 @@ +# +# 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. +# + +# See Altera Application Note AN455 +# +# R = decimation factor, 8-256 +# Fc = passband (one-sided) cutoff frequency +# L = number of taps + +function taps = cic_comp_taps(R, Fc, L) + M = 1; %% Differential delay + N = 4; %% Number of stages + B = 18; %% Coeffi. Bit-width + Fs = 64e6; %% (High) Sampling freq in Hz before decimation + Fo = R*Fc/Fs; %% Normalized Cutoff freq; 0<Fo<=0.5/M; + p = 2e3; %% Granularity + s = 0.25/p; %% Step size + fp = [0:s:Fo]; %% Pass band frequency samples + fs = (Fo+s):s:0.5; %% Stop band frequency samples + f = [fp fs]*2; %% Normalized frequency samples; 0<=f<=1 + Mp = ones(1,length(fp)); %% Pass band response; Mp(1)=1 + Mp(2:end) = abs( M*R*sin(pi*fp(2:end)/R)./sin(pi*M*fp(2:end))).^N; + Mf = [Mp zeros(1,length(fs))]; + f(end) = 1; + h = fir2(L,f,Mf); %% Filter length L+1 + taps = h/sum(h); %% Floating point coefficients +endfunction diff --git a/gr-utils/octave/cool.m b/gr-utils/octave/cool.m new file mode 100644 index 0000000000..f8b8a5cea6 --- /dev/null +++ b/gr-utils/octave/cool.m @@ -0,0 +1,50 @@ +%% Copyright (C) 1999,2000 Kai Habel +%% +%% This program 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 of the License, or +%% (at your option) any later version. +%% +%% This program 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, Boston, MA 02110-1301 USA + +%% -*- texinfo -*- +%% @deftypefn {Function File} {} cool (@var{n}) +%% Create color colormap. +%% (cyan to magenta) +%% The argument @var{n} should be a scalar. If it +%% is omitted, the length of the current colormap or 64 is assumed. +%% @end deftypefn +%% @seealso{colormap} + +%% Author: Kai Habel <kai.habel@gmx.de> + +function map = cool (number) + + if (nargin == 0) + number = rows (colormap); + elseif (nargin == 1) + if (! is_scalar (number)) + error ("cool: argument must be a scalar"); + end + else + usage ("cool (number)"); + end + + if (number == 1) + map = [0, 1, 1]; + elseif (number > 1) + r = (0:number - 1)' ./ (number - 1); + g = 1 - r; + b = ones (number, 1); + map = [r, g, b]; + else + map = []; + end + diff --git a/gr-utils/octave/db_width.m b/gr-utils/octave/db_width.m new file mode 100644 index 0000000000..e9c64cc795 --- /dev/null +++ b/gr-utils/octave/db_width.m @@ -0,0 +1,35 @@ +% +% Copyright 2001 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. + +%% find the N-dB width of the given filter +%% E.g., to find the 3-dB width, use width = db_width (taps, -3.0) +%% the result is normalized to nyquist == 1 + +function width = db_width (taps, db) + [H,w] = freqz (taps, 1, 4096); + Habs = abs(H); + max_H = max(Habs); + min_H = min(Habs); + threshold = max_H * 10^(db/20); + if (min_H > threshold) + error ("The %g dB point is never reached", db); + end + above = Habs >= threshold; + width = sum(above) / length (above); diff --git a/gr-utils/octave/filter_tools.m b/gr-utils/octave/filter_tools.m new file mode 100644 index 0000000000..552791e334 --- /dev/null +++ b/gr-utils/octave/filter_tools.m @@ -0,0 +1,42 @@ +% +% Copyright 2001 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. +% +%% equivalent to the C++ code in VrComplexFIRfilter::buildFilterComplex + +1; + +%% hamming window, nothing fancy + +function taps = build_filter_complex_lp (gain, ntaps) + + taps = gain * (0.54 - 0.46 * cos (2 * pi * (0:ntaps-1)' / (ntaps-1))); + +end + +%% old_taps describes a low pass filter, convert it to bandpass +%% centered at center_freq. center_freq is normalized to Fs (sampling freq) + +function new_taps = freq_shift_filter (old_taps, center_freq) + + ntaps = length(old_taps); + + new_taps = exp (j*2*pi*center_freq*(0:ntaps-1)') .* old_taps; + +end diff --git a/gr-utils/octave/is_complex.m b/gr-utils/octave/is_complex.m new file mode 100644 index 0000000000..4700467b15 --- /dev/null +++ b/gr-utils/octave/is_complex.m @@ -0,0 +1,24 @@ +# +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +function p = is_complex (x) + p = any (imag (x) != 0); +endfunction; diff --git a/gr-utils/octave/lp_to_bp.m b/gr-utils/octave/lp_to_bp.m new file mode 100644 index 0000000000..4e73f6cc73 --- /dev/null +++ b/gr-utils/octave/lp_to_bp.m @@ -0,0 +1,27 @@ +# +# Copyright 2002 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. +# + +## transform low pass coefficients into bandpass coefficients + +function bp_taps = lp_to_bp (lp_taps, center_freq, sampling_freq) + arg = 2 * pi * center_freq / sampling_freq; + bp_taps = lp_taps .* exp (j*arg*(0:length(lp_taps)-1)'); +endfunction diff --git a/gr-utils/octave/plot_cic_decimator_response.m b/gr-utils/octave/plot_cic_decimator_response.m new file mode 100644 index 0000000000..8f06aeafed --- /dev/null +++ b/gr-utils/octave/plot_cic_decimator_response.m @@ -0,0 +1,44 @@ +# +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +function plot_cic_decimator_response (R, N, M) + ## R = decimation rate + ## N = number of stages (4) + ## M = 1 + gain = (R*M)^N + npoints = 1024; + w = 0:1/npoints:1-1/npoints; + w = w * 1 * pi; + ## w = w * R; + length(w); + num = sin (w*R*M/2); + length (num); + ## H = sin (w*R*M/2) ./ sin (w/2) + denom = sin(w/2); + length (denom); + H = (num ./ denom) .^ N; + H(1) = gain; + H = H ./ gain; + plot (R*w/(2*pi), 10 * log10 (H)); + ## plot (R*w/(2*pi), H); +endfunction + + diff --git a/gr-utils/octave/plot_freq_response.m b/gr-utils/octave/plot_freq_response.m new file mode 100644 index 0000000000..335c51d626 --- /dev/null +++ b/gr-utils/octave/plot_freq_response.m @@ -0,0 +1,36 @@ +# +# Copyright 2001 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. +# + +function plot_freq_response (b,...) + if (nargin == 1) + ## Response of an FIR filter + a = 1; + elseif (nargin == 2) + ## response of an IIR filter + a = va_arg (); + endif + + [H,w] = freqz (b,a); + plot (w/(2*pi), abs(H)); + grid; + xlabel ('Normalized Frequency (Fs == 1)'); + ylabel ('Magnitude (linear)'); +endfunction diff --git a/gr-utils/octave/plot_freq_response_db.m b/gr-utils/octave/plot_freq_response_db.m new file mode 100644 index 0000000000..10ce7d6e17 --- /dev/null +++ b/gr-utils/octave/plot_freq_response_db.m @@ -0,0 +1,39 @@ +# +# Copyright 2001 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. +# + +function plot_freq_response_db (b,...) + if (nargin == 1) + ## Response of an FIR filter + a = 1; + elseif (nargin == 2) + ## response of an IIR filter + a = va_arg (); + endif + + [H,w] = freqz (b,a); + + grid; + xlabel ('Normalized Frequency (Fs == 1)'); + ylabel ('Magnitude Squared (dB)'); + abs = abs(H); +# plot (w/(2*pi), 20 * log10 (abs/max(abs))); + plot (w/(2*pi), 20 * log10 (abs)); +endfunction diff --git a/gr-utils/octave/plot_freq_response_phase.m b/gr-utils/octave/plot_freq_response_phase.m new file mode 100644 index 0000000000..591bd5b948 --- /dev/null +++ b/gr-utils/octave/plot_freq_response_phase.m @@ -0,0 +1,38 @@ +# +# Copyright 2001 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. +# + +function plot_freq_response_db (b,...) + if (nargin == 1) + ## Response of an FIR filter + a = 1; + elseif (nargin == 2) + ## response of an IIR filter + a = va_arg (); + endif + + [H,w] = freqz (b,a); + + grid; + xlabel ('Normalized Frequency (Fs == 1)'); + ylabel ('Phase (radians)'); + abs = abs(H); + plot (w/(2*pi), atan2(imag(H), real(H))) +endfunction diff --git a/gr-utils/octave/plotfft.m b/gr-utils/octave/plotfft.m new file mode 100644 index 0000000000..20a2efd4c2 --- /dev/null +++ b/gr-utils/octave/plotfft.m @@ -0,0 +1,40 @@ +# +# Copyright 2001 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. +# + +function plotfft (data, sample_rate) + + if (nargin == 1) + sample_rate = 1.0; + endif; + + if ((m = nargchk (1,2,nargin))) + usage (m); + endif; + + len = length(data); + s = fft (data.*kaiser(len, 5)); + + incr = sample_rate/len; + min_x = -sample_rate/2; + max_x = sample_rate/2 - incr; + plot (min_x:incr:max_x, abs(fftshift(s))); + +endfunction diff --git a/gr-utils/octave/plotfftavgk.m b/gr-utils/octave/plotfftavgk.m new file mode 100644 index 0000000000..c82c540f39 --- /dev/null +++ b/gr-utils/octave/plotfftavgk.m @@ -0,0 +1,61 @@ +# +# Copyright 2002 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. +# + +function plotfftavgk_db (all_data, k, sample_rate) + + if (nargin == 2) + sample_rate = 1.0; + endif; + + if ((m = nargchk (2,3,nargin))) + usage (m); + endif; + + ## len = 1024; + len = 8192; + ##window = ones (len, 1); + window = kaiser (len, 5); + + s = zeros (len,1); + + count = min (100, floor (length (all_data)/len)); + + for i = 0:count-1; + data = all_data((k+i)*len + 1 : (k+i+1)*len); + s = s + abs (fft (data.*window)); + endfor; + + s = s ./ count; + + incr = sample_rate/len; + min_x = -sample_rate/2; + max_x = sample_rate/2 - incr; + + x = min_x:incr:max_x; + ## y = 20 * log10(fftshift(s)); + y = (fftshift(s)); + plot (x, y); + + i = find (y == max(y)) + x(i) + y(i) + +endfunction diff --git a/gr-utils/octave/plotfftavgk_db.m b/gr-utils/octave/plotfftavgk_db.m new file mode 100644 index 0000000000..73cee140d0 --- /dev/null +++ b/gr-utils/octave/plotfftavgk_db.m @@ -0,0 +1,73 @@ +# +# Copyright 2001 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. +# + +function plotfftavgk_db (all_data, k, sample_rate) + + if (nargin == 2) + sample_rate = 1.0; + endif; + + if ((m = nargchk (2,3,nargin))) + usage (m); + endif; + + len = 1024; + ## len = 8192; + ##window = ones (len, 1); + #window = kaiser (len, 5); + window = hanning (len); + + s = zeros (len,1); + + count = min (100, floor (length (all_data)/len)); + + for i = 0:count-1; + data = all_data((k+i)*len + 1 : (k+i+1)*len); + s = s + abs (fft (data.*window)); + endfor; + + s = s ./ count; + + incr = sample_rate/len; + + if is_complex (all_data); + min_x = -sample_rate/2; + max_x = sample_rate/2 - incr; + + x = min_x:incr:max_x; + y = 20 * log10(fftshift(s)); + plot (x, y); + else + min_x = 0 + max_x = sample_rate/2 - incr; + + x = min_x:incr:max_x; + y = 20 * log10(s(1:len/2)); + plot (x, y); + + endif; + + + i = find (y == max(y)) + x(i) + y(i) + +endfunction diff --git a/gr-utils/octave/plotfftk.m b/gr-utils/octave/plotfftk.m new file mode 100644 index 0000000000..df2bf3aca0 --- /dev/null +++ b/gr-utils/octave/plotfftk.m @@ -0,0 +1,41 @@ +# +# Copyright 2001 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. +# + +function plotfftk (all_data, k, sample_rate) + + if (nargin == 2) + sample_rate = 1.0; + endif; + + if ((m = nargchk (2,3,nargin))) + usage (m); + endif; + + len = 1024; + data = all_data(k*len + 1 : (k+1)*len); + s = fft (data.*kaiser(len, 5)); + + incr = sample_rate/len; + min_x = -sample_rate/2; + max_x = sample_rate/2 - incr; + plot (min_x:incr:max_x, abs(fftshift(s))); + +endfunction diff --git a/gr-utils/octave/plotfftk_db.m b/gr-utils/octave/plotfftk_db.m new file mode 100644 index 0000000000..b2c85412f7 --- /dev/null +++ b/gr-utils/octave/plotfftk_db.m @@ -0,0 +1,43 @@ +# +# Copyright 2001 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. +# + +function plotfftk_db (all_data, k, sample_rate) + + if (nargin == 2) + sample_rate = 1.0; + endif; + + if ((m = nargchk (2,3,nargin))) + usage (m); + endif; + + len = 1024; + data = all_data(k*len + 1 : (k+1)*len); + ## s = fft (data.*kaiser(len, 5)); + ## s = fft (data.*hamming(len)); + s = fft (data.*hanning(len)); + + incr = sample_rate/len; + min_x = -sample_rate/2; + max_x = sample_rate/2 - incr; + plot (min_x:incr:max_x, 20 * log10(abs(fftshift(s)))); + +endfunction diff --git a/gr-utils/octave/put_markers.m b/gr-utils/octave/put_markers.m new file mode 100644 index 0000000000..1244d31aaf --- /dev/null +++ b/gr-utils/octave/put_markers.m @@ -0,0 +1,32 @@ +# +# Copyright 2002 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. +# + +function put_markers (y) + + if (nargin == 0) + y = 25; + endif; + + hold on; + plot (3.06e6, y, '@'); + plot (8.44e6, y, '@'); + +endfunction diff --git a/gr-utils/octave/rainbow.m b/gr-utils/octave/rainbow.m new file mode 100644 index 0000000000..35fab19b89 --- /dev/null +++ b/gr-utils/octave/rainbow.m @@ -0,0 +1,53 @@ +## Copyright (C) 1999,2000 Kai Habel +## +## This program 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 of the License, or +## (at your option) any later version. +## +## This program 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, Boston, MA 02110-1301 USA + +## -*- texinfo -*- +## @deftypefn {Function File} {} rainbow (@var{n}) +## Create color colormap. +## (red through yellow, green, cyan,blue,magenta to red) +## The argument @var{n} should be a scalar. If it +## is omitted, the length of the current colormap or 64 is assumed. +## @end deftypefn +## @seealso{colormap} + +## Author: Kai Habel <kai.habel@gmx.de> + +## 2001-09-13 Paul Kienzle <pkienzle@users.sf.net> +## * renamed to rainbow for use with tk_octave +## * remove reference to __current_color_map__ + +function map = rainbow (number) + + if (nargin == 0) + number = length(colormap); + elseif (nargin == 1) + if (! is_scalar (number)) + error ("rainbow: argument must be a scalar"); + endif + else + usage ("rainbow (number)"); + endif + + if (number == 1) + map = [1, 0, 0]; + elseif (number > 1) + h = linspace (0, 1, number)'; + map = hsv2rgb ([h, ones(number, 1), ones(number, 1)]); + else + map = []; + endif + +endfunction diff --git a/gr-utils/octave/read_char_binary.m b/gr-utils/octave/read_char_binary.m new file mode 100644 index 0000000000..029cea7834 --- /dev/null +++ b/gr-utils/octave/read_char_binary.m @@ -0,0 +1,45 @@ +% +% Copyright 2001 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. +% + +function v = read_char_binary (filename, count) + + %% usage: read_char (filename, [count]) + %% + %% open filename and return the contents, treating them as + %% signed short integers + %% + + m = nargchk (1,2,nargin); + if (m) + usage (m); + end + + if (nargin < 2) + count = Inf; + end + + f = fopen (filename, 'rb'); + if (f < 0) + v = 0; + else + v = fread (f, count, 'char'); + fclose (f); + end diff --git a/gr-utils/octave/read_complex_binary.m b/gr-utils/octave/read_complex_binary.m new file mode 100644 index 0000000000..eb81f0fa08 --- /dev/null +++ b/gr-utils/octave/read_complex_binary.m @@ -0,0 +1,48 @@ +% +% Copyright 2001 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. +% + +function v = read_complex_binary (filename, count) + + %% usage: read_complex_binary (filename, [count]) + %% + %% open filename and return the contents as a column vector, + %% treating them as 32 bit complex numbers + %% + + m = nargchk (1,2,nargin); + if (m) + usage (m); + end + + if (nargin < 2) + count = Inf; + end + + f = fopen (filename, 'rb'); + if (f < 0) + v = 0; + else + t = fread (f, [2, count], 'float'); + fclose (f); + v = t(1,:) + t(2,:)*i; + [r, c] = size (v); + v = reshape (v, c, r); + end diff --git a/gr-utils/octave/read_cshort_binary.m b/gr-utils/octave/read_cshort_binary.m new file mode 100644 index 0000000000..149b6ca88c --- /dev/null +++ b/gr-utils/octave/read_cshort_binary.m @@ -0,0 +1,46 @@ +% +% Copyright 2001,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. +% + +function cv = read_cshort_binary (filename, count) + + %% usage: read_cshort_binary (filename, [count]) + %% + %% open filename and return the contents, treating them as + %% signed short integers + %% + + m = nargchk (1,2,nargin); + if (m) + usage (m); + end + + if (nargin < 2) + count = Inf; + end + + f = fopen (filename, 'rb'); + if (f < 0) + cv = 0; + else + v = fread (f, count, 'short'); + fclose (f); + cv = v(1:2:end)+v(2:2:end)*j; + end diff --git a/gr-utils/octave/read_float_binary.m b/gr-utils/octave/read_float_binary.m new file mode 100644 index 0000000000..d27d09b9c1 --- /dev/null +++ b/gr-utils/octave/read_float_binary.m @@ -0,0 +1,45 @@ +% +% Copyright 2001 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. +% + +function v = read_float_binary (filename, count) + + %% usage: read_float_binary (filename, [count]) + %% + %% open filename and return the contents, treating them as + %% 32 bit floats + %% + + m = nargchk (1,2,nargin); + if (m) + usage (m); + end + + if (nargin < 2) + count = Inf; + end + + f = fopen (filename, 'rb'); + if (f < 0) + v = 0; + else + v = fread (f, count, 'float'); + fclose (f); + end diff --git a/gr-utils/octave/read_int_binary.m b/gr-utils/octave/read_int_binary.m new file mode 100644 index 0000000000..cd83bb6636 --- /dev/null +++ b/gr-utils/octave/read_int_binary.m @@ -0,0 +1,46 @@ +% +% Copyright 2001,2002 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. +% + +function v = read_int_binary (filename, count) + + %% usage: read_int_binary (filename, [count]) + %% + %% open filename and return the contents, treating them as + %% signed integers + %% + + m = nargchk (1,2,nargin); + if (m) + usage (m); + end + + if (nargin < 2) + count = Inf; + end + + f = fopen (filename, 'rb'); + if (f < 0) + v = 0; + else + v = fread (f, count, 'int'); + fclose (f); + end +end diff --git a/gr-utils/octave/read_short_binary.m b/gr-utils/octave/read_short_binary.m new file mode 100644 index 0000000000..7b42f5e2be --- /dev/null +++ b/gr-utils/octave/read_short_binary.m @@ -0,0 +1,45 @@ +% +% Copyright 2001 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. +% + +function v = read_short_binary (filename, count) + + %% usage: read_short_binary (filename, [count]) + %% + %% open filename and return the contents, treating them as + %% signed short integers + %% + + m = nargchk (1,2,nargin); + if (m) + usage (m); + end + + if (nargin < 2) + count = Inf; + end + + f = fopen (filename, 'rb'); + if (f < 0) + v = 0; + else + v = fread (f, count, 'short'); + fclose (f); + end diff --git a/gr-utils/octave/read_xambi.m b/gr-utils/octave/read_xambi.m new file mode 100644 index 0000000000..5adb94264e --- /dev/null +++ b/gr-utils/octave/read_xambi.m @@ -0,0 +1,46 @@ +# +# Copyright 2001,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. +# + +function v = read_xambi (filename) + + ## usage: read_xambi (filename) + ## + ## read binary cross-ambiguity data from radar tools. + ## The file has an 8 float header, the first word of which specifies + ## the number of doppler bins. + ## returns a matrix + + if ((m = nargchk (1,1,nargin))) + usage (m); + endif; + + f = fopen (filename, "rb"); + if (f < 0) + v = 0; + else + header = fread(f, 8, "float"); + ndoppler_bins = header(1) + min_doppler = header(2) + max_doppler = header(3) + v = fread (f, [ndoppler_bins, Inf], "float"); + fclose (f); + endif; +endfunction; diff --git a/gr-utils/octave/runsum.m b/gr-utils/octave/runsum.m new file mode 100644 index 0000000000..0f530b0159 --- /dev/null +++ b/gr-utils/octave/runsum.m @@ -0,0 +1,9 @@ +function r = runsum(x) + len = length(x); + r = zeros (1, len); + r(1) = x(1); + for i = 2:len; + r(i) = r(i-1) + x(i); + endfor; +endfunction; + diff --git a/gr-utils/octave/single_pole_iir.m b/gr-utils/octave/single_pole_iir.m new file mode 100644 index 0000000000..12e21f2acf --- /dev/null +++ b/gr-utils/octave/single_pole_iir.m @@ -0,0 +1,25 @@ +# +# Copyright 2002 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. +# + +function [b, a] = single_pole_iir (alpha) + b = [alpha]; + a = [1, alpha - 1]; +endfunction
\ No newline at end of file diff --git a/gr-utils/octave/split_vect.m b/gr-utils/octave/split_vect.m new file mode 100644 index 0000000000..aef5c5c383 --- /dev/null +++ b/gr-utils/octave/split_vect.m @@ -0,0 +1,15 @@ +% split vector into packets + +function y = split_vect(vect,N) + Z = floor(max(size(vect))/N); + y = []; + if(size(vect)(1)>size(vect)(2)) + v = vect'; + else + v = vect; + end + for i=1:Z + y(i,1:N) = v((i-1)*N+1:i*N); + end +end + diff --git a/gr-utils/octave/write_float_binary.m b/gr-utils/octave/write_float_binary.m new file mode 100644 index 0000000000..79414878b6 --- /dev/null +++ b/gr-utils/octave/write_float_binary.m @@ -0,0 +1,40 @@ +# +# Copyright 2001 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. +# + +function v = write_float_binary (data, filename) + + ## usage: write_float_binary (data, filename) + ## + ## open filename and write data to it as 32 bit floats + ## + + if ((m = nargchk (2,2,nargin))) + usage (m); + endif; + + f = fopen (filename, "wb"); + if (f < 0) + v = 0; + else + v = fwrite (f, data, "float"); + fclose (f); + endif; +endfunction; diff --git a/gr-utils/octave/write_short_binary.m b/gr-utils/octave/write_short_binary.m new file mode 100644 index 0000000000..72b3c408eb --- /dev/null +++ b/gr-utils/octave/write_short_binary.m @@ -0,0 +1,40 @@ +# +# Copyright 2001 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. +# + +function v = write_short_binary (data, filename) + + ## usage: write_short_binary (data, filename) + ## + ## open filename and write data to it as 16 bit shorts + ## + + if ((m = nargchk (2,2,nargin))) + usage (m); + endif; + + f = fopen (filename, "wb"); + if (f < 0) + v = 0; + else + v = fwrite (f, data, "short"); + fclose (f); + endif; +endfunction; diff --git a/gr-utils/src/python/CMakeLists.txt b/gr-utils/python/CMakeLists.txt index ef4e66d13f..fc21dc654d 100644 --- a/gr-utils/src/python/CMakeLists.txt +++ b/gr-utils/python/CMakeLists.txt @@ -49,7 +49,6 @@ GR_PYTHON_INSTALL( gr_plot_iq gr_plot_short gr_plot_qt - gr_filter_design gr_read_file_metadata grcc DESTINATION ${GR_RUNTIME_DIR} diff --git a/gr-utils/src/python/README.plot b/gr-utils/python/README.plot index 60f14c669c..60f14c669c 100644 --- a/gr-utils/src/python/README.plot +++ b/gr-utils/python/README.plot diff --git a/gr-utils/src/python/gr_modtool b/gr-utils/python/gr_modtool index 8c5c710aff..8c5c710aff 100755 --- a/gr-utils/src/python/gr_modtool +++ b/gr-utils/python/gr_modtool diff --git a/gr-utils/src/python/gr_plot_char b/gr-utils/python/gr_plot_char index a2b93a63c6..a2b93a63c6 100755 --- a/gr-utils/src/python/gr_plot_char +++ b/gr-utils/python/gr_plot_char diff --git a/gr-utils/src/python/gr_plot_const b/gr-utils/python/gr_plot_const index 749ad035b5..749ad035b5 100755 --- a/gr-utils/src/python/gr_plot_const +++ b/gr-utils/python/gr_plot_const diff --git a/gr-utils/src/python/gr_plot_fft b/gr-utils/python/gr_plot_fft index 4343481645..4343481645 100644 --- a/gr-utils/src/python/gr_plot_fft +++ b/gr-utils/python/gr_plot_fft diff --git a/gr-utils/src/python/gr_plot_fft_c b/gr-utils/python/gr_plot_fft_c index 43e808d95a..43e808d95a 100755 --- a/gr-utils/src/python/gr_plot_fft_c +++ b/gr-utils/python/gr_plot_fft_c diff --git a/gr-utils/src/python/gr_plot_fft_f b/gr-utils/python/gr_plot_fft_f index dee9b17dea..dee9b17dea 100755 --- a/gr-utils/src/python/gr_plot_fft_f +++ b/gr-utils/python/gr_plot_fft_f diff --git a/gr-utils/src/python/gr_plot_float b/gr-utils/python/gr_plot_float index 22806e48ae..22806e48ae 100755 --- a/gr-utils/src/python/gr_plot_float +++ b/gr-utils/python/gr_plot_float diff --git a/gr-utils/src/python/gr_plot_int b/gr-utils/python/gr_plot_int index 355ddf0189..355ddf0189 100755 --- a/gr-utils/src/python/gr_plot_int +++ b/gr-utils/python/gr_plot_int diff --git a/gr-utils/src/python/gr_plot_iq b/gr-utils/python/gr_plot_iq index bf8077b6b4..bf8077b6b4 100755 --- a/gr-utils/src/python/gr_plot_iq +++ b/gr-utils/python/gr_plot_iq diff --git a/gr-utils/src/python/gr_plot_psd b/gr-utils/python/gr_plot_psd index 059ca6b645..059ca6b645 100644 --- a/gr-utils/src/python/gr_plot_psd +++ b/gr-utils/python/gr_plot_psd diff --git a/gr-utils/src/python/gr_plot_psd_c b/gr-utils/python/gr_plot_psd_c index fff2bff0f2..fff2bff0f2 100755 --- a/gr-utils/src/python/gr_plot_psd_c +++ b/gr-utils/python/gr_plot_psd_c diff --git a/gr-utils/src/python/gr_plot_psd_f b/gr-utils/python/gr_plot_psd_f index ec67994797..ec67994797 100755 --- a/gr-utils/src/python/gr_plot_psd_f +++ b/gr-utils/python/gr_plot_psd_f diff --git a/gr-utils/src/python/gr_plot_qt b/gr-utils/python/gr_plot_qt index 153359f0c6..153359f0c6 100755 --- a/gr-utils/src/python/gr_plot_qt +++ b/gr-utils/python/gr_plot_qt diff --git a/gr-utils/src/python/gr_plot_short b/gr-utils/python/gr_plot_short index 702a2a94a6..702a2a94a6 100755 --- a/gr-utils/src/python/gr_plot_short +++ b/gr-utils/python/gr_plot_short diff --git a/gr-utils/src/python/gr_read_file_metadata b/gr-utils/python/gr_read_file_metadata index cf0cd5b116..4373cd054b 100644 --- a/gr-utils/src/python/gr_read_file_metadata +++ b/gr-utils/python/gr_read_file_metadata @@ -23,7 +23,7 @@ import sys from optparse import OptionParser -from gruel import pmt +import pmt from gnuradio.blocks import parse_file_metadata def main(filename, detached=False): @@ -40,7 +40,7 @@ def main(filename, detached=False): # Convert from string to PMT (should be a dictionary) try: - header = pmt.pmt_deserialize_str(header_str) + header = pmt.deserialize_str(header_str) except RuntimeError: sys.stderr.write("Could not deserialize header: invalid or corrupt data file.\n") sys.exit(1) @@ -54,7 +54,7 @@ def main(filename, detached=False): break try: - extra = pmt.pmt_deserialize_str(extra_str) + extra = pmt.deserialize_str(extra_str) except RuntimeError: sys.stderr.write("Could not deserialize extras: invalid or corrupt data file.\n") sys.exit(1) diff --git a/gr-utils/src/python/grcc b/gr-utils/python/grcc index 7e5665dc05..7e5665dc05 100755 --- a/gr-utils/src/python/grcc +++ b/gr-utils/python/grcc diff --git a/gr-utils/src/python/modtool/CMakeLists.txt b/gr-utils/python/modtool/CMakeLists.txt index 7647c86f67..7647c86f67 100644 --- a/gr-utils/src/python/modtool/CMakeLists.txt +++ b/gr-utils/python/modtool/CMakeLists.txt diff --git a/gr-utils/src/python/modtool/README.modtool b/gr-utils/python/modtool/README.modtool index 84c2e66c11..84c2e66c11 100644 --- a/gr-utils/src/python/modtool/README.modtool +++ b/gr-utils/python/modtool/README.modtool diff --git a/gr-utils/src/python/modtool/__init__.py b/gr-utils/python/modtool/__init__.py index a242722ab4..a242722ab4 100644 --- a/gr-utils/src/python/modtool/__init__.py +++ b/gr-utils/python/modtool/__init__.py diff --git a/gr-utils/src/python/modtool/cmakefile_editor.py b/gr-utils/python/modtool/cmakefile_editor.py index 3d90b8d163..3d90b8d163 100644 --- a/gr-utils/src/python/modtool/cmakefile_editor.py +++ b/gr-utils/python/modtool/cmakefile_editor.py diff --git a/gr-utils/src/python/modtool/code_generator.py b/gr-utils/python/modtool/code_generator.py index fbe9aa92c2..33cebc68c4 100644 --- a/gr-utils/src/python/modtool/code_generator.py +++ b/gr-utils/python/modtool/code_generator.py @@ -31,14 +31,14 @@ class GRMTemplate(Cheetah.Template.Template): """ An extended template class """ def __init__(self, src, searchList): self.grtypelist = { - 'sync': 'gr_sync_block', - 'sink': 'gr_sync_block', - 'source': 'gr_sync_block', - 'decimator': 'gr_sync_decimator', - 'interpolator': 'gr_sync_interpolator', - 'general': 'gr_block', - 'tagged_stream': 'gr_tagged_stream_block', - 'hier': 'gr_hier_block2', + 'sync': 'sync_block', + 'sink': 'sync_block', + 'source': 'sync_block', + 'decimator': 'sync_decimator', + 'interpolator': 'sync_interpolator', + 'general': 'block', + 'tagged_stream': 'tagged_stream_block', + 'hier': 'hier_block2', 'noblock': ''} searchList['str_to_fancyc_comment'] = str_to_fancyc_comment searchList['str_to_python_comment'] = str_to_python_comment diff --git a/gr-utils/src/python/modtool/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt index 2ad81710b8..6f01385e84 100644 --- a/gr-utils/src/python/modtool/gr-newmod/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt @@ -83,8 +83,7 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) ######################################################################## # Find gnuradio build dependencies ######################################################################## -find_package(Gruel) -find_package(GnuradioCore) +find_package(GnuradioRuntime) find_package(CppUnit) # To run a more advanced search for GNU Radio and it's components and @@ -92,17 +91,12 @@ find_package(CppUnit) # of GR_REQUIRED_COMPONENTS (in all caps) and change "version" to the # minimum API compatible version required. # -# set(GR_REQUIRED_COMPONENTS CORE BLOCKS FILTER ...) +# set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER ...) # find_package(Gnuradio "version") -if(NOT GRUEL_FOUND) - message(FATAL_ERROR "Gruel required to compile howto") +if(NOT GNURADIO_RUNTIME_FOUND) + message(FATAL_ERROR "GnuRadio Runtime required to compile howto") endif() - -if(NOT GNURADIO_CORE_FOUND) - message(FATAL_ERROR "GnuRadio Core required to compile howto") -endif() - if(NOT CPPUNIT_FOUND) message(FATAL_ERROR "CppUnit required to compile howto") endif() @@ -113,16 +107,14 @@ endif() include_directories( ${CMAKE_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) link_directories( ${Boost_LIBRARY_DIRS} - ${GRUEL_LIBRARY_DIRS} ${CPPUNIT_LIBRARY_DIRS} - ${GNURADIO_CORE_LIBRARY_DIRS} + ${GNURADIO_RUNTIME_LIBRARY_DIRS} ) # Set component parameters diff --git a/gr-utils/src/python/modtool/gr-newmod/apps/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/apps/CMakeLists.txt index c837d77f67..c837d77f67 100644 --- a/gr-utils/src/python/modtool/gr-newmod/apps/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/apps/CMakeLists.txt diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake index 7ce4c49ae5..7ce4c49ae5 100644 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake index 9af308f84b..9af308f84b 100644 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake new file mode 100644 index 0000000000..99a4a6d2c0 --- /dev/null +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake @@ -0,0 +1,6 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GNURADIO_RUNTIME gnuradio-runtime) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake index 9331d5debc..9331d5debc 100644 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake index a2e4f3b34e..a2e4f3b34e 100644 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake index efdddf371f..efdddf371f 100644 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake index 6ba5ee3a5c..6ba5ee3a5c 100644 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake index 6174c034e9..6174c034e9 100644 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake +++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in b/gr-utils/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in index 9ae1ae4bd6..9ae1ae4bd6 100644 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in +++ b/gr-utils/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/docs/CMakeLists.txt index f16fbf6db4..f16fbf6db4 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/docs/CMakeLists.txt diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/README.howto b/gr-utils/python/modtool/gr-newmod/docs/README.howto index a0a6c0f19d..a0a6c0f19d 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/README.howto +++ b/gr-utils/python/modtool/gr-newmod/docs/README.howto diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt index 1b4479929b..1b4479929b 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in b/gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in index cb6a913bbe..71a6bb920b 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in @@ -679,7 +679,7 @@ INPUT_FILTER = # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. -FILTER_PATTERNS = *.py=@top_srcdir@/gnuradio-core/doc/other/doxypy.py +FILTER_PATTERNS = *.py=@top_srcdir@/doc/doxygen/other/doxypy.py # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in b/gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in index 50b8aa81d6..50b8aa81d6 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py index 5cd0b3c6c5..5cd0b3c6c5 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py index e8f026ab90..e8f026ab90 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py index 0132ab86fd..0132ab86fd 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py index 39823979f6..39823979f6 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py index 1522ac23f1..1522ac23f1 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py index 6255dda163..6255dda163 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py index 7a70e14a1a..7a70e14a1a 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py index a991530198..a991530198 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py index 629edd180d..629edd180d 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox b/gr-utils/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox index 708f8c6d98..708f8c6d98 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox b/gr-utils/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox index 6357044912..6357044912 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/swig_doc.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py index 4e1ce2e475..4e1ce2e475 100644 --- a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/swig_doc.py +++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py diff --git a/gr-utils/src/python/modtool/gr-newmod/grc/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/grc/CMakeLists.txt index d776de7523..d776de7523 100644 --- a/gr-utils/src/python/modtool/gr-newmod/grc/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/grc/CMakeLists.txt diff --git a/gr-utils/src/python/modtool/gr-newmod/include/howto/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/include/howto/CMakeLists.txt index 1cfb5a6eac..1cfb5a6eac 100644 --- a/gr-utils/src/python/modtool/gr-newmod/include/howto/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/include/howto/CMakeLists.txt diff --git a/gr-utils/src/python/modtool/gr-newmod/include/howto/api.h b/gr-utils/python/modtool/gr-newmod/include/howto/api.h index 5263a1cf70..db5f81f394 100644 --- a/gr-utils/src/python/modtool/gr-newmod/include/howto/api.h +++ b/gr-utils/python/modtool/gr-newmod/include/howto/api.h @@ -22,7 +22,7 @@ #ifndef INCLUDED_HOWTO_API_H #define INCLUDED_HOWTO_API_H -#include <gruel/attributes.h> +#include <gnuradio/attributes.h> #ifdef gnuradio_howto_EXPORTS # define HOWTO_API __GR_ATTR_EXPORT diff --git a/gr-utils/src/python/modtool/gr-newmod/lib/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt index a9df565cf2..312594149c 100644 --- a/gr-utils/src/python/modtool/gr-newmod/lib/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt @@ -29,7 +29,7 @@ list(APPEND howto_sources ) add_library(gnuradio-howto SHARED ${howto_sources}) -target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES}) +target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) set_target_properties(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS") ######################################################################## @@ -57,7 +57,7 @@ add_executable(test-howto ${test_howto_sources}) target_link_libraries( test-howto - ${GNURADIO_CORE_LIBRARIES} + ${GNURADIO_RUNTIME_LIBRARIES} ${Boost_LIBRARIES} ${CPPUNIT_LIBRARIES} gnuradio-howto diff --git a/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.cc b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.cc index f86aed4aa1..f86aed4aa1 100644 --- a/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.cc +++ b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.cc diff --git a/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.h b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h index 8eff956b61..23f0f7f33e 100644 --- a/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.h +++ b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h @@ -23,7 +23,7 @@ #ifndef _QA_HOWTO_H_ #define _QA_HOWTO_H_ -#include <gruel/attributes.h> +#include <gnuradio/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr-filter directory diff --git a/gr-utils/src/python/modtool/gr-newmod/lib/test_howto.cc b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc index bf344265d7..f01bd5a064 100644 --- a/gr-utils/src/python/modtool/gr-newmod/lib/test_howto.cc +++ b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc @@ -20,10 +20,14 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> -#include <gr_unittests.h> +#include <gnuradio/unittests.h> #include "qa_howto.h" #include <iostream> diff --git a/gr-utils/src/python/modtool/gr-newmod/python/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/python/CMakeLists.txt index 9901854c8f..9901854c8f 100644 --- a/gr-utils/src/python/modtool/gr-newmod/python/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/python/CMakeLists.txt diff --git a/gr-utils/src/python/modtool/gr-newmod/python/__init__.py b/gr-utils/python/modtool/gr-newmod/python/__init__.py index 575cbfc222..575cbfc222 100644 --- a/gr-utils/src/python/modtool/gr-newmod/python/__init__.py +++ b/gr-utils/python/modtool/gr-newmod/python/__init__.py diff --git a/gr-utils/src/python/modtool/gr-newmod/swig/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt index 1e3e59e2c4..b9925ea06f 100644 --- a/gr-utils/src/python/modtool/gr-newmod/swig/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt @@ -31,12 +31,8 @@ include(GrPython) ######################################################################## # Setup swig generation ######################################################################## -foreach(incdir ${GNURADIO_CORE_INCLUDE_DIRS}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig) -endforeach(incdir) - -foreach(incdir ${GRUEL_INCLUDE_DIRS}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gruel/swig) +foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS}) + list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig) endforeach(incdir) set(GR_SWIG_LIBRARIES gnuradio-howto) diff --git a/gr-utils/src/python/modtool/gr-newmod/swig/howto_swig.i b/gr-utils/python/modtool/gr-newmod/swig/howto_swig.i index 4627d48d34..1946fb47a8 100644 --- a/gr-utils/src/python/modtool/gr-newmod/swig/howto_swig.i +++ b/gr-utils/python/modtool/gr-newmod/swig/howto_swig.i @@ -2,7 +2,7 @@ #define HOWTO_API -%include "gnuradio.i" // the common stuff +%include "runtime_swig.i" // the common stuff //load generated python docstrings %include "howto_swig_doc.i" diff --git a/gr-utils/src/python/modtool/grc_xml_generator.py b/gr-utils/python/modtool/grc_xml_generator.py index 7ccd443196..7ccd443196 100644 --- a/gr-utils/src/python/modtool/grc_xml_generator.py +++ b/gr-utils/python/modtool/grc_xml_generator.py diff --git a/gr-utils/src/python/modtool/modtool.conf.in b/gr-utils/python/modtool/modtool.conf.in index 8b3df1b9cf..8b3df1b9cf 100644 --- a/gr-utils/src/python/modtool/modtool.conf.in +++ b/gr-utils/python/modtool/modtool.conf.in diff --git a/gr-utils/src/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py index 81103e460d..81103e460d 100644 --- a/gr-utils/src/python/modtool/modtool_add.py +++ b/gr-utils/python/modtool/modtool_add.py diff --git a/gr-utils/src/python/modtool/modtool_base.py b/gr-utils/python/modtool/modtool_base.py index 3f8f2bc3c7..a03334bedc 100644 --- a/gr-utils/src/python/modtool/modtool_base.py +++ b/gr-utils/python/modtool/modtool_base.py @@ -131,7 +131,7 @@ class ModTool(object): return False for f in files: if os.path.isfile(f) and f == 'CMakeLists.txt': - if re.search('find_package\(GnuradioCore\)', open(f).read()) is not None: + if re.search('find_package\(GnuradioRuntime\)', open(f).read()) is not None: self._info['version'] = '36' # Might be 37, check that later has_makefile = True elif re.search('GR_REGISTER_COMPONENT', open(f).read()) is not None: diff --git a/gr-utils/src/python/modtool/modtool_disable.py b/gr-utils/python/modtool/modtool_disable.py index 36725e5578..36725e5578 100644 --- a/gr-utils/src/python/modtool/modtool_disable.py +++ b/gr-utils/python/modtool/modtool_disable.py diff --git a/gr-utils/src/python/modtool/modtool_help.py b/gr-utils/python/modtool/modtool_help.py index 76d9fd28bd..76d9fd28bd 100644 --- a/gr-utils/src/python/modtool/modtool_help.py +++ b/gr-utils/python/modtool/modtool_help.py diff --git a/gr-utils/src/python/modtool/modtool_info.py b/gr-utils/python/modtool/modtool_info.py index 680bd41b99..0f0f66f3fd 100644 --- a/gr-utils/src/python/modtool/modtool_info.py +++ b/gr-utils/python/modtool/modtool_info.py @@ -127,10 +127,8 @@ class ModToolInfo(ModTool): try: cmakecache_fid = open(os.path.join(mod_info['build_dir'], 'CMakeCache.txt')) for line in cmakecache_fid: - if line.find('GNURADIO_CORE_INCLUDE_DIRS:%s' % path_or_internal) != -1: - inc_dirs += line.replace('GNURADIO_CORE_INCLUDE_DIRS:%s=' % path_or_internal, '').strip().split(';') - if line.find('GRUEL_INCLUDE_DIRS:%s' % path_or_internal) != -1: - inc_dirs += line.replace('GRUEL_INCLUDE_DIRS:%s=' % path_or_internal, '').strip().split(';') + if line.find('GNURADIO_RUNTIME_INCLUDE_DIRS:%s' % path_or_internal) != -1: + inc_dirs += line.replace('GNURADIO_RUNTIME_INCLUDE_DIRS:%s=' % path_or_internal, '').strip().split(';') except IOError: pass if len(inc_dirs) == 0 and self.options.suggested_dirs is not None: diff --git a/gr-utils/src/python/modtool/modtool_makexml.py b/gr-utils/python/modtool/modtool_makexml.py index 777cc09e1f..777cc09e1f 100644 --- a/gr-utils/src/python/modtool/modtool_makexml.py +++ b/gr-utils/python/modtool/modtool_makexml.py diff --git a/gr-utils/src/python/modtool/modtool_newmod.py b/gr-utils/python/modtool/modtool_newmod.py index 0613d5fbe1..0613d5fbe1 100644 --- a/gr-utils/src/python/modtool/modtool_newmod.py +++ b/gr-utils/python/modtool/modtool_newmod.py diff --git a/gr-utils/src/python/modtool/modtool_rm.py b/gr-utils/python/modtool/modtool_rm.py index 32dfee4806..32dfee4806 100644 --- a/gr-utils/src/python/modtool/modtool_rm.py +++ b/gr-utils/python/modtool/modtool_rm.py diff --git a/gr-utils/src/python/modtool/parser_cc_block.py b/gr-utils/python/modtool/parser_cc_block.py index 0d1d75f29a..703522c8fb 100644 --- a/gr-utils/src/python/modtool/parser_cc_block.py +++ b/gr-utils/python/modtool/parser_cc_block.py @@ -41,7 +41,7 @@ class ParserCCBlock(object): """ From a type identifier, returns the data type. E.g., for sizeof(int), it will return 'int'. Returns a list! """ - if 'gr_make_iosignaturev' in iosigcall: + if 'gr::io_signature::makev' in iosigcall: print 'tbi' raise ValueError return {'type': [_typestr_to_iotype(x) for x in typestr.split(',')], @@ -72,9 +72,9 @@ class ParserCCBlock(object): elif len(vlen_parts) > 1: return '*'.join(vlen_parts).strip() iosig = {} - iosig_regex = '(?P<incall>gr_make_io_signature[23v]?)\s*\(\s*(?P<inmin>[^,]+),\s*(?P<inmax>[^,]+),' + \ + iosig_regex = '(?P<incall>gr::io_signature::make[23v]?)\s*\(\s*(?P<inmin>[^,]+),\s*(?P<inmax>[^,]+),' + \ '\s*(?P<intype>(\([^\)]*\)|[^)])+)\),\s*' + \ - '(?P<outcall>gr_make_io_signature[23v]?)\s*\(\s*(?P<outmin>[^,]+),\s*(?P<outmax>[^,]+),' + \ + '(?P<outcall>gr::io_signature::make[23v]?)\s*\(\s*(?P<outmin>[^,]+),\s*(?P<outmax>[^,]+),' + \ '\s*(?P<outtype>(\([^\)]*\)|[^)])+)\)' iosig_match = re.compile(iosig_regex, re.MULTILINE).search(self.code_cc) try: diff --git a/gr-utils/src/python/modtool/templates.py b/gr-utils/python/modtool/templates.py index 0e5fba25cc..740ba5dabd 100644 --- a/gr-utils/src/python/modtool/templates.py +++ b/gr-utils/python/modtool/templates.py @@ -105,7 +105,7 @@ ${str_to_fancyc_comment($license)} \#include "config.h" \#endif -\#include <gr_io_signature.h> +\#include <gnuradio/io_signature.h> #if $blocktype == 'noblock' \#include <${modname}/${blockname}.h> #else @@ -153,9 +153,9 @@ namespace gr { * The private constructor */ ${blockname}_impl::${blockname}_impl(${strip_default_values($arglist)}) - : ${grblocktype}("${blockname}", - gr_make_io_signature($inputsig), - gr_make_io_signature($outputsig)$decimation) + : gr::${grblocktype}("${blockname}", + gr::io_signature::make($inputsig), + gr::io_signature::make($outputsig)$decimation) #if $blocktype == 'hier' { connect(self(), 0, d_firstblock, 0); @@ -251,7 +251,7 @@ ${str_to_fancyc_comment($license)} \#define INCLUDED_${modname.upper()}_${blockname.upper()}_H \#include <${modname}/api.h> -\#include <${grblocktype}.h> +\#include <gnuradio/${grblocktype}.h> namespace gr { namespace ${modname} { @@ -274,7 +274,7 @@ namespace gr { * \ingroup ${modname} * */ - class ${modname.upper()}_API ${blockname} : virtual public $grblocktype + class ${modname.upper()}_API ${blockname} : virtual public gr::$grblocktype { public: typedef boost::shared_ptr<${blockname}> sptr; @@ -298,7 +298,7 @@ namespace gr { ''' -# Python block (from grextras!) +# Python block Templates['block_python'] = '''\#!/usr/bin/env python ${str_to_python_comment($license)} # @@ -592,7 +592,7 @@ ${modname}_make_${blockname} (${strip_default_values($arglist)}) * The private constructor */ ${modname}_${blockname}::${modname}_${blockname} (${strip_default_values($arglist)}) - : ${grblocktype} ("${blockname}", + : gr_${grblocktype} ("${blockname}", gr_make_io_signature($inputsig), gr_make_io_signature($outputsig)$decimation) { @@ -677,7 +677,7 @@ class ${modname.upper()}_API $blockname }; #else -\#include <${grblocktype}.h> +\#include <gr_${grblocktype}.h> class ${modname}_${blockname}; @@ -690,7 +690,7 @@ ${modname.upper()}_API ${modname}_${blockname}_sptr ${modname}_make_${blockname} * \ingroup ${modname} * */ -class ${modname.upper()}_API ${modname}_${blockname} : public $grblocktype +class ${modname.upper()}_API ${modname}_${blockname} : public gr_$grblocktype { private: friend ${modname.upper()}_API ${modname}_${blockname}_sptr ${modname}_make_${blockname} (${strip_default_values($arglist)}); diff --git a/gr-utils/src/python/modtool/util_functions.py b/gr-utils/python/modtool/util_functions.py index c40dbd73bb..c40dbd73bb 100644 --- a/gr-utils/src/python/modtool/util_functions.py +++ b/gr-utils/python/modtool/util_functions.py diff --git a/gr-utils/src/python/plot_data.py b/gr-utils/python/plot_data.py index 242ca2a4b0..2ae3b1d5b3 100644 --- a/gr-utils/src/python/plot_data.py +++ b/gr-utils/python/plot_data.py @@ -18,6 +18,9 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # +""" +Utility to help plotting data from files. +""" try: import scipy diff --git a/gr-utils/src/python/plot_fft_base.py b/gr-utils/python/plot_fft_base.py index 4afdc3a360..4afdc3a360 100755 --- a/gr-utils/src/python/plot_fft_base.py +++ b/gr-utils/python/plot_fft_base.py diff --git a/gr-utils/src/python/plot_psd_base.py b/gr-utils/python/plot_psd_base.py index fe3c9e12b7..fe3c9e12b7 100755 --- a/gr-utils/src/python/plot_psd_base.py +++ b/gr-utils/python/plot_psd_base.py diff --git a/gr-utils/src/python/pyqt_filter.py b/gr-utils/python/pyqt_filter.py index 0c781f2347..0c781f2347 100644 --- a/gr-utils/src/python/pyqt_filter.py +++ b/gr-utils/python/pyqt_filter.py diff --git a/gr-utils/src/python/pyqt_filter.ui b/gr-utils/python/pyqt_filter.ui index 9853352e2e..9853352e2e 100644 --- a/gr-utils/src/python/pyqt_filter.ui +++ b/gr-utils/python/pyqt_filter.ui diff --git a/gr-utils/src/python/pyqt_plot.py b/gr-utils/python/pyqt_plot.py index 5650135abf..5650135abf 100644 --- a/gr-utils/src/python/pyqt_plot.py +++ b/gr-utils/python/pyqt_plot.py diff --git a/gr-utils/src/python/pyqt_plot.ui b/gr-utils/python/pyqt_plot.ui index 55c72fda26..55c72fda26 100644 --- a/gr-utils/src/python/pyqt_plot.ui +++ b/gr-utils/python/pyqt_plot.ui diff --git a/gr-utils/src/python/gr_filter_design b/gr-utils/src/python/gr_filter_design deleted file mode 100755 index cc21ea5e76..0000000000 --- a/gr-utils/src/python/gr_filter_design +++ /dev/null @@ -1,874 +0,0 @@ -#!/usr/bin/env python - -import sys, os, re, csv -from optparse import OptionParser -from gnuradio import gr, blks2, eng_notation - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Please install SciPy to run this script (http://www.scipy.org/)" - raise SystemExit, 1 - -try: - from PyQt4 import Qt, QtCore, QtGui -except ImportError: - print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)" - raise SystemExit, 1 - -try: - import PyQt4.Qwt5 as Qwt -except ImportError: - print "Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)" - raise SystemExit, 1 - -try: - from gnuradio.pyqt_filter import Ui_MainWindow -except ImportError: - print "Could not import from pyqt_filter. Please build with \"pyuic4 pyqt_filter.ui -o pyqt_filter.py\"" - raise SystemExit, 1 - - -class gr_plot_filter(QtGui.QMainWindow): - def __init__(self, qapp, options): - QtGui.QWidget.__init__(self, None) - self.gui = Ui_MainWindow() - self.gui.setupUi(self) - - self.connect(self.gui.action_save, - Qt.SIGNAL("activated()"), - self.action_save_dialog) - self.connect(self.gui.action_open, - Qt.SIGNAL("activated()"), - self.action_open_dialog) - - - self.connect(self.gui.filterTypeComboBox, - Qt.SIGNAL("currentIndexChanged(const QString&)"), - self.changed_filter_type) - self.connect(self.gui.filterDesignTypeComboBox, - Qt.SIGNAL("currentIndexChanged(const QString&)"), - self.changed_filter_design_type) - - self.connect(self.gui.designButton, - Qt.SIGNAL("released()"), - self.design) - - self.connect(self.gui.tabGroup, - Qt.SIGNAL("currentChanged(int)"), - self.tab_changed) - - self.connect(self.gui.nfftEdit, - Qt.SIGNAL("textEdited(QString)"), - self.nfft_edit_changed) - - self.gui.designButton.setShortcut(QtCore.Qt.Key_Return) - - self.taps = [] - self.fftdB = [] - self.fftDeg = [] - self.groupDelay = [] - self.nfftpts = int(10000) - self.gui.nfftEdit.setText(Qt.QString("%1").arg(self.nfftpts)) - - self.firFilters = ("Low Pass", "Band Pass", "Complex Band Pass", "Band Notch", - "High Pass", "Root Raised Cosine", "Gaussian") - self.optFilters = ("Low Pass", "Band Pass", "Complex Band Pass", - "Band Notch", "High Pass") - - self.set_windowed() - - # Initialize to LPF - self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage) - - # Set Axis labels - self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.xBottom, - "Frequency (Hz)") - self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.yLeft, - "Magnitude (dB)") - self.gui.timePlot.setAxisTitle(self.gui.timePlot.xBottom, - "Tap number") - self.gui.timePlot.setAxisTitle(self.gui.timePlot.yLeft, - "Amplitude") - self.gui.phasePlot.setAxisTitle(self.gui.phasePlot.xBottom, - "Frequency (Hz)") - self.gui.phasePlot.setAxisTitle(self.gui.phasePlot.yLeft, - "Phase (Radians)") - self.gui.groupPlot.setAxisTitle(self.gui.groupPlot.xBottom, - "Frequency (Hz)") - self.gui.groupPlot.setAxisTitle(self.gui.groupPlot.yLeft, - "Delay (sec)") - - # Set up plot curves - self.rcurve = Qwt.QwtPlotCurve("Real") - self.rcurve.attach(self.gui.timePlot) - self.icurve = Qwt.QwtPlotCurve("Imag") - self.icurve.attach(self.gui.timePlot) - - self.freqcurve = Qwt.QwtPlotCurve("PSD") - self.freqcurve.attach(self.gui.freqPlot) - - self.phasecurve = Qwt.QwtPlotCurve("Phase") - self.phasecurve.attach(self.gui.phasePlot) - - self.groupcurve = Qwt.QwtPlotCurve("Group Delay") - self.groupcurve.attach(self.gui.groupPlot) - - # Create zoom functionality for the plots - self.timeZoomer = Qwt.QwtPlotZoomer(self.gui.timePlot.xBottom, - self.gui.timePlot.yLeft, - Qwt.QwtPicker.PointSelection, - Qwt.QwtPicker.AlwaysOn, - self.gui.timePlot.canvas()) - - self.freqZoomer = Qwt.QwtPlotZoomer(self.gui.freqPlot.xBottom, - self.gui.freqPlot.yLeft, - Qwt.QwtPicker.PointSelection, - Qwt.QwtPicker.AlwaysOn, - self.gui.freqPlot.canvas()) - - self.phaseZoomer = Qwt.QwtPlotZoomer(self.gui.phasePlot.xBottom, - self.gui.phasePlot.yLeft, - Qwt.QwtPicker.PointSelection, - Qwt.QwtPicker.AlwaysOn, - self.gui.phasePlot.canvas()) - - self.groupZoomer = Qwt.QwtPlotZoomer(self.gui.groupPlot.xBottom, - self.gui.groupPlot.yLeft, - Qwt.QwtPicker.PointSelection, - Qwt.QwtPicker.AlwaysOn, - self.gui.groupPlot.canvas()) - - # Set up pen for colors and line width - blue = QtGui.qRgb(0x00, 0x00, 0xFF) - blueBrush = Qt.QBrush(Qt.QColor(blue)) - red = QtGui.qRgb(0xFF, 0x00, 0x00) - redBrush = Qt.QBrush(Qt.QColor(red)) - self.freqcurve.setPen(Qt.QPen(blueBrush, 2)) - self.rcurve.setPen(Qt.QPen(blueBrush, 2)) - self.icurve.setPen(Qt.QPen(redBrush, 2)) - self.phasecurve.setPen(Qt.QPen(blueBrush, 2)) - self.groupcurve.setPen(Qt.QPen(blueBrush, 2)) - - # Set up validators for edit boxes - self.intVal = Qt.QIntValidator(None) - self.dblVal = Qt.QDoubleValidator(None) - self.gui.nfftEdit.setValidator(self.intVal) - self.gui.sampleRateEdit.setValidator(self.dblVal) - self.gui.filterGainEdit.setValidator(self.dblVal) - self.gui.endofLpfPassBandEdit.setValidator(self.dblVal) - self.gui.startofLpfStopBandEdit.setValidator(self.dblVal) - self.gui.lpfStopBandAttenEdit.setValidator(self.dblVal) - self.gui.lpfPassBandRippleEdit.setValidator(self.dblVal) - self.gui.startofBpfPassBandEdit.setValidator(self.dblVal) - self.gui.endofBpfPassBandEdit.setValidator(self.dblVal) - self.gui.bpfTransitionEdit.setValidator(self.dblVal) - self.gui.bpfStopBandAttenEdit.setValidator(self.dblVal) - self.gui.bpfPassBandRippleEdit.setValidator(self.dblVal) - self.gui.startofBnfStopBandEdit.setValidator(self.dblVal) - self.gui.endofBnfStopBandEdit.setValidator(self.dblVal) - self.gui.bnfTransitionEdit.setValidator(self.dblVal) - self.gui.bnfStopBandAttenEdit.setValidator(self.dblVal) - self.gui.bnfPassBandRippleEdit.setValidator(self.dblVal) - self.gui.endofHpfStopBandEdit.setValidator(self.dblVal) - self.gui.startofHpfPassBandEdit.setValidator(self.dblVal) - self.gui.hpfStopBandAttenEdit.setValidator(self.dblVal) - self.gui.hpfPassBandRippleEdit.setValidator(self.dblVal) - self.gui.rrcSymbolRateEdit.setValidator(self.dblVal) - self.gui.rrcAlphaEdit.setValidator(self.dblVal) - self.gui.rrcNumTapsEdit.setValidator(self.dblVal) - self.gui.gausSymbolRateEdit.setValidator(self.dblVal) - self.gui.gausBTEdit.setValidator(self.dblVal) - self.gui.gausNumTapsEdit.setValidator(self.dblVal) - - self.gui.nTapsEdit.setText("0") - - self.filterWindows = {"Hamming Window" : gr.firdes.WIN_HAMMING, - "Hann Window" : gr.firdes.WIN_HANN, - "Blackman Window" : gr.firdes.WIN_BLACKMAN, - "Rectangular Window" : gr.firdes.WIN_RECTANGULAR, - "Kaiser Window" : gr.firdes.WIN_KAISER, - "Blackman-harris Window" : gr.firdes.WIN_BLACKMAN_hARRIS} - self.EQUIRIPPLE_FILT = 6 # const for equiripple filter window types - self.show() - - def changed_filter_type(self, ftype): - strftype = str(ftype.toAscii()) - if(ftype == "Low Pass"): - self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage) - elif(ftype == "Band Pass"): - self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage) - elif(ftype == "Complex Band Pass"): - self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage) - elif(ftype == "Band Notch"): - self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbnfPage) - elif(ftype == "High Pass"): - self.gui.filterTypeWidget.setCurrentWidget(self.gui.firhpfPage) - elif(ftype == "Root Raised Cosine"): - self.gui.filterTypeWidget.setCurrentWidget(self.gui.rrcPage) - elif(ftype == "Gaussian"): - self.gui.filterTypeWidget.setCurrentWidget(self.gui.gausPage) - - self.design() - - def changed_filter_design_type(self, design): - if(design == "Equiripple"): - self.set_equiripple() - else: - self.set_windowed() - - self.design() - - def set_equiripple(self): - # Stop sending the signal for this function - self.gui.filterTypeComboBox.blockSignals(True) - - self.equiripple = True - self.gui.lpfPassBandRippleLabel.setVisible(True) - self.gui.lpfPassBandRippleEdit.setVisible(True) - self.gui.bpfPassBandRippleLabel.setVisible(True) - self.gui.bpfPassBandRippleEdit.setVisible(True) - self.gui.bnfPassBandRippleLabel.setVisible(True) - self.gui.bnfPassBandRippleEdit.setVisible(True) - self.gui.hpfPassBandRippleLabel.setVisible(True) - self.gui.hpfPassBandRippleEdit.setVisible(True) - - # Save current type and repopulate the combo box for - # filters this window type can handle - currenttype = self.gui.filterTypeComboBox.currentText() - items = self.gui.filterTypeComboBox.count() - for i in xrange(items): - self.gui.filterTypeComboBox.removeItem(0) - self.gui.filterTypeComboBox.addItems(self.optFilters) - - # If the last filter type was valid for this window type, - # go back to it; otherwise, reset - try: - index = self.optFilters.index(currenttype) - self.gui.filterTypeComboBox.setCurrentIndex(index) - except ValueError: - pass - - # Tell gui its ok to start sending this signal again - self.gui.filterTypeComboBox.blockSignals(False) - - def set_windowed(self): - # Stop sending the signal for this function - self.gui.filterTypeComboBox.blockSignals(True) - - self.equiripple = False - self.gui.lpfPassBandRippleLabel.setVisible(False) - self.gui.lpfPassBandRippleEdit.setVisible(False) - self.gui.bpfPassBandRippleLabel.setVisible(False) - self.gui.bpfPassBandRippleEdit.setVisible(False) - self.gui.bnfPassBandRippleLabel.setVisible(False) - self.gui.bnfPassBandRippleEdit.setVisible(False) - self.gui.hpfPassBandRippleLabel.setVisible(False) - self.gui.hpfPassBandRippleEdit.setVisible(False) - - # Save current type and repopulate the combo box for - # filters this window type can handle - currenttype = self.gui.filterTypeComboBox.currentText() - items = self.gui.filterTypeComboBox.count() - for i in xrange(items): - self.gui.filterTypeComboBox.removeItem(0) - self.gui.filterTypeComboBox.addItems(self.firFilters) - - # If the last filter type was valid for this window type, - # go back to it; otherwise, reset - try: - index = self.optFilters.index(currenttype) - self.gui.filterTypeComboBox.setCurrentIndex(index) - except ValueError: - pass - - # Tell gui its ok to start sending this signal again - self.gui.filterTypeComboBox.blockSignals(False) - - def design(self): - ret = True - fs,r = self.gui.sampleRateEdit.text().toDouble() - ret = r and ret - gain,r = self.gui.filterGainEdit.text().toDouble() - ret = r and ret - - if(ret): - winstr = str(self.gui.filterDesignTypeComboBox.currentText().toAscii()) - ftype = str(self.gui.filterTypeComboBox.currentText().toAscii()) - - if(winstr == "Equiripple"): - designer = {"Low Pass" : self.design_opt_lpf, - "Band Pass" : self.design_opt_bpf, - "Complex Band Pass" : self.design_opt_cbpf, - "Band Notch" : self.design_opt_bnf, - "High Pass" : self.design_opt_hpf} - taps,params,r = designer[ftype](fs, gain) - - else: - designer = {"Low Pass" : self.design_win_lpf, - "Band Pass" : self.design_win_bpf, - "Complex Band Pass" : self.design_win_cbpf, - "Band Notch" : self.design_win_bnf, - "High Pass" : self.design_win_hpf, - "Root Raised Cosine" : self.design_win_rrc, - "Gaussian" : self.design_win_gaus} - wintype = self.filterWindows[winstr] - taps,params,r = designer[ftype](fs, gain, wintype) - - if(r): - self.draw_plots(taps, params) - - - # Filter design functions using a window - def design_win_lpf(self, fs, gain, wintype): - ret = True - pb,r = self.gui.endofLpfPassBandEdit.text().toDouble() - ret = r and ret - sb,r = self.gui.startofLpfStopBandEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.lpfStopBandAttenEdit.text().toDouble() - ret = r and ret - - if(ret): - tb = sb - pb - - taps = gr.firdes.low_pass_2(gain, fs, pb, tb, - atten, wintype) - params = {"fs": fs, "gain": gain, "wintype": wintype, - "filttype": "lpf", "pbend": pb, "sbstart": sb, - "atten": atten, "ntaps": len(taps)} - return (taps, params, ret) - else: - return ([], [], ret) - - def design_win_bpf(self, fs, gain, wintype): - ret = True - pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() - ret = r and ret - pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() - ret = r and ret - tb,r = self.gui.bpfTransitionEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() - ret = r and ret - - if(r): - taps = gr.firdes.band_pass_2(gain, fs, pb1, pb2, tb, - atten, wintype) - params = {"fs": fs, "gain": gain, "wintype": wintype, - "filttype": "bpf", "pbstart": pb1, "pbend": pb2, - "tb": tb, "atten": atten, "ntaps": len(taps)} - return (taps,params,r) - else: - return ([],[],r) - - def design_win_cbpf(self, fs, gain, wintype): - ret = True - pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() - ret = r and ret - pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() - ret = r and ret - tb,r = self.gui.bpfTransitionEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() - ret = r and ret - - if(r): - taps = gr.firdes.complex_band_pass_2(gain, fs, pb1, pb2, tb, - atten, wintype) - params = {"fs": fs, "gain": gain, "wintype": wintype, - "filttype": "cbpf", "pbstart": pb1, "pbend": pb2, - "tb": tb, "atten": atten, "ntaps": len(taps)} - return (taps,params,r) - else: - return ([],[],r) - - def design_win_bnf(self, fs, gain, wintype): - ret = True - pb1,r = self.gui.startofBnfStopBandEdit.text().toDouble() - ret = r and ret - pb2,r = self.gui.endofBnfStopBandEdit.text().toDouble() - ret = r and ret - tb,r = self.gui.bnfTransitionEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.bnfStopBandAttenEdit.text().toDouble() - ret = r and ret - - if(r): - taps = gr.firdes.band_reject_2(gain, fs, pb1, pb2, tb, - atten, wintype) - params = {"fs": fs, "gain": gain, "wintype": wintype, - "filttype": "bnf", "sbstart": pb1, "sbend": pb2, - "tb": tb, "atten": atten, "ntaps": len(taps)} - return (taps,params,r) - else: - return ([],[],r) - - def design_win_hpf(self, fs, gain, wintype): - ret = True - sb,r = self.gui.endofHpfStopBandEdit.text().toDouble() - ret = r and ret - pb,r = self.gui.startofHpfPassBandEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.hpfStopBandAttenEdit.text().toDouble() - ret = r and ret - - if(r): - tb = pb - sb - taps = gr.firdes.high_pass_2(gain, fs, pb, tb, - atten, wintype) - params = {"fs": fs, "gain": gain, "wintype": wintype, - "filttype": "hpf", "sbend": sb, "pbstart": pb, - "atten": atten, "ntaps": len(taps)} - return (taps,params,r) - else: - return ([],[],r) - - def design_win_rrc(self, fs, gain, wintype): - ret = True - sr,r = self.gui.rrcSymbolRateEdit.text().toDouble() - ret = r and ret - alpha,r = self.gui.rrcAlphaEdit.text().toDouble() - ret = r and ret - ntaps,r = self.gui.rrcNumTapsEdit.text().toInt() - ret = r and ret - - if(r): - taps = gr.firdes.root_raised_cosine(gain, fs, sr, - alpha, ntaps) - params = {"fs": fs, "gain": gain, "wintype": wintype, - "filttype": "rrc", "srate": sr, "alpha": alpha, - "ntaps": ntaps} - return (taps,params,r) - else: - return ([],[],r) - - def design_win_gaus(self, fs, gain, wintype): - ret = True - sr,r = self.gui.gausSymbolRateEdit.text().toDouble() - ret = r and ret - bt,r = self.gui.gausBTEdit.text().toDouble() - ret = r and ret - ntaps,r = self.gui.gausNumTapsEdit.text().toInt() - ret = r and ret - - if(r): - spb = fs / sr - taps = gr.firdes.gaussian(gain, spb, bt, ntaps) - params = {"fs": fs, "gain": gain, "wintype": wintype, - "filttype": "gaus", "srate": sr, "bt": bt, - "ntaps": ntaps} - return (taps,params,r) - else: - return ([],[],r) - - # Design Functions for Equiripple Filters - def design_opt_lpf(self, fs, gain): - ret = True - pb,r = self.gui.endofLpfPassBandEdit.text().toDouble() - ret = r and ret - sb,r = self.gui.startofLpfStopBandEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.lpfStopBandAttenEdit.text().toDouble() - ret = r and ret - ripple,r = self.gui.lpfPassBandRippleEdit.text().toDouble() - ret = r and ret - - if(ret): - try: - taps = blks2.optfir.low_pass(gain, fs, pb, sb, - ripple, atten) - except RuntimeError, e: - reply = QtGui.QMessageBox.information(self, "Filter did not converge", - e.args[0], "&Ok") - return ([],[],False) - else: - params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT, - "filttype": "lpf", "pbend": pb, "sbstart": sb, - "atten": atten, "ripple": ripple, "ntaps": len(taps)} - return (taps, params, ret) - else: - return ([], [], ret) - - def design_opt_bpf(self, fs, gain): - ret = True - pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() - ret = r and ret - pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() - ret = r and ret - tb,r = self.gui.bpfTransitionEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() - ret = r and ret - ripple,r = self.gui.bpfPassBandRippleEdit.text().toDouble() - ret = r and ret - - if(r): - sb1 = pb1 - tb - sb2 = pb2 + tb - try: - taps = blks2.optfir.band_pass(gain, fs, sb1, pb1, pb2, sb2, - ripple, atten) - except RuntimeError, e: - reply = QtGui.QMessageBox.information(self, "Filter did not converge", - e.args[0], "&Ok") - return ([],[],False) - - else: - params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT, - "filttype": "bpf", "pbstart": pb1, "pbend": pb2, - "tb": tb, "atten": atten, "ripple": ripple, - "ntaps": len(taps)} - return (taps,params,r) - else: - return ([],[],r) - - def design_opt_cbpf(self, fs, gain): - ret = True - pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() - ret = r and ret - pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() - ret = r and ret - tb,r = self.gui.bpfTransitionEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() - ret = r and ret - ripple,r = self.gui.bpfPassBandRippleEdit.text().toDouble() - ret = r and ret - - if(r): - sb1 = pb1 - tb - sb2 = pb2 + tb - try: - taps = blks2.optfir.complex_band_pass(gain, fs, sb1, pb1, pb2, sb2, - ripple, atten) - except RuntimeError, e: - reply = QtGui.QMessageBox.information(self, "Filter did not converge", - e.args[0], "&Ok") - return ([],[],False) - else: - params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT, - "filttype": "cbpf", "pbstart": pb1, "pbend": pb2, - "tb": tb, "atten": atten, "ripple": ripple, - "ntaps": len(taps)} - return (taps,params,r) - else: - return ([],[],r) - - def design_opt_bnf(self, fs, gain): - ret = True - sb1,r = self.gui.startofBnfStopBandEdit.text().toDouble() - ret = r and ret - sb2,r = self.gui.endofBnfStopBandEdit.text().toDouble() - ret = r and ret - tb,r = self.gui.bnfTransitionEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.bnfStopBandAttenEdit.text().toDouble() - ret = r and ret - ripple,r = self.gui.bnfPassBandRippleEdit.text().toDouble() - ret = r and ret - - if(r): - pb1 = sb1 - tb - pb2 = sb2 + tb - try: - taps = blks2.optfir.band_reject(gain, fs, pb1, sb1, sb2, pb2, - ripple, atten) - except RuntimeError, e: - reply = QtGui.QMessageBox.information(self, "Filter did not converge", - e.args[0], "&Ok") - return ([],[],False) - else: - params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT, - "filttype": "bnf", "sbstart": pb1, "sbend": pb2, - "tb": tb, "atten": atten, "ripple": ripple, - "ntaps": len(taps)} - return (taps,params,r) - else: - return ([],[],r) - - def design_opt_hpf(self, fs, gain): - ret = True - sb,r = self.gui.endofHpfStopBandEdit.text().toDouble() - ret = r and ret - pb,r = self.gui.startofHpfPassBandEdit.text().toDouble() - ret = r and ret - atten,r = self.gui.hpfStopBandAttenEdit.text().toDouble() - ret = r and ret - ripple,r = self.gui.hpfPassBandRippleEdit.text().toDouble() - ret = r and ret - - if(r): - try: - taps = blks2.optfir.high_pass(gain, fs, sb, pb, - atten, ripple) - except RuntimeError, e: - reply = QtGui.QMessageBox.information(self, "Filter did not converge", - e.args[0], "&Ok") - return ([],[],False) - else: - params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT, - "filttype": "hpf", "sbend": sb, "pbstart": pb, - "atten": atten, "ripple": ripple, - "ntaps": len(taps)} - return (taps,params,r) - else: - return ([],[],r) - - def nfft_edit_changed(self, nfft): - infft,r = nfft.toInt() - if(r and (infft != self.nfftpts)): - self.nfftpts = infft - self.update_freq_curves() - - def tab_changed(self, tab): - if(tab == 0): - self.update_freq_curves() - if(tab == 1): - self.update_time_curves() - if(tab == 2): - self.update_phase_curves() - if(tab == 3): - self.update_group_curves() - - def get_fft(self, fs, taps, Npts): - Ts = 1.0/fs - fftpts = fftpack.fft(taps, Npts) - self.freq = scipy.arange(0, fs, 1.0/(Npts*Ts)) - self.fftdB = 20.0*scipy.log10(abs(fftpts)) - self.fftDeg = scipy.unwrap(scipy.angle(fftpts)) - self.groupDelay = -scipy.diff(self.fftDeg) - - def update_time_curves(self): - ntaps = len(self.taps) - if(ntaps > 0): - if(type(self.taps[0]) == scipy.complex128): - self.rcurve.setData(scipy.arange(ntaps), self.taps.real) - self.icurve.setData(scipy.arange(ntaps), self.taps.imag) - else: - self.rcurve.setData(scipy.arange(ntaps), self.taps) - - # Reset the x-axis to the new time scale - ymax = 1.5 * max(self.taps) - ymin = 1.5 * min(self.taps) - self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom, - 0, ntaps) - self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft, - ymin, ymax) - - # Set the zoomer base to unzoom to the new axis - self.timeZoomer.setZoomBase() - - self.gui.timePlot.replot() - - def update_freq_curves(self): - npts = len(self.fftdB) - if(npts > 0): - self.freqcurve.setData(self.freq, self.fftdB) - - # Reset the x-axis to the new time scale - ymax = 1.5 * max(self.fftdB[0:npts/2]) - ymin = 1.1 * min(self.fftdB[0:npts/2]) - xmax = self.freq[npts/2] - xmin = self.freq[0] - self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom, - xmin, xmax) - self.gui.freqPlot.setAxisScale(self.gui.freqPlot.yLeft, - ymin, ymax) - - # Set the zoomer base to unzoom to the new axis - self.freqZoomer.setZoomBase() - - self.gui.freqPlot.replot() - - - def update_phase_curves(self): - npts = len(self.fftDeg) - if(npts > 0): - self.phasecurve.setData(self.freq, self.fftDeg) - - # Reset the x-axis to the new time scale - ymax = 1.5 * max(self.fftDeg[0:npts/2]) - ymin = 1.1 * min(self.fftDeg[0:npts/2]) - xmax = self.freq[npts/2] - xmin = self.freq[0] - self.gui.phasePlot.setAxisScale(self.gui.phasePlot.xBottom, - xmin, xmax) - self.gui.phasePlot.setAxisScale(self.gui.phasePlot.yLeft, - ymin, ymax) - - # Set the zoomer base to unzoom to the new axis - self.phaseZoomer.setZoomBase() - - self.gui.phasePlot.replot() - - def update_group_curves(self): - npts = len(self.groupDelay) - if(npts > 0): - self.groupcurve.setData(self.freq, self.groupDelay) - - # Reset the x-axis to the new time scale - ymax = 1.5 * max(self.groupDelay[0:npts/2]) - ymin = 1.1 * min(self.groupDelay[0:npts/2]) - xmax = self.freq[npts/2] - xmin = self.freq[0] - self.gui.groupPlot.setAxisScale(self.gui.groupPlot.xBottom, - xmin, xmax) - self.gui.groupPlot.setAxisScale(self.gui.groupPlot.yLeft, - ymin, ymax) - - # Set the zoomer base to unzoom to the new axis - self.groupZoomer.setZoomBase() - - self.gui.groupPlot.replot() - - def action_save_dialog(self): - filename = QtGui.QFileDialog.getSaveFileName(self, "Save CSV Filter File", ".", "") - try: - handle = open(filename, "wb") - except IOError: - reply = QtGui.QMessageBox.information(self, 'File Name', - ("Could not save to file: %s" % filename), - "&Ok") - return - - csvhandle = csv.writer(handle, delimiter=",") - for k in self.params.keys(): - csvhandle.writerow([k, self.params[k]]) - csvhandle.writerow(["taps",] + self.taps.tolist()) - handle.close() - - def action_open_dialog(self): - filename = QtGui.QFileDialog.getOpenFileName(self, "Open CSV Filter File", ".", "") - if(len(filename) == 0): - return - - try: - handle = open(filename, "rb") - except IOError: - reply = QtGui.QMessageBox.information(self, 'File Name', - ("Could not open file: %s" % filename), - "&Ok") - return - - csvhandle = csv.reader(handle, delimiter=",") - taps = [] - params = {} - for row in csvhandle: - if(row[0] != "taps"): - testcpx = re.findall("[+-]?\d+\.*\d*[Ee]?[-+]?\d+j", row[1]) - if(len(testcpx) > 0): # it's a complex - params[row[0]] = complex(row[1]) - else: # assume it's a float - try: # if it's not a float, its a string - params[row[0]] = float(row[1]) - except ValueError: - params[row[0]] = row[1] - else: - testcpx = re.findall("[+-]?\d+\.*\d*[Ee]?[-+]?\d+j", row[1]) - if(len(testcpx) > 0): # it's a complex - taps = [complex(r) for r in row[1:]] - else: - taps = [float(r) for r in row[1:]] - handle.close() - self.draw_plots(taps, params) - - self.gui.sampleRateEdit.setText(Qt.QString("%1").arg(params["fs"])) - self.gui.filterGainEdit.setText(Qt.QString("%1").arg(params["gain"])) - - # Set up GUI parameters for each filter type - if(params["filttype"] == "lpf"): - self.gui.filterTypeComboBox.setCurrentIndex(0) - self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"])) - - self.gui.endofLpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbend"])) - self.gui.startofLpfStopBandEdit.setText(Qt.QString("%1").arg(params["sbstart"])) - self.gui.lpfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"])) - if(params["wintype"] == self.EQUIRIPPLE_FILT): - self.gui.lpfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"])) - elif(params["filttype"] == "bpf"): - self.gui.filterTypeComboBox.setCurrentIndex(1) - self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"])) - - self.gui.startofBpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbstart"])) - self.gui.endofBpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbend"])) - self.gui.bpfTransitionEdit.setText(Qt.QString("%1").arg(params["tb"])) - self.gui.bpfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"])) - if(params["wintype"] == self.EQUIRIPPLE_FILT): - self.gui.bpfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"])) - elif(params["filttype"] == "cbpf"): - self.gui.filterTypeComboBox.setCurrentIndex(2) - self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"])) - - self.gui.startofBpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbstart"])) - self.gui.endofBpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbend"])) - self.gui.bpfTransitionEdit.setText(Qt.QString("%1").arg(params["tb"])) - self.gui.bpfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"])) - if(params["wintype"] == self.EQUIRIPPLE_FILT): - self.gui.bpfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"])) - elif(params["filttype"] == "bnf"): - self.gui.filterTypeComboBox.setCurrentIndex(3) - self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"])) - - self.gui.startofBnfStopBandEdit.setText(Qt.QString("%1").arg(params["sbstart"])) - self.gui.endofBnfStopBandEdit.setText(Qt.QString("%1").arg(params["sbend"])) - self.gui.bnfTransitionEdit.setText(Qt.QString("%1").arg(params["tb"])) - self.gui.bnfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"])) - if(params["wintype"] == self.EQUIRIPPLE_FILT): - self.gui.bnfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"])) - elif(params["filttype"] == "hpf"): - self.gui.filterTypeComboBox.setCurrentIndex(4) - self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"])) - - self.gui.endofHpfStopBandEdit.setText(Qt.QString("%1").arg(params["sbend"])) - self.gui.startofHpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbstart"])) - self.gui.hpfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"])) - if(params["wintype"] == self.EQUIRIPPLE_FILT): - self.gui.hpfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"])) - elif(params["filttype"] == "rrc"): - self.gui.filterTypeComboBox.setCurrentIndex(5) - self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"])) - - self.gui.rrcSymbolRateEdit.setText(Qt.QString("%1").arg(params["srate"])) - self.gui.rrcAlphaEdit.setText(Qt.QString("%1").arg(params["alpha"])) - self.gui.rrcNumTapsEdit.setText(Qt.QString("%1").arg(params["ntaps"])) - elif(params["filttype"] == "gaus"): - self.gui.filterTypeComboBox.setCurrentIndex(6) - self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"])) - - self.gui.gausSymbolRateEdit.setText(Qt.QString("%1").arg(params["srate"])) - self.gui.gausBTEdit.setText(Qt.QString("%1").arg(params["bt"])) - self.gui.gausNumTapsEdit.setText(Qt.QString("%1").arg(params["ntaps"])) - - def draw_plots(self, taps, params): - self.params = params - self.taps = scipy.array(taps) - self.get_fft(self.params["fs"], self.taps, self.nfftpts) - self.update_time_curves() - self.update_freq_curves() - self.update_phase_curves() - self.update_group_curves() - - self.gui.nTapsEdit.setText(Qt.QString("%1").arg(self.taps.size)) - - -def setup_options(): - usage="%prog: [options] (input_filename)" - description = "" - - parser = OptionParser(conflict_handler="resolve", - usage=usage, description=description) - return parser - -def main(args): - parser = setup_options() - (options, args) = parser.parse_args () - - app = Qt.QApplication(args) - gplt = gr_plot_filter(app, options) - app.exec_() - -if __name__ == '__main__': - main(sys.argv) - diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake deleted file mode 100644 index 3773588a70..0000000000 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core) - -FIND_PATH( - GNURADIO_CORE_INCLUDE_DIRS - NAMES gr_random.h - HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio - ${PC_GNURADIO_CORE_INCLUDEDIR} - PATHS /usr/local/include/gnuradio - /usr/include/gnuradio -) - -FIND_LIBRARY( - GNURADIO_CORE_LIBRARIES - NAMES gnuradio-core - HINTS $ENV{GNURADIO_CORE_DIR}/lib - ${PC_GNURADIO_CORE_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake deleted file mode 100644 index 58dff70444..0000000000 --- a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GRUEL gruel) - -FIND_PATH( - GRUEL_INCLUDE_DIRS - NAMES gruel/attributes.h - HINTS $ENV{GRUEL_DIR}/include - ${PC_GRUEL_INCLUDEDIR} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - GRUEL_LIBRARIES - NAMES gruel - HINTS $ENV{GRUEL_DIR}/lib - ${PC_GRUEL_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) -MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) |