本文整理匯總了Python中osmosdr.source方法的典型用法代碼示例。如果您正苦於以下問題:Python osmosdr.source方法的具體用法?Python osmosdr.source怎麽用?Python osmosdr.source使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類osmosdr
的用法示例。
在下文中一共展示了osmosdr.source方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: compute_dec_interp
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [as 別名]
def compute_dec_interp(self,a,b):
a = int(a)
b = int(b)
gcd = self.gcd(a,b)
dec = a/gcd
interp = b/gcd
return dec,interp
# reference at https://github.com/osmocom/gr-osmosdr/blob/master/include/osmosdr/source.h
示例2: __init__
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [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))
示例3: __init__
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [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))
示例4: __init__
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [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))
示例5: __init__
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [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))
示例6: __init__
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [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) + " " + 'airspy'
)
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))
示例7: __init__
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [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))
示例8: __init__
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [as 別名]
def __init__(self):
if os.path.isfile(rgb_lrpt_file):
os.unlink(rgb_lrpt_file)
l = open(rgb_lrpt_file, 'w+')
l.write("[IN]\r\n")
l.write("source=file\r\n")
l.write("filename=" + BITSTREAM_WINDOWS_DIR + bitstream_file + "\r\n")
l.write("mode=72K\r\n")
l.write("[OUT]\r\n")
l.write("rgb=122.jpg\r\n")
l.write("rgb_q=100\r\n")
# l.write("mono=jpg\r\n")
l.write("logs=no\r\n")
l.write("APID70=no\r\n")
l.write("VCDU=no\r\n")
l.write("path=" + IMAGES_WINDOWS_DIR + "\r\n")
l.close()
if os.path.isfile(mono_lrpt_file):
os.unlink(mono_lrpt_file)
m = open(mono_lrpt_file, 'w+')
m.write("[IN]\r\n")
m.write("source=file\r\n")
m.write("filename=" + BITSTREAM_WINDOWS_DIR + bitstream_file + "\r\n")
m.write("mode=72K\r\n")
m.write("[OUT]\r\n")
m.write("rgb=555.jpg\r\n")
m.write("rgb_q=100\r\n")
m.write("mono=jpg\r\n")
m.write("logs=no\r\n")
m.write("APID70=no\r\n")
m.write("VCDU=no\r\n")
m.write("path=" + IMAGES_WINDOWS_DIR + "\r\n")
m.close()
if os.path.isfile(config.get('METEOR', 'decode_script')):
os.unlink(config.get('METEOR', 'decode_script'))
g = open(config.get('METEOR', 'decode_script'), 'w+')
g.write("#!/bin/bash\n")
g.write("\n")
g.write("/usr/local/bin/medet " + bitstream_name + " " + image_name + " -t >/tmp/METEOR_DECODE.log 2>&1\n")
# g.write("convert -quality 97 "+image_name+".bmp "+image_name+".jpg")
g.write("\n")
g.close()
os.chmod(config.get('METEOR', 'decode_script'), 0755)
示例9: __init__
# 需要導入模塊: import osmosdr [as 別名]
# 或者: from osmosdr import source [as 別名]
def __init__(self):
gr.top_block.__init__(self, "Top Block")
##################################################
# Variables
##################################################
self.trans_width = trans_width = 10e3
self.samp_rate = samp_rate = 1e6
self.mult_const = mult_const = 100
self.lowpass_decimation = lowpass_decimation = 10
self.freq = freq = 344940000
self.cutoff_freq = cutoff_freq = 50e3
##################################################
# Blocks
##################################################
self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
self.osmosdr_source_0.set_sample_rate(samp_rate)
self.osmosdr_source_0.set_center_freq(freq, 0)
self.osmosdr_source_0.set_freq_corr(0, 0)
self.osmosdr_source_0.set_dc_offset_mode(0, 0)
self.osmosdr_source_0.set_iq_balance_mode(0, 0)
self.osmosdr_source_0.set_gain_mode(True, 0)
self.osmosdr_source_0.set_gain(0, 0)
self.osmosdr_source_0.set_if_gain(20, 0)
self.osmosdr_source_0.set_bb_gain(20, 0)
self.osmosdr_source_0.set_antenna('', 0)
self.osmosdr_source_0.set_bandwidth(0, 0)
self.low_pass_filter_0 = filter.fir_filter_ccf(lowpass_decimation, firdes.low_pass(
1, samp_rate, cutoff_freq, trans_width, firdes.WIN_HAMMING, 6.76))
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((mult_const, ))
self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_char*1, '/tmp/grcfifo', False)
self.blocks_file_sink_1.set_unbuffered(False)
self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
##################################################
# Connections
##################################################
self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_multiply_const_vxx_0, 0))
self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_1, 0))
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_uchar_0, 0))
self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))
self.connect((self.osmosdr_source_0, 0), (self.low_pass_filter_0, 0))