本文整理汇总了Python中gnuradio.gr.top_block方法的典型用法代码示例。如果您正苦于以下问题:Python gr.top_block方法的具体用法?Python gr.top_block怎么用?Python gr.top_block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnuradio.gr
的用法示例。
在下文中一共展示了gr.top_block方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self, sample_rate=32000):
gr.top_block.__init__(self, "Top Block 22")
##################################################
# Variables
##################################################
self.sample_rate = sample_rate
print('[TopBlock22] __init__: sample_rate:', self.sample_rate)
##################################################
# Blocks
##################################################
self.blocks_add_xx = blocks.add_vff(1)
self.audio_sink = audio.sink(32000, '', True)
self.analog_sig_source_x_1 = analog.sig_source_f(sample_rate, analog.GR_COS_WAVE, 440, 0.4, 0)
self.analog_sig_source_x_0 = analog.sig_source_f(sample_rate, analog.GR_COS_WAVE, 350, 0.4, 0)
self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 0.005, -42)
##################################################
# Connections
##################################################
self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx, 2))
self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx, 0))
self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_xx, 1))
self.connect((self.blocks_add_xx, 0), (self.audio_sink, 0))
示例2: main
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def main(top_block_cls=top_block, options=None):
from distutils.version import StrictVersion
if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
style = gr.prefs().get_string("qtgui", "style", "raster")
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
tb.start()
if GUI:
tb.show()
def quitting():
tb.stop()
tb.wait()
qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
qapp.exec_()
示例3: closeEvent
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "top_block")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()
示例4: quitting
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def quitting():
top_block.stop()
#tb.wait()
示例5: setUp
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def setUp (self):
self.tb = gr.top_block ()
示例6: main
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def main(top_block_cls=top_block, options=None):
tb = top_block_cls()
tb.start()
tb.wait()
示例7: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self):
gr.top_block.__init__(self, name="Doorbell Top Block")
# RF Config
self.threshold_min = -60
self.threshold_max = -50
self.samp_rate = samp_rate = 100e3
self.gain = gain = 30
self.freq = freq = 315e6
self.decimation = 10
# USRP
self.usrp = uhd.usrp_source("", uhd.stream_args("fc32"))
self.usrp.set_samp_rate(samp_rate)
self.usrp.set_center_freq(freq, 0)
self.usrp.set_gain(gain, 0)
self.usrp.set_antenna("TX/RX", 0)
# Low Pass Filter
self.lpf = filter.fir_filter_ccf(self.decimation,
firdes.low_pass(1, samp_rate, 50e3, 10e3, firdes.WIN_HAMMING, 6.76))
# Complex to Power (dB)
self._10log10 = blocks.nlog10_ff(10, 1, 0)
self.complex_to_mag_squared = blocks.complex_to_mag_squared(1)
# Threshold
self.threshold = blocks.threshold_ff(self.threshold_min, self.threshold_max, 0)
# Framer
self.framer = doorbell_framer()
# Connect the blocks
self.connect((self.usrp, 0), (self.lpf, 0))
self.connect((self.lpf, 0), (self.complex_to_mag_squared, 0))
self.connect((self.complex_to_mag_squared, 0), (self._10log10, 0))
self.connect((self._10log10, 0), (self.threshold, 0))
self.connect((self.threshold, 0), (self.framer, 0))
# Doorbell Framer
示例8: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self,main):
self.main = main
gr.top_block.__init__(self, "Top Block")
QWidget.__init__(self)
self.fir_offset_f = 0
self.cw_offset = 0
self.blocks_multiply_const_volume = None
self.logpwrfft = None
self.audio_sink = None
self.osmosdr_source = None
self.analog_agc_cc = None
self.analog_pwr_squelch = None
self.analog_pwr_squelch_ssb = None
self.freq_xlating_fir_filter = None
self.low_pass_filter_am = None
self.low_pass_filter_fm = None
self.low_pass_filter_wfm = None
self.low_pass_filter_ssb = None
self.band_pass_filter_cw = None
self.cw_base = None
self.mode = None
self.sample_rate = None
self.audio_rate = None
self.gain_names = None
self.device_found = False
self.currently_configured_device = None
self.error = False
#self.if_offset_f = 0
示例9: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
gr.top_block.__init__(self, "Top Block")
self.sample_rate = sample_rate
self.rf_gain = rf_gain
self.port = port
self.if_gain = if_gain
self.frequency = frequency
self.freq_correction = freq_correction
self.bb_gain = bb_gain
self.bandwidth = bandwidth
self.osmosdr_source_0 = osmosdr.source(
args="numchan=" + str(1) + " " + 'uhd'
)
self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
self.osmosdr_source_0.set_sample_rate(sample_rate)
self.osmosdr_source_0.set_center_freq(frequency, 0)
self.osmosdr_source_0.set_freq_corr(freq_correction, 0)
self.osmosdr_source_0.set_gain(rf_gain, 0)
self.osmosdr_source_0.set_if_gain(if_gain, 0)
self.osmosdr_source_0.set_bb_gain(bb_gain, 0)
self.osmosdr_source_0.set_antenna('', 0)
self.osmosdr_source_0.set_bandwidth(bandwidth, 0)
self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex*1, '127.0.0.1', port, False)
self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0))
示例10: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
gr.top_block.__init__(self, "Top Block")
self.sample_rate = sample_rate
self.rf_gain = rf_gain
self.port = port
self.if_gain = if_gain
self.frequency = frequency
self.freq_correction = freq_correction
self.bb_gain = bb_gain
self.bandwidth = bandwidth
self.osmosdr_sink_0 = osmosdr.sink(
args="numchan=" + str(1) + " " + 'uhd'
)
self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t())
self.osmosdr_sink_0.set_sample_rate(sample_rate)
self.osmosdr_sink_0.set_center_freq(frequency, 0)
self.osmosdr_sink_0.set_freq_corr(freq_correction, 0)
self.osmosdr_sink_0.set_gain(rf_gain, 0)
self.osmosdr_sink_0.set_if_gain(if_gain, 0)
self.osmosdr_sink_0.set_bb_gain(bb_gain, 0)
self.osmosdr_sink_0.set_antenna('', 0)
self.osmosdr_sink_0.set_bandwidth(bandwidth, 0)
self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex * 1, '127.0.0.1', port, 65536, False)
self.connect((self.blocks_udp_source_0, 0), (self.osmosdr_sink_0, 0))
示例11: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
gr.top_block.__init__(self, "Top Block")
self.sample_rate = sample_rate
self.rf_gain = rf_gain
self.port = port
self.if_gain = if_gain
self.frequency = frequency
self.freq_correction = freq_correction
self.bb_gain = bb_gain
self.bandwidth = bandwidth
self.osmosdr_source_0 = osmosdr.source(
args="numchan=" + str(1) + " " + 'bladerf'
)
self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
self.osmosdr_source_0.set_sample_rate(sample_rate)
self.osmosdr_source_0.set_center_freq(frequency, 0)
self.osmosdr_source_0.set_freq_corr(freq_correction, 0)
self.osmosdr_source_0.set_gain(rf_gain, 0)
self.osmosdr_source_0.set_if_gain(if_gain, 0)
self.osmosdr_source_0.set_bb_gain(bb_gain, 0)
self.osmosdr_source_0.set_antenna('', 0)
self.osmosdr_source_0.set_bandwidth(bandwidth, 0)
self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)
self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0))
示例12: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
gr.top_block.__init__(self, "Top Block")
self.sample_rate = sample_rate
self.rf_gain = rf_gain
self.port = port
self.if_gain = if_gain
self.frequency = frequency
self.freq_correction = freq_correction
self.bb_gain = bb_gain
self.bandwidth = bandwidth
self.osmosdr_source_0 = osmosdr.source(
args="numchan=" + str(1) + " " + 'hackrf'
)
self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
self.osmosdr_source_0.set_sample_rate(sample_rate)
self.osmosdr_source_0.set_center_freq(frequency, 0)
self.osmosdr_source_0.set_freq_corr(freq_correction, 0)
self.osmosdr_source_0.set_gain(rf_gain, 0)
self.osmosdr_source_0.set_if_gain(if_gain, 0)
self.osmosdr_source_0.set_bb_gain(bb_gain, 0)
self.osmosdr_source_0.set_antenna('', 0)
self.osmosdr_source_0.set_bandwidth(bandwidth, 0)
self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)
self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0))
示例13: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
gr.top_block.__init__(self, "Top Block")
self.sample_rate = sample_rate
self.rf_gain = rf_gain
self.port = port
self.if_gain = if_gain
self.frequency = frequency
self.freq_correction = freq_correction
self.bb_gain = bb_gain
self.bandwidth = bandwidth
self.osmosdr_source_0 = osmosdr.source(
args="numchan=" + str(1) + " " + 'sdrplay'
)
self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
self.osmosdr_source_0.set_sample_rate(sample_rate)
self.osmosdr_source_0.set_center_freq(frequency, 0)
self.osmosdr_source_0.set_freq_corr(freq_correction, 0)
self.osmosdr_source_0.set_gain(rf_gain, 0)
self.osmosdr_source_0.set_if_gain(if_gain, 0)
self.osmosdr_source_0.set_bb_gain(bb_gain, 0)
self.osmosdr_source_0.set_antenna('', 0)
self.osmosdr_source_0.set_bandwidth(bandwidth, 0)
self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)
self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0))
示例14: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
gr.top_block.__init__(self, "Top Block")
self.sample_rate = sample_rate
self.rf_gain = rf_gain
self.port = port
self.if_gain = if_gain
self.frequency = frequency
self.freq_correction = freq_correction
self.bb_gain = bb_gain
self.bandwidth = bandwidth
self.osmosdr_source_0 = osmosdr.source(
args="numchan=" + str(1) + " " + 'fcd'
)
self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
self.osmosdr_source_0.set_sample_rate(sample_rate)
self.osmosdr_source_0.set_center_freq(frequency, 0)
self.osmosdr_source_0.set_freq_corr(freq_correction, 0)
self.osmosdr_source_0.set_gain(rf_gain, 0)
self.osmosdr_source_0.set_if_gain(if_gain, 0)
self.osmosdr_source_0.set_bb_gain(bb_gain, 0)
self.osmosdr_source_0.set_antenna('', 0)
self.osmosdr_source_0.set_bandwidth(bandwidth, 0)
self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)
self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0))
示例15: __init__
# 需要导入模块: from gnuradio import gr [as 别名]
# 或者: from gnuradio.gr import top_block [as 别名]
def __init__(self, sample_rate, frequency, freq_correction, rf_gain, if_gain, bb_gain, bandwidth, port):
gr.top_block.__init__(self, "Top Block")
self.sample_rate = sample_rate
self.rf_gain = rf_gain
self.port = port
self.if_gain = if_gain
self.frequency = frequency
self.freq_correction = freq_correction
self.bb_gain = bb_gain
self.bandwidth = bandwidth
self.osmosdr_source_0 = osmosdr.source(
args="numchan=" + str(1) + " " + 'rtl'
)
self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
self.osmosdr_source_0.set_sample_rate(sample_rate)
self.osmosdr_source_0.set_center_freq(frequency, 0)
self.osmosdr_source_0.set_freq_corr(freq_correction, 0)
self.osmosdr_source_0.set_gain(rf_gain, 0)
self.osmosdr_source_0.set_if_gain(if_gain, 0)
self.osmosdr_source_0.set_bb_gain(bb_gain, 0)
self.osmosdr_source_0.set_antenna('', 0)
self.osmosdr_source_0.set_bandwidth(bandwidth, 0)
self.blocks_tcp_server_sink_0 = blocks.tcp_server_sink(gr.sizeof_gr_complex * 1, '127.0.0.1', port, False)
self.connect((self.osmosdr_source_0, 0), (self.blocks_tcp_server_sink_0, 0))