当前位置: 首页>>代码示例>>Python>>正文


Python Source.process方法代码示例

本文整理汇总了Python中source.Source.process方法的典型用法代码示例。如果您正苦于以下问题:Python Source.process方法的具体用法?Python Source.process怎么用?Python Source.process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在source.Source的用法示例。


在下文中一共展示了Source.process方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Source

# 需要导入模块: from source import Source [as 别名]
# 或者: from source.Source import process [as 别名]

    fc = opt.channel
    # Print option summary:
    print 'Parameters in experiment:'
    print '\tSamples per bit:', opt.spb
    print '\tChannel type:', ('Audio' if not opt.bypass else 'Bypass')
    if opt.bypass:
        print '\t  Noise:', opt.noise, ' lag:', opt.lag, 'h: [', opt.h, ']'
    print '\tFrequency:', fc, 'Hz'
    print '\tHamming code n :', opt.cc_len
########################################################

    #instantiate and run the source block
    src = Source(opt.monotone, opt.fname)
    src_payload, databits = src.process()

    # instantiate and run the transmitter block
    xmitter = Transmitter(fc, opt.samplerate, opt.one, opt.spb, opt.silence, opt.cc_len)
    coded_bits = xmitter.encode(databits)
    coded_bits_with_preamble = xmitter.add_preamble(coded_bits)
    samples = xmitter.bits_to_samples(coded_bits_with_preamble)
    mod_samples = xmitter.modulate(samples)

####################################
    # create channel instance
    if opt.bypass:
        h = [float(x) for x in opt.h.split(' ')]
        channel = bch.BypassChannel(opt.noise, opt.lag, h)
    else:
        channel = ach.AudioChannel(opt.samplerate, opt.chunksize, opt.prefill)
开发者ID:cynosure-wei,项目名称:engr40n-wireless-communication-system,代码行数:32,代码来源:sendrecv_coding.py

示例2: Source

# 需要导入模块: from source import Source [as 别名]
# 或者: from source.Source import process [as 别名]
from source import Source
import numpy as np


s = Source(10, "testfiles/Truth.txt", True)
srcbits, payload, databits =  s.process()
print "srcbits: ", srcbits
print
print
print "payload: ", payload
print
print
print "databits", databits

开发者ID:diegoc1,项目名称:E40Project,代码行数:15,代码来源:testSource.py

示例3: Source

# 需要导入模块: from source import Source [as 别名]
# 或者: from source.Source import process [as 别名]
from sink import Sink
from source import Source
import numpy as np
from common_srcsink import hamming

compress = True
sou = Source(1, "testfiles/columns.png", compress)
sink = Sink(compress)

a, b, c = sou.process()
srcbits = sink.process(c)


# #testArr = np.array([1, 1, 1, 0, 0, 0, 0, 0])
# testArr = sou.text2bits("testfiles/Time.txt")

# statistics_bits, encoded_bits  = sou.huffman_encode(testArr)
# print len(encoded_bits)

# print "Encoded bits", encoded_bits
# print

# sink = Sink(1)

# srcbits = sink.huffman_decode(encoded_bits, statistics_bits)

# text = sink.bits2text(srcbits)


# print 
# print
开发者ID:diegoc1,项目名称:E40Project,代码行数:33,代码来源:testSink.py

示例4: Source

# 需要导入模块: from source import Source [as 别名]
# 或者: from source.Source import process [as 别名]
    print 'Parameters in experiment:'
    print '\tSamples per bit:', opt.spb
    print '\tChannel type:', ('Audio' if not opt.bypass else 'Bypass')
    if opt.bypass:
        print '\t  Noise:', opt.noise, ' lag:', opt.lag, 'h: [', opt.h, ']'
    print '\tFrequency:', fc, 'Hz'

    print '\tSource coding:', ('On' if opt.compress else 'Off')
    print '\tChannel coding:', ('n = %d' % opt.cc_len if opt.cc_len!=0 else 'Off')
    print '\tEncryption:', ('On' if opt.encrypt else 'Off')

########################################################

    #instantiate and run the source block
    src = Source(opt.monotone, opt.fname, opt.compress, opt.encrypt)
    src_bits, src_payload, databits, pubkey = src.process()  
    
    # instantiate and run the transmitter block
    xmitter = Transmitter(fc, opt.samplerate, opt.one, opt.spb, opt.silence, opt.cc_len)
    if opt.cc_len!=0:
        databits = xmitter.encode(databits, opt.cc_len)
    databits_with_preamble = xmitter.add_preamble(databits)
    samples = xmitter.bits_to_samples(databits_with_preamble)
    mod_samples = xmitter.modulate(samples)

####################################    
    # create channel instance
    if opt.bypass:
        h = [float(x) for x in opt.h.split(' ')]
        channel = bch.BypassChannel(opt.noise, opt.lag, h)
        #channel_2 = ach.AudioChannel(opt.samplerate, opt.chunksize, opt.prefill)
开发者ID:wharvey92,项目名称:ms3,代码行数:33,代码来源:sendrecv.py


注:本文中的source.Source.process方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。