本文整理匯總了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: