本文整理汇总了Python中receiver.Receiver.detect_threshold方法的典型用法代码示例。如果您正苦于以下问题:Python Receiver.detect_threshold方法的具体用法?Python Receiver.detect_threshold怎么用?Python Receiver.detect_threshold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类receiver.Receiver
的用法示例。
在下文中一共展示了Receiver.detect_threshold方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Receiver
# 需要导入模块: from receiver import Receiver [as 别名]
# 或者: from receiver.Receiver import detect_threshold [as 别名]
channel = ach.AudioChannel(opt.samplerate, opt.chunksize, opt.prefill)
# transmit the samples, and retrieve samples back from the channel
try:
samples_rx = channel.xmit_and_recv(mod_samples)
except ZeroDivisionError:
# should only happen for audio channel
print "I didn't get any samples; is your microphone or speaker OFF?"
sys.exit(1)
#################################
# process the received samples
# make receiver
r = Receiver(fc, opt.samplerate, opt.spb)
demod_samples = r.demodulate(samples_rx)
one, zero, thresh = r.detect_threshold(demod_samples)
barker_start = r.detect_preamble(demod_samples, thresh, one)
rcdbits = r.demap_and_check(demod_samples, barker_start)
decoded_bits = r.decode(rcdbits)
# push into sink
sink = Sink()
rcd_payload = sink.process(decoded_bits)
if len(rcd_payload) > 0:
hd, err = common_srcsink.hamming(decoded_bits, databits)
print 'Hamming distance for payload at frequency', fc,'Hz:', hd, 'BER:', err
else:
print 'Could not recover transmission.'
if opt.graph: