[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10136 - in gnuradio/branches/developers/n4hy/pfb_fbs/
From: |
n4hy |
Subject: |
[Commit-gnuradio] r10136 - in gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src: lib lib/filter lib/general lib/gengen lib/missing lib/runtime python/gnuradio/blks2impl python/gnuradio/gr |
Date: |
Fri, 19 Dec 2008 19:35:54 -0700 (MST) |
Author: n4hy
Date: 2008-12-19 19:35:52 -0700 (Fri, 19 Dec 2008)
New Revision: 10136
Added:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.h
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.i
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.h
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.i
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.h
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.i
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.h
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.i
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.h
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.i
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/posix_memalign.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/posix_memalign.h
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/qa_classify.py
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/Makefile.am
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/general.i
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.h
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.i
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_math.h
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/Makefile.am
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/runtime/gr_realtime.i
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk.py
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/Makefile.am
Log:
Bringing my branch up to date.
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/Makefile.am
2008-12-20 02:34:40 UTC (rev 10135)
+++ gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/Makefile.am
2008-12-20 02:35:52 UTC (rev 10136)
@@ -50,7 +50,9 @@
runtime/libruntime.la \
$(OMNITHREAD_LA) \
$(GRUEL_LA) \
- $(FFTW3F_LIBS)
+ $(FFTW3F_LIBS) \
+ $(GSL_LIBS) \
+ $(CBLAS_LIBS)
libgnuradio_core_qa_la_LIBADD = \
filter/libfilter-qa.la \
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -23,12 +23,12 @@
#include <config.h>
#endif
#include <gr_fir_fff_altivec.h>
-#include <stdlib.h>
#include <stdexcept>
#include <assert.h>
#include <gr_math.h>
#include <gr_altivec.h>
#include <dotprod_fff_altivec.h>
+#include "posix_memalign.h"
gr_fir_fff_altivec::gr_fir_fff_altivec()
: gr_fir_fff_generic(),
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/Makefile.am
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/Makefile.am
2008-12-20 02:35:52 UTC (rev 10136)
@@ -126,6 +126,7 @@
gr_pwr_squelch_cc.cc \
gr_pwr_squelch_ff.cc \
gr_quadrature_demod_cf.cc \
+ gr_rail_ff.cc \
gr_random.cc \
gr_regenerate_bb.cc \
gr_remez.cc \
@@ -138,6 +139,7 @@
gr_simple_framer.cc \
gr_simple_squelch_cc.cc \
gr_skiphead.cc \
+ gr_squash_ff.cc \
gr_squelch_base_cc.cc \
gr_squelch_base_ff.cc \
gr_stream_mux.cc \
@@ -145,6 +147,7 @@
gr_stream_to_vector.cc \
gr_streams_to_stream.cc \
gr_streams_to_vector.cc \
+ gr_stretch_ff.cc \
gr_test.cc \
gr_threshold_ff.cc \
gr_throttle.cc \
@@ -152,6 +155,8 @@
gr_vco_f.cc \
gr_vector_to_stream.cc \
gr_vector_to_streams.cc \
+ gr_wavelet_ff.cc \
+ gr_wvps_ff.cc \
gri_add_const_ss_generic.cc \
gri_char_to_float.cc \
gri_debugger_hook.cc \
@@ -277,6 +282,7 @@
gr_pwr_squelch_cc.h \
gr_pwr_squelch_ff.h \
gr_quadrature_demod_cf.h \
+ gr_rail_ff.h \
gr_random.h \
gr_regenerate_bb.h \
gr_remez.h \
@@ -289,6 +295,7 @@
gr_simple_framer.h \
gr_simple_framer_sync.h \
gr_simple_squelch_cc.h \
+ gr_squash_ff.h \
gr_skiphead.h \
gr_squelch_base_cc.h \
gr_squelch_base_ff.h \
@@ -297,6 +304,7 @@
gr_stream_to_vector.h \
gr_streams_to_stream.h \
gr_streams_to_vector.h \
+ gr_stretch_ff.h \
gr_test_types.h \
gr_test.h \
gr_threshold_ff.h \
@@ -306,6 +314,8 @@
gr_vco_f.h \
gr_vector_to_stream.h \
gr_vector_to_streams.h \
+ gr_wavelet_ff.h \
+ gr_wvps_ff.h \
gri_add_const_ss.h \
gri_agc_cc.h \
gri_agc_ff.h \
@@ -430,6 +440,7 @@
gr_pwr_squelch_cc.i \
gr_pwr_squelch_ff.i \
gr_quadrature_demod_cf.i \
+ gr_rail_ff.i \
gr_regenerate_bb.i \
gr_remez.i \
gr_rms_cf.i \
@@ -440,6 +451,7 @@
gr_simple_framer.i \
gr_simple_squelch_cc.i \
gr_skiphead.i \
+ gr_squash_ff.i \
gr_squelch_base_cc.i \
gr_squelch_base_ff.i \
gr_stream_mux.i \
@@ -447,6 +459,7 @@
gr_stream_to_vector.i \
gr_streams_to_stream.i \
gr_streams_to_vector.i \
+ gr_stretch_ff.i \
gr_test.i \
gr_threshold_ff.i \
gr_throttle.i \
@@ -455,6 +468,8 @@
gr_vector_to_stream.i \
gr_vector_to_streams.i \
gr_unpack_k_bits_bb.i \
+ gr_wavelet_ff.i \
+ gr_wvps_ff.i \
gri_agc_cc.i \
gri_agc_ff.i \
gri_agc2_cc.i \
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/general.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/general.i
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/general.i
2008-12-20 02:35:52 UTC (rev 10136)
@@ -134,6 +134,12 @@
#include <gr_scrambler_bb.h>
#include <gr_probe_mpsk_snr_c.h>
#include <gr_probe_density_b.h>
+#include <gr_rail_ff.h>
+#include <gr_squash_ff.h>
+#include <gr_stretch_ff.h>
+#include <gr_wavelet_ff.h>
+#include <gr_wvps_ff.h>
+
%}
%include "gr_nop.i"
@@ -248,3 +254,8 @@
%include "gr_scrambler_bb.i"
%include "gr_probe_mpsk_snr_c.i"
%include "gr_probe_density_b.i"
+%include "gr_rail_ff.i"
+%include "gr_squash_ff.i"
+%include "gr_stretch_ff.i"
+%include "gr_wavelet_ff.i"
+%include "gr_wvps_ff.i"
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.cc
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2007 Free Software Foundation, Inc.
+ * Copyright 2002,2007,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -739,6 +739,12 @@
taps[n] = 0.42 - 0.50 * cos ((2*M_PI * n) / (M-1)) - 0.08 * cos ((4*M_PI
* n) / (M-1));
break;
+ case WIN_BLACKMAN_hARRIS:
+ for (int n = -ntaps/2; n < ntaps/2; n++)
+ taps[n+ntaps/2] = 0.35875 + 0.48829*cos((2*M_PI * n) / (float)M) +
+ 0.14128*cos((4*M_PI * n) / (float)M) + 0.01168*cos((6*M_PI * n) /
(float)M);
+ break;
+
#if 0
case WIN_KAISER:
for (int n = 0; n < ntaps; n++)
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.h
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.h
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.h
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -40,7 +40,8 @@
WIN_HANN = 1, // max attenuation 44 dB
WIN_BLACKMAN = 2, // max attenuation 74 dB
WIN_RECTANGULAR = 3,
- WIN_KAISER = 4 // max attenuation a function of beta, google it
+ WIN_KAISER = 4, // max attenuation a function of beta, google it
+ WIN_BLACKMAN_hARRIS = 5,
};
@@ -68,12 +69,30 @@
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
+ /*!
+ * \brief use "window method" to design a low-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB required stopband attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuatin --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
static std::vector<float>
low_pass_2 (double gain,
double sampling_freq,
double cutoff_freq, // Hz beginning transition band
double transition_width, // Hz width of transition band
- double attenuation_dB, // attenuation dB
+ double attenuation_dB, // out of band attenuation dB
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
@@ -91,6 +110,7 @@
* maximum attenuation and passband ripple.
* \p beta: parameter for Kaiser window
*/
+
static std::vector<float>
high_pass (double gain,
double sampling_freq,
@@ -99,12 +119,30 @@
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
+ /*!
+ * \brief use "window method" to design a high-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
static std::vector<float>
high_pass_2 (double gain,
double sampling_freq,
double cutoff_freq, // Hz center of transition band
double transition_width, // Hz width of transition band
- double attenuation_dB, // attenuation dB
+ double attenuation_dB, // out of band attenuation dB
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
@@ -132,13 +170,32 @@
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
+ /*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
static std::vector<float>
band_pass_2 (double gain,
double sampling_freq,
double low_cutoff_freq, // Hz beginning transition band
double high_cutoff_freq, // Hz beginning transition band
double transition_width, // Hz width of transition band
- double attenuation_dB, // attenuation dB
+ double attenuation_dB, // out of band attenuation dB
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
@@ -167,17 +224,35 @@
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
+ /*!
+ * \brief use "window method" to design a complex band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
static std::vector<gr_complex>
complex_band_pass_2 (double gain,
double sampling_freq,
double low_cutoff_freq, // Hz beginning transition band
double high_cutoff_freq, // Hz beginning transition band
double transition_width, // Hz width of transition band
- double attenuation_dB, // attenuation dB
+ double attenuation_dB, // out of band attenuation dB
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
-
/*!
* \brief use "window method" to design a band-reject FIR filter
*
@@ -203,13 +278,32 @@
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
+ /*!
+ * \brief use "window method" to design a band-reject FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
static std::vector<float>
band_reject_2 (double gain,
double sampling_freq,
double low_cutoff_freq, // Hz beginning transition band
double high_cutoff_freq, // Hz beginning transition band
double transition_width, // Hz width of transition band
- double attenuation_dB, // attenuation dB
+ double attenuation_dB, // out of band attenuation dB
win_type window = WIN_HAMMING,
double beta = 6.76); // used only with Kaiser
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.i
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_firdes.i
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,4 +1,24 @@
/* -*- C++ -*- */
+/*
+ * Copyright 2002,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.
+ */
/*!
* \brief Finite Impulse Response (FIR) filter design functions.
@@ -14,7 +34,8 @@
WIN_HANN = 1, // max attenuation 44 dB
WIN_BLACKMAN = 2, // max attenuation 74 dB
WIN_RECTANGULAR = 3,
- WIN_KAISER = 4 // max attenuation variable with beta, google it
+ WIN_KAISER = 4, // max attenuation variable with beta, google it
+ WIN_BLACKMAN_hARRIS = 5,
};
// ... class methods ...
@@ -43,6 +64,33 @@
) throw(std::out_of_range);
/*!
+ * \brief use "window method" to design a low-pass FIR filter
+ * using alternative design criteria
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+ static std::vector<float>
+ low_pass_2 (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation
+ win_type window = WIN_HAMMING,
+ double beta = 6.76 // used only with Kaiser
+ ) throw(std::out_of_range);
+
+ /*!
* \brief use "window method" to design a high-pass FIR filter
*
* \p gain: overall gain of filter (typically 1.0)
@@ -56,6 +104,7 @@
* maximum attenuation and passband ripple.
* \p beta: parameter for Kaiser window
*/
+
static std::vector<float>
high_pass (double gain,
double sampling_freq,
@@ -66,6 +115,34 @@
) throw(std::out_of_range);
/*!
+ * \brief use "window method" to design a high-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ high_pass_2 (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+
+ /*!
* \brief use "window method" to design a band-pass FIR filter
*
* \p gain: overall gain of filter (typically 1.0)
@@ -80,6 +157,7 @@
* maximum attenuation and passband ripple.
* \p beta: parameter for Kaiser window
*/
+
static std::vector<float>
band_pass (double gain,
double sampling_freq,
@@ -92,6 +170,35 @@
/*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_pass_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
* \brief use "window method" to design a band-reject FIR filter
*
* \p gain: overall gain of filter (typically 1.0)
@@ -119,6 +226,35 @@
/*!
+ * \brief use "window method" to design a complex band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<gr_complex>
+ complex_band_pass_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
* \brief use "window method" to design a band-reject FIR filter
*
* \p gain: overall gain of filter (typically 1.0)
@@ -144,6 +280,36 @@
double beta = 6.76
) throw(std::out_of_range);
+
+ /*!
+ * \brief use "window method" to design a band-reject FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_reject_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
/*!\brief design a Hilbert Transform Filter
*
* \p ntaps: Number of taps, must be odd
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_math.h
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_math.h
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_math.h
2008-12-20 02:35:52 UTC (rev 10136)
@@ -82,7 +82,7 @@
static inline float gr_clip(float x, float clip)
{
- float y;
+ float y = x;
if(x > clip)
y = clip;
else if(x < -clip)
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -90,12 +90,12 @@
// Select a phase detector and a decision maker for the modulation order
switch(d_M) {
case 2: // optimized algorithms for BPSK
- d_phase_error_detector =
&gr_mpsk_receiver_cc::phase_error_detector_generic; //bpsk;
+ d_phase_error_detector = &gr_mpsk_receiver_cc::phase_error_detector_bpsk;
//bpsk;
d_decision = &gr_mpsk_receiver_cc::decision_bpsk;
break;
case 4: // optimized algorithms for QPSK
- d_phase_error_detector =
&gr_mpsk_receiver_cc::phase_error_detector_generic; //qpsk;
+ d_phase_error_detector = &gr_mpsk_receiver_cc::phase_error_detector_qpsk;
//qpsk;
d_decision = &gr_mpsk_receiver_cc::decision_qpsk;
break;
@@ -104,8 +104,6 @@
d_decision = &gr_mpsk_receiver_cc::decision_generic;
break;
}
-
- set_history(3); // ensure 2 extra input sample is
available
}
gr_mpsk_receiver_cc::~gr_mpsk_receiver_cc ()
@@ -119,24 +117,21 @@
unsigned ninputs = ninput_items_required.size();
for (unsigned i=0; i < ninputs; i++)
ninput_items_required[i] = (int) ceil((noutput_items * d_omega) +
d_interp->ntaps());
- //ninput_items_required[i] = (int)(d_omega);
-
}
// FIXME add these back in an test difference in performance
float
gr_mpsk_receiver_cc::phase_error_detector_qpsk(gr_complex sample) const
{
- float phase_error = ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() -
- (sample.imag()>0 ? 1.0 : -1.0) * sample.real());
+ float phase_error = -((sample.real()>0 ? 1.0 : -1.0) * sample.imag() -
+ (sample.imag()>0 ? 1.0 : -1.0) * sample.real());
return -phase_error;
}
-// FIXME add these back in an test difference in performance
float
gr_mpsk_receiver_cc::phase_error_detector_bpsk(gr_complex sample) const
{
- return (sample.real()*sample.imag());
+ return -(sample.real()*sample.imag());
}
float gr_mpsk_receiver_cc::phase_error_detector_generic(gr_complex sample)
const
@@ -200,7 +195,10 @@
d_phase += d_freq; // increment the phase based on the frequency of the
rotation
// Keep phase clamped and not walk to infinity
- d_phase = gr_branchless_clip(d_phase, M_TWOPI);
+ while(d_phase > M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase < -M_TWOPI)
+ d_phase += M_TWOPI;
nco = gr_expj(d_phase+d_theta); // get the NCO value for derotating the
current sample
sample = nco*symbol; // get the downconverted symbol
@@ -262,7 +260,10 @@
d_phase += d_freq + d_alpha*phase_error; // adjust phase based on error
// Make sure we stay within +-2pi
- d_phase = gr_branchless_clip(d_phase, M_TWOPI);
+ while(d_phase > M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase < -M_TWOPI)
+ d_phase += M_TWOPI;
// Limit the frequency range
d_freq = gr_branchless_clip(d_freq, d_max_freq);
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.cc
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_rail_ff.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_rail_ff.h>
+#include <gr_io_signature.h>
+
+gr_rail_ff_sptr
+gr_make_rail_ff(float lo, float hi)
+{
+ return gr_rail_ff_sptr(new gr_rail_ff(lo, hi));
+}
+
+gr_rail_ff::gr_rail_ff(float lo, float hi)
+ : gr_sync_block("rail_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_lo(lo), d_hi(hi)
+{
+}
+
+int
+gr_rail_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ if (in[i] < d_lo)
+ out[i] = d_lo;
+ else if (in[i] > d_hi)
+ out[i] = d_hi;
+ else
+ out[i] = in[i];
+ }
+
+ return noutput_items;
+}
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.h
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_rail_ff.h)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.h
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_RAIL_FF_H_
+# define INCLUDED_GR_RAIL_FF_H_
+
+#include <gr_sync_block.h>
+
+/*!
+ * \brief clips input values to min, max
+ * \ingroup misc
+ */
+
+class gr_rail_ff;
+typedef boost::shared_ptr<gr_rail_ff> gr_rail_ff_sptr;
+
+gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi);
+
+class gr_rail_ff : public gr_sync_block
+{
+ friend gr_rail_ff_sptr gr_make_rail_ff (float lo, float hi);
+
+ float d_lo, d_hi; // the constant
+ gr_rail_ff(float lo, float hi);
+
+ public:
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ float hi() const { return d_hi; }
+ void set_hi(float hi) { d_hi = hi; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.i
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_rail_ff.i)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_rail_ff.i
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,rail_ff);
+
+gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi);
+
+class gr_rail_ff : public gr_sync_block
+{
+private:
+ gr_rail_ff(float lo, float hi);
+};
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.cc
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_squash_ff.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdexcept>
+#include <gr_squash_ff.h>
+#include <gr_io_signature.h>
+
+// expect input vector of igrid.size y-values,
+// produce output vector of ogrid.size y-values
+
+gr_squash_ff_sptr
+gr_make_squash_ff(const std::vector<float> &igrid,
+ const std::vector<float> &ogrid)
+{
+ return gr_squash_ff_sptr(new gr_squash_ff(igrid, ogrid));
+}
+
+gr_squash_ff::gr_squash_ff(const std::vector<float> &igrid,
+ const std::vector<float> &ogrid)
+ : gr_sync_block("squash_ff",
+ gr_make_io_signature(1, 1, sizeof(float) * igrid.size()),
+ gr_make_io_signature(1, 1, sizeof(float) * ogrid.size()))
+{
+ d_inum = igrid.size();
+ d_onum = ogrid.size();
+ d_igrid = (double *) malloc(d_inum * sizeof(double));
+ d_iwork = (double *) malloc(d_inum * sizeof(double));
+ d_ogrid = (double *) malloc(d_onum * sizeof(double));
+ for (unsigned int i = 0; i < d_inum; i++)
+ d_igrid[i] = igrid[i];
+ for (unsigned int i = 0; i < d_onum; i++)
+ d_ogrid[i] = ogrid[i];
+
+ d_accel = gsl_interp_accel_alloc();
+ d_spline = gsl_spline_alloc(gsl_interp_cspline, d_inum); // FIXME check
w/ Frank
+}
+
+gr_squash_ff::~gr_squash_ff()
+{
+ free((char *) d_igrid);
+ free((char *) d_iwork);
+ free((char *) d_ogrid);
+ gsl_interp_accel_free(d_accel);
+ gsl_spline_free(d_spline);
+}
+
+int
+gr_squash_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int count = 0; count < noutput_items; count++) {
+
+ for (unsigned int i = 0; i < d_inum; i++)
+ d_iwork[i] = in[i];
+
+ gsl_spline_init(d_spline, d_igrid, d_iwork, d_inum);
+
+ for (unsigned int i = 0; i < d_onum; i++)
+ out[i] = gsl_spline_eval(d_spline, d_ogrid[i], d_accel);
+
+ in += d_inum;
+ out += d_onum;
+ }
+
+ return noutput_items;
+}
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.h
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_squash_ff.h)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.h
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SQUASH_FF_H_
+# define INCLUDED_GR_SQUASH_FF_H_
+
+#include <gr_sync_block.h>
+#include <gsl/gsl_errno.h>
+#include <gsl/gsl_interp.h>
+#include <gsl/gsl_spline.h>
+/*!
+ * \brief implements cheap resampling of spectrum directly from
+ * spectral points, using gsl interpolation
+ * \ingroup misc
+ */
+
+class gr_squash_ff;
+typedef boost::shared_ptr<gr_squash_ff> gr_squash_ff_sptr;
+
+gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid,
+ const std::vector<float> &ogrid);
+
+class gr_squash_ff : public gr_sync_block
+{
+ friend gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid,
+ const std::vector<float> &ogrid);
+
+ size_t d_inum;
+ size_t d_onum;
+ double *d_igrid;
+ double *d_iwork;
+ double *d_ogrid;
+
+ gsl_interp_accel *d_accel;
+ gsl_spline *d_spline;
+
+ gr_squash_ff(const std::vector<float> &igrid,
+ const std::vector<float> &ogrid);
+
+ public:
+ ~gr_squash_ff();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.i
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_squash_ff.i)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_squash_ff.i
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,squash_ff);
+
+gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid,
+ const std::vector<float> &ogrid);
+
+class gr_squash_ff : public gr_sync_block
+{
+private:
+ gr_squash_ff(const std::vector<float> &igrid,
+ const std::vector<float> &ogrid);
+
+};
+
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.cc
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_stretch_ff.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_stretch_ff.h>
+#include <gr_io_signature.h>
+
+gr_stretch_ff_sptr
+gr_make_stretch_ff(float lo, size_t vlen)
+{
+ return gr_stretch_ff_sptr(new gr_stretch_ff(lo, vlen));
+}
+
+gr_stretch_ff::gr_stretch_ff(float lo, size_t vlen)
+ : gr_sync_block("stretch_ff",
+ gr_make_io_signature(1, 1, vlen * sizeof(float)),
+ gr_make_io_signature(1, 1, vlen * sizeof(float))),
+ d_lo(lo), d_vlen(vlen)
+{
+}
+
+int
+gr_stretch_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int count = 0; count < noutput_items; count++) {
+ float vmax = in[0] - d_lo;
+
+ for (unsigned int i = 1; i < d_vlen; i++) {
+ float vtmp = in[i] - d_lo;
+ if (vtmp > vmax)
+ vmax = vtmp;
+ }
+
+ if (vmax != 0.0)
+ for (unsigned int i = 0; i < d_vlen; i++)
+ out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax);
+ else
+ for (unsigned int i = 0; i < d_vlen; i++)
+ out[i] = in[i];
+
+ in += d_vlen;
+ out += d_vlen;
+ }
+
+ return noutput_items;
+}
+
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.h
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_stretch_ff.h)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.h
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_STRETCH_FF_H_
+# define INCLUDED_GR_STRETCH_FF_H_
+
+#include <gr_sync_block.h>
+
+/*!
+ * \brief adjust y-range of an input vector by mapping to range
+ * (max-of-input, stipulated-min). Primarily for spectral signature
+ * matching by normalizing spectrum dynamic ranges.
+ * \ingroup misc
+ */
+
+
+class gr_stretch_ff;
+typedef boost::shared_ptr<gr_stretch_ff> gr_stretch_ff_sptr;
+
+gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
+
+class gr_stretch_ff : public gr_sync_block
+{
+ friend gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
+
+ float d_lo; // the constant
+ size_t d_vlen;
+ gr_stretch_ff(float lo, size_t vlen);
+
+ public:
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ size_t vlen() const { return d_vlen; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.i
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_stretch_ff.i)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_stretch_ff.i
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,stretch_ff);
+
+gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
+
+class gr_stretch_ff : public gr_sync_block
+{
+private:
+ gr_stretch_ff(float lo, size_t vlen);
+};
+
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.cc
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_wavelet_ff.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the tewavelet of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdexcept>
+#include <gr_wavelet_ff.h>
+#include <gr_io_signature.h>
+
+#include <stdio.h>
+
+// NB in this version, only Daubechies wavelets
+// order is wavelet length, even, 2...20
+
+gr_wavelet_ff_sptr
+gr_make_wavelet_ff(int size,
+ int order,
+ bool forward)
+{
+ return gr_wavelet_ff_sptr(new gr_wavelet_ff(size,
+ order,
+ forward));
+}
+
+gr_wavelet_ff::gr_wavelet_ff(int size,
+ int order,
+ bool forward)
+ : gr_sync_block("wavelet_ff",
+ gr_make_io_signature(1, 1, size * sizeof(float)),
+ gr_make_io_signature(1, 1, size * sizeof(float))),
+ d_size(size),
+ d_order(order),
+ d_forward(forward)
+{
+ d_wavelet = gsl_wavelet_alloc(gsl_wavelet_daubechies, d_order);
+ if (d_wavelet == NULL)
+ throw std::runtime_error("can't allocate wavelet");
+ d_workspace = gsl_wavelet_workspace_alloc(d_size);
+ if (d_workspace == NULL)
+ throw std::runtime_error("can't allocate wavelet workspace");
+ d_temp = (double *) malloc(d_size*sizeof(double));
+ if (d_workspace == NULL)
+ throw std::runtime_error("can't allocate wavelet double conversion temp");
+}
+
+gr_wavelet_ff::~gr_wavelet_ff()
+{
+ gsl_wavelet_free(d_wavelet);
+ gsl_wavelet_workspace_free(d_workspace);
+ free((char *) d_temp);
+}
+
+int
+gr_wavelet_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int count = 0; count < noutput_items; count++) {
+ for (int i = 0; i < d_size; i++)
+ d_temp[i] = in[i];
+
+ if (d_forward)
+ gsl_wavelet_transform_forward(d_wavelet,
+ d_temp,
+ 1,
+ d_size,
+ d_workspace);
+ else
+ gsl_wavelet_transform_inverse(d_wavelet,
+ d_temp,
+ 1,
+ d_size,
+ d_workspace);
+
+ for (int i = 0; i < d_size; i++)
+ out[i] = d_temp[i];
+
+ in += d_size;
+ out += d_size;
+ }
+
+ return noutput_items;
+}
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.h
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_wavelet_ff.h)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.h
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef INCLUDED_GR_WAVELET_FF_H
+#define INCLUDED_GR_WAVELET_FF_H
+
+#include <iostream>
+#include <gr_sync_block.h>
+
+#include <gsl/gsl_errno.h>
+#include <gsl/gsl_wavelet.h>
+
+class gr_wavelet_ff;
+typedef boost::shared_ptr<gr_wavelet_ff> gr_wavelet_ff_sptr;
+
+gr_wavelet_ff_sptr
+gr_make_wavelet_ff(int size = 1024,
+ int order = 20,
+ bool forward = true);
+
+/*!
+ * \brief compute wavelet transform using gsl routines
+ * \ingroup math
+ */
+
+class gr_wavelet_ff : public gr_sync_block
+{
+ int d_size;
+ int d_order;
+ bool d_forward;
+ gsl_wavelet *d_wavelet;
+ gsl_wavelet_workspace *d_workspace;
+ double *d_temp;
+
+ friend gr_wavelet_ff_sptr
+ gr_make_wavelet_ff(int size,
+ int order,
+ bool forward);
+
+ gr_wavelet_ff(int size,
+ int order,
+ bool forward);
+
+public:
+ ~gr_wavelet_ff();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_WAVELET_FF_H */
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.i
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_wavelet_ff.i)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wavelet_ff.i
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,wavelet_ff);
+
+gr_wavelet_ff_sptr gr_make_wavelet_ff(int size, int order, bool forward);
+
+class gr_wavelet_ff : public gr_sync_block
+{
+private:
+ gr_wavelet_ff(int size, int order, bool forward);
+};
+
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.cc
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_wvps_ff.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,98 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_wvps_ff.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+static int
+ceil_log2(int k)
+{
+ int m = 0;
+ for (int n = k-1; n > 0; n >>= 1) m++;
+ return m;
+}
+
+gr_wvps_ff_sptr
+gr_make_wvps_ff(int ilen)
+{
+ return gr_wvps_ff_sptr(new gr_wvps_ff(ilen));
+}
+
+gr_wvps_ff::gr_wvps_ff(int ilen)
+ : gr_sync_block("wvps_ff",
+ gr_make_io_signature(1, 1, sizeof(float) * ilen),
+ gr_make_io_signature(1, 1, sizeof(float) * ceil_log2(ilen))),
+ d_ilen(ilen), d_olen(ceil_log2(ilen))
+{
+}
+
+// input vector assumed to be output from gsl wavelet computation
+
+int
+gr_wvps_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int count = 0; count < noutput_items; count++) {
+
+ // any power?
+
+ if (in[0] == 0.0) {
+ for (int i = 0; i < d_olen; i++)
+ out[i] = 0.0;
+
+ } else {
+
+ // get power normalization from 0-th wavelet coefficient
+
+ float scl = 1.0/(in[0]*in[0]);
+ int k = 1;
+
+ // sum powers over sequences of bins,
+ // sequence lengths in increasing powers of 2
+
+ for (int e = 0; e < d_olen; e++) {
+ int m = 01<<e;
+ float sum = 0.0;
+
+ for (int l = 0; l < m; l++)
+ sum += (in[k+l]*in[k+l]);
+
+ out[e] = scl*sum;
+ k += m;
+ }
+ }
+
+ in += d_ilen;
+ out += d_olen;
+ }
+
+ return noutput_items;
+}
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.h
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_wvps_ff.h)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.h
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_WVPS_FF_H
+#define INCLUDED_GR_WVPS_FF_H
+
+#include <gr_sync_decimator.h>
+
+class gr_wvps_ff;
+typedef boost::shared_ptr<gr_wvps_ff> gr_wvps_ff_sptr;
+
+gr_wvps_ff_sptr
+gr_make_wvps_ff(int ilen);
+
+
+/*!
+ * \brief computes the Wavelet Power Spectrum from a set of wavelet
coefficients
+ * \ingroup misc
+ */
+class gr_wvps_ff : public gr_sync_block
+{
+ friend gr_wvps_ff_sptr
+ gr_make_wvps_ff(int ilen);
+
+ int d_ilen;
+ int d_olen;
+
+ protected:
+ gr_wvps_ff(int ilen);
+
+ public:
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+};
+
+#endif /* INCLUDED_GR_WVPS_FF_H */
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.i
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/general/gr_wvps_ff.i)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/general/gr_wvps_ff.i
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,29 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+GR_SWIG_BLOCK_MAGIC(gr,wvps_ff);
+
+gr_wvps_ff_sptr gr_make_wvps_ff(int ilen);
+
+class gr_wvps_ff : public gr_sync_block
+{
+private:
+ gr_wvps_ff(int ilen);
+};
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -30,10 +30,11 @@
#include <gr_io_signature.h>
address@hidden@::@NAME@ ()
address@hidden@::@NAME@ (int vlen)
: gr_sync_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (@TYPE@)),
- gr_make_io_signature (0, 0, 0))
+ gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen),
+ gr_make_io_signature (0, 0, 0)),
+ d_vlen(vlen)
{
}
@@ -43,7 +44,7 @@
gr_vector_void_star &output_items)
{
@TYPE@ *iptr = (@TYPE@ *) input_items[0];
- for (int i = 0; i < noutput_items; i++)
+ for (int i = 0; i < noutput_items * d_vlen; i++)
d_data.push_back (iptr[i]);
return noutput_items;
@@ -51,9 +52,9 @@
@address@hidden
address@hidden@ ()
address@hidden@ (int vlen)
{
- return @address@hidden (new @NAME@ ());
+ return @address@hidden (new @NAME@ (vlen));
}
std::vector<@TYPE@>
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -31,7 +31,7 @@
typedef boost::shared_ptr<@NAME@> @address@hidden;
@address@hidden
address@hidden@ ();
address@hidden@ (int vlen = 1);
/*!
@@ -40,9 +40,10 @@
*/
class @NAME@ : public gr_sync_block {
- friend @address@hidden address@hidden@ ();
+ friend @address@hidden address@hidden@ (int vlen);
std::vector<@TYPE@> d_data;
- @NAME@ ();
+ int d_vlen;
+ @NAME@ (int vlen);
public:
virtual int work (int noutput_items,
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,11 +25,11 @@
GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
address@hidden@ address@hidden@ ();
address@hidden@ address@hidden@ (int vlen = 1);
class @NAME@ : public gr_sync_block {
private:
- @NAME@ ();
+ @NAME@ (int vlen);
public:
void clear() {d_data.clear();}
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,16 +28,20 @@
#include <@address@hidden>
#include <algorithm>
#include <gr_io_signature.h>
+#include <stdexcept>
address@hidden@::@NAME@ (const std::vector<@TYPE@> &data, bool repeat)
address@hidden@::@NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen)
: gr_sync_block ("@BASE_NAME@",
gr_make_io_signature (0, 0, 0),
- gr_make_io_signature (1, 1, sizeof (@TYPE@))),
+ gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen)),
d_data (data),
d_repeat (repeat),
- d_offset (0)
+ d_offset (0),
+ d_vlen (vlen)
{
+ if ((data.size() % vlen) != 0)
+ throw std::invalid_argument("data length must be a multiple of vlen");
}
int
@@ -54,7 +58,7 @@
if (size == 0)
return -1;
- for (int i = 0; i < noutput_items; i++){
+ for (int i = 0; i < noutput_items*d_vlen; i++){
optr[i] = d_data[offset++];
if (offset >= size)
offset = 0;
@@ -68,18 +72,18 @@
return -1; // Done!
unsigned n = std::min ((unsigned) d_data.size () - d_offset,
- (unsigned) noutput_items);
+ (unsigned) noutput_items*d_vlen);
for (unsigned i = 0; i < n; i++)
optr[i] = d_data[d_offset + i];
d_offset += n;
- return n;
+ return n/d_vlen;
}
}
@address@hidden
address@hidden@ (const std::vector<@TYPE@> &data, bool repeat)
address@hidden@ (const std::vector<@TYPE@> &data, bool repeat, int vlen)
{
- return @address@hidden (new @NAME@ (data, repeat));
+ return @address@hidden (new @NAME@ (data, repeat, vlen));
}
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -37,13 +37,14 @@
class @NAME@ : public gr_sync_block {
friend @address@hidden
- address@hidden@ (const std::vector<@TYPE@> &data, bool repeat = false);
+ address@hidden@ (const std::vector<@TYPE@> &data, bool repeat, int vlen);
std::vector<@TYPE@> d_data;
bool d_repeat;
unsigned int d_offset;
+ int d_vlen;
- @NAME@ (const std::vector<@TYPE@> &data, bool repeat);
+ @NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen);
public:
void rewind() {d_offset=0;}
@@ -53,6 +54,6 @@
};
@address@hidden
address@hidden@ (const std::vector<@TYPE@> &data, bool repeat);
address@hidden@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen
= 1);
#endif
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,11 +25,12 @@
GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
@address@hidden
address@hidden@ (const std::vector<@TYPE@> &data, bool repeat = false);
address@hidden@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen
= 1)
+ throw(std::invalid_argument);
class @NAME@ : public gr_sync_block {
public:
void rewind() {d_offset=0;}
private:
- @NAME@ (const std::vector<@TYPE@> &data);
+ @NAME@ (const std::vector<@TYPE@> &data, int vlen);
};
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/Makefile.am
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/Makefile.am
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,5 +1,5 @@
#
-# Copyright 2003,2004 Free Software Foundation, Inc.
+# Copyright 2003,2004,2008 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,13 +21,18 @@
include $(top_srcdir)/Makefile.common
+AM_CPPFLAGS = $(GNURADIO_INCLUDES) $(WITH_INCLUDES)
+
EXTRA_DIST = \
getopt.h \
getopt.c \
gettimeofday.c \
- usleep.c
+ posix_memalign.cc \
+ posix_memalign.h \
+ usleep.c
noinst_LTLIBRARIES = libmissing.la
libmissing_la_SOURCES = \
- bug_work_around_8.cc
+ bug_work_around_8.cc \
+ posix_memalign.cc
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/posix_memalign.cc
(from rev 10133,
gnuradio/trunk/gnuradio-core/src/lib/missing/posix_memalign.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/posix_memalign.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/posix_memalign.cc
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,109 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "posix_memalign.h"
+
+#ifndef HAVE_POSIX_MEMALIGN
+
+/* emulate posix_memalign functionality, to some degree */
+
+#include <errno.h>
+#include "gr_pagesize.h"
+
+int posix_memalign
+(void **memptr, size_t alignment, size_t size)
+{
+ /* emulate posix_memalign functionality, to some degree */
+
+ /* make sure the return handle is valid; return "bad address" if not valid */
+ if (memptr == 0)
+ return (EFAULT);
+ *memptr = (void*) 0;
+
+ /* make sure 'alignment' is a power of 2
+ * and multiple of sizeof (void*)
+ */
+
+ /* make sure 'alignment' is a multiple of sizeof (void*) */
+ if ((alignment % sizeof (void*)) != 0)
+ return (EINVAL);
+
+ /* make sure 'alignment' is a power of 2 */
+ if ((alignment & (alignment - 1)) != 0)
+ return (EINVAL);
+
+ /* good alignment */
+
+#if (ALIGNED_MALLOC != 0)
+
+ /* if 'malloc' is known to be aligned, and the desired 'alignment'
+ * matches is <= that provided by 'malloc', then use 'malloc'. This
+ * works on, e.g., Darwin 8 & 9: for which malloc is 16-byte aligned.
+ */
+ size_t am = (size_t) ALIGNED_MALLOC;
+ if (alignment <= am) {
+ /* make sure ALIGNED_MALLOC is a power of 2, to guarantee that the
+ * alignment is correct (since 'alignment' must be a power of 2).
+ */
+ if ((am & (am - 1)) != 0)
+ return (EINVAL);
+ /* good malloc alignment */
+ *memptr = malloc (size);
+ }
+
+#endif /* (ALIGNED_MALLOC != 0) */
+#ifdef HAVE_VALLOC
+
+ if (*memptr == (void*) 0) {
+ /* try valloc if it exists */
+ /* cheap and easy way to make sure alignment is met, so long as it
+ * is <= pagesize () */
+ if (alignment <= (size_t) gr_pagesize ()) {
+ *memptr = valloc (size);
+ }
+ }
+
+#endif /* HAVE_VALLOC */
+
+#if (ALIGNED_MALLOC == 0) && !defined (HAVE_VALLOC)
+ /* no posix_memalign, valloc, and malloc isn't known to be aligned
+ * (enough for the input arguments); no idea what to do.
+ */
+
+#error gnuradio-core/src/libmissing/posix_memalign.cc: Cannot find a way to
alloc aligned memory.
+
+#endif
+
+ /* if the pointer wasn't allocated properly, return that there was
+ * not enough memory to allocate; otherwise, return OK (0).
+ */
+ if (*memptr == (void*) 0)
+ return (ENOMEM);
+ else
+ return (0);
+};
+
+#endif /* ! HAVE_POSIX_MEMALIGN */
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/posix_memalign.h
(from rev 10133, gnuradio/trunk/gnuradio-core/src/lib/missing/posix_memalign.h)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/posix_memalign.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/missing/posix_memalign.h
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _POSIX_MEMALIGN_H_
+#define _POSIX_MEMALIGN_H_
+
+#include <stdlib.h>
+
+#ifndef HAVE_POSIX_MEMALIGN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int posix_memalign (void** memptr, size_t alignment, size_t size);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* ! HAVE_POSIX_MEMALIGN */
+
+#endif /* _POSIX_MEMALIGN_H_ */
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/runtime/gr_realtime.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/runtime/gr_realtime.i
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/lib/runtime/gr_realtime.i
2008-12-20 02:35:52 UTC (rev 10136)
@@ -1,4 +1,44 @@
-%rename(enable_realtime_scheduling) gruel::enable_realtime_scheduling;
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
-%include <gruel/realtime.h>
+%rename(enable_realtime_scheduling) gr_enable_realtime_scheduling;
+// NOTE: This is duplicated from gruel/src/include/gruel/gr_realtime.h,
+// and must be kept in sync with it. This is the least evil workaround
+// for allowing 3rd party code builds to work when GNU Radio is
+// installed from binary packages into the standard system directories.
+// Otherwise, they can't find #include <gruel/gr_realtime.h>, since
+// pkg-config strips -I/usr/include from the --cflags path.
+
+namespace gruel {
+
+ typedef enum {
+ RT_OK = 0,
+ RT_NOT_IMPLEMENTED,
+ RT_NO_PRIVS,
+ RT_OTHER_ERROR
+ } rt_status_t;
+
+}
+
+typedef gruel::rt_status_t gr_rt_status_t;
+gr_rt_status_t gr_enable_realtime_scheduling();
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk.py
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk.py
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk.py
2008-12-20 02:35:52 UTC (rev 10136)
@@ -255,8 +255,8 @@
self._mm_omega = self._samples_per_symbol
self._mm_gain_omega = .25 * self._mm_gain_mu * self._mm_gain_mu
self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha
- fmin = -0.025
- fmax = 0.025
+ fmin = -0.1
+ fmax = 0.1
self.receiver=gr.mpsk_receiver_cc(arity, 0,
self._costas_alpha, self._costas_beta,
Modified:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/Makefile.am
2008-12-20 02:34:40 UTC (rev 10135)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/Makefile.am
2008-12-20 02:35:52 UTC (rev 10136)
@@ -49,6 +49,7 @@
qa_agc.py \
qa_argmax.py \
qa_bin_statistics.py \
+ qa_classify.py \
qa_cma_equalizer.py \
qa_complex_to_xxx.py \
qa_constellation_decoder_cb.py \
@@ -93,4 +94,5 @@
qa_skiphead.py \
qa_unpack_k_bits.py \
qa_repeat.py \
- qa_scrambler.py
+ qa_scrambler.py \
+ qa_vector_sink_source.py
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/qa_classify.py
(from rev 10133,
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/qa_classify.py)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/qa_classify.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/qa_classify.py
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,182 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import numpy
+from gnuradio import gr, gr_unittest
+import copy
+#import pygsl.wavelet as wavelet # FIXME: pygsl not checked for in config
+import math
+
+
+def sqr(x):
+ return x*x
+
+def np2(k):
+ m = 0
+ n = k - 1
+ while n > 0:
+ m += 1
+ return m
+
+
+class qa_classify(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+# def test_000_(self):
+# src_data = numpy.zeros(10)
+# trg_data = numpy.zeros(10)
+# src = gr.vector_source_f(src_data)
+# dst = gr.vector_sink_f()
+# self.tb.connect(src, dst)
+# self.tb.run()
+# rsl_data = dst.data()
+# sum = 0
+# for (u,v) in zip(trg_data, rsl_data):
+# w = u - v
+# sum += w * w
+# sum /= float(len(trg_data))
+# assert sum < 1e-6
+
+ def test_001_(self):
+ src_data = numpy.array([-1.0, 1.0, -1.0, 1.0])
+ trg_data = src_data * 0.5
+ src = gr.vector_source_f(src_data)
+ dst = gr.vector_sink_f()
+ rail = gr.rail_ff(-0.5, 0.5)
+ self.tb.connect(src, rail)
+ self.tb.connect(rail, dst)
+ self.tb.run()
+ rsl_data = dst.data()
+ sum = 0
+ for (u, v) in zip(trg_data, rsl_data):
+ w = u - v
+ sum += w * w
+ sum /= float(len(trg_data))
+ assert sum < 1e-6
+
+ def test_002_(self):
+ src_data = numpy.array([-1.0,
+ -1.0/2.0,
+ -1.0/3.0,
+ -1.0/4.0,
+ -1.0/5.0])
+ trg_data = copy.deepcopy(src_data)
+
+ src = gr.vector_source_f(src_data, False, len(src_data))
+ st = gr.stretch_ff(-1.0/5.0, len(src_data))
+ dst = gr.vector_sink_f(len(src_data))
+ self.tb.connect(src, st)
+ self.tb.connect(st, dst)
+ self.tb.run()
+ rsl_data = dst.data()
+ sum = 0
+ for (u, v) in zip(trg_data, rsl_data):
+ w = u - v
+ sum += w * w
+ sum /= float(len(trg_data))
+ assert sum < 1e-6
+
+ def test_003_(self):
+ src_grid = (0.0, 1.0, 2.0, 3.0, 4.0)
+ trg_grid = copy.deepcopy(src_grid)
+ src_data = (0.0, 1.0, 0.0, 1.0, 0.0)
+
+ src = gr.vector_source_f(src_data, False, len(src_grid))
+ sq = gr.squash_ff(src_grid, trg_grid)
+ dst = gr.vector_sink_f(len(trg_grid))
+ self.tb.connect(src, sq)
+ self.tb.connect(sq, dst)
+ self.tb.run()
+ rsl_data = dst.data()
+ sum = 0
+ for (u, v) in zip(src_data, rsl_data):
+ w = u - v
+ sum += w * w
+ sum /= float(len(src_data))
+ assert sum < 1e-6
+
+# def test_004_(self): # FIXME: requires pygsl
+#
+# n = 256
+# o = 4
+# ws = wavelet.workspace(n)
+# w = wavelet.daubechies(o)
+#
+# a = numpy.arange(n)
+# b = numpy.sin(a*numpy.pi/16.0)
+# c = w.transform_forward(b, ws)
+# d = w.transform_inverse(c, ws)
+#
+# src = gr.vector_source_f(b, False, n)
+# wv = gr.wavelet_ff(n, o, True)
+#
+# dst = gr.vector_sink_f(n)
+# self.tb.connect(src, wv)
+# self.tb.connect(wv, dst)
+# self.tb.run()
+# e = dst.data()
+#
+# sum = 0
+# for (u, v) in zip(c, e):
+# w = u - v
+# sum += w * w
+# sum /= float(len(c))
+# assert sum < 1e-6
+
+ def test_005_(self):
+
+ src_data = (1.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0)
+
+ dwav = numpy.array(src_data)
+ wvps = numpy.zeros(3)
+ # wavelet power spectrum
+ scl = 1.0/sqr(dwav[0])
+ k = 1
+ for e in range(len(wvps)):
+ wvps[e] = scl*sqr(dwav[k:k+(01<<e)]).sum()
+ k += 01<<e
+
+ src = gr.vector_source_f(src_data, False, len(src_data))
+ kon = gr.wvps_ff(len(src_data))
+ dst = gr.vector_sink_f(int(math.ceil(math.log(len(src_data), 2))))
+
+ self.tb.connect(src, kon)
+ self.tb.connect(kon, dst)
+
+ self.tb.run()
+ snk_data = dst.data()
+
+ sum = 0
+ for (u,v) in zip(snk_data, wvps):
+ w = u - v
+ sum += w * w
+ sum /= float(len(snk_data))
+ assert sum < 1e-6
+
+if __name__ == '__main__':
+ gr_unittest.main()
+
Copied:
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
(from rev 10133,
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py)
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
2008-12-20 02:35:52 UTC (rev 10136)
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_sink_source(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ src = gr.vector_source_f(src_data)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ src = gr.vector_source_f(src_data, False, 2)
+ dst = gr.vector_sink_f(2)
+
+ self.tb.connect(src, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_003(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+ self.assertRaises(ValueError, lambda : gr.vector_source_f(src_data,
False, 3))
+
+if __name__ == '__main__':
+ gr_unittest.main ()
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10136 - in gnuradio/branches/developers/n4hy/pfb_fbs/gnuradio-core/src: lib lib/filter lib/general lib/gengen lib/missing lib/runtime python/gnuradio/blks2impl python/gnuradio/gr,
n4hy <=