本文整理汇总了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")