summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-fft/include/gnuradio/fft/window.h42
-rw-r--r--gr-fft/lib/window.cc19
-rw-r--r--gr-filter/lib/firdes.cc25
-rw-r--r--gr-filter/lib/qa_firdes.cc523
-rwxr-xr-xgr-filter/python/filter/qa_firdes.py95
-rwxr-xr-xgr-filter/python/filter/qa_freq_xlating_fir_filter.py4
6 files changed, 190 insertions, 518 deletions
diff --git a/gr-fft/include/gnuradio/fft/window.h b/gr-fft/include/gnuradio/fft/window.h
index 4a7fb44ff9..92f62c64cb 100644
--- a/gr-fft/include/gnuradio/fft/window.h
+++ b/gr-fft/include/gnuradio/fft/window.h
@@ -35,19 +35,41 @@ namespace gr {
public:
enum win_type {
- WIN_NONE = -1, //!< don't use a window
- WIN_HAMMING = 0, //!< Hamming window; max attenuation 53 dB
- WIN_HANN = 1, //!< Hann window; max attenuation 44 dB
- WIN_BLACKMAN = 2, //!< Blackman window; max attenuation 74 dB
- WIN_RECTANGULAR = 3, //!< Basic rectangular window
- WIN_KAISER = 4, //!< Kaiser window; max attenuation a function of beta, google it
- WIN_BLACKMAN_hARRIS = 5, //!< Blackman-harris window
- WIN_BLACKMAN_HARRIS = 5, //!< alias to WIN_BLACKMAN_hARRIS for capitalization consistency
- WIN_BARTLETT = 6, //!< Barlett (triangular) window
- WIN_FLATTOP = 7, //!< flat top window; useful in FFTs
+ WIN_HAMMING = 0, //!< Hamming window; max attenuation 53 dB
+ WIN_HANN = 1, //!< Hann window; max attenuation 44 dB
+ WIN_BLACKMAN = 2, //!< Blackman window; max attenuation 74 dB
+ WIN_RECTANGULAR = 3, //!< Basic rectangular window; max attenuation 21 dB
+ WIN_KAISER = 4, //!< Kaiser window; max attenuation see window::max_attenuation
+ WIN_BLACKMAN_hARRIS = 5, //!< Blackman-harris window; max attenuation 92 dB
+ WIN_BLACKMAN_HARRIS = 5, //!< alias to WIN_BLACKMAN_hARRIS for capitalization consistency
+ WIN_BARTLETT = 6, //!< Barlett (triangular) window; max attenuation 26 dB
+ WIN_FLATTOP = 7, //!< flat top window; useful in FFTs; max attenuation 93 dB
};
/*!
+ * \brief Given a window::win_type, this tells you the maximum
+ * attenuation you can expect.
+ *
+ * \details
+ * For most windows, this is a set value. For the Kaiser window,
+ * the attenuation is based on the value of beta. The actual
+ * relationship is a piece-wise exponential relationship to
+ * calculate beta from the desired attenuation and can be found
+ * on page 542 of Oppenheim and Schafer (Discrete-Time Signal
+ * Processing, 3rd edition). To simplify this function to solve
+ * for A given beta, we use a linear form that is exact for
+ * attenuation >= 50 dB.
+ *
+ * For an attenuation of 50 dB, beta = 4.55.
+ *
+ * For an attenuation of 70 dB, beta = 6.76.
+ *
+ * \param type The window::win_type enumeration of the window type.
+ * \param beta Beta value only used for the Kaiser window.
+ */
+ static double max_attenuation(win_type type, double beta=6.76);
+
+ /*!
* \brief Helper function to build cosine-based windows. 3-coefficient version.
*/
static std::vector<float> coswindow(int ntaps, float c0, float c1, float c2);
diff --git a/gr-fft/lib/window.cc b/gr-fft/lib/window.cc
index 1610b46f5d..015e2d9943 100644
--- a/gr-fft/lib/window.cc
+++ b/gr-fft/lib/window.cc
@@ -74,7 +74,24 @@ namespace gr {
return 1.0/(ntaps >> 1);
}
- std::vector<float>
+ double
+ window::max_attenuation(win_type type, double beta)
+ {
+ switch(type) {
+ case(WIN_HAMMING): return 53; break;
+ case(WIN_HANN): return 44; break;
+ case(WIN_BLACKMAN): return 74; break;
+ case(WIN_RECTANGULAR): return 21; break;
+ case(WIN_KAISER): return (beta/0.1102 + 8.7); break;
+ case(WIN_BLACKMAN_hARRIS): return 92; break;
+ case(WIN_BARTLETT): return 27; break;
+ case(WIN_FLATTOP): return 93; break;
+ default:
+ throw std::out_of_range("window::max_attenuation: unknown window type provided.");
+ }
+ }
+
+ std::vector<float>
window::coswindow(int ntaps, float c0, float c1, float c2)
{
std::vector<float> taps(ntaps);
diff --git a/gr-filter/lib/firdes.cc b/gr-filter/lib/firdes.cc
index a52a2ddf63..cb6bffd18a 100644
--- a/gr-filter/lib/firdes.cc
+++ b/gr-filter/lib/firdes.cc
@@ -658,21 +658,6 @@ namespace gr {
// === Utilities ===
//
- // delta_f / width_factor gives number of taps required.
- const int MAX_WIDTH_FACTOR = 8;
- static const float width_factor[8] = { // indexed by win_type
- 3.3, // WIN_HAMMING
- 3.1, // WIN_HANN
- 5.5, // WIN_BLACKMAN
- 2.0, // WIN_RECTANGULAR
- //5.0 // WIN_KAISER (guesstimate compromise)
- //2.0 // WIN_KAISER (guesstimate compromise)
- 10.0, // WIN_KAISER
- 6.0, // WIN_BLACKMAN_HARRIS (est.)
- 3.0, // WIN_BARTLETT (est.)
- 5.5, // WIN_FLATTOP (est.)
- };
-
int
firdes::compute_ntaps_windes(double sampling_freq,
double transition_width, // this is frequency, not relative frequency
@@ -692,14 +677,8 @@ namespace gr {
win_type window_type,
double beta)
{
- // normalized transition width
- double delta_f = transition_width / sampling_freq;
-
- // compute number of taps required for given transition width
- if(window_type >= MAX_WIDTH_FACTOR)
- throw std::runtime_error("firdes::compute_ntaps: window_type out of range.");
-
- int ntaps = (int)(width_factor[window_type] / delta_f + 0.5);
+ double a = fft::window::max_attenuation(static_cast<fft::window::win_type>(window_type), beta);
+ int ntaps = (int)(a*sampling_freq/(22.0*transition_width));
if((ntaps & 1) == 0) // if even...
ntaps++; // ...make odd
diff --git a/gr-filter/lib/qa_firdes.cc b/gr-filter/lib/qa_firdes.cc
index dfc5e00f35..ef61dffae7 100644
--- a/gr-filter/lib/qa_firdes.cc
+++ b/gr-filter/lib/qa_firdes.cc
@@ -36,14 +36,15 @@ namespace gr {
using std::vector;
-#if 0
+#if 1
static void
print_taps(std::ostream &s, vector<float> &v)
{
-
+ s << std::setprecision(9);
for(unsigned int i = 0; i < v.size(); i++) {
- printf("tap[%2d] = %16.7e\n", i, v[i]);
+ s << v[i] << ", ";
}
+ s << std::endl;
}
#endif
@@ -57,430 +58,94 @@ namespace gr {
CPPUNIT_ASSERT_DOUBLES_EQUAL(v[i], v[n - i - 1], 1e-9);
}
- const static float t1_exp[53] = {
- -9.0525491e-04,
- 2.0713841e-04,
- 1.2388536e-03,
- 2.9683491e-04,
- -1.7744775e-03,
- -1.3599906e-03,
- 2.2031884e-03,
- 3.2744040e-03,
- -1.8868084e-03,
- -5.9935520e-03,
- 6.4301129e-18,
- 8.9516686e-03,
- 4.2178580e-03,
- -1.0998557e-02,
- -1.1173409e-02,
- 1.0455756e-02,
- 2.0686293e-02,
- -5.2032238e-03,
- -3.1896964e-02,
- -7.4998410e-03,
- 4.3362070e-02,
- 3.2502845e-02,
- -5.3328082e-02,
- -8.5621715e-02,
- 6.0117975e-02,
- 3.1128189e-01,
- 4.3769023e-01,
- 3.1128189e-01,
- 6.0117975e-02,
- -8.5621715e-02,
- -5.3328082e-02,
- 3.2502845e-02,
- 4.3362070e-02,
- -7.4998410e-03,
- -3.1896964e-02,
- -5.2032238e-03,
- 2.0686293e-02,
- 1.0455756e-02,
- -1.1173409e-02,
- -1.0998557e-02,
- 4.2178580e-03,
- 8.9516686e-03,
- 6.4301129e-18,
- -5.9935520e-03,
- -1.8868084e-03,
- 3.2744040e-03,
- 2.2031884e-03,
- -1.3599906e-03,
- -1.7744775e-03,
- 2.9683491e-04,
- 1.2388536e-03,
- 2.0713841e-04,
- -9.0525491e-04
+ const static float t1_exp[39] = {
+ 0.00111410965, -0.000583702058, -0.00192639488, 2.30933896e-18, 0.00368289859,
+ 0.00198723329, -0.0058701504, -0.00666110823, 0.0068643163, 0.0147596458,
+ -0.00398709066, -0.0259727165, -0.0064281947, 0.0387893915, 0.0301109217,
+ -0.0507995859, -0.0833103433, 0.0593735874, 0.310160041, 0.437394291,
+ 0.310160041, 0.0593735874, -0.0833103433, -0.0507995859, 0.0301109217,
+ 0.0387893915, -0.0064281947, -0.0259727165, -0.00398709066, 0.0147596458,
+ 0.0068643163, -0.00666110823, -0.0058701504, 0.00198723329, 0.00368289859,
+ 2.30933896e-18, -0.00192639488, -0.000583702058, 0.00111410965
};
- const static float t2_exp[53] = {
- 9.0380036e-04,
- -2.0680559e-04,
- -1.2368630e-03,
- -2.9635796e-04,
- 1.7716263e-03,
- 1.3578053e-03,
- -2.1996482e-03,
- -3.2691427e-03,
- 1.8837767e-03,
- 5.9839217e-03,
- -6.4197810e-18,
- -8.9372853e-03,
- -4.2110807e-03,
- 1.0980885e-02,
- 1.1155456e-02,
- -1.0438956e-02,
- -2.0653054e-02,
- 5.1948633e-03,
- 3.1845711e-02,
- 7.4877902e-03,
- -4.3292396e-02,
- -3.2450620e-02,
- 5.3242393e-02,
- 8.5484132e-02,
- -6.0021374e-02,
- -3.1078172e-01,
- 5.6184036e-01,
- -3.1078172e-01,
- -6.0021374e-02,
- 8.5484132e-02,
- 5.3242393e-02,
- -3.2450620e-02,
- -4.3292396e-02,
- 7.4877902e-03,
- 3.1845711e-02,
- 5.1948633e-03,
- -2.0653054e-02,
- -1.0438956e-02,
- 1.1155456e-02,
- 1.0980885e-02,
- -4.2110807e-03,
- -8.9372853e-03,
- -6.4197810e-18,
- 5.9839217e-03,
- 1.8837767e-03,
- -3.2691427e-03,
- -2.1996482e-03,
- 1.3578053e-03,
- 1.7716263e-03,
- -2.9635796e-04,
- -1.2368630e-03,
- -2.0680559e-04,
- 9.0380036e-04
+ const static float t2_exp[39] = {
+ -0.00111255341, 0.000582886743, 0.00192370394, -2.30611317e-18, -0.0036777542,
+ -0.00198445749, 0.00586195057, 0.00665180339, -0.00685472786, -0.0147390282,
+ 0.00398152089, 0.0259364359, 0.00641921535, -0.0387352072, -0.0300688613,
+ 0.0507286265, 0.0831939653, -0.0592906512, -0.309726775, 0.561578512,
+ -0.309726775, -0.0592906512, 0.0831939653, 0.0507286265, -0.0300688613,
+ -0.0387352072, 0.00641921535, 0.0259364359, 0.00398152089, -0.0147390282,
+ -0.00685472786, 0.00665180339, 0.00586195057, -0.00198445749, -0.0036777542,
+ -2.30611317e-18, 0.00192370394, 0.000582886743, -0.00111255341
};
- const static float t3_exp[107] = {
- -1.8970841e-06,
- -7.1057165e-04,
- 5.4005696e-04,
- 4.6233178e-04,
- 2.0572044e-04,
- 3.5209916e-04,
- -1.4098573e-03,
- 1.1279077e-04,
- -6.2994129e-04,
- 1.1450432e-03,
- 1.3637283e-03,
- -6.4360141e-04,
- 3.6509900e-04,
- -3.2864159e-03,
- 7.0192874e-04,
- 3.7524730e-04,
- 2.0256115e-03,
- 3.0641893e-03,
- -3.6618244e-03,
- 7.5592739e-05,
- -5.5586505e-03,
- 2.3849572e-03,
- 4.0114378e-03,
- 1.6636450e-03,
- 4.7835698e-03,
- -1.0191196e-02,
- -3.8158931e-04,
- -5.5551580e-03,
- 5.3901658e-03,
- 1.1366769e-02,
- -3.0000482e-03,
- 4.9341680e-03,
- -2.0093076e-02,
- 5.5752542e-17,
- 1.2093617e-03,
- 8.6089745e-03,
- 2.2382140e-02,
- -1.6854567e-02,
- 1.6913920e-03,
- -3.1222520e-02,
- 3.2711059e-03,
- 2.2604836e-02,
- 8.1451107e-03,
- 3.7583180e-02,
- -5.2293688e-02,
- -8.0551542e-03,
- -4.0092729e-02,
- 1.5582236e-02,
- 9.7452506e-02,
- -1.6183170e-02,
- 8.3281815e-02,
- -2.8196752e-01,
- -1.0965768e-01,
- 5.2867508e-01,
- -1.0965768e-01,
- -2.8196752e-01,
- 8.3281815e-02,
- -1.6183170e-02,
- 9.7452506e-02,
- 1.5582236e-02,
- -4.0092729e-02,
- -8.0551542e-03,
- -5.2293688e-02,
- 3.7583180e-02,
- 8.1451107e-03,
- 2.2604836e-02,
- 3.2711059e-03,
- -3.1222520e-02,
- 1.6913920e-03,
- -1.6854567e-02,
- 2.2382140e-02,
- 8.6089745e-03,
- 1.2093617e-03,
- 5.5752542e-17,
- -2.0093076e-02,
- 4.9341680e-03,
- -3.0000482e-03,
- 1.1366769e-02,
- 5.3901658e-03,
- -5.5551580e-03,
- -3.8158931e-04,
- -1.0191196e-02,
- 4.7835698e-03,
- 1.6636450e-03,
- 4.0114378e-03,
- 2.3849572e-03,
- -5.5586505e-03,
- 7.5592739e-05,
- -3.6618244e-03,
- 3.0641893e-03,
- 2.0256115e-03,
- 3.7524730e-04,
- 7.0192874e-04,
- -3.2864159e-03,
- 3.6509900e-04,
- -6.4360141e-04,
- 1.3637283e-03,
- 1.1450432e-03,
- -6.2994129e-04,
- 1.1279077e-04,
- -1.4098573e-03,
- 3.5209916e-04,
- 2.0572044e-04,
- 4.6233178e-04,
- 5.4005696e-04,
- -7.1057165e-04,
- -1.8970841e-06
+ const static float t3_exp[77] = {
+ 0.000119983582, 0.000607753696, 0.000897691818, -0.0010834164, 2.31763315e-05,
+ -0.00179765455, 0.000822491478, 0.0014836716, 0.000661226455, 0.00204213755,
+ -0.00466352375, -0.000186616904, -0.00289339852, 0.00297895772, 0.00664081471,
+ -0.00184599939, 0.00318629085, -0.0135707017, 3.90737225e-17, 0.000884963025,
+ 0.00652826019, 0.0175401419, -0.013614703, 0.00140484457, -0.0266032815,
+ 0.00285289111, 0.0201372877, 0.00739659835, 0.0347237773, -0.0490655154,
+ -0.00766157778, -0.0385900773, 0.0151521852, 0.0955788717, -0.0159830209,
+ 0.0826964602, -0.281061709, -0.109556615, 0.528591633, -0.109556615,
+ -0.281061709, 0.0826964602, -0.0159830209, 0.0955788717, 0.0151521852,
+ -0.0385900773, -0.00766157778, -0.0490655154, 0.0347237773, 0.00739659835,
+ 0.0201372877, 0.00285289111, -0.0266032815, 0.00140484457, -0.013614703,
+ 0.0175401419, 0.00652826019, 0.000884963025, 3.90737225e-17, -0.0135707017,
+ 0.00318629085, -0.00184599939, 0.00664081471, 0.00297895772, -0.00289339852,
+ -0.000186616904, -0.00466352375, 0.00204213755, 0.000661226455, 0.0014836716,
+ 0.000822491478, -0.00179765455, 2.31763315e-05, -0.0010834164, 0.000897691818,
+ 0.000607753696, 0.000119983582
};
- const static float t4_exp[] = { // low pass
- 0.001059958362,
- 0.0002263929928,
- -0.001277606934,
- -0.0009675776237,
- 0.001592264394,
- 0.00243603508,
- -0.001451682881,
- -0.004769335967,
- 5.281541594e-18,
- 0.007567512803,
- 0.003658855334,
- -0.009761494584,
- -0.01011830103,
- 0.009636915289,
- 0.0193619132,
- -0.004935568199,
- -0.03060629964,
- -0.007267376408,
- 0.04236677289,
- 0.03197422624,
- -0.05274848267,
- -0.0850463286,
- 0.05989059806,
- 0.31065014,
- 0.4370569289,
- 0.31065014,
- 0.05989059806,
- -0.0850463286,
- -0.05274848267,
- 0.03197422624,
- 0.04236677289,
- -0.007267376408,
- -0.03060629964,
- -0.004935568199,
- 0.0193619132,
- 0.009636915289,
- -0.01011830103,
- -0.009761494584,
- 0.003658855334,
- 0.007567512803,
- 5.281541594e-18,
- -0.004769335967,
- -0.001451682881,
- 0.00243603508,
- 0.001592264394,
- -0.0009675776237,
- -0.001277606934,
- 0.0002263929928,
- 0.001059958362,
+ const static float t4_exp[49] = { // low pass
+ 0.00105995836, 0.000226392993, -0.00127760693, -0.000967577624, 0.00159226439,
+ 0.00243603508, -0.00145168288, -0.00476933597, 5.28154159e-18, 0.0075675128,
+ 0.00365885533, -0.00976149458, -0.010118301, 0.00963691529, 0.0193619132,
+ -0.0049355682, -0.0306062996, -0.00726737641, 0.0423667729, 0.0319742262,
+ -0.0527484827, -0.0850463286, 0.0598905981, 0.31065014, 0.437056929,
+ 0.31065014, 0.0598905981, -0.0850463286, -0.0527484827, 0.0319742262,
+ 0.0423667729, -0.00726737641, -0.0306062996, -0.0049355682, 0.0193619132,
+ 0.00963691529, -0.010118301, -0.00976149458, 0.00365885533, 0.0075675128,
+ 5.28154159e-18, -0.00476933597, -0.00145168288, 0.00243603508, 0.00159226439,
+ -0.000967577624, -0.00127760693, 0.000226392993, 0.00105995836
};
- const static float t5_exp[] = { //high pass
- -0.001062123571,
- -0.0002268554381,
- 0.001280216733,
- 0.000969554123,
- -0.001595516922,
- -0.002441011136,
- 0.001454648213,
- 0.004779078532,
- -5.292330097e-18,
- -0.007582970895,
- -0.00366632943,
- 0.009781434201,
- 0.01013896987,
- -0.009656600654,
- -0.01940146461,
- 0.004945650231,
- 0.03066881932,
- 0.00728222169,
- -0.04245331511,
- -0.03203954175,
- 0.05285623297,
- 0.08522006124,
- -0.06001294032,
- -0.3112847209,
- 0.5630782247,
- -0.3112847209,
- -0.06001294032,
- 0.08522006124,
- 0.05285623297,
- -0.03203954175,
- -0.04245331511,
- 0.00728222169,
- 0.03066881932,
- 0.004945650231,
- -0.01940146461,
- -0.009656600654,
- 0.01013896987,
- 0.009781434201,
- -0.00366632943,
- -0.007582970895,
- -5.292330097e-18,
- 0.004779078532,
- 0.001454648213,
- -0.002441011136,
- -0.001595516922,
- 0.000969554123,
- 0.001280216733,
- -0.0002268554381,
- -0.001062123571,
+ const static float t5_exp[49] = { //high pass
+ -0.00106212357, -0.000226855438, 0.00128021673, 0.000969554123, -0.00159551692,
+ -0.00244101114, 0.00145464821, 0.00477907853, -5.2923301e-18, -0.00758297089,
+ -0.00366632943, 0.0097814342, 0.0101389699, -0.00965660065, -0.0194014646,
+ 0.00494565023, 0.0306688193, 0.00728222169, -0.0424533151, -0.0320395418,
+ 0.052856233, 0.0852200612, -0.0600129403, -0.311284721, 0.563078225,
+ -0.311284721, -0.0600129403, 0.0852200612, 0.052856233, -0.0320395418,
+ -0.0424533151, 0.00728222169, 0.0306688193, 0.00494565023, -0.0194014646,
+ -0.00965660065, 0.0101389699, 0.0097814342, -0.00366632943, -0.00758297089,
+ -5.2923301e-18, 0.00477907853, 0.00145464821, -0.00244101114, -0.00159551692,
+ 0.000969554123, 0.00128021673, -0.000226855438, -0.00106212357
};
const static float t6_exp[] = { // bandpass
- 0.0002809273137,
- -0.001047327649,
- 7.936541806e-05,
- -0.0004270860809,
- 0.0007595835486,
- 0.0008966081077,
- -0.0004236323002,
- 0.0002423936094,
- -0.002212299034,
- 0.0004807534278,
- 0.0002620361629,
- 0.001443728455,
- 0.002229931997,
- -0.002720607212,
- 5.731141573e-05,
- -0.004297634587,
- 0.001878833398,
- 0.003217151389,
- 0.001357055153,
- 0.003965090029,
- -0.008576190099,
- -0.0003257228818,
- -0.004805727862,
- 0.004721920472,
- 0.01007549558,
- -0.002688719891,
- 0.004467967432,
- -0.01837076992,
- 5.119658377e-17,
- 0.001125075156,
- 0.008071650751,
- 0.02113764361,
- -0.01602453552,
- 0.001618095324,
- -0.03004053794,
- 0.003163811285,
- 0.0219683405,
- 0.007950295694,
- 0.03682873398,
- -0.05142467469,
- -0.00794606097,
- -0.03965795785,
- 0.01544955093,
- 0.09681399167,
- -0.01610304788,
- 0.08297294378,
- -0.2811714709,
- -0.1094062924,
- 0.5275565982,
- -0.1094062924,
- -0.2811714709,
- 0.08297294378,
- -0.01610304788,
- 0.09681399167,
- 0.01544955093,
- -0.03965795785,
- -0.00794606097,
- -0.05142467469,
- 0.03682873398,
- 0.007950295694,
- 0.0219683405,
- 0.003163811285,
- -0.03004053794,
- 0.001618095324,
- -0.01602453552,
- 0.02113764361,
- 0.008071650751,
- 0.001125075156,
- 5.119658377e-17,
- -0.01837076992,
- 0.004467967432,
- -0.002688719891,
- 0.01007549558,
- 0.004721920472,
- -0.004805727862,
- -0.0003257228818,
- -0.008576190099,
- 0.003965090029,
- 0.001357055153,
- 0.003217151389,
- 0.001878833398,
- -0.004297634587,
- 5.731141573e-05,
- -0.002720607212,
- 0.002229931997,
- 0.001443728455,
- 0.0002620361629,
- 0.0004807534278,
- -0.002212299034,
- 0.0002423936094,
- -0.0004236323002,
- 0.0008966081077,
- 0.0007595835486,
- -0.0004270860809,
- 7.936541806e-05,
- -0.001047327649,
- 0.0002809273137,
+ 0.000280927314, -0.00104732765, 7.93654181e-05, -0.000427086081, 0.000759583549,
+ 0.000896608108, -0.0004236323, 0.000242393609, -0.00221229903, 0.000480753428,
+ 0.000262036163, 0.00144372846, 0.002229932, -0.00272060721, 5.73114157e-05,
+ -0.00429763459, 0.0018788334, 0.00321715139, 0.00135705515, 0.00396509003,
+ -0.0085761901, -0.000325722882, -0.00480572786, 0.00472192047, 0.0100754956,
+ -0.00268871989, 0.00446796743, -0.0183707699, 5.11965838e-17, 0.00112507516,
+ 0.00807165075, 0.0211376436, -0.0160245355, 0.00161809532, -0.0300405379,
+ 0.00316381129, 0.0219683405, 0.00795029569, 0.036828734, -0.0514246747,
+ -0.00794606097, -0.0396579579, 0.0154495509, 0.0968139917, -0.0161030479,
+ 0.0829729438, -0.281171471, -0.109406292, 0.527556598, -0.109406292,
+ -0.281171471, 0.0829729438, -0.0161030479, 0.0968139917, 0.0154495509,
+ -0.0396579579, -0.00794606097, -0.0514246747, 0.036828734, 0.00795029569,
+ 0.0219683405, 0.00316381129, -0.0300405379, 0.00161809532, -0.0160245355,
+ 0.0211376436, 0.00807165075, 0.00112507516, 5.11965838e-17, -0.0183707699,
+ 0.00446796743, -0.00268871989, 0.0100754956, 0.00472192047, -0.00480572786,
+ -0.000325722882, -0.0085761901, 0.00396509003, 0.00135705515, 0.00321715139,
+ 0.0018788334, -0.00429763459, 5.73114157e-05, -0.00272060721, 0.002229932,
+ 0.00144372846, 0.000262036163, 0.000480753428, -0.00221229903, 0.000242393609,
+ -0.0004236323, 0.000896608108, 0.000759583549, -0.000427086081, 7.93654181e-05,
+ -0.00104732765, 0.000280927314
};
void
@@ -493,15 +158,15 @@ namespace gr {
500,
firdes::WIN_HAMMING);
- // cout << "ntaps: " << taps.size() << endl;
- // print_taps(cout, taps);
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
CPPUNIT_ASSERT_EQUAL(NELEM(t1_exp), taps.size());
for(unsigned int i = 0; i < taps.size(); i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(t1_exp[i], taps[i], 1e-9);
check_symmetry(taps);
-}
+ }
void
qa_firdes::t2()
@@ -513,8 +178,8 @@ namespace gr {
500,
firdes::WIN_HAMMING);
- // cout << "ntaps: " << taps.size() << endl;
- // print_taps(cout, taps);
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
CPPUNIT_ASSERT_EQUAL(NELEM(t2_exp), taps.size());
@@ -535,8 +200,8 @@ namespace gr {
0.62e6,
firdes::WIN_HAMMING);
- // cout << "ntaps: " << taps.size() << endl;
- // print_taps(cout, taps);
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
CPPUNIT_ASSERT_EQUAL(NELEM(t3_exp), taps.size());
@@ -557,8 +222,8 @@ namespace gr {
66,
firdes::WIN_HAMMING);
- // std::cout << "ntaps: " << taps.size() << std::endl;
- // print_taps(std::cout, taps);
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
CPPUNIT_ASSERT_EQUAL(NELEM(t4_exp), taps.size());
for(unsigned int i = 0; i < taps.size(); i++)
@@ -578,8 +243,8 @@ namespace gr {
66,
firdes::WIN_HAMMING);
- // std::cout << "ntaps: " << taps.size() << std::endl;
- // print_taps(std::cout, taps);
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
CPPUNIT_ASSERT_EQUAL(NELEM(t5_exp), taps.size());
@@ -601,8 +266,8 @@ namespace gr {
66,
firdes::WIN_HAMMING);
- // std::cout << "ntaps: " << taps.size() << std::endl;
- // print_taps(std::cout, taps);
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
CPPUNIT_ASSERT_EQUAL(NELEM(t6_exp), taps.size());
diff --git a/gr-filter/python/filter/qa_firdes.py b/gr-filter/python/filter/qa_firdes.py
index d38af31822..b32e5b2f91 100755
--- a/gr-filter/python/filter/qa_firdes.py
+++ b/gr-filter/python/filter/qa_firdes.py
@@ -32,15 +32,14 @@ class test_firdes(gr_unittest.TestCase):
pass
def test_low_pass(self):
- known_taps = (0.0030193300917744637, -0.004960992839187384,
- 0.006678304169327021, -1.132049690556083e-17,
- -0.0251916591078043, 0.07206480950117111,
- -0.13062666356563568, 0.18007083237171173,
- 0.7978920936584473, 0.18007083237171173,
- -0.13062666356563568, 0.07206480950117111,
- -0.0251916591078043, -1.132049690556083e-17,
- 0.006678304169327021, -0.004960992839187384,
- 0.0030193300917744637)
+ known_taps = (0.0024871660862118006, -4.403502608370943e-18,
+ -0.014456653036177158, 0.0543283149600029,
+ -0.116202212870121, 0.17504146695137024,
+ 0.7976038455963135, 0.17504146695137024,
+ -0.116202212870121, 0.0543283149600029,
+ -0.014456653036177158, -4.403502608370943e-18,
+ 0.0024871660862118006)
+
new_taps = filter.firdes.low_pass(1, 1, 0.4, 0.2)
self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
@@ -56,15 +55,13 @@ class test_firdes(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
def test_high_pass(self):
- known_taps = (-0.003062003292143345, 0.005031108390539885,
- -0.0067726909182965755, 1.1480492661182674e-17,
- 0.025547700002789497, -0.0730833187699318,
- 0.13247284293174744, -0.18261581659317017,
- 0.20229223370552063, -0.18261581659317017,
- 0.13247284293174744, -0.0730833187699318,
- 0.025547700002789497, 1.1480492661182674e-17,
- -0.0067726909182965755, 0.005031108390539885,
- -0.003062003292143345)
+ known_taps = (-0.0027197482995688915, 4.815287179370254e-18,
+ 0.01580853760242462, -0.05940871313214302,
+ 0.1270686239004135, -0.1914101094007492,
+ 0.21804752945899963, -0.1914101094007492,
+ 0.1270686239004135, -0.05940871313214302,
+ 0.01580853760242462, 4.815287179370254e-18,
+ -0.0027197482995688915)
new_taps = filter.firdes.high_pass(1, 1, 0.4, 0.2)
self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
@@ -80,15 +77,13 @@ class test_firdes(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
def test_band_pass(self):
- known_taps = (0.004961997736245394, -0.008152946829795837,
- -0.004192151129245758, -5.749020235348687e-18,
- 0.01581347920000553, 0.11843203753232956,
- -0.21467317640781403, -0.11303528398275375,
- 0.40520283579826355, -0.11303528398275375,
- -0.21467317640781403, 0.11843203753232956,
- 0.01581347920000553, -5.749020235348687e-18,
- -0.004192151129245758, -0.008152946829795837,
- 0.004961997736245394)
+ known_taps = (-0.001676854444667697, -2.4018533253972557e-18,
+ 0.009746716357767582, 0.09589414298534393,
+ -0.20510689914226532, -0.11801345646381378,
+ 0.4350462853908539, -0.11801345646381378,
+ -0.20510689914226532, 0.09589414298534393,
+ 0.009746716357767582, -2.4018533253972557e-18,
+ -0.001676854444667697)
new_taps = filter.firdes.band_pass(1, 1, 0.2, 0.4, 0.2)
self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
@@ -104,23 +99,19 @@ class test_firdes(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
def test_complex_band_pass(self):
- known_taps = ((0.0024772135075181723+0.0017997993854805827j),
- (-0.004070250317454338+0.002957213670015335j),
- (-0.0020928815938532352-0.006441210396587849j),
- (-2.8701231652956686e-18+2.805614574993832e-24j),
- (0.007894645445048809-0.024297315627336502j),
- (0.05912570655345917+0.04295721650123596j),
- (-0.10717268288135529+0.07786571979522705j),
- (-0.0564316064119339-0.17367789149284363j),
- (0.20229223370552063-2.4115112751132983e-07j),
- (-0.05643119290471077+0.17367802560329437j),
- (-0.10717286914587021-0.07786546647548676j),
- (0.05912560224533081-0.0429573580622673j),
- (0.007894691079854965+0.024297300726175308j),
- (-2.8701231652956686e-18+2.6687109203363464e-24j),
- (-0.0020928694866597652+0.006441214121878147j),
- (-0.004070255905389786-0.0029572059866040945j),
- (0.0024772100150585175-0.0017998040420934558j))
+ known_taps = ((-0.0008404505206272006-0.0025866336654871702j),
+ (-1.2038217948425635e-18+1.1767648157397848e-24j),
+ (0.0048850891180336475-0.015034818090498447j),
+ (0.048062704503536224+0.03491950035095215j),
+ (-0.10280057787895203+0.07468919456005096j),
+ (-0.05914920195937157-0.18204176425933838j),
+ (0.21804752945899963-2.5993290364567656e-07j),
+ (-0.059148769825696945+0.18204189836978912j),
+ (-0.10280075669288635-0.07468894869089127j),
+ (0.04806262254714966-0.0349196158349514j),
+ (0.004885117989033461+0.015034808777272701j),
+ (-1.2038217948425635e-18+1.1193430388030685e-24j),
+ (-0.000840445572976023+0.002586635295301676j))
new_taps = filter.firdes.complex_band_pass(1, 1, 0.2, 0.4, 0.2)
self.assertComplexTuplesAlmostEqual(known_taps, new_taps, 5)
@@ -142,15 +133,13 @@ class test_firdes(gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual(known_taps, new_taps, 5)
def test_band_reject(self):
- known_taps = (-0.004915320314466953, 0.008076251484453678,
- 0.00415271520614624, 5.694938753309664e-18,
- -0.01566472090780735, -0.11731793731451035,
- 0.2126537412405014, 0.11197195947170258,
- 0.6020866632461548, 0.11197195947170258,
- 0.2126537412405014, -0.11731793731451035,
- -0.01566472090780735, 5.694938753309664e-18,
- 0.00415271520614624, 0.008076251484453678,
- -0.004915320314466953)
+ known_taps = (0.0015371545450761914, 2.201753372137003e-18,
+ -0.00893471110612154, -0.08790513873100281,
+ 0.1880193054676056, 0.1081816703081131,
+ 0.5982034206390381, 0.1081816703081131,
+ 0.1880193054676056, -0.08790513873100281,
+ -0.00893471110612154, 2.201753372137003e-18,
+ 0.0015371545450761914)
new_taps = filter.firdes.band_reject(1, 1, 0.2, 0.4, 0.2)
self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
diff --git a/gr-filter/python/filter/qa_freq_xlating_fir_filter.py b/gr-filter/python/filter/qa_freq_xlating_fir_filter.py
index 39a803715e..ca5245db64 100755
--- a/gr-filter/python/filter/qa_freq_xlating_fir_filter.py
+++ b/gr-filter/python/filter/qa_freq_xlating_fir_filter.py
@@ -91,7 +91,7 @@ class test_freq_xlating_filter(gr_unittest.TestCase):
def generate_scf_source(self):
self.fs = fs = 1
self.fc = fc = 0.3
- self.bw = bw = 0.1
+ self.bw = bw = 0.12
self.taps = filter.firdes.low_pass(1, fs, bw, bw/4)
times = xrange(100)
self.src_data = map(lambda t: int(100*math.sin(2*cmath.pi*fc/fs*(t/100.0))), times)
@@ -99,7 +99,7 @@ class test_freq_xlating_filter(gr_unittest.TestCase):
def generate_scc_source(self):
self.fs = fs = 1
self.fc = fc = 0.3
- self.bw = bw = 0.1
+ self.bw = bw = 0.12
self.taps = filter.firdes.complex_band_pass(1, fs, -bw/2, bw/2, bw/4)
times = xrange(100)
self.src_data = map(lambda t: int(100*math.sin(2*cmath.pi*fc/fs*(t/100.0))), times)