[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/05: analog: white-space fixes
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/05: analog: white-space fixes |
Date: |
Fri, 7 Mar 2014 17:52:50 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch maint
in repository gnuradio.
commit d0d7585af59f22416897534516a1b5b021e6e318
Author: Sebastian Koslowski <address@hidden>
Date: Sat Jan 4 01:52:38 2014 +0100
analog: white-space fixes
---
gr-analog/python/analog/fm_demod.py | 59 ++++++++++++++++++++-----------------
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 1976a07..cf99b76 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 2821f6e..d2a38d4 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)