[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] max_streams problem in own module
From: |
Ramakrishnan Muthukrishnan |
Subject: |
Re: [Discuss-gnuradio] max_streams problem in own module |
Date: |
Thu, 03 Mar 2005 22:09:57 +0530 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
|| On Thu, 3 Mar 2005 10:34:15 -0500 (EST)
|| Charles Clancy <address@hidden> wrote:
clancy> Cool, that seems to work. Is there a derivative block? Something
clancy> that takes float f(x) and returns float f'(x)?
A filter with taps [1, 0, -1] works "satisfactorily" as a differentiator. Try
this small program.
- ramakrishnan
#!/usr/bin/python
# diff.py
from gnuradio import gr
from gnuradio import audio
from gnuradio.wxgui import stdgui, fftsink, scopesink
import sys
import os
import wx
class app_flow_graph (stdgui.gui_flow_graph):
def __init__(self, frame, panel, vbox, argv):
stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv)
sampling_freq = 32e3
freq = parse_arguments (argv[1:])
# create signals
src1 = gr.sig_source_f (sampling_freq,gr.GR_COS_WAVE,1000,1,0)
coeff = [1,0,-1]
filter = gr.fir_filter_fff (1, coeff)
# create a probe
#block, fft_win = fftsink.make_fft_sink_f (self, panel, "Spectrum",
512, audio_rate)
scopeblock, scope_win = scopesink.make_scope_sink_f (self, panel,
"Spectrum", sampling_freq)
self.connect (src1, filter)
self.connect (filter, scopeblock)
vbox.Add (scope_win, 1, wx.EXPAND)
def parse_arguments (args):
freq = float (args[0])
print "Tuning to freq %d" % (freq)
return freq
if __name__ == '__main__':
app = stdgui.stdapp (app_flow_graph, "Spectrum")
app.MainLoop ()
--
Ramakrishnan http://www.hackGNU.org/
Use Free Software -- Help stamp out Software Hoarding!