我想知道是否可以停止处理图,将其中一个块与另一个具有相同数量的输入/输出通道和数据类型的块交换,然后重新启动它,而无需拆除整个图?例如:
MAX = 10000
class my_top_block(gr.top_block):
def __init__(self, peak_hold=80):
gr.top_block.__init__(self)
self.sample_rate = 10e3
self.s = gr.noise_source_f (gr.GR_UNIFORM, MAX)
u = foo.peak_fv (MAX, peak_hold)
self.connect(s, u)
self.v = foo.wait_vv ()
self.connect(u, v)
self.t = gr.null_sink (4 * 1024)
self.connect(v, t)
def set_peak_record(self, record, peak_hold=80):
self.stop()
if record == True:
u = foo.peak_record_fv (MAX, peak_hold)
else:
u = foo.peak_fv (MAX, peak_hold)
self.connect(self.s, u)
self.connect(u, self.v)
self.start()
这有点做作,但我希望它能说明我的问题。谢谢!