當前位置: 首頁>>代碼示例>>Python>>正文


Python Receiver.detect_threshold方法代碼示例

本文整理匯總了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:
開發者ID:cynosure-wei,項目名稱:engr40n-wireless-communication-system,代碼行數:33,代碼來源:sendrecv_coding.py


注:本文中的receiver.Receiver.detect_threshold方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。