diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2014-01-04 01:52:38 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2014-01-04 02:05:29 +0100 |
commit | d0d7585af59f22416897534516a1b5b021e6e318 (patch) | |
tree | 332fe9d4b1b38d926fd2a7b2f8b1be5532cb24d2 /gr-analog | |
parent | e751e54aaeae1eb47b83169d905331b4c704b431 (diff) |
analog: white-space fixes
Diffstat (limited to 'gr-analog')
-rw-r--r-- | gr-analog/python/analog/fm_demod.py | 59 | ||||
-rw-r--r-- | gr-analog/python/analog/fm_emph.py | 24 |
2 files changed, 44 insertions, 39 deletions
diff --git a/gr-analog/python/analog/fm_demod.py b/gr-analog/python/analog/fm_demod.py index 1976a076ca..cf99b768d1 100644 --- a/gr-analog/python/analog/fm_demod.py +++ b/gr-analog/python/analog/fm_demod.py @@ -28,6 +28,7 @@ try: except ImportError: import analog_swig as analog + class fm_demod_cf(gr.hier_block2): """ Generalized FM demodulation block with deemphasis and audio @@ -36,7 +37,7 @@ class fm_demod_cf(gr.hier_block2): This block demodulates a band-limited, complex down-converted FM channel into the the original baseband signal, optionally applying deemphasis. Low pass filtering is done on the resultant signal. It - produces an output float strem in the range of [-1.0, +1.0]. + produces an output float stream in the range of [-1.0, +1.0]. Args: channel_rate: incoming sample rate of the FM baseband (integer) @@ -49,27 +50,30 @@ class fm_demod_cf(gr.hier_block2): """ def __init__(self, channel_rate, audio_decim, deviation, audio_pass, audio_stop, gain=1.0, tau=75e-6): - gr.hier_block2.__init__(self, "fm_demod_cf", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - k = channel_rate/(2*pi*deviation) - QUAD = analog.quadrature_demod_cf(k) - - audio_taps = filter.optfir.low_pass(gain, # Filter gain - channel_rate, # Sample rate - audio_pass, # Audio passband - audio_stop, # Audio stopband - 0.1, # Passband ripple - 60) # Stopband attenuation - LPF = filter.fir_filter_fff(audio_decim, audio_taps) - - if tau is not None: - DEEMPH = fm_deemph(channel_rate, tau) - self.connect(self, QUAD, DEEMPH, LPF, self) + gr.hier_block2.__init__(self, "fm_demod_cf", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_float)) # Output signature + + k = channel_rate/(2*pi*deviation) + QUAD = analog.quadrature_demod_cf(k) + + audio_taps = filter.optfir.low_pass( + gain, # Filter gain + channel_rate, # Sample rate + audio_pass, # Audio passband + audio_stop, # Audio stopband + 0.1, # Passband ripple + 60 # Stopband attenuation + ) + LPF = filter.fir_filter_fff(audio_decim, audio_taps) + + if tau is not None: + DEEMPH = fm_deemph(channel_rate, tau) + self.connect(self, QUAD, DEEMPH, LPF, self) else: self.connect(self, QUAD, LPF, self) + class demod_20k0f3e_cf(fm_demod_cf): """ NBFM demodulation block, 20 KHz channels @@ -84,9 +88,10 @@ class demod_20k0f3e_cf(fm_demod_cf): """ def __init__(self, channel_rate, audio_decim): fm_demod_cf.__init__(self, channel_rate, audio_decim, - 5000, # Deviation - 3000, # Audio passband frequency - 4500) # Audio stopband frequency + 5000, # Deviation + 3000, # Audio passband frequency + 4500) # Audio stopband frequency + class demod_200kf3e_cf(fm_demod_cf): """ @@ -101,8 +106,8 @@ class demod_200kf3e_cf(fm_demod_cf): audio_decim: input to output decimation rate (integer) """ def __init__(self, channel_rate, audio_decim): - fm_demod_cf.__init__(self, channel_rate, audio_decim, - 75000, # Deviation - 15000, # Audio passband - 16000, # Audio stopband - 20.0) # Audio gain + fm_demod_cf.__init__(self, channel_rate, audio_decim, + 75000, # Deviation + 15000, # Audio passband + 16000, # Audio stopband + 20.0) # Audio gain diff --git a/gr-analog/python/analog/fm_emph.py b/gr-analog/python/analog/fm_emph.py index 2821f6e3cd..d2a38d4aff 100644 --- a/gr-analog/python/analog/fm_emph.py +++ b/gr-analog/python/analog/fm_emph.py @@ -34,25 +34,25 @@ import math # See "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis # + class fm_deemph(gr.hier_block2): """ FM Deemphasis IIR filter. """ - def __init__(self, fs, tau=75e-6): """ - + Args: fs: sampling frequency in Hz (float) tau: Time constant in seconds (75us in US, 50us in EUR) (float) """ gr.hier_block2.__init__(self, "fm_deemph", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature + gr.io_signature(1, 1, gr.sizeof_float), # Input signature + gr.io_signature(1, 1, gr.sizeof_float)) # Output signature w_p = 1/tau - w_pp = math.tan(w_p / (fs * 2)) # prewarped analog freq + w_pp = math.tan(w_p / (fs * 2)) # prewarped analog freq a1 = (w_pp - 1)/(w_pp + 1) b0 = w_pp/(1 + w_pp) @@ -68,7 +68,7 @@ class fm_deemph(gr.hier_block2): plot1 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True) deemph = filter.iir_filter_ffd(btaps, ataps) - self.connect(self, deemph, self) + self.connect(self, deemph, self) # # 1 + s*t1 @@ -119,21 +119,21 @@ class fm_deemph(gr.hier_block2): # See "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis # + class fm_preemph(gr.hier_block2): """ FM Preemphasis IIR filter. """ def __init__(self, fs, tau=75e-6): """ - + Args: fs: sampling frequency in Hz (float) tau: Time constant in seconds (75us in US, 50us in EUR) (float) """ - - gr.hier_block2.__init__(self, "fm_deemph", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature + gr.hier_block2.__init__(self, "fm_deemph", + gr.io_signature(1, 1, gr.sizeof_float), # Input signature + gr.io_signature(1, 1, gr.sizeof_float)) # Output signature # FIXME make this compute the right answer @@ -147,4 +147,4 @@ class fm_preemph(gr.hier_block2): plot2 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True) preemph = filter.iir_filter_ffd(btaps, ataps) - self.connect(self, preemph, self) + self.connect(self, preemph, self) |