[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6404 - in gnuradio/branches/developers/jcorgan/t162:
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r6404 - in gnuradio/branches/developers/jcorgan/t162: gnuradio-core/src/python/gnuradio/blks2impl gnuradio-examples/python/usrp |
Date: |
Tue, 11 Sep 2007 12:34:45 -0600 (MDT) |
Author: jcorgan
Date: 2007-09-11 12:34:44 -0600 (Tue, 11 Sep 2007)
New Revision: 6404
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/fm_tx4.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/fm_tx_2_daughterboards.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/max_power.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_benchmark_usb.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_nbfm_rcv.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_spectrum_sense.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_tv_rcv.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_tv_rcv_nogui.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv2_nogui.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_nogui.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wxapt_rcv.py
Log:
Converted examples/python/usrp to new top block code, more blocks done in blks2
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -45,7 +45,6 @@
Takes M complex streams in, produces single complex stream out
that runs at M times the input sample rate
- @param fg: flow_graph
@param mpoints: number of freq bins/interpolation factor/subbands
@param taps: filter taps for subband filter
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,5 +1,5 @@
#
-# Copyright 2005 Free Software Foundation, Inc.
+# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,19 +35,23 @@
# See "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis
#
-class fm_deemph(gr.hier_block):
+class fm_deemph(gr.hier_block2):
"""
FM Deemphasis IIR filter.
"""
- def __init__(self, fg, fs, tau=75e-6):
+
+
+ def __init__(self, fs, tau=75e-6):
"""
- @param fg: flow graph
- @type fg: gr.flow_graph
@param fs: sampling frequency in Hz
@type fs: float
@param tau: Time constant in seconds (75us in US, 50us in EUR)
@type tau: 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
+
w_p = 1/tau
w_pp = math.tan (w_p / (fs * 2)) # prewarped analog freq
@@ -65,7 +69,7 @@
plot1 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True)
deemph = gr.iir_filter_ffd(btaps, ataps)
- gr.hier_block.__init__(self, fg, deemph, deemph)
+ self.connect(self, deemph, self)
#
# 1 + s*t1
@@ -116,20 +120,22 @@
# See "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis
#
-class fm_preemph(gr.hier_block):
+class fm_preemph(gr.hier_block2):
"""
FM Preemphasis IIR filter.
"""
- def __init__(self, fg, fs, tau=75e-6):
+ def __init__(self, fs, tau=75e-6):
"""
- @param fg: flow graph
- @type fg: gr.flow_graph
@param fs: sampling frequency in Hz
@type fs: float
@param tau: Time constant in seconds (75us in US, 50us in EUR)
@type tau: 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
+
# FIXME make this compute the right answer
btaps = [1]
@@ -142,4 +148,4 @@
plot2 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True)
preemph = gr.iir_filter_ffd(btaps, ataps)
- gr.hier_block.__init__(self, fg, preemph, preemph)
+ self.connect(self, preemph, self)
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -21,18 +21,17 @@
import math
from gnuradio import gr, optfir
-from gnuradio.blksimpl.fm_emph import fm_deemph
-from gnuradio.blksimpl.standard_squelch import standard_squelch
+from gnuradio.blks2impl.fm_emph import fm_deemph
+#from gnuradio.blks2impl.standard_squelch import standard_squelch
-class nbfm_rx(gr.hier_block):
- def __init__(self, fg, audio_rate, quad_rate, tau=75e-6, max_dev=5e3):
+class nbfm_rx(gr.hier_block2):
+ def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3):
"""
Narrow Band FM Receiver.
Takes a single complex baseband input stream and produces a single
float output stream of audio sample in the range [-1, +1].
- @param fg: flow graph
@param audio_rate: sample rate of audio stream, >= 16k
@type audio_rate: integer
@param quad_rate: sample rate of output stream
@@ -51,6 +50,10 @@
audio_filter
"""
+ gr.hier_block2.__init__(self, "nbfm_rx",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) #
Output signature
+
# FIXME audio_rate and quad_rate ought to be exact rationals
audio_rate = int(audio_rate)
quad_rate = int(quad_rate)
@@ -66,7 +69,7 @@
self.quad_demod = gr.quadrature_demod_cf(k)
# FM Deemphasis IIR filter
- self.deemph = fm_deemph (fg, quad_rate, tau=tau)
+ self.deemph = fm_deemph (quad_rate, tau=tau)
# compute FIR taps for audio filter
audio_decim = quad_rate // audio_rate
@@ -82,6 +85,4 @@
# input: float; output: float; taps: float
self.audio_filter = gr.fir_filter_fff(audio_decim, audio_taps)
- fg.connect(self.quad_demod, self.deemph, self.audio_filter)
-
- gr.hier_block.__init__(self, fg, self.quad_demod, self.audio_filter)
+ self.connect(self, self.quad_demod, self.deemph, self.audio_filter,
self)
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -21,19 +21,18 @@
import math
from gnuradio import gr, optfir
-from gnuradio.blksimpl.fm_emph import fm_preemph
+from gnuradio.blks2impl.fm_emph import fm_preemph
#from gnuradio import ctcss
-class nbfm_tx(gr.hier_block):
- def __init__(self, fg, audio_rate, quad_rate, tau=75e-6, max_dev=5e3):
+class nbfm_tx(gr.hier_block2):
+ def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3):
"""
Narrow Band FM Transmitter.
Takes a single float input stream of audio samples in the range [-1,+1]
and produces a single FM modulated complex baseband output.
- @param fg: flow graph
@param audio_rate: sample rate of audio stream, >= 16k
@type audio_rate: integer
@param quad_rate: sample rate of output stream
@@ -45,6 +44,10 @@
quad_rate must be an integer multiple of audio_rate.
"""
+
+ gr.hier_block2.__init__(self, "nbfm_tx",
+ gr.io_signature(1, 1, gr.sizeof_float), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
audio_rate = int(audio_rate)
@@ -68,28 +71,22 @@
#print "len(interp_taps) =", len(interp_taps)
self.interpolator = gr.interp_fir_filter_fff (interp_factor,
interp_taps)
- self.preemph = fm_preemph (fg, quad_rate, tau=tau)
+ self.preemph = fm_preemph (quad_rate, tau=tau)
k = 2 * math.pi * max_dev / quad_rate
self.modulator = gr.frequency_modulator_fc (k)
if do_interp:
- fg.connect (self.interpolator, self.preemph, self.modulator)
- gr.hier_block.__init__(self, fg, self.interpolator, self.modulator)
+ self.connect (self, self.interpolator, self.preemph,
self.modulator, self)
else:
- fg.connect(self.preemph, self.modulator)
- gr.hier_block.__init__(self, fg, self.preemph, self.modulator)
+ self.connect(self, self.preemph, self.modulator, self)
-#class ctcss_gen_f(gr.sig_source_f):
-# def __init__(self, sample_rate, tone_freq):
-# gr.sig_source_f.__init__(self, sample_rate, gr.SIN_WAVE, tone_freq,
0.1, 0.0)
-#
-# def set_tone (self, tone):
-# gr.sig_source_f.set_frequency(self,tone)
+class ctcss_gen_f(gr.hier_block2):
+ def __init__(self, sample_rate, tone_freq):
+ gr.hier_block2.__init__(self, "ctcss_gen_f",
+ gr.io_signature(0, 0, 0), # Input
signature
+ gr.io_signature(1, 1, gr.sizeof_float)) #
Output signature
-class ctcss_gen_f(gr.hier_block):
- def __init__(self, fg, sample_rate, tone_freq):
self.plgen = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, tone_freq,
0.1, 0.0)
-
- gr.hier_block.__init__(self, fg, self.plgen, self.plgen)
+ self.connect(self.plgen, self)
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,5 +1,5 @@
#
-# Copyright 2005 Free Software Foundation, Inc.
+# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,8 +22,11 @@
import math
from gnuradio import gr, optfir
-class standard_squelch(gr.hier_block):
- def __init__(self, fg, audio_rate):
+class standard_squelch(gr.hier_block2):
+ def __init__(self, audio_rate):
+ gr.hier_block2.__init__(self, "standard_squelch",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input
signature
+ gr.io_signature(1, 1, gr.sizeof_float)) #
Output signature
self.input_node = gr.add_const_ff(0) # FIXME kludge
@@ -43,26 +46,26 @@
self.div = gr.divide_ff()
self.squelch_mult = gr.multiply_ff()
- fg.connect (self.input_node, (self.squelch_mult, 0))
+ self.connect (self, self.input_node)
+ self.connect (self.input_node, (self.squelch_mult, 0))
- fg.connect (self.input_node,self.low_iir)
- fg.connect (self.low_iir,(self.low_square,0))
- fg.connect (self.low_iir,(self.low_square,1))
- fg.connect (self.low_square,self.low_smooth,(self.sub,0))
- fg.connect (self.low_smooth, (self.add,0))
+ self.connect (self.input_node,self.low_iir)
+ self.connect (self.low_iir,(self.low_square,0))
+ self.connect (self.low_iir,(self.low_square,1))
+ self.connect (self.low_square,self.low_smooth,(self.sub,0))
+ self.connect (self.low_smooth, (self.add,0))
- fg.connect (self.input_node,self.hi_iir)
- fg.connect (self.hi_iir,(self.hi_square,0))
- fg.connect (self.hi_iir,(self.hi_square,1))
- fg.connect (self.hi_square,self.hi_smooth,(self.sub,1))
- fg.connect (self.hi_smooth, (self.add,1))
+ self.connect (self.input_node,self.hi_iir)
+ self.connect (self.hi_iir,(self.hi_square,0))
+ self.connect (self.hi_iir,(self.hi_square,1))
+ self.connect (self.hi_square,self.hi_smooth,(self.sub,1))
+ self.connect (self.hi_smooth, (self.add,1))
- fg.connect (self.sub, (self.div, 0))
- fg.connect (self.add, (self.div, 1))
- fg.connect (self.div, self.gate, self.squelch_lpf,
(self.squelch_mult,1))
+ self.connect (self.sub, (self.div, 0))
+ self.connect (self.add, (self.div, 1))
+ self.connect (self.div, self.gate, self.squelch_lpf,
(self.squelch_mult,1))
+ self.connect (self.squelch_mult, self)
- gr.hier_block.__init__(self, fg, self.input_node, self.squelch_mult)
-
def set_threshold(self, threshold):
self.gate.set_hi(threshold)
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,5 +1,5 @@
#
-# Copyright 2005 Free Software Foundation, Inc.
+# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,24 +20,26 @@
#
from gnuradio import gr
-from gnuradio.blksimpl.fm_emph import fm_deemph
+from gnuradio.blks2impl.fm_emph import fm_deemph
import math
-class wfm_rcv(gr.hier_block):
- def __init__ (self, fg, quad_rate, audio_decimation):
+class wfm_rcv(gr.hier_block2):
+ def __init__ (self, quad_rate, audio_decimation):
"""
Hierarchical block for demodulating a broadcast FM signal.
The input is the downconverted complex baseband signal (gr_complex).
The output is the demodulated audio (float).
- @param fg: flow graph.
- @type fg: flow graph
@param quad_rate: input sample rate of complex baseband input.
@type quad_rate: float
@param audio_decimation: how much to decimate quad_rate to get to
audio.
@type audio_decimation: integer
"""
+ gr.hier_block2.__init__(self, "wfm_rcv",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) #
Output signature
+
volume = 20.
max_dev = 75e3
@@ -52,7 +54,7 @@
self.fm_demod = gr.quadrature_demod_cf (fm_demod_gain)
# input: float; output: float
- self.deemph = fm_deemph (fg, audio_rate)
+ self.deemph = fm_deemph (audio_rate)
# compute FIR filter taps for audio filter
width_of_transition_band = audio_rate / 32
@@ -64,9 +66,4 @@
# input: float; output: float
self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs)
- fg.connect (self.fm_demod, self.audio_filter, self.deemph)
-
- gr.hier_block.__init__(self,
- fg,
- self.fm_demod, # head of the pipeline
- self.deemph) # tail of the pipeline
+ self.connect (self, self.fm_demod, self.audio_filter, self.deemph,
self)
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -20,25 +20,25 @@
#
from gnuradio import gr
-from gnuradio.blksimpl.fm_emph import fm_deemph
+from gnuradio.blks2impl.fm_emph import fm_deemph
import math
-class wfm_rcv_pll(gr.hier_block):
- def __init__ (self, fg, demod_rate, audio_decimation):
+class wfm_rcv_pll(gr.hier_block2):
+ def __init__ (self, demod_rate, audio_decimation):
"""
Hierarchical block for demodulating a broadcast FM signal.
The input is the downconverted complex baseband signal (gr_complex).
The output is two streams of the demodulated audio (float) 0=Left,
1=Right.
- @param fg: flow graph.
- @type fg: flow graph
@param demod_rate: input sample rate of complex baseband input.
@type demod_rate: float
@param audio_decimation: how much to decimate demod_rate to get to
audio.
@type audio_decimation: integer
"""
-
+ gr.hier_block2.__init__(self, "wfm_rcv_pll",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 2, gr.sizeof_float)) #
Output signature
bandwidth = 200e3
audio_rate = demod_rate / audio_decimation
@@ -54,8 +54,8 @@
self.fm_demod = gr.pll_freqdet_cf (alpha,beta,max_freq,-max_freq)
# input: float; output: float
- self.deemph_Left = fm_deemph (fg, audio_rate)
- self.deemph_Right = fm_deemph (fg, audio_rate)
+ self.deemph_Left = fm_deemph (audio_rate)
+ self.deemph_Right = fm_deemph (audio_rate)
# compute FIR filter taps for audio filter
width_of_transition_band = audio_rate / 32
@@ -151,56 +151,42 @@
if 1:
# send the real signal to complex filter to pick off the carrier
and then to one side of a multiplier
- fg.connect
(self.fm_demod,self.stereo_carrier_filter,self.stereo_carrier_pll_recovery,
(self.stereo_carrier_generator,0))
+ self.connect (self,
self.fm_demod,self.stereo_carrier_filter,self.stereo_carrier_pll_recovery,
(self.stereo_carrier_generator,0))
# send the already filtered carrier to the otherside of the carrier
- fg.connect (self.stereo_carrier_pll_recovery,
(self.stereo_carrier_generator,1))
+ self.connect (self.stereo_carrier_pll_recovery,
(self.stereo_carrier_generator,1))
# the resulting signal from this multiplier is the carrier with
correct phase but at -38000 Hz.
# send the new carrier to one side of the mixer (multiplier)
- fg.connect (self.stereo_carrier_generator,
(self.stereo_basebander,0))
+ self.connect (self.stereo_carrier_generator,
(self.stereo_basebander,0))
# send the demphasized audio to the DSBSC pick off filter, the
complex
# DSBSC signal at +38000 Hz is sent to the other side of the
mixer/multiplier
- fg.connect (self.fm_demod,self.stereo_dsbsc_filter,
(self.stereo_basebander,1))
+ self.connect (self.fm_demod,self.stereo_dsbsc_filter,
(self.stereo_basebander,1))
# the result is BASEBANDED DSBSC with phase zero!
# Pick off the real part since the imaginary is theoretically zero
and then to one side of a summer
- fg.connect (self.stereo_basebander, self.LmR_real,
(self.Make_Left,0))
+ self.connect (self.stereo_basebander, self.LmR_real,
(self.Make_Left,0))
#take the same real part of the DSBSC baseband signal and send it
to negative side of a subtracter
- fg.connect (self.LmR_real,(self.Make_Right,1))
+ self.connect (self.LmR_real,(self.Make_Right,1))
# Make rds carrier by taking the squared pilot tone and multiplying
by pilot tone
- fg.connect (self.stereo_basebander,(self.rds_carrier_generator,0))
- fg.connect
(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1))
+ self.connect (self.stereo_basebander,(self.rds_carrier_generator,0))
+ self.connect
(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1))
# take signal, filter off rds, send into mixer 0 channel
- fg.connect
(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
+ self.connect
(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
# take rds_carrier_generator output and send into mixer 1 channel
- fg.connect
(self.rds_carrier_generator,(self.rds_signal_generator,1))
+ self.connect
(self.rds_carrier_generator,(self.rds_signal_generator,1))
# send basebanded rds signal and send into "processor" which for
now is a null sink
- fg.connect (self.rds_signal_generator,self_rds_signal_processor)
+ self.connect (self.rds_signal_generator,self_rds_signal_processor)
if 1:
# pick off the audio, L+R that is what we used to have and send it
to the summer
- fg.connect(self.fm_demod, self.audio_filter, (self.Make_Left, 1))
+ self.connect(self.fm_demod, self.audio_filter, (self.Make_Left, 1))
# take the picked off L+R audio and send it to the PLUS side of
the subtractor
- fg.connect(self.audio_filter,(self.Make_Right, 0))
+ self.connect(self.audio_filter,(self.Make_Right, 0))
# The result of Make_Left gets (L+R) + (L-R) and results in
2*L
# The result of Make_Right gets (L+R) - (L-R) and results in 2*R
-
-
- # kludge the signals into a stereo channel
- kludge = gr.kludge_copy(gr.sizeof_float)
- fg.connect(self.Make_Left , self.deemph_Left, (kludge, 0))
- fg.connect(self.Make_Right, self.deemph_Right, (kludge, 1))
-
- #send it to the audio system
- gr.hier_block.__init__(self,
- fg,
- self.fm_demod, # head of the pipeline
- kludge) # tail of the pipeline
+ self.connect(self.Make_Left , self.deemph_Left, (self, 0))
+ self.connect(self.Make_Right, self.deemph_Right, (self, 1))
else:
- fg.connect (self.fm_demod, self.audio_filter)
- gr.hier_block.__init__(self,
- fg,
- self.fm_demod, # head of the pipeline
- self.audio_filter) # tail of the pipeline
+ self.connect (self.fm_demod, self.audio_filter, self)
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/fm_tx4.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/fm_tx4.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/fm_tx4.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,4 +1,24 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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.
+#
"""
Transmit N simultaneous narrow band FM signals.
@@ -15,14 +35,14 @@
from gnuradio import gr, eng_notation
from gnuradio import usrp
from gnuradio import audio
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from usrpm import usrp_dbid
import math
import sys
-from gnuradio.wxgui import stdgui, fftsink
+from gnuradio.wxgui import stdgui2, fftsink2
from gnuradio import tx_debug_gui
import wx
@@ -30,12 +50,15 @@
########################################################
# instantiate one transmit chain for each call
-class pipeline(gr.hier_block):
- def __init__(self, fg, filename, lo_freq, audio_rate, if_rate):
+class pipeline(gr.hier_block2):
+ def __init__(self, filename, lo_freq, audio_rate, if_rate):
+ gr.hier_block2.__init__(self, "pipeline",
+ gr.io_signature(0, 0, 0), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
+
src = gr.file_source (gr.sizeof_float, filename, True)
- fmtx = blks.nbfm_tx (fg, audio_rate, if_rate,
- max_dev=5e3, tau=75e-6)
+ fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6)
# Local oscillator
lo = gr.sig_source_c (if_rate, # sample rate
@@ -45,17 +68,14 @@
0) # DC Offset
mixer = gr.multiply_cc ()
- fg.connect (src, fmtx, (mixer, 0))
- fg.connect (lo, (mixer, 1))
+ self.connect (src, fmtx, (mixer, 0))
+ self.connect (lo, (mixer, 1))
- gr.hier_block.__init__(self, fg, src, mixer)
-
-
-class fm_tx_graph (stdgui.gui_flow_graph):
+class fm_tx_block(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
MAX_CHANNELS = 7
- stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
parser = OptionParser (option_class=eng_option)
parser.add_option("-T", "--tx-subdev-spec", type="subdev",
default=None,
@@ -119,9 +139,9 @@
step = 25e3
offset = (0 * step, 1 * step, -1 * step, 2 * step, -2 * step, 3 *
step, -3 * step)
for i in range (options.nchannels):
- t = pipeline (self, "audio-%d.dat" % (i % 4), offset[i],
- self.audio_rate, self.usrp_rate)
- self.connect (t, (sum, i))
+ t = pipeline("audio-%d.dat" % (i % 4), offset[i],
+ self.audio_rate, self.usrp_rate)
+ self.connect(t, (sum, i))
gain = gr.multiply_const_cc (4000.0 / options.nchannels)
@@ -131,9 +151,9 @@
# plot an FFT to verify we are sending what we want
if 1:
- post_mod = fftsink.fft_sink_c(self, panel, title="Post Modulation",
- fft_size=512,
sample_rate=self.usrp_rate,
- y_per_div=20, ref_level=40)
+ post_mod = fftsink2.fft_sink_c(panel, title="Post Modulation",
+ fft_size=512,
sample_rate=self.usrp_rate,
+ y_per_div=20, ref_level=40)
self.connect (sum, post_mod)
vbox.Add (post_mod.win, 1, wx.EXPAND)
@@ -170,7 +190,7 @@
return False
def main ():
- app = stdgui.stdapp (fm_tx_graph, "Multichannel FM Tx")
+ app = stdgui2.stdapp(fm_tx_block, "Multichannel FM Tx", nstatus=1)
app.MainLoop ()
if __name__ == '__main__':
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/fm_tx_2_daughterboards.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/fm_tx_2_daughterboards.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/fm_tx_2_daughterboards.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,4 +1,24 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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.
+#
"""
Transmit 2 signals, one out each daughterboard.
@@ -14,7 +34,7 @@
from gnuradio.eng_notation import num_to_str, str_to_num
from gnuradio import usrp
from gnuradio import audio
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from usrpm import usrp_dbid
@@ -22,11 +42,14 @@
import sys
-class example_signal_0(gr.hier_block):
+class example_signal_0(gr.hier_block2):
"""
Sinusoid at 600 Hz.
"""
- def __init__(self, fg, sample_rate):
+ def __init__(self, sample_rate):
+ gr.hier_block2.__init__(self, "example_signal_0",
+ gr.io_signature(0, 0, 0), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
src = gr.sig_source_c (sample_rate, # sample rate
gr.GR_SIN_WAVE, # waveform type
@@ -34,14 +57,17 @@
1.0, # amplitude
0) # DC Offset
- gr.hier_block.__init__(self, fg, None, src)
+ self.connect(src, self)
-class example_signal_1(gr.hier_block):
+class example_signal_1(gr.hier_block2):
"""
North American dial tone (350 + 440 Hz).
"""
- def __init__(self, fg, sample_rate):
+ def __init__(self, sample_rate):
+ gr.hier_block2.__init__(self, "example_signal_1",
+ gr.io_signature(0, 0, 0), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
src0 = gr.sig_source_c (sample_rate, # sample rate
gr.GR_SIN_WAVE, # waveform type
@@ -55,17 +81,14 @@
1.0, # amplitude
0) # DC Offset
sum = gr.add_cc()
- fg.connect(src0, (sum, 0))
- fg.connect(src1, (sum, 1))
-
- gr.hier_block.__init__(self, fg, None, sum)
-
+ self.connect(src0, (sum, 0))
+ self.connect(src1, (sum, 1))
+ self.connect(sum, self)
+class my_top_block(gr.top_block):
-class my_graph(gr.flow_graph):
-
def __init__(self):
- gr.flow_graph.__init__ (self)
+ gr.top_block.__init__(self)
usage="%prog: [options] side-A-tx-freq side-B-tx-freq"
parser = OptionParser (option_class=eng_option, usage=usage)
@@ -108,8 +131,8 @@
# ----------------------------------------------------------------
# build two signal sources, interleave them, amplify and connect them
to usrp
- sig0 = example_signal_0(self, self.usrp_rate)
- sig1 = example_signal_1(self, self.usrp_rate)
+ sig0 = example_signal_0(self.usrp_rate)
+ sig1 = example_signal_1(self.usrp_rate)
intl = gr.interleave(gr.sizeof_gr_complex)
self.connect(sig0, (intl, 0))
@@ -155,6 +178,6 @@
if __name__ == '__main__':
try:
- my_graph().run()
+ my_top_block().run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/max_power.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/max_power.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/max_power.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -30,12 +30,12 @@
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-def ramp_source (fg):
+def ramp_source ():
period = 2**16
src = gr.vector_source_s (range (-period/2, period/2, 1), True)
return src
-def build_graph (tx_enable, rx_enable):
+def build_block (tx_enable, rx_enable):
max_usb_rate = 8e6 # 8 MS/sec
dac_freq = 128e6
adc_freq = 64e6
@@ -48,23 +48,23 @@
rx_mux = 0x00003210
rx_decim = int ((adc_freq * rx_nchan) / (max_usb_rate/2)) # 32
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
if tx_enable:
tx_src0 = gr.sig_source_c (dac_freq/tx_interp, gr.GR_CONST_WAVE, 0,
16e3, 0)
usrp_tx = usrp.sink_c (0, tx_interp, tx_nchan, tx_mux)
usrp_tx.set_tx_freq (0, 10e6)
usrp_tx.set_tx_freq (1, 9e6)
- fg.connect (tx_src0, usrp_tx)
+ tb.connect (tx_src0, usrp_tx)
if rx_enable:
usrp_rx = usrp.source_c (0, rx_decim, rx_nchan, rx_mux)
usrp_rx.set_rx_freq (0, 5.5e6)
usrp_rx.set_rx_freq (1, 6.5e6)
rx_dst0 = gr.null_sink (gr.sizeof_gr_complex)
- fg.connect (usrp_rx, rx_dst0)
+ tb.connect (usrp_rx, rx_dst0)
- return fg
+ return tb
def main ():
parser = OptionParser (option_class=eng_option)
@@ -73,11 +73,11 @@
parser.add_option ("-r", action="store_true", dest="rx_enable",
default=False, help="enable Rx path")
(options, args) = parser.parse_args ()
- fg = build_graph (options.tx_enable, options.rx_enable)
+ tb = build_block (options.tx_enable, options.rx_enable)
- fg.start ()
+ tb.start ()
raw_input ('Press Enter to quit: ')
- fg.stop ()
+ tb.stop ()
if __name__ == '__main__':
main ()
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_benchmark_usb.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_benchmark_usb.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_benchmark_usb.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -55,21 +55,21 @@
# print "tx_interp =", tx_interp, "rx_decim =", rx_decim
assert (tx_interp == 2 * rx_decim)
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
# Build the Tx pipeline
data_src = gr.lfsr_32k_source_s ()
src_head = gr.head (gr.sizeof_short, int (stream_length * 2))
usrp_tx = usrp.sink_s (0, tx_interp)
- fg.connect (data_src, src_head, usrp_tx)
+ tb.connect (data_src, src_head, usrp_tx)
# and the Rx pipeline
usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210,
usrp.FPGA_MODE_LOOPBACK)
head = gr.head (gr.sizeof_short, stream_length)
check = gr.check_lfsr_32k_s ()
- fg.connect (usrp_rx, head, check)
+ tb.connect (usrp_rx, head, check)
- fg.run ()
+ tb.run ()
ntotal = check.ntotal ()
nright = check.nright ()
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005 Free Software Foundation, Inc.
+# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -28,9 +28,9 @@
from gnuradio import gr, gru, eng_notation
from gnuradio import usrp
from gnuradio import audio
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
-from gnuradio.wxgui import stdgui, fftsink, scopesink, slider, form
+from gnuradio.wxgui import stdgui2, fftsink2, scopesink2, slider, form
from usrpm import usrp_dbid
from numpy import convolve, array
@@ -43,9 +43,9 @@
# Control Stuff
# ////////////////////////////////////////////////////////////////////////
-class ptt_graph(stdgui.gui_flow_graph):
+class ptt_block(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
self.frame = frame
self.space_bar_pressed = False
@@ -73,8 +73,11 @@
if options.freq < 1e6:
options.freq *= 1e6
- self.txpath = transmit_path(self, options.tx_subdev_spec,
options.audio_input)
- self.rxpath = receive_path(self, options.rx_subdev_spec,
options.rx_gain, options.audio_output)
+ self.txpath = transmit_path(options.tx_subdev_spec,
options.audio_input)
+ self.rxpath = receive_path(options.rx_subdev_spec, options.rx_gain,
options.audio_output)
+ self.connect(self.txpath)
+ self.connect(self.rxpath)
+
self._build_gui(frame, panel, vbox, argv, options.no_gui)
self.set_transmit(False)
@@ -142,29 +145,29 @@
panel.SetFocus()
if 1 and not(no_gui):
- rx_fft = fftsink.fft_sink_c (self, panel, title="Rx Input",
fft_size=512,
+ rx_fft = fftsink2.fft_sink_c(panel, title="Rx Input", fft_size=512,
sample_rate=self.rxpath.if_rate,
ref_level=80, y_per_div=20)
self.connect (self.rxpath.u, rx_fft)
vbox.Add (rx_fft.win, 1, wx.EXPAND)
if 1 and not(no_gui):
- rx_fft = fftsink.fft_sink_c (self, panel, title="Post s/w DDC",
+ rx_fft = fftsink2.fft_sink_c(panel, title="Post s/w DDC",
fft_size=512,
sample_rate=self.rxpath.quad_rate,
ref_level=80, y_per_div=20)
self.connect (self.rxpath.ddc, rx_fft)
vbox.Add (rx_fft.win, 1, wx.EXPAND)
if 0 and not(no_gui):
- foo = scopesink.scope_sink_f (self, panel, title="Squelch",
- sample_rate=32000)
+ foo = scopesink2.scope_sink_f(panel, title="Squelch",
+ sample_rate=32000)
self.connect (self.rxpath.fmrx.div, (foo,0))
self.connect (self.rxpath.fmrx.gate, (foo,1))
self.connect (self.rxpath.fmrx.squelch_lpf, (foo,2))
vbox.Add (foo.win, 1, wx.EXPAND)
if 0 and not(no_gui):
- tx_fft = fftsink.fft_sink_c (self, panel, title="Tx Output",
+ tx_fft = fftsink2.fft_sink_c(panel, title="Tx Output",
fft_size=512,
sample_rate=self.txpath.usrp_rate)
self.connect (self.txpath.amp, tx_fft)
vbox.Add (tx_fft.win, 1, wx.EXPAND)
@@ -265,9 +268,12 @@
# Transmit Path
# ////////////////////////////////////////////////////////////////////////
-class transmit_path(gr.hier_block):
- def __init__(self, fg, subdev_spec, audio_input):
-
+class transmit_path(gr.hier_block2):
+ def __init__(self, subdev_spec, audio_input):
+ gr.hier_block2.__init__(self, "transmit_path",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
+
self.u = usrp.sink_c ()
dac_rate = self.u.dac_rate();
@@ -298,11 +304,11 @@
audio_taps = convolve(array(lpf),array(hpf))
self.audio_filt = gr.fir_filter_fff(1,audio_taps)
- self.pl = blks.ctcss_gen_f(fg, self.audio_rate,123.0)
+ self.pl = blks2.ctcss_gen_f(self.audio_rate,123.0)
self.add_pl = gr.add_ff()
- fg.connect(self.pl,(self.add_pl,1))
+ self.connect(self.pl,(self.add_pl,1))
- self.fmtx = blks.nbfm_tx(fg, self.audio_rate, self.if_rate)
+ self.fmtx = blks2.nbfm_tx(self.audio_rate, self.if_rate)
self.amp = gr.multiply_const_cc (self.normal_gain)
# determine the daughterboard subdevice we're using
@@ -312,10 +318,8 @@
self.subdev = usrp.selected_subdev(self.u, subdev_spec)
print "TX using", self.subdev.name()
- fg.connect(self.audio, self.audio_amp, self.audio_filt,
- (self.add_pl,0), self.fmtx, self.amp, self.u)
-
- gr.hier_block.__init__(self, fg, None, None)
+ self.connect(self.audio, self.audio_amp, self.audio_filt,
+ (self.add_pl,0), self.fmtx, self.amp, self.u)
self.set_gain(self.subdev.gain_range()[1]) # set max Tx gain
@@ -357,8 +361,11 @@
# Receive Path
# ////////////////////////////////////////////////////////////////////////
-class receive_path(gr.hier_block):
- def __init__(self, fg, subdev_spec, gain, audio_output):
+class receive_path(gr.hier_block2):
+ def __init__(self, subdev_spec, gain, audio_output):
+ gr.hier_block2.__init__(self, "receive_path",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
self.u = usrp.source_c ()
adc_rate = self.u.adc_rate()
@@ -395,10 +402,10 @@
self.if_rate) # input
sample rate
# instantiate the guts of the single channel receiver
- self.fmrx = blks.nbfm_rx(fg, audio_rate, self.quad_rate)
+ self.fmrx = blks2.nbfm_rx(audio_rate, self.quad_rate)
# standard squelch block
- self.squelch = blks.standard_squelch(fg, audio_rate)
+ self.squelch = blks2.standard_squelch(audio_rate)
# audio gain / mute block
self._audio_gain = gr.multiply_const_ff(1.0)
@@ -407,8 +414,7 @@
audio_sink = audio.sink (int(audio_rate), audio_output)
# now wire it all together
- fg.connect (self.u, self.ddc, self.fmrx, self.squelch,
self._audio_gain, audio_sink)
- gr.hier_block.__init__(self, fg, self.u, audio_sink)
+ self.connect (self.u, self.ddc, self.fmrx, self.squelch,
self._audio_gain, audio_sink)
if gain is None:
# if no gain was specified, use the mid-point in dB
@@ -484,7 +490,7 @@
# ////////////////////////////////////////////////////////////////////////
def main():
- app = stdgui.stdapp(ptt_graph, "NBFM Push to Talk")
+ app = stdgui2.stdapp(ptt_block, "NBFM Push to Talk")
app.MainLoop()
if __name__ == '__main__':
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_nbfm_rcv.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_nbfm_rcv.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_nbfm_rcv.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,12 +1,32 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2007 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, gru, eng_notation, optfir
from gnuradio import audio
from gnuradio import usrp
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import slider, powermate
-from gnuradio.wxgui import stdgui, fftsink, form
+from gnuradio.wxgui import stdgui2, fftsink2, form
from optparse import OptionParser
from usrpm import usrp_dbid
import sys
@@ -18,9 +38,9 @@
# Control Stuff
#////////////////////////////////////////////////////////////////////////
-class my_graph (stdgui.gui_flow_graph):
+class my_top_block (stdgui2.std_top_block):
def __init__(self,frame,panel,vbox,argv):
- stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv)
+ stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv)
parser=OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
@@ -50,8 +70,9 @@
self.freq = 0
self.freq_step = 25e3
- self.rxpath = receive_path(self, options.rx_subdev_spec, options.gain,
options.audio_output)
-
+ self.rxpath = receive_path(options.rx_subdev_spec, options.gain,
options.audio_output)
+ self.connect(self.rxpath)
+
self._build_gui(vbox, options.no_gui)
# set initial values
@@ -79,28 +100,27 @@
self.src_fft = None
if 1 and not(no_gui):
- self.src_fft = fftsink.fft_sink_c (self, self.panel, title="Data
from USRP",
+ self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from
USRP",
fft_size=512,
sample_rate=self.rxpath.if_rate,
ref_level=80, y_per_div=20)
self.connect (self.rxpath.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
-
if 1 and not(no_gui):
- rx_fft = fftsink.fft_sink_c (self, self.panel, title="Post s/w
DDC",
+ rx_fft = fftsink2.fft_sink_c(self.panel, title="Post s/w DDC",
fft_size=512,
sample_rate=self.rxpath.quad_rate,
ref_level=80, y_per_div=20)
self.connect (self.rxpath.ddc, rx_fft)
vbox.Add (rx_fft.win, 4, wx.EXPAND)
if 1 and not(no_gui):
- post_deemph_fft = fftsink.fft_sink_f (self, self.panel,
title="Post Deemph",
+ post_deemph_fft = fftsink2.fft_sink_f(self.panel, title="Post
Deemph",
fft_size=512,
sample_rate=self.rxpath.audio_rate,
y_per_div=10, ref_level=-40)
self.connect (self.rxpath.fmrx.deemph, post_deemph_fft)
vbox.Add (post_deemph_fft.win, 4, wx.EXPAND)
if 0:
- post_filt_fft = fftsink.fft_sink_f (self, self.panel, title="Post
Filter",
+ post_filt_fft = fftsink2.fft_sink_f(self.panel, title="Post
Filter",
fft_size=512,
sample_rate=audio_rate,
y_per_div=10, ref_level=-40)
self.connect (self.guts.audio_filter, post_filt)
@@ -225,8 +245,11 @@
USE_SIMPLE_SQUELCH = False
-class receive_path(gr.hier_block):
- def __init__(self, fg, subdev_spec, gain, audio_output):
+class receive_path(gr.hier_block2):
+ def __init__(self, subdev_spec, gain, audio_output):
+ gr.hier_block2.__init__(self, "receive_path",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
self.u = usrp.source_c ()
adc_rate = self.u.adc_rate()
@@ -266,10 +289,10 @@
if USE_SIMPLE_SQUELCH:
self.squelch = gr.simple_squelch_cc(20)
else:
- self.squelch = blks.standard_squelch(fg, self.audio_rate)
+ self.squelch = blks2.standard_squelch(self.audio_rate)
# instantiate the guts of the single channel receiver
- self.fmrx = blks.nbfm_rx(fg, self.audio_rate, self.quad_rate)
+ self.fmrx = blks2.nbfm_rx(self.audio_rate, self.quad_rate)
# audio gain / mute block
self._audio_gain = gr.multiply_const_ff(1.0)
@@ -279,14 +302,12 @@
# now wire it all together
if USE_SIMPLE_SQUELCH:
- fg.connect (self.u, self.ddc, self.squelch, self.fmrx,
- self._audio_gain, audio_sink)
+ self.connect (self.u, self.ddc, self.squelch, self.fmrx,
+ self._audio_gain, audio_sink)
else:
- fg.connect (self.u, self.ddc, self.fmrx, self.squelch,
- self._audio_gain, audio_sink)
+ self.connect (self.u, self.ddc, self.fmrx, self.squelch,
+ self._audio_gain, audio_sink)
- gr.hier_block.__init__(self, fg, self.u, audio_sink)
-
if gain is None:
# if no gain was specified, use the mid-point in dB
g = self.subdev.gain_range()
@@ -358,5 +379,5 @@
# ////////////////////////////////////////////////////////////////////////
if __name__ == '__main__':
- app = stdgui.stdapp (my_graph, "USRP NBFM RX")
+ app = stdgui2.stdapp (my_top_block, "USRP NBFM RX")
app.MainLoop ()
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_spectrum_sense.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_spectrum_sense.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_spectrum_sense.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,9 +1,28 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2007 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, gru, eng_notation, optfir, window
from gnuradio import audio
from gnuradio import usrp
-from gnuradio import blks
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from usrpm import usrp_dbid
@@ -16,9 +35,9 @@
"""
This class allows C++ code to callback into python.
"""
- def __init__(self, fg):
+ def __init__(self, tb):
gr.feval_dd.__init__(self)
- self.fg = fg
+ self.tb = tb
def eval(self, ignore):
"""
@@ -36,7 +55,7 @@
#
# message on stderr. Not exactly helpful ;)
- new_freq = self.fg.set_next_freq()
+ new_freq = self.tb.set_next_freq()
return new_freq
except Exception, e:
@@ -55,10 +74,10 @@
self.data = struct.unpack('%df' % (self.vlen,), t)
-class my_graph(gr.flow_graph):
+class my_top_block(gr.top_block):
def __init__(self):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
usage = "usage: %prog [options] min_freq max_freq"
parser = OptionParser(option_class=eng_option, usage=usage)
@@ -213,12 +232,12 @@
self.subdev.set_gain(gain)
-def main_loop(fg):
+def main_loop(tb):
while 1:
# Get the next message sent from the C++ code (blocking call).
# It contains the center frequency and the mag squared of the fft
- m = parse_msg(fg.msgq.delete_head())
+ m = parse_msg(tb.msgq.delete_head())
# Print center freq so we know that something is happening...
print m.center_freq
@@ -233,10 +252,10 @@
if __name__ == '__main__':
- fg = my_graph()
+ tb = my_top_block()
try:
- fg.start() # start executing flow graph in another
thread...
- main_loop(fg)
+ tb.start() # start executing flow graph in another
thread...
+ main_loop(tb)
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,29 +32,29 @@
tx_interp = 32 # tx should be twice rx
rx_decim = 16
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
data_src = gr.lfsr_32k_source_s ()
# usrp_tx = usrp.sink_s (0, tx_interp, 1, 0x98)
usrp_tx = usrp.sink_s (0, tx_interp)
- fg.connect (data_src, usrp_tx)
+ tb.connect (data_src, usrp_tx)
usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210,
usrp.FPGA_MODE_LOOPBACK)
sink = gr.check_lfsr_32k_s ()
- fg.connect (usrp_rx, sink)
+ tb.connect (usrp_rx, sink)
# file_sink = gr.file_sink (gr.sizeof_short, "loopback.dat")
- # fg.connect (usrp_rx, file_sink)
+ # tb.connect (usrp_rx, file_sink)
- return fg
+ return tb
def main ():
- fg = build_graph ()
+ tb = build_graph ()
try:
- fg.run()
+ tb.run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_tv_rcv.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_tv_rcv.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_tv_rcv.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,4 +1,25 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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.
+#
+
"""
Realtime capture and display of analog Tv stations.
Can also use a file as source or sink
@@ -16,10 +37,9 @@
print "FYI: gr-video-sdl is not installed"
print "realtime SDL video output window will not be available"
from gnuradio import usrp
-from gnuradio import blks
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import slider, powermate
-from gnuradio.wxgui import stdgui, fftsink, form
+from gnuradio.wxgui import stdgui2, fftsink2, form
from optparse import OptionParser
from usrpm import usrp_dbid
import sys
@@ -45,9 +65,9 @@
usrp_dbid.BASIC_RX))
-class tv_rx_graph (stdgui.gui_flow_graph):
+class tv_rx_block (stdgui2.std_top_block):
def __init__(self,frame,panel,vbox,argv):
- stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv)
+ stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv)
usage="%prog: [options] [input_filename]. \n If you don't specify an
input filename the usrp will be used as source\n " \
"Make sure your input capture file containes interleaved shorts
not complex floats"
@@ -391,5 +411,5 @@
if __name__ == '__main__':
- app = stdgui.stdapp (tv_rx_graph, "USRP TV RX black-and-white")
+ app = stdgui2.stdapp (tv_rx_block, "USRP TV RX black-and-white")
app.MainLoop ()
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_tv_rcv_nogui.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_tv_rcv_nogui.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_tv_rcv_nogui.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,4 +1,24 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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.
+#
"""
Reads from a file and generates PAL TV pictures in black and white
@@ -24,10 +44,10 @@
print "realtime \"sdl\" video output window will not be available"
-class my_graph(gr.flow_graph):
+class my_top_block(gr.top_block):
def __init__(self):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
usage="%prog: [options] output_filename. \n Special output_filename
\"sdl\" will use video_sink_sdl as realtime output window. " \
"You then need to have gr-video-sdl installed. \n" \
@@ -174,6 +194,6 @@
if __name__ == '__main__':
try:
- my_graph().run()
+ my_top_block().run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,12 +1,32 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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, gru, eng_notation, optfir
from gnuradio import audio
from gnuradio import usrp
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import slider, powermate
-from gnuradio.wxgui import stdgui, fftsink, form
+from gnuradio.wxgui import stdgui2, fftsink2, form
from optparse import OptionParser
from usrpm import usrp_dbid
import sys
@@ -26,9 +46,9 @@
usrp_dbid.BASIC_RX))
-class wfm_rx_graph (stdgui.gui_flow_graph):
+class wfm_rx_block (stdgui2.std_top_block):
def __init__(self,frame,panel,vbox,argv):
- stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv)
+ stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv)
parser=OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
@@ -84,7 +104,7 @@
#print len(chan_filt_coeffs)
chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
- self.guts = blks.wfm_rcv (self, demod_rate, audio_decimation)
+ self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
self.volume_control = gr.multiply_const_ff(self.vol)
@@ -129,20 +149,20 @@
if 1:
- self.src_fft = fftsink.fft_sink_c (self, self.panel, title="Data
from USRP",
+ self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from
USRP",
fft_size=512,
sample_rate=usrp_rate)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
if 1:
- post_filt_fft = fftsink.fft_sink_f (self, self.panel, title="Post
Demod",
+ post_filt_fft = fftsink2.fft_sink_f(self.panel, title="Post
Demod",
fft_size=1024,
sample_rate=usrp_rate,
y_per_div=10, ref_level=0)
self.connect (self.guts.fm_demod, post_filt_fft)
vbox.Add (post_filt_fft.win, 4, wx.EXPAND)
if 0:
- post_deemph_fft = fftsink.fft_sink_f (self, self.panel,
title="Post Deemph",
+ post_deemph_fft = fftsink2.fft_sink_f(self.panel, title="Post
Deemph",
fft_size=512,
sample_rate=audio_rate,
y_per_div=10, ref_level=-20)
self.connect (self.guts.deemph, post_deemph_fft)
@@ -266,5 +286,5 @@
if __name__ == '__main__':
- app = stdgui.stdapp (wfm_rx_graph, "USRP WFM RX")
+ app = stdgui2.stdapp (wfm_rx_block, "USRP WFM RX")
app.MainLoop ()
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv2_nogui.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv2_nogui.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv2_nogui.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,9 +1,29 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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, gru, eng_notation, optfir
from gnuradio import audio
from gnuradio import usrp
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from usrpm import usrp_dbid
@@ -22,10 +42,10 @@
usrp_dbid.BASIC_RX))
-class wfm_rx_graph (gr.flow_graph):
+class wfm_rx_block (gr.top_block):
def __init__(self):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
parser=OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
@@ -107,7 +127,7 @@
for n in range(2):
chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
- guts = blks.wfm_rcv (self, demod_rate, audio_decimation)
+ guts = blks2.wfm_rcv (demod_rate, audio_decimation)
volume_control = gr.multiply_const_ff(self.vol)
self.connect((di, n), chan_filt)
self.connect(chan_filt, guts, volume_control)
@@ -135,10 +155,13 @@
def set_gain(self, gain):
self.subdev.set_gain(gain)
+ def __del__(self):
+ # Avoid weak-reference error
+ del self.subdev
if __name__ == '__main__':
- fg = wfm_rx_graph()
+ tb = wfm_rx_block()
try:
- fg.run()
+ tb.run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_nogui.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_nogui.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_nogui.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,9 +1,29 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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, gru, eng_notation, optfir
from gnuradio import audio
from gnuradio import usrp
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from usrpm import usrp_dbid
@@ -23,10 +43,10 @@
usrp_dbid.BASIC_RX))
-class wfm_rx_graph (gr.flow_graph):
+class wfm_rx_block (gr.top_block):
def __init__(self):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
parser=OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
@@ -78,7 +98,7 @@
#print len(chan_filt_coeffs)
chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
- self.guts = blks.wfm_rcv (self, demod_rate, audio_decimation)
+ self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
self.volume_control = gr.multiply_const_ff(self.vol)
@@ -147,8 +167,8 @@
if __name__ == '__main__':
- fg = wfm_rx_graph()
+ tb = wfm_rx_block()
try:
- fg.run()
+ tb.run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,12 +1,32 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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, gru, eng_notation, optfir
from gnuradio import audio
from gnuradio import usrp
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import slider, powermate
-from gnuradio.wxgui import stdgui, fftsink, form, scopesink
+from gnuradio.wxgui import stdgui2, fftsink2, form, scopesink2
from optparse import OptionParser
from usrpm import usrp_dbid
import sys
@@ -25,9 +45,9 @@
usrp_dbid.TV_RX_REV_3,
usrp_dbid.BASIC_RX))
-class wfm_rx_graph (stdgui.gui_flow_graph):
+class wfm_rx_block (stdgui2.std_top_block):
def __init__(self,frame,panel,vbox,argv):
- stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv)
+ stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv)
parser=OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
@@ -86,8 +106,8 @@
chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
- #self.guts = blks.wfm_rcv (self, demod_rate, audio_decimation)
- self.guts = blks.wfm_rcv_pll (self, demod_rate, audio_decimation)
+ #self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
+ self.guts = blks2.wfm_rcv_pll (demod_rate, audio_decimation)
# FIXME rework {add,multiply}_const_* to handle multiple streams
self.volume_control_l = gr.multiply_const_ff(self.vol)
@@ -146,34 +166,34 @@
if 1:
- self.src_fft = fftsink.fft_sink_c (self, self.panel, title="Data
from USRP",
+ self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from
USRP",
fft_size=512,
sample_rate=usrp_rate)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
if 1:
- post_fm_demod_fft = fftsink.fft_sink_f (self, self.panel,
title="Post FM Demod",
- fft_size=512,
sample_rate=demod_rate,
- y_per_div=10, ref_level=0)
+ post_fm_demod_fft = fftsink2.fft_sink_f(self.panel, title="Post FM
Demod",
+ fft_size=512,
sample_rate=demod_rate,
+ y_per_div=10, ref_level=0)
self.connect (self.guts.fm_demod, post_fm_demod_fft)
vbox.Add (post_fm_demod_fft.win, 4, wx.EXPAND)
if 0:
- post_stereo_carrier_generator_fft = fftsink.fft_sink_c (self,
self.panel, title="Post Stereo_carrier_generator",
+ post_stereo_carrier_generator_fft = fftsink2.fft_sink_c
(self.panel, title="Post Stereo_carrier_generator",
fft_size=512,
sample_rate=audio_rate,
y_per_div=10, ref_level=0)
self.connect (self.guts.stereo_carrier_generator,
post_stereo_carrier_generator_fft)
vbox.Add (post_stereo_carrier_generator_fft.win, 4, wx.EXPAND)
if 0:
- post_deemphasis_left = fftsink.fft_sink_f (self, self.panel,
title="Post_Deemphasis_Left",
+ post_deemphasis_left = fftsink2.fft_sink_f (self.panel,
title="Post_Deemphasis_Left",
fft_size=512,
sample_rate=audio_rate,
y_per_div=10, ref_level=0)
self.connect (self.guts.deemph_Left, post_deemphasis_left)
vbox.Add (post_deemphasis_left.win, 4, wx.EXPAND)
if 0:
- post_deemphasis_right = fftsink.fft_sink_f (self, self.panel,
title="Post_Deemphasis_Right",
+ post_deemphasis_right = fftsink2.fft_sink_f(self.panel,
title="Post_Deemphasis_Right",
fft_size=512,
sample_rate=audio_rate,
y_per_div=10, ref_level=-20)
self.connect (self.guts.deemph_Left, post_deemphasis_right)
@@ -181,14 +201,14 @@
if 0:
- LmR_fft = fftsink.fft_sink_f (self, self.panel, title="LmR",
- fft_size=512,
sample_rate=audio_rate,
- y_per_div=10, ref_level=-20)
+ LmR_fft = fftsink2.fft_sink_f(self.panel, title="LmR",
+ fft_size=512, sample_rate=audio_rate,
+ y_per_div=10, ref_level=-20)
self.connect (self.guts.LmR_real,LmR_fft)
vbox.Add (LmR_fft.win, 4, wx.EXPAND)
if 0:
- self.scope = scopesink.scope_sink_f(self, self.panel,
sample_rate=demod_rate)
+ self.scope = scopesink2.scope_sink_f(self.panel,
sample_rate=demod_rate)
self.connect (self.guts.fm_demod_a,self.scope)
vbox.Add (self.scope.win,4,wx.EXPAND)
@@ -322,5 +342,5 @@
if __name__ == '__main__':
- app = stdgui.stdapp (wfm_rx_graph, "USRP WFM RX")
+ app = stdgui2.stdapp (wfm_rx_block, "USRP WFM RX")
app.MainLoop ()
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -53,11 +53,10 @@
from gnuradio import gr, gru, eng_notation, optfir
from gnuradio import audio
from gnuradio import usrp
-from gnuradio import blks
-from gnuradio.blksimpl.fm_emph import fm_deemph
+from gnuradio.blks2impl.fm_emph import fm_deemph
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import slider, powermate
-from gnuradio.wxgui import stdgui, fftsink, form
+from gnuradio.wxgui import stdgui2, fftsink2, form
from optparse import OptionParser
from usrpm import usrp_dbid
import sys
@@ -76,9 +75,9 @@
usrp_dbid.BASIC_RX))
-class wfm_rx_sca_graph (stdgui.gui_flow_graph):
+class wfm_rx_sca_block (stdgui2.std_top_block):
def __init__(self,frame,panel,vbox,argv):
- stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv)
+ stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv)
parser=OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
@@ -179,7 +178,7 @@
self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs)
# Create deemphasis block that is applied after SCA demodulation
- self.deemph = fm_deemph (self, audio_rate, sca_tau)
+ self.deemph = fm_deemph (audio_rate, sca_tau)
self.volume_control = gr.multiply_const_ff(self.vol)
@@ -228,27 +227,27 @@
return self.set_sca_freq(kv['sca_freq'])
if 1:
- self.src_fft = fftsink.fft_sink_c (self, self.panel, title="Data
from USRP",
+ self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from
USRP",
fft_size=512,
sample_rate=usrp_rate)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
if 1:
- post_demod_fft = fftsink.fft_sink_f (self, self.panel, title="Post
FM Demod",
- fft_size=2048,
sample_rate=demod_rate,
- y_per_div=10, ref_level=0)
+ post_demod_fft = fftsink2.fft_sink_f(self.panel, title="Post FM
Demod",
+ fft_size=2048,
sample_rate=demod_rate,
+ y_per_div=10, ref_level=0)
self.connect (self.fm_demod, post_demod_fft)
vbox.Add (post_demod_fft.win, 4, wx.EXPAND)
if 0:
- post_demod_sca_fft = fftsink.fft_sink_f (self, self.panel,
title="Post SCA Demod",
+ post_demod_sca_fft = fftsink2.fft_sink_f(self.panel, title="Post
SCA Demod",
fft_size=1024,
sample_rate=sca_demod_rate,
y_per_div=10, ref_level=0)
self.connect (self.fm_demod_sca, post_demod_sca_fft)
vbox.Add (post_demod_sca_fft.win, 4, wx.EXPAND)
if 0:
- post_deemph_fft = fftsink.fft_sink_f (self, self.panel,
title="Post SCA Deemph",
+ post_deemph_fft = fftsink2.fft_sink_f (self.panel, title="Post SCA
Deemph",
fft_size=512,
sample_rate=audio_rate,
y_per_div=10, ref_level=-20)
self.connect (self.deemph, post_deemph_fft)
@@ -395,5 +394,5 @@
if __name__ == '__main__':
- app = stdgui.stdapp (wfm_rx_sca_graph, "USRP WFM SCA RX")
+ app = stdgui2.stdapp (wfm_rx_sca_block, "USRP WFM SCA RX")
app.MainLoop ()
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wxapt_rcv.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wxapt_rcv.py
2007-09-11 18:31:37 UTC (rev 6403)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/usrp/usrp_wxapt_rcv.py
2007-09-11 18:34:44 UTC (rev 6404)
@@ -1,12 +1,32 @@
#!/usr/bin/env python
+#
+# Copyright 2005,2006,2007 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, gru, eng_notation, optfir
from gnuradio import audio
from gnuradio import usrp
-from gnuradio import blks
+from gnuradio import blks2
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import slider, powermate
-from gnuradio.wxgui import stdgui, fftsink, form
+from gnuradio.wxgui import stdgui2, fftsink2, form
from optparse import OptionParser
from usrpm import usrp_dbid
import sys
@@ -26,9 +46,9 @@
usrp_dbid.BASIC_RX))
-class wxapt_rx_graph (stdgui.gui_flow_graph):
+class wxapt_rx_block (stdgui2.std_top_block):
def __init__(self,frame,panel,vbox,argv):
- stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv)
+ stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv)
parser=OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
@@ -84,7 +104,7 @@
#print len(chan_filt_coeffs)
chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
- self.guts = blks.wfm_rcv (self, demod_rate, audio_decimation)
+ self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
self.volume_control = gr.multiply_const_ff(self.vol)
@@ -127,20 +147,20 @@
if 1:
- self.src_fft = fftsink.fft_sink_c (self, self.panel, title="Data
from USRP",
+ self.src_fft = fftsink2.fft_sink_c (self.panel, title="Data from
USRP",
fft_size=512,
sample_rate=usrp_rate)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
if 1:
- post_deemph_fft = fftsink.fft_sink_f (self, self.panel,
title="Post Deemph",
+ post_deemph_fft = fftsink2.fft_sink_f (self.panel, title="Post
Deemph",
fft_size=512,
sample_rate=demod_rate,
y_per_div=10, ref_level=-20)
self.connect (self.guts.deemph, post_deemph_fft)
vbox.Add (post_deemph_fft.win, 4, wx.EXPAND)
if 1:
- post_filt_fft = fftsink.fft_sink_f (self, self.panel, title="Post
Filter",
+ post_filt_fft = fftsink2.fft_sink_f (self.panel, title="Post
Filter",
fft_size=512,
sample_rate=audio_rate,
y_per_div=10, ref_level=0)
self.connect (self.guts.audio_filter, post_filt_fft)
@@ -264,5 +284,5 @@
if __name__ == '__main__':
- app = stdgui.stdapp (wxapt_rx_graph, "USRP WXAPT RX")
+ app = stdgui2.stdapp (wxapt_rx_block, "USRP WXAPT RX")
app.MainLoop ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6404 - in gnuradio/branches/developers/jcorgan/t162: gnuradio-core/src/python/gnuradio/blks2impl gnuradio-examples/python/usrp,
jcorgan <=