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


Python Channel.transmission方法代码示例

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


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

示例1:

# 需要导入模块: import Channel [as 别名]
# 或者: from Channel import transmission [as 别名]
# -*- coding:utf-8 -*-

import Huffman, Hamming, Channel

#test if function is correct
if __name__ == "__main__":
    # Huffman is encoding XD
    Huffman.make_code_table("frequency.txt", "huffman_table.out")
    Huffman.encode("huffman_table.out", "raw_file.txt", "huffman.out", 4)
    # Hamming is encoding ;D
    print "=====message with Hamming-coding====="
    Hamming.error_flag("error_flag.out")
    Hamming.make_code_table("hamming_table.out")
    Hamming.encode("hamming_table.out", "huffman.out", "hamming.out")
    # message is in the channel
    Channel.transmission("hamming.out", "channel.out")
    # Hamming is decoding ;D
    Hamming.decode("hamming_table.out", "channel.out", "hamming_decode_out_from_channel.out", "error_flag.out")
    # Huffman is decoding XD
    Huffman.decode("huffman_table.out", "hamming_decode_out_from_channel.out", "huffman_decode_out_from_channel.out")
    print "=====message *without* Hamming-coding====="
    # message is in the channel
    Channel.transmission("hamming.out", "channel.out")
    # Huffman is decoding XD
    Huffman.decode("huffman_table.out", "channel.out", "huffman_decode_out_from_channel2.out")
    print "=====Huffman====="
    Huffman.efficiency("huffman_table.out", "frequency.txt")
开发者ID:CheshireTsui,项目名称:Encode-Decode,代码行数:29,代码来源:test.py


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