Flow_graph.stop() hangs

flow_graph.stop() seems to hang on me. This doesn’t occur when I use
grc,
which means I most have a problem with my code. The last line of the
following code is where the problem is.

Any ideas appreciated!
Justin

def write(t, filename):
‘’’
generate and signal, transmit using usrp, then write the received
data
to a file
t – number of seconds to collect
‘’’
interp = 64
waveform_type = gr.GR_SIN_WAVE
waveform_ampl = 100
waveform_freq = 20e3
waveform_offset = 0
target_freq = 0e3

u = usrp.sink_c (0, interp)
usb_freq = u.dac_freq() / interp
subdev = usrp.selected_subdev(u, (0, 0))
u.tune(subdev._which, subdev, target_freq)

sink = gr.file_sink (gr.sizeof_gr_complex, filename)
siggen = gr.sig_source_c (usb_freq,
                          gr.GR_SIN_WAVE,
                          waveform_freq,
                          waveform_ampl,
                          waveform_offset)

siggen.set_waveform(waveform_type)
decim = 64
frame_decim = 1
u_source = usrp.source_c(decim_rate=decim)
u_source.set_mux(usrp.determine_rx_mux_value(self.adc0, (0, 0)))
input_rate = u_source.adc_freq() / u_source.decim_rate()

# connect graph
fg = gr.flow_graph()
fg.connect(siggen, u)
fg.connect(u_source, sink)
fg.validate()
fg.start()
for i in range(t):
    time.sleep(1)
    print i, 'of', t
fg.stop() # <---- this line hangs!

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