当前位置: 首页>>代码示例>>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;未经允许,请勿转载。