Hello,
I am trying to generate multiple files with formatted names using python, for a later offline processing.
The code below does the job for me but:
1- everytime a new class(flow graph) is created.
2- definition of the file_sink and its connection to the previous block must be inside the set_file_name function.
Purpose:
The flow graph is processing a limited number of samples, there is no infinite run, so I want
to rerun the flow graph without making new objects or connections and with dynamically changing parameters.
the relevant part of the code:
...
def set_file_name(self, name):
self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, name, False)
self.connect((self.blocks_throttle_0, 0), (self.blocks_file_sink_0, 0))
self.blocks_file_sink_0.set_unbuffered(False)
def main(top_block_cls=top_block, options=None):
for i in range(10):
tb = top_block_cls()
tb.set_file_name('./out'+str(i)+'.dat')
tb.start()
tb.wait()
...
def set_file_name(self, name):
self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, name, False)
self.connect((self.blocks_throttle_0, 0), (self.blocks_file_sink_0, 0))
self.blocks_file_sink_0.set_unbuffered(False)
def main(top_block_cls=top_block, options=None):
for i in range(10):
tb = top_block_cls()
tb.set_file_name('./out'+str(i)+'.dat')
tb.start()
tb.wait()
...
Any Ideas?
Thank you.
_______________________________________________ Discuss-gnuradio mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
