__int__ , self in dial tone

Hello
In an effort to understand the GNU python programming instance, I am
trying to
create an instance of the flow graph in the dial_tone example (codeA)
just to make
sure I understand how instancing works.
I did this below in ,'mycodeA, but the program did not work.
What am I missing?
This was done in the FM receiver example, i just listed it below(codeB)
as a quick reference.

codeA-------------------------------------------------------------------------
def build_graph ():
sampling_freq = 32000
ampl = 0.1

fg = gr.flow_graph ()
src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl)
src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl)
dst = audio.sink (sampling_freq)
fg.connect (src0, (dst, 0))
fg.connect (src1, (dst, 1))

mycodeA-----------------------------------------------------------------------------------------------------------------

def build_graph ():
sampling_freq = 32000
ampl = 0.1

gr.flow_graph (self)
src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl)
src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl)
dst = audio.sink (sampling_freq)
self.connect (src0, (dst, 0))
self.connect (src1, (dst, 1))

codeB---------------------------------------------------------------------------------------------------------------------

class wfm_rx_graph (stdgui.gui_flow_graph):
def init(self,frame,panel,vbox,argv):
stdgui.gui_flow_graph.init (self,frame,panel,vbox,argv)

IF_freq = parseargs(argv[1:])
adc_rate = 64e6

    decim = 250
    quad_rate = adc_rate / decim               # 256 kHz
    audio_decimation = 8
    audio_rate = quad_rate / audio_decimation  # 32 kHz

    # usrp is data source
    src = usrp.source_c (0, decim)
    src.set_rx_freq (0, IF_freq)
    src.set_pga(0,20)

    guts = blks.wfm_rcv (self, quad_rate, audio_decimation)

    # sound card as final sink
    audio_sink = audio.sink (int (audio_rate))

    # now wire it all together
    self.connect (src, guts)
   self.connect (guts, (audio_sink, 0)

On Fri, Jul 14, 2006 at 09:44:19AM -0700, Quenton B. wrote:

Hello
In an effort to understand the GNU python programming instance, I am
trying to create an instance of the flow graph in the dial_tone example
(codeA) just to make sure I understand how instancing works.
I did this below in ,'mycodeA, but the program did not work.
What am I missing?
This was done in the FM receiver example, i just listed it below(codeB)
as a quick reference.

Try spending some time with the python tutorial:
http://docs.python.org/tut/tut.html
Particularly section 9, “Classes”

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs