diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2013-11-21 19:09:32 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2013-11-21 19:09:32 +0100 |
commit | 69303bb9c04dcc5936ba7ec89ea6d8db47d9c90a (patch) | |
tree | e247658f61b5b60a43d37a00754f23d46f9f391b | |
parent | 1ddeb4ad99a8bbeccfbbf55cc2609cb71f23f548 (diff) | |
download | dabmod-69303bb9c04dcc5936ba7ec89ea6d8db47d9c90a.tar.gz dabmod-69303bb9c04dcc5936ba7ec89ea6d8db47d9c90a.tar.bz2 dabmod-69303bb9c04dcc5936ba7ec89ea6d8db47d9c90a.zip |
Make generate-filter compatible with newer GNURadior9
-rwxr-xr-x | doc/fir-filter/generate-filter.py | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/doc/fir-filter/generate-filter.py b/doc/fir-filter/generate-filter.py index e4e2d0b..403f080 100755 --- a/doc/fir-filter/generate-filter.py +++ b/doc/fir-filter/generate-filter.py @@ -3,6 +3,14 @@ # that can be used for the FIRFilter function in # CRC DabMod # +# Usage: +# 1) adapt the filter settings below +# 2) Call this script and redirect the output of this script into a file +# +# Requires: +# A recent gnuradio version (3.7) +# +# # The MIT License (MIT) # # Copyright (c) 2013 Matthias P. Braendli @@ -27,13 +35,30 @@ # SOFTWARE. import gnuradio -from gnuradio import gr +from gnuradio import digital + +# From documentation at +# http://gnuradio.org/doc/doxygen/classgr_1_1filter_1_1firdes.html + +# use "window method" to design a low-pass FIR filter +# +# gain: overall gain of filter (typically 1.0) +# sampling_freq: sampling freq (Hz) +# cutoff_freq: center of transition band (Hz) +# transition_width: width of transition band (Hz). +# The normalized width of the transition band is what sets the number of taps required. Narrow --> more taps +# window_type: What kind of window to use. Determines maximum attenuation and passband ripple. +# beta: parameter for Kaiser window gain = 1 -rate = 2.048e6 +sampling_freq = 2.048e6 cutoff = 810e3 transition_width = 150e3 -taps = gr.firdes_low_pass(gain, rate, cutoff, transition_width, gr.firdes.WIN_HAMMING, beta=6.76) +window = digital.filter.window.WIN_HAMMING + + +# Generate filter taps and print them out +taps = digital.filter.firdes_low_pass(gain, sampling_freq, cutoff, transition_width, window, beta=6.76) print(len(taps)) for t in taps: |